From c3f203e060113d2ee90bb452f27402e74c352211 Mon Sep 17 00:00:00 2001
From: Nick Clemens <nick@bywatersolutions.com>
Date: Sun, 16 Sep 2018 01:21:16 +0000
Subject: [PATCH] Bug 18736: (follow-up) cast as UNSIGNED instead of INTEGER
Content-Type: text/plain; charset=utf-8

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>
---
 C4/Acquisition.pm | 2 +-
 C4/Budgets.pm     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm
index 4d33a68636..b28b4b0e10 100644
--- a/C4/Acquisition.pm
+++ b/C4/Acquisition.pm
@@ -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"); }
 }
 
diff --git a/C4/Budgets.pm b/C4/Budgets.pm
index 6e3887b549..870d8d277c 100644
--- a/C4/Budgets.pm
+++ b/C4/Budgets.pm
@@ -1364,7 +1364,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"; }
 }
 
-- 
2.11.0