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

(-)a/C4/Acquisition.pm (-8 / +11 lines)
Lines 2003-2009 sub TransferOrder { Link Here
2003
2003
2004
=head3 get_rounding_sql
2004
=head3 get_rounding_sql
2005
2005
2006
    $rounding_sql = get_rounding_sql("mysql_variable_to_round_string");
2006
    $rounding_sql = get_rounding_sql($column_name);
2007
2007
2008
returns the correct SQL routine based on OrderPriceRounding system preference.
2008
returns the correct SQL routine based on OrderPriceRounding system preference.
2009
2009
Lines 2011-2019 returns the correct SQL routine based on OrderPriceRounding system preference. Link Here
2011
2011
2012
sub get_rounding_sql {
2012
sub get_rounding_sql {
2013
    my ( $round_string ) = @_;
2013
    my ( $round_string ) = @_;
2014
    my $rounding_pref = C4::Context->preference('OrderPriceRounding');
2014
    my $rounding_pref = C4::Context->preference('OrderPriceRounding') // q{};
2015
    if ( $rounding_pref eq "nearest_cent"  ) { return ("CAST($round_string*100 AS UNSIGNED)/100"); }
2015
    if ( $rounding_pref eq "nearest_cent"  ) {
2016
    else                                     { return ("$round_string"); }
2016
        return "CAST($round_string*100 AS UNSIGNED)/100";
2017
    }
2018
    return $round_string;
2017
}
2019
}
2018
2020
2019
=head3 get_rounded_price
2021
=head3 get_rounded_price
Lines 2026-2034 returns a price rounded as specified in OrderPriceRounding system preference. Link Here
2026
2028
2027
sub get_rounded_price {
2029
sub get_rounded_price {
2028
    my ( $price ) =  @_;
2030
    my ( $price ) =  @_;
2029
    my $rounding_pref = C4::Context->preference('OrderPriceRounding');
2031
    my $rounding_pref = C4::Context->preference('OrderPriceRounding') // q{};
2030
    if( $rounding_pref eq 'nearest_cent' ) { return Koha::Number::Price->new( $price )->round(); }
2032
    if( $rounding_pref eq 'nearest_cent' ) {
2031
    else                                   { return $price; }
2033
        return Koha::Number::Price->new( $price )->round();
2034
    }
2035
    return $price;
2032
}
2036
}
2033
2037
2034
2038
2035
- 

Return to bug 18736