Allows nominal currency with decimal fractions

Write here for anything about bibliography module in SLiMS.

Moderators: wynerst, buitenzorg812, purwoko, sutriadi, ido, Dicarve, ridorido

Allows nominal currency with decimal fractions

Postby heru_subekti » 19 Oct 2017, 09:19

Hello, this time I will share tips to change the currency value for the item of copies. In standard setting, the format of currency field using a round value.
Then how to several countries that use the currency value with fractional cents?
A first step, you must change the data type for the currency in the table of items (I assume you can use the mysql manager, for example phpMyAdmin), then run the following query
Code: Select all
ALTER TABLE `item` CHANGE `price` `price` DECIMAL( 10, 2 ) NULL DEFAULT NULL ;

then open the file slims_folder / admin / modules / bibliography / item.php, find the line contains
Code: Select all
$data['price'] = preg_replace('@[.,\-a­-z ]@i', '', strip_tags($_POST['p­rice']));

Code: Select all
[.,\-a­-z ]

look at this script, the characters in the parameter will be omitted. that means you have to remove the dot within the parameters so that these characters are not deleted when saved to the database.
after edit
Code: Select all
$data['price'] = preg_replace('@[,\-a­-z ]@i', '', strip_tags($_POST['p­rice']));

and then save.

image preview :
currency.jpg (61.36 KiB) Viewed 1484 times
User avatar
Posts: 59
Joined: 04 Oct 2012, 00:02
Location: Trenggalek, Jawa Timur

Return to Bibliography Module

Who is online

Users browsing this forum: No registered users and 1 guest