@@ -, +, @@ workflow 0 - Apply patches and updatedatabase 1 - Add an order to a basket 2 - You should note new 'Retail price field' 3 - You should have a separate 'Replacement price' field 4 - Enter values and ensure they are saved as expected 5 - In the basket you should see the replacement price 6 - Modify order and ensure value is loaded and saved correctly 7 - Add and cancle an order and esure replacement price shows/saves 8 - Close basket 9 - Receive an order --- C4/Acquisition.pm | 8 + acqui/addorderiso2709.pl | 8 +- acqui/finishreceive.pl | 6 +- acqui/neworderempty.pl | 2 + acqui/orderreceive.pl | 1 + .../prog/en/modules/acqui/basket.tt | 6 + .../prog/en/modules/acqui/invoice.tt | 5 + .../prog/en/modules/acqui/neworderempty.tt | 8 +- .../prog/en/modules/acqui/orderreceive.tt | 6 +- .../prog/en/modules/acqui/parcel.tt | 197 +++++++++--------- 10 files changed, 146 insertions(+), 101 deletions(-) --- a/C4/Acquisition.pm +++ a/C4/Acquisition.pm @@ -1507,6 +1507,10 @@ sub ModReceiveOrder { orderstatus = 'complete' |; + $query .= q| + , replacementprice = ? + | if defined $order->{replacementprice}; + $query .= q| , unitprice = ?, unitprice_tax_included = ?, unitprice_tax_excluded = ? | if defined $order->{unitprice}; @@ -1528,6 +1532,10 @@ sub ModReceiveOrder { my $sth = $dbh->prepare( $query ); my @params = ( $quantrec, $datereceived, $invoice->{invoiceid}, ( $budget_id ? $budget_id : $order->{budget_id} ) ); + if ( defined $order->{replacementprice} ) { + push @params, $order->{replacementprice}; + } + if ( defined $order->{unitprice} ) { push @params, $order->{unitprice}, $order->{unitprice_tax_included}, $order->{unitprice_tax_excluded}; } --- a/acqui/addorderiso2709.pl +++ a/acqui/addorderiso2709.pl @@ -262,6 +262,7 @@ if ($op eq ""){ ); my $price = $infos->{price}; + my $replacementprice = $infos->{replacementprice}; if ($price){ # in France, the cents separator is the , but sometimes, ppl use a . # in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation @@ -283,6 +284,7 @@ if ($op eq ""){ } else { $orderinfo{listprice} = 0; } + $orderinfo{replacementprice} = $replacementprice || 0; # remove uncertainprice flag if we have found a price in the MARC record $orderinfo{uncertainprice} = 0 if $orderinfo{listprice}; @@ -511,8 +513,9 @@ sub import_biblios_list { my ( $marcblob, $encoding ) = GetImportRecordMarc( $biblio->{'import_record_id'} ); my $marcrecord = MARC::Record->new_from_usmarc($marcblob) || die "couldn't translate marc information"; - my $infos = get_infos_syspref('MarcFieldsToOrder', $marcrecord, ['price', 'quantity', 'budget_code', 'discount', 'sort1', 'sort2']); + my $infos = get_infos_syspref('MarcFieldsToOrder', $marcrecord, ['price', 'quantity', 'budget_code', 'discount', 'sort1', 'sort2','replacementprice']); my $price = $infos->{price}; + my $replacementprice = $infos->{replacementprice}; my $quantity = $infos->{quantity}; my $budget_code = $infos->{budget_code}; my $discount = $infos->{discount}; @@ -566,7 +569,7 @@ sub import_biblios_list { 'quantity' => $item_quantity, 'budget_code' => $item_budget_code || $budget_code, 'itemprice' => $item_price || $price, - 'replacementprice' => $item_replacement_price, + 'replacementprice' => $item_replacement_price || $replacementprice, 'itemcallnumber' => $item_callnumber, ); $all_items_quantity++; @@ -583,6 +586,7 @@ sub import_biblios_list { if ($alliteminfos == -1 || scalar(@$alliteminfos) == 0) { $cellrecord{price} = $price || ''; + $cellrecord{replacementprice} = $replacementprice || ''; $cellrecord{quantity} = $quantity || ''; $cellrecord{budget_id} = $budget_id || ''; $cellrecord{discount} = $discount || ''; --- a/acqui/finishreceive.pl +++ a/acqui/finishreceive.pl @@ -48,6 +48,7 @@ my $origquantityrec = $input->param('origquantityrec'); my $quantityrec = $input->param('quantityrec'); my $quantity = $input->param('quantity'); my $unitprice = $input->param('unitprice'); +my $replacementprice = $input->param('replacementprice'); my $datereceived = $input->param('datereceived'), my $invoiceid = $input->param('invoiceid'); my $invoice = GetInvoice($invoiceid); @@ -59,6 +60,8 @@ my $order = GetOrder($ordernumber); my $new_ordernumber = $ordernumber; $unitprice = Koha::Number::Price->new( $unitprice )->unformat(); +$replacementprice = Koha::Number::Price->new( $replacementprice )->unformat(); +warn "Replacement $replacementprice"; my $basket = Koha::Acquisition::Orders->find( $ordernumber )->basket; #need old receivedate if we update the order, parcel.pl only shows the right parcel this way FIXME @@ -85,6 +88,7 @@ if ($quantityrec > $origquantityrec ) { $order->{order_internalnote} = $input->param("order_internalnote"); $order->{tax_rate_on_receiving} = $input->param("tax_rate"); + $order->{replacementprice} = $replacementprice; $order->{unitprice} = $unitprice; $order = C4::Acquisition::populate_order_with_prices( @@ -156,7 +160,7 @@ ModItem( dateaccessioned => $datereceived, datelastseen => $datereceived, price => $unitprice, - replacementprice => $order->{rrp}, + replacementprice => $replacementprice, replacementpricedate => $datereceived, }, $biblionumber, --- a/acqui/neworderempty.pl +++ a/acqui/neworderempty.pl @@ -371,6 +371,7 @@ if ( defined $from_subscriptionid ) { $data->{tax_rate} = $lastOrderReceived->{tax_rate_on_ordering}; $data->{discount} = $lastOrderReceived->{discount}; $data->{rrp} = $lastOrderReceived->{rrp}; + $data->{replacementprice} = $lastOrderReceived->{replacementprice}; $data->{ecost} = $lastOrderReceived->{ecost}; $data->{quantity} = $lastOrderReceived->{quantity}; $data->{unitprice} = $lastOrderReceived->{unitprice}; @@ -454,6 +455,7 @@ $template->param( quantity => $quantity, quantityrec => $quantity, rrp => $data->{'rrp'}, + replacementprice => $data->{'replacementprice'}, gst_values => \@gst_values, tax_rate => $data->{tax_rate_on_ordering} ? $data->{tax_rate_on_ordering}+0.0 : $bookseller->tax_rate ? $bookseller->tax_rate+0.0 : 0, listprice => sprintf( "%.2f", $data->{listprice} || $data->{price} || $listprice), --- a/acqui/orderreceive.pl +++ a/acqui/orderreceive.pl @@ -213,6 +213,7 @@ $template->param( quantityreceivedplus1 => $order->{'quantityreceived'} + 1, quantityreceived => $order->{'quantityreceived'}, rrp => $rrp, + replacementprice => $order->{'replacementprice'}, ecost => $ecost, unitprice => $unitprice, tax_rate => $tax_rate, --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -357,6 +357,7 @@ ecost tax exc. RRP tax inc. ecost tax inc. + Replacement price Qty. Total tax exc. ([% currency %]) Total tax inc. ([% currency %]) @@ -381,6 +382,7 @@       +   [% foot_loo.quantity %] [% foot_loo.total_tax_excluded | $Price%] [% foot_loo.total_tax_included | $Price %] @@ -403,6 +405,7 @@       +   [% total_quantity %] [% total_tax_excluded | $Price %] [% total_tax_included | $Price %] @@ -478,6 +481,7 @@ [% books_loo.ecost_tax_excluded | $Price%] [% books_loo.rrp_tax_included | $Price %] [% books_loo.ecost_tax_included | $Price %] + [% books_loo.replacementprice | $Price %] [% books_loo.quantity %] [% books_loo.total_tax_excluded | $Price %] [% books_loo.total_tax_included | $Price %] @@ -540,6 +544,7 @@ ecost tax exc. RRP tax inc. ecost tax inc. + Replacement price Qty. Total tax exc. ([% currency %]) Total tax inc. ([% currency %]) @@ -592,6 +597,7 @@ [% order.ecost_tax_excluded | $Price %] [% order.rrp_tax_included | $Price %] [% order.ecost_tax_included | $Price %] + [% order.replacementprice | $Price %] [% order.quantity %] [% order.total_tax_excluded | $Price %] [% order.total_tax_included | $Price %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt @@ -99,6 +99,7 @@ Library Actual cost tax exc. Actual cost tax inc. + Replacement price Qty. Total tax exc. ([% currency.symbol %]) Total tax inc. ([% currency.symbol %]) @@ -129,6 +130,7 @@

[% order.branchcode %]

[% order.unitprice_tax_excluded | $Price %] [% order.unitprice_tax_included | $Price %] + [% order.replacementprice | $Price %] [% order.quantity %] [% order.total_tax_excluded | $Price %] [% order.total_tax_included | $Price %] @@ -144,6 +146,7 @@ Total (GST [% tf.tax_rate * 100 %] %) + [% tf.quantity %] [% tf.total_tax_excluded | $Price %] [% tf.total_tax_included | $Price %] @@ -156,6 +159,7 @@ Total ([% currency.symbol %]) + [% total_quantity %] [% total_tax_excluded | $Price %] [% total_tax_included | $Price %] @@ -167,6 +171,7 @@ Total + Shipment cost ([% currency.symbol %]) + [% total_quantity %] [% total_tax_excluded_shipment | $Price %] [% total_tax_included_shipment | $Price %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -433,13 +433,17 @@
  • [% IF ( close ) %] - Replacement cost: + Retail price: [% rrp %] (adjusted for [% cur_active %], [% IF (listincgst == 1) %]tax inc.[% ELSE %]tax exc.[% END %]) [% ELSE %] - + (adjusted for [% cur_active %], [% IF (listincgst == 1) %]tax inc.[% ELSE %]tax exc.[% END %]) [% END %]
  • +
  • + + +
  • [% IF (listincgst == 1) %](tax inc.)[% ELSE %](tax exc.)[% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -238,7 +238,11 @@ [% END %] -
  • [% rrp | $Price %]
  • +
  • [% rrp | $Price %]
  • +
  • + + +
  • [% ecost | $Price %]
  • --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt @@ -102,6 +102,7 @@ Order line search Summary search   + Replacement price search Quantity search Unit cost search Order cost search @@ -115,6 +116,7 @@ Order line Summary More + Replacement price Quantity Unit cost Order cost @@ -167,6 +169,7 @@ MARC
    Card + [% loop_order.replacementprice | $Price %] [% loop_order.quantity %] [% loop_order.ecost | $Price %] [% loop_order.total | $Price %] @@ -227,6 +230,7 @@ Holds Summary More + Replacement price Quantity Fund Est cost @@ -318,6 +322,7 @@ MARC
    Card + [% order.replacementprice | $Price %] [% order.quantityreceived %] [% order.budget.budget_name %] [% order.ecost | $Price %] @@ -437,96 +442,98 @@ [% Asset.js("lib/jquery/plugins/jquery.cookie.min.js") %] [% END %] --