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

(-)a/C4/Acquisition.pm (-1 / +1 lines)
Lines 2013-2019 returns the correct SQL routine based on OrderPriceRounding system preference. Link Here
2013
sub _get_rounding_sql {
2013
sub _get_rounding_sql {
2014
    my $round_string = @_;
2014
    my $round_string = @_;
2015
    my $rounding_pref = C4::Context->preference('OrderPriceRounding');
2015
    my $rounding_pref = C4::Context->preference('OrderPriceRounding');
2016
    if ( $rounding_pref eq "nearest_cent"  ) { return ("ROUND($round_string,2)"); }
2016
    if ( $rounding_pref eq "nearest_cent"  ) { return ("CEIL($round_string*100)/100"); }
2017
    else                                     { return ("$round_string"); }
2017
    else                                     { return ("$round_string"); }
2018
}
2018
}
2019
2019
(-)a/C4/Budgets.pm (-1 / +1 lines)
Lines 1345-1351 returns the correct SQL routine based on OrderPriceRounding system preference. Link Here
1345
sub _get_rounding_sql {
1345
sub _get_rounding_sql {
1346
    my $to_round = shift;
1346
    my $to_round = shift;
1347
    my $rounding_pref = C4::Context->preference('OrderPriceRounding');
1347
    my $rounding_pref = C4::Context->preference('OrderPriceRounding');
1348
    if   ($rounding_pref eq 'nearest_cent') { return "ROUND($to_round,2)"; }
1348
    if   ($rounding_pref eq 'nearest_cent') { return "CEIL($to_round*100)/100"; }
1349
    else { return "$to_round"; }
1349
    else { return "$to_round"; }
1350
}
1350
}
1351
1351
(-)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