Bug 18736: (follow-up) cast as UNSIGNED instead of INTEGER
authorNick Clemens <nick@bywatersolutions.com>
Sun, 16 Sep 2018 01:21:16 +0000 (01:21 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Thu, 21 Mar 2019 16:29:06 +0000 (16:29 +0000)
More recent MySql versions require the use of SIGNED or UNSIGNED rather
than INTEGER. UNSIGNED will still work in older installs

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

C4/Acquisition.pm
C4/Budgets.pm

index 4d33a68..b28b4b0 100644 (file)
@@ -2011,7 +2011,7 @@ returns the correct SQL routine based on OrderPriceRounding system preference.
 sub _get_rounding_sql {
     my ( $round_string ) = @_;
     my $rounding_pref = C4::Context->preference('OrderPriceRounding');
-    if ( $rounding_pref eq "nearest_cent"  ) { return ("CAST($round_string*100 AS INTEGER)/100"); }
+    if ( $rounding_pref eq "nearest_cent"  ) { return ("CAST($round_string*100 AS UNSIGNED)/100"); }
     else                                     { return ("$round_string"); }
 }
 
index e43b44f..83ed17d 100644 (file)
@@ -1382,7 +1382,7 @@ returns the correct SQL routine based on OrderPriceRounding system preference.
 sub _get_rounding_sql {
     my $to_round = shift;
     my $rounding_pref = C4::Context->preference('OrderPriceRounding');
-    if   ($rounding_pref eq 'nearest_cent') { return "CAST($to_round*100 AS INTEGER)/100"; }
+    if   ($rounding_pref eq 'nearest_cent') { return "CAST($to_round*100 AS UNSIGNED)/100"; }
     else { return "$to_round"; }
 }