From 64592a6400c0411a1ddef111b3405babceb4749e Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Tue, 17 Apr 2018 18:08:07 +0000 Subject: [PATCH] Bug 18736: [DO NOT PUSH] C4/Acquisition print scaffolding. Need to trigger all the print STDERR "C4/Acquisition.pm... cases. --- C4/Acquisition.pm | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 6d06f1f..056c26a 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -96,6 +96,7 @@ BEGIN { &get_rounded_price ); + print STDERR "C4/Acquisition.pm 1\n"; } @@ -1478,6 +1479,7 @@ sub ModReceiveOrder { tax_value_on_receiving = quantity * | . _get_rounding_sql(q|unitprice_tax_excluded|) . q| * tax_rate_on_receiving WHERE ordernumber = ? |, undef, $order->{ordernumber}); + print STDERR "C4/Acquisition.pm 2\n"; delete $order->{ordernumber}; $order->{budget_id} = ( $budget_id || $order->{budget_id} ); @@ -1489,6 +1491,7 @@ sub ModReceiveOrder { $order->{tax_rate_on_receiving} //= 0; $order->{tax_value_on_ordering} = $order->{quantity} * get_rounded_price($order->{ecost_tax_excluded}) * $order->{tax_rate_on_ordering}; $order->{tax_value_on_receiving} = $order->{quantity} * get_rounded_price($order->{unitprice_tax_excluded}) * $order->{tax_rate_on_receiving}; + print STDERR "C4/Acquisition.pm 3\n"; $order->{datereceived} = $datereceived; $order->{invoiceid} = $invoice->{invoiceid}; $order->{orderstatus} = 'complete'; @@ -1654,6 +1657,7 @@ sub CancelReceipt { tax_value_on_receiving = quantity * | . _get_rounding_sql(q|unitprice_tax_excluded|) . q| * tax_rate_on_receiving WHERE ordernumber = ? |, undef, $parent_ordernumber); + print STDERR "C4/Acquisition.pm 4\n"; _cancel_items_receipt( $order_obj, $parent_ordernumber ); # Delete order line @@ -2013,8 +2017,12 @@ returns the correct SQL routine based on OrderPriceRounding system preference. sub _get_rounding_sql { my ( $round_string ) = @_; my $rounding_pref = C4::Context->preference('OrderPriceRounding'); - if ( $rounding_pref eq "nearest_cent" ) { return ("CAST($round_string*100 AS INTEGER)/100"); } - else { return ("$round_string"); } + if ( $rounding_pref eq "nearest_cent" ) { + print STDERR "C4/Acquisition.pm 5\n"; + return ("CAST($round_string*100 AS INTEGER)/100"); } + else { + print STDERR "C4/Acquisition.pm 6\n"; + return ("$round_string"); } } =head3 get_rounded_price @@ -2028,8 +2036,12 @@ returns a price rounded as specified in OrderPriceRounding system preference. sub get_rounded_price { my ( $price ) = @_; my $rounding_pref = C4::Context->preference('OrderPriceRounding'); - if( $rounding_pref eq 'nearest_cent' ) { return Koha::Number::Price->new( $price )->format(); } - else { return $price; } + if( $rounding_pref eq 'nearest_cent' ) { + print STDERR "C4/Acquisition.pm 7\n"; + return Koha::Number::Price->new( $price )->format(); } + else { + print STDERR "C4/Acquisition.pm 8\n"; + return $price; } } @@ -2189,6 +2201,7 @@ sub GetLateOrders { (aqorders.quantity - COALESCE(aqorders.quantityreceived,0)) * " . _get_rounding_sql("aqorders.rrp") . " AS subtotal, DATEDIFF(CAST(now() AS date),closedate) AS latesince "; + print STDERR "C4/Acquisition.pm 9\n"; if ( defined $delay ) { $from .= " AND (closedate <= DATE_SUB(CAST(now() AS date),INTERVAL ? DAY)) " ; push @query_params, $delay; @@ -2201,6 +2214,7 @@ sub GetLateOrders { aqorders.quantity * "._get_rounding_sql("aqorders.rrp")." AS subtotal, (CAST(now() AS date) - closedate) AS latesince "; + print STDERR "C4/Acquisition.pm 10\n"; if ( defined $delay ) { $from .= " AND (closedate <= (CAST(now() AS date) -(INTERVAL ? DAY)) "; push @query_params, $delay; @@ -3034,6 +3048,7 @@ sub populate_order_with_prices { # tax value = quantity * ecost tax excluded * tax rate $order->{tax_value_on_ordering} = $order->{quantity} * get_rounded_price($order->{ecost_tax_excluded}) * $order->{tax_rate_on_ordering}; + print STDERR "C4/Acquisition.pm 11\n"; } if ($receiving) { @@ -3068,6 +3083,7 @@ sub populate_order_with_prices { # tax value = quantity * unit price tax excluded * tax rate $order->{tax_value_on_receiving} = $order->{quantity} * get_rounded_price($order->{unitprice_tax_excluded}) * $order->{tax_rate_on_receiving}; + print STDERR "C4/Acquisition.pm 12\n"; } return $order; -- 2.1.4