The acquisitions system in Koha uses GetMarcPrice to get the price from a bib record, but unless it is in a very specific format ( e.g. 123.45 ), the data passed back is often no processed, and and no value is used. Currently, there is no single function that attempts to find a good value if the field is not in this particular format. I propose a new subroutine, MungeMarcPrice, that would make a best attempt at finding a real number value in the price field. It should do the following. 1) First, look to see if there are *any* numbers in the field, if not, fail out. 2) Check for multiple price-like substrings in the price string, if multiple are found, use the first. 3) Convert decimal commas, to decimal periods, as that is the format Koha uses. Here is a question; do all common currency formats use only two trailing digits? Examples: "$1.95" => "1.95" "$5.99 ($7.75 CAN)" => "5.99" "Rs15.76 ($5.60 U.S.)" => "15.75" Here, we could use the currency and exchange rates table to attempt to fine the active currency, and search for that first, in which case the output would be "5.60" "Rental material" => "" "For sale ($450.00) or rent ($45.00)" => "450.00" "For sale ($200.00 for 3/4 in.; $150.00 for 1/2 in." => "200.00" "$4.95 (lib. bdg.)" => "4.95"
This should also perhaps take into account commas and decimal commas. Examples: "1,000,00" => "1000.00" "$12,232,342.00" => "12232242.00"
*** This bug has been marked as a duplicate of bug 7112 ***