@@ -, +, @@ 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 @@
[% order.branchcode %]