View | Details | Raw Unified | Return to bug 18736
Collapse All | Expand All

(-)a/C4/Acquisition.pm (-1 / +1 lines)
Lines 2011-2017 returns the correct SQL routine based on OrderPriceRounding system preference. Link Here
2011
sub _get_rounding_sql {
2011
sub _get_rounding_sql {
2012
    my $round_string = @_;
2012
    my $round_string = @_;
2013
    my $rounding_pref = C4::Context->preference('OrderPriceRounding');
2013
    my $rounding_pref = C4::Context->preference('OrderPriceRounding');
2014
    if ( $rounding_pref eq "nearest_cent"  ) { return ("ROUND($round_string,2)"); }
2014
    if ( $rounding_pref eq "nearest_cent"  ) { return ("CEIL($round_string*100)/100"); }
2015
    else                                     { return ("$round_string"); }
2015
    else                                     { return ("$round_string"); }
2016
}
2016
}
2017
2017
(-)a/C4/Budgets.pm (-1 / +1 lines)
Lines 1292-1298 returns the correct SQL routine based on OrderPriceRounding system preference. Link Here
1292
sub _get_rounding_sql {
1292
sub _get_rounding_sql {
1293
    my $to_round = shift;
1293
    my $to_round = shift;
1294
    my $rounding_pref = C4::Context->preference('OrderPriceRounding');
1294
    my $rounding_pref = C4::Context->preference('OrderPriceRounding');
1295
    if   ($rounding_pref eq 'nearest_cent') { return "ROUND($to_round,2)"; }
1295
    if   ($rounding_pref eq 'nearest_cent') { return "CEIL($to_round*100)/100"; }
1296
    else { return "$to_round"; }
1296
    else { return "$to_round"; }
1297
}
1297
}
1298
1298
(-)a/installer/data/mysql/atomicupdate/bug18736_add_rounding_syspref.perl (-2 / +1 lines)
Lines 1-6 Link Here
1
$DBversion = 'XXX';  # will be replaced by the RM
1
$DBversion = 'XXX';  # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
2
if( CheckVersion( $DBversion ) ) {
3
    # $dbh->do( "INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OrderPriceRounding',NULL,'Local preference for rounding orders before calculations to ensure correct calculations','|nearest_cent','Choice')" );
3
    $dbh->do( "INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OrderPriceRounding',NULL,'Local preference for rounding orders before calculations to ensure correct calculations','|nearest_cent','Choice')" );
4
4
5
    SetVersion( $DBversion );
5
    SetVersion( $DBversion );
6
    print "Upgrade to $DBversion done (Bug 18736 - Add syspref to control order rounding)\n";
6
    print "Upgrade to $DBversion done (Bug 18736 - Add syspref to control order rounding)\n";
7
- 

Return to bug 18736