Bug 6079

Summary: Single parentheses in currency causes order to fail when updating
Product: Koha Reporter: Mark G <mark.gavillet>
Component: AcquisitionsAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Bugs List <koha-bugs>
Severity: trivial    
Priority: P5 - low CC: jonathan.druart
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Mark G 2011-04-06 08:39:58 UTC

    
Comment 1 Mark G 2011-04-06 08:47:14 UTC
To reproduce add a currency with a single parenthesis - either left or right - and try to update an order. Adding both left and right parentheses to the currency will not cause the order update to fail.

Originally discovered because the length of field truncated to leave a single left parenthesis.
Comment 2 Jonathan Druart 2015-03-25 14:12:53 UTC
Should be fixed with the following patch:

diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm
index 0bb34c6..320169a 100644
--- a/C4/Acquisition.pm
+++ b/C4/Acquisition.pm
@@ -1269,7 +1269,7 @@ sub ModOrder {
     foreach my $orderinfokey (grep(!/ordernumber/, keys %$orderinfo)){
         # ... and skip hash entries that are not in the aqorders table
         # FIXME : probably not the best way to do it (would be better to have a correct hash)
-        next unless grep(/^$orderinfokey$/, @$colnames);
+        next unless grep(/^\Q$orderinfokey\E$/, @$colnames);
             $query .= "$orderinfokey=?, ";
             push(@params, $orderinfo->{$orderinfokey});
     }

But not sure of the consequences...