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 ("CEIL($round_string*100)/100"); }
2016
    if ( $rounding_pref eq "nearest_cent"  ) { return ("CAST($round_string*100 AS INTEGER)/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 "CEIL($to_round*100)/100"; }
1348
    if   ($rounding_pref eq 'nearest_cent') { return "CAST($to_round*100 AS INTEGER)/100"; }
1349
    else { return "$to_round"; }
1349
    else { return "$to_round"; }
1350
}
1350
}
1351
1351
(-)a/t/db_dependent/Budgets.t (-2 / +1 lines)
Lines 852-858 subtest 'GetBudgetSpent GetBudgetOrdered tests' => sub { Link Here
852
852
853
    t::lib::Mocks::mock_preference('OrderPriceRounding','nearest_cent');
853
    t::lib::Mocks::mock_preference('OrderPriceRounding','nearest_cent');
854
    $spent_ordered = GetBudgetOrdered( $spent_order->{budget_id} );
854
    $spent_ordered = GetBudgetOrdered( $spent_order->{budget_id} );
855
    is($spent_ordered,'78.80',"We expect the ordered amount to be equal to the estimated price rounded times quantity");
855
    is($spent_ordered,'78.8000',"We expect the ordered amount to be equal to the estimated price rounded times quantity");
856
856
857
#Okay, now we can receive the order, giving the price as the user would
857
#Okay, now we can receive the order, giving the price as the user would
858
858
859
- 

Return to bug 18736