From 6776331ce44b4680fc1bc65a7bc203aed0f4d865 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Sun, 16 Sep 2018 01:21:16 +0000 Subject: [PATCH] Bug 18736: (follow-up) cast as UNSIGNED instead of INTEGER 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 --- 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 0bb9610e02..d58d3bd7ef 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -2010,7 +2010,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