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

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

Return to bug 18736