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

(-)a/C4/Acquisition.pm (-8 / +11 lines)
Lines 2013-2019 sub TransferOrder { Link Here
2013
2013
2014
=head3 get_rounding_sql
2014
=head3 get_rounding_sql
2015
2015
2016
    $rounding_sql = get_rounding_sql("mysql_variable_to_round_string");
2016
    $rounding_sql = get_rounding_sql($column_name);
2017
2017
2018
returns the correct SQL routine based on OrderPriceRounding system preference.
2018
returns the correct SQL routine based on OrderPriceRounding system preference.
2019
2019
Lines 2021-2029 returns the correct SQL routine based on OrderPriceRounding system preference. Link Here
2021
2021
2022
sub get_rounding_sql {
2022
sub get_rounding_sql {
2023
    my ( $round_string ) = @_;
2023
    my ( $round_string ) = @_;
2024
    my $rounding_pref = C4::Context->preference('OrderPriceRounding');
2024
    my $rounding_pref = C4::Context->preference('OrderPriceRounding') // q{};
2025
    if ( $rounding_pref eq "nearest_cent"  ) { return ("CAST($round_string*100 AS UNSIGNED)/100"); }
2025
    if ( $rounding_pref eq "nearest_cent"  ) {
2026
    else                                     { return ("$round_string"); }
2026
        return "CAST($round_string*100 AS UNSIGNED)/100";
2027
    }
2028
    return $round_string;
2027
}
2029
}
2028
2030
2029
=head3 get_rounded_price
2031
=head3 get_rounded_price
Lines 2036-2044 returns a price rounded as specified in OrderPriceRounding system preference. Link Here
2036
2038
2037
sub get_rounded_price {
2039
sub get_rounded_price {
2038
    my ( $price ) =  @_;
2040
    my ( $price ) =  @_;
2039
    my $rounding_pref = C4::Context->preference('OrderPriceRounding');
2041
    my $rounding_pref = C4::Context->preference('OrderPriceRounding') // q{};
2040
    if( $rounding_pref eq 'nearest_cent' ) { return Koha::Number::Price->new( $price )->round(); }
2042
    if( $rounding_pref eq 'nearest_cent' ) {
2041
    else                                   { return $price; }
2043
        return Koha::Number::Price->new( $price )->round();
2044
    }
2045
    return $price;
2042
}
2046
}
2043
2047
2044
2048
2045
- 

Return to bug 18736