Bugzilla – Attachment 70215 Details for
Bug 18639
Separate replacement cost and retail price fields in acquisitions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18639 - Add replacementprice field to acquisitions workflow
Bug-18639---Add-replacementprice-field-to-acquisit.patch (text/plain), 20.64 KB, created by
Nick Clemens (kidclamp)
on 2017-12-29 16:52:15 UTC
(
hide
)
Description:
Bug 18639 - Add replacementprice field to acquisitions workflow
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2017-12-29 16:52:15 UTC
Size:
20.64 KB
patch
obsolete
>From 42e5b0d14be45251c747c0ae714348a658c11211 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 29 Dec 2017 16:16:23 +0000 >Subject: [PATCH] Bug 18639 - Add replacementprice field to acquisitions > workflow > >To test: > 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 >10 - You should be able to edit replacement price >11 - 'retail price' field is not editable >12 - Check associated item, replacement price in item should be updated >13 - Cancel receipt, check item. receive again with new replacement >price, check item >14 - Price should be correctly updated >15 - Finish receipt, value should show in table >16 - Test with receive from file >--- > C4/Acquisition.pm | 8 ++++++++ > acqui/addorderiso2709.pl | 8 ++++++-- > acqui/finishreceive.pl | 6 +++++- > acqui/neworderempty.pl | 2 ++ > acqui/orderreceive.pl | 1 + > koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt | 6 ++++++ > koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt | 5 +++++ > koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt | 8 ++++++-- > koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt | 6 +++++- > koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt | 7 +++++++ > 10 files changed, 51 insertions(+), 6 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index 15a51dd..70041f6 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -1506,6 +1506,10 @@ sub ModReceiveOrder { > |; > > $query .= q| >+ , replacementprice = ? >+ | if defined $order->{replacementprice}; >+ >+ $query .= q| > , unitprice = ?, unitprice_tax_included = ?, unitprice_tax_excluded = ? > | if defined $order->{unitprice}; > >@@ -1526,6 +1530,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}; > } >diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl >index 3ce7e1e..0b619ee 100755 >--- a/acqui/addorderiso2709.pl >+++ b/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 || ''; >diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl >index 7bec865..260b994 100755 >--- a/acqui/finishreceive.pl >+++ b/acqui/finishreceive.pl >@@ -49,6 +49,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); >@@ -60,6 +61,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 >@@ -86,6 +89,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( >@@ -157,7 +161,7 @@ ModItem( > dateaccessioned => $datereceived, > datelastseen => $datereceived, > price => $unitprice, >- replacementprice => $order->{rrp}, >+ replacementprice => $replacementprice, > replacementpricedate => $datereceived, > }, > $biblionumber, >diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl >index ab92985..11efcc6 100755 >--- a/acqui/neworderempty.pl >+++ b/acqui/neworderempty.pl >@@ -268,6 +268,7 @@ if ( defined $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}; >@@ -349,6 +350,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), >diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl >index 7952e1d..ff6e8f9 100755 >--- a/acqui/orderreceive.pl >+++ b/acqui/orderreceive.pl >@@ -215,6 +215,7 @@ $template->param( > quantityreceivedplus1 => $order->{'quantityreceived'} + 1, > quantityreceived => $order->{'quantityreceived'}, > rrp => $rrp, >+ replacementprice => $order->{'replacementprice'}, > ecost => $ecost, > unitprice => $unitprice, > tax_rate => $tax_rate, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >index 81d07ff..f4cbd06 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >@@ -353,6 +353,7 @@ > <th class="tax_excluded">ecost tax exc.</th> > <th class="tax_included">RRP tax inc.</th> > <th class="tax_included">ecost tax inc.</th> >+ <th class="replacementprice">Replacement price</th> > <th>Qty.</th> > <th class="tax_excluded">Total tax exc. ([% currency %])</th> > <th class="tax_included">Total tax inc. ([% currency %])</th> >@@ -377,6 +378,7 @@ > <th class="tax_excluded"> </th> > <th class="tax_included"> </th> > <th class="tax_included"> </th> >+ <th class="replacementprice"> </th> > <th>[% foot_loo.quantity %]</th> > <th class="tax_excluded">[% foot_loo.total_tax_excluded | $Price%]</th> > <th class="tax_included">[% foot_loo.total_tax_included | $Price %]</th> >@@ -399,6 +401,7 @@ > <th class="tax_excluded"> </th> > <th class="tax_included"> </th> > <th class="tax_included"> </th> >+ <th class="replacementprice"> </th> > <th>[% total_quantity %]</th> > <th class="tax_excluded">[% total_tax_excluded | $Price %]</th> > <th class="tax_included">[% total_tax_included | $Price %]</th> >@@ -474,6 +477,7 @@ > <td class="number tax_excluded [% IF books_loo.ecost_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.ecost_tax_excluded | $Price%]</td> > <td class="number tax_included [% IF books_loo.rrp_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.rrp_tax_included | $Price %]</td> > <td class="number tax_included [% IF books_loo.ecost_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.ecost_tax_included | $Price %]</td> >+ <td class="number replacementprice [% IF books_loo.replacementprice.search(zero_regex) %]error[% END %]">[% books_loo.replacementprice | $Price %]</td> > <td class="number [% IF books_loo.quantity.search(zero_regex) %]error[% END %]">[% books_loo.quantity %]</td> > <td class="number tax_excluded [% IF books_loo.total_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.total_tax_excluded | $Price %]</td> > <td class="number tax_included [% IF books_loo.total_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.total_tax_included | $Price %]</td> >@@ -536,6 +540,7 @@ > <th class="tax_excluded">ecost tax exc.</th> > <th class="tax_included">RRP tax inc.</th> > <th class="tax_included">ecost tax inc.</th> >+ <th class="replacementprice">Replacement price</th> > <th>Qty.</th> > <th class="tax_excluded">Total tax exc. ([% currency %])</th> > <th class="tax_included">Total tax inc. ([% currency %])</th> >@@ -588,6 +593,7 @@ > <td class="number tax_excluded">[% order.ecost_tax_excluded | $Price %]</td> > <td class="number tax_included">[% order.rrp_tax_included | $Price %]</td> > <td class="number tax_included">[% order.ecost_tax_included | $Price %]</td> >+ <td class="number replacementprice">[% order.replacementprice | $Price %]</td> > <td class="number">[% order.quantity %]</td> > <td class="number tax_excluded">[% order.total_tax_excluded | $Price %]</td> > <td class="number tax_included">[% order.total_tax_included | $Price %]</td> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt >index 2061814..0830d51 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt >@@ -98,6 +98,7 @@ > <th>Library</th> > <th class="tax_excluded">Actual cost tax exc.</th> > <th class="tax_included">Actual cost tax inc.</th> >+ <th class="replacementprice">Replacement price</th> > <th>Qty.</th> > <th class="tax_excluded">Total tax exc. ([% currency.symbol %])</th> > <th class="tax_included">Total tax inc. ([% currency.symbol %])</th> >@@ -128,6 +129,7 @@ > <td><p>[% order.branchcode %]</p></td> > <td class="number tax_excluded">[% order.unitprice_tax_excluded | $Price %]</td> > <td class="number tax_included">[% order.unitprice_tax_included | $Price %]</td> >+ <td class="number replacementprice">[% order.replacementprice | $Price %]</td> > <td class="number">[% order.quantity %]</td> > <td class="number tax_excluded">[% order.total_tax_excluded | $Price %]</td> > <td class="number tax_included">[% order.total_tax_included | $Price %]</td> >@@ -142,6 +144,7 @@ > <tr> > <th colspan="2">Total (GST [% tf.tax_rate * 100 %] %)</th> > <th class="tax_excluded"/><th class="tax_included"/> >+ <th class="replacementprice"/> > <th>[% tf.quantity %]</th> > <th class="tax_excluded">[% tf.total_tax_excluded | $Price %]</th> > <th class="tax_included">[% tf.total_tax_included | $Price %]</th> >@@ -153,6 +156,7 @@ > <tr> > <th colspan='2'>Total ([% currency.symbol %])</th> > <th class="tax_excluded"/><th class="tax_included"/> >+ <th class="replacementprice"/> > <th>[% total_quantity %]</th> > <th class="tax_excluded">[% total_tax_excluded | $Price %]</th> > <th class="tax_included">[% total_tax_included | $Price %]</th> >@@ -164,6 +168,7 @@ > <th colspan="2">Total + Shipment cost ([% currency.symbol %])</th> > <th class="tax_excluded"></th> > <th class="tax_included"></th> >+ <th class="replacementprice"/> > <th>[% total_quantity %]</th> > <th class="tax_excluded">[% total_tax_excluded_shipment | $Price %]</th> > <th class="tax_included">[% total_tax_included_shipment | $Price %]</th> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >index faa2db4..f1deb62 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >@@ -598,14 +598,18 @@ $(document).ready(function() > </li> > <li> > [% IF ( close ) %] >- <span class="label">Replacement cost: </span> >+ <span class="label">Retail price: </span> > <input type="hidden" name="rrp" id="rrp" value="[% rrp %]" />[% rrp %] (adjusted for [% cur_active %], [% IF (listincgst == 1) %]tax inc.[% ELSE %]tax exc.[% END %]) > [% ELSE %] >- <label for="rrp">Replacement cost: </label> >+ <label for="rrp">Retail price: </label> > <input type="text" size="20" name="rrp" id="rrp" value="[% rrp %]" /> (adjusted for [% cur_active %], [% IF (listincgst == 1) %]tax inc.[% ELSE %]tax exc.[% END %]) > [% END %] > </li> > <li> >+ <label for="replacementprice">Replacement cost: </label> >+ <input type="text" size="20" name="replacementprice" id="replacementprice" value="[% replacementprice %]" /> >+ </li> >+ <li> > <label for="ecost">Budgeted cost: </label> > <input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" readonly="readonly" /> [% IF (listincgst == 1) %](tax inc.)[% ELSE %](tax exc.)[% END %] > </li> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >index b26343c..a0782b9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >@@ -346,7 +346,11 @@ > <input type="hidden" name="tax_rate" value="0" /> > [% END %] > >- <li><label for="rrp">Replacement cost: </label>[% rrp | $Price %]</li> >+ <li><label for="rrp">Retail price: </label>[% rrp | $Price %]</li> >+ <li> >+ <label for="replacementprice">Replacement price:</label> >+ <input type="text" size="20" name="replacementprice" id="replacementprice" value="[% replacementprice | $Price %]" /> >+ </li> > <li><label for="ecost">Budgeted cost: </label>[% ecost | $Price %]</li> > <li> > <label for="unitprice">Actual cost:</label> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt >index ee4d8d6..9066584 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt >@@ -40,6 +40,7 @@ > null, > null, > null, >+ null, > ], > 'bAutoWidth': false, > "sPaginationType": "four_button" >@@ -56,6 +57,7 @@ > { type: "text" }, > { type: "text" }, > { type: "text" }, >+ { type: "text" }, > null, > null > ] >@@ -233,6 +235,7 @@ > <th>Order line search</th> > <th>Summary search</th> > <th> </th> >+ <th>Replacement price search</th> > <th>Quantity search</th> > <th>Unit cost search</th> > <th>Order cost search</th> >@@ -246,6 +249,7 @@ > <th>Order line</th> > <th>Summary</th> > <th>View record</th> >+ <th>Replacement price</th> > <th>Quantity</th> > <th>Unit cost</th> > <th>Order cost</th> >@@ -294,6 +298,7 @@ > [% END %] > </td> > <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% loop_order.biblionumber %]" class="previewData">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=[% loop_order.biblionumber %]" class="previewData">Card</a></td> >+ <td>[% loop_order.replacementprice | $Price %]</td> > <td>[% loop_order.quantity %]</td> > <td>[% loop_order.ecost | $Price %]</td> > <td>[% loop_order.total | $Price %]</td> >@@ -354,6 +359,7 @@ > <th>Holds</th> > <th>Summary</th> > <th>View record</th> >+ <th>Replacement price</th> > <th>Quantity</th> > <th>Fund</th> > <th>Est cost</th> >@@ -435,6 +441,7 @@ > [% END %] > </td> > <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% order.biblionumber %]" class="previewData">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=[% order.biblionumber %]" class="previewData">Card</a></td> >+ <td>[% order.replacementprice | $Price %]</td> > <td>[% order.quantityreceived %]</td> > <td>[% order.budget.budget_name %]</td> > <td>[% order.ecost | $Price %]</td> >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18639
:
70213
|
70214
|
70215
|
70216
|
75946
|
76867
|
76868
|
76869
|
76870
|
76871
|
78184
|
78185
|
78186
|
78187
|
78188
|
78189
|
78191
|
78249
|
78250
|
78251
|
78252
|
78253
|
78254
|
78255
|
78256
|
79789