Bugzilla – Attachment 146821 Details for
Bug 25655
Additionally store actual cost in foreign currency and currency from the invoice
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25655: Store actual cost in foreign currency and currency from the invoice
Bug-25655-Store-actual-cost-in-foreign-currency-an.patch (text/plain), 6.77 KB, created by
Katrin Fischer
on 2023-02-17 10:41:15 UTC
(
hide
)
Description:
Bug 25655: Store actual cost in foreign currency and currency from the invoice
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2023-02-17 10:41:15 UTC
Size:
6.77 KB
patch
obsolete
>From 9c8b4f59a01b9bd693129bd5cbd226076da09f95 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 16 Jan 2023 21:59:38 +0100 >Subject: [PATCH] Bug 25655: Store actual cost in foreign currency and currency > from the invoice > >Bug 24158 allows to calculate the actual cost on time of receive from a foreign currency. >This new enhancement is storing the price and the currency in database, into two new columns >invoice_unitprice an invoice_currency > >Test plan: >Create a new order with several items to receive >Receive one or more items, and tick "change currency" on the order >receive page >Select a currency and finish the receiving >In DB notice that the price and the currency have been stored. >Receive remaining items and confirm that the form is prefilled with >previous price and currency > >Sponsored-by: The Research University in the Helmholtz Association (KIT) >Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu> >Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> >--- > Koha/Acquisition/Order.pm | 3 +- > acqui/finishreceive.pl | 32 ++++++++++++++++--- > .../prog/en/modules/acqui/orderreceive.tt | 18 +++++------ > 3 files changed, 38 insertions(+), 15 deletions(-) > >diff --git a/Koha/Acquisition/Order.pm b/Koha/Acquisition/Order.pm >index b9059b0132..c73f977791 100644 >--- a/Koha/Acquisition/Order.pm >+++ b/Koha/Acquisition/Order.pm >@@ -635,7 +635,8 @@ sub to_api_mapping { > uncertainprice => 'uncertain_price', > unitprice => 'unit_price', > unitprice_tax_excluded => 'unit_price_tax_excluded', >- unitprice_tax_included => 'unit_price_tax_included' >+ unitprice_tax_included => 'unit_price_tax_included', >+ invoice_unitprice => 'invoice_unit_price', > }; > } > >diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl >index b0dd1b7fae..3c9e87ca78 100755 >--- a/acqui/finishreceive.pl >+++ b/acqui/finishreceive.pl >@@ -51,6 +51,8 @@ my $quantity = $input->param('quantity'); > my $unitprice = $input->param('unitprice'); > my $replacementprice = $input->param('replacementprice'); > my $datereceived = $input->param('datereceived'); >+my $invoice_unitprice = $input->param('invoice_unitprice'); >+my $invoice_currency = $input->param('invoice_currency'); > my $invoiceid = $input->param('invoiceid'); > my $invoice = GetInvoice($invoiceid); > my $invoiceno = $invoice->{invoicenumber}; >@@ -98,10 +100,22 @@ if ($quantityrec > $origquantityrec ) { > } > } > >- $order_obj->order_internalnote(scalar $input->param("order_internalnote")); >- $order_obj->tax_rate_on_receiving(scalar $input->param("tax_rate")); >- $order_obj->replacementprice($replacementprice); >- $order_obj->unitprice($unitprice); >+ $order_obj->set( >+ { >+ order_internalnote => scalar $input->param("order_internalnote"), >+ tax_rate_on_receiving => scalar $input->param("tax_rate"), >+ replacementprice => $replacementprice, >+ unitprice => $unitprice, >+ ( >+ defined $invoice_unitprice && $invoice_unitprice ne '' >+ ? ( >+ invoice_unitprice => $invoice_unitprice, >+ invoice_currency => $invoice_currency, >+ ) >+ : () >+ ), >+ } >+ ); > > $order_obj->populate_with_prices_for_receiving(); > >@@ -189,7 +203,15 @@ if (C4::Context->preference("AcquisitionLog")) { > bookfund => $bookfund || 'unchanged', > tax_rate => $input->param("tax_rate"), > replacementprice => $replacementprice, >- unitprice => $unitprice >+ unitprice => $unitprice, >+ ( >+ defined $invoice_unitprice && $invoice_unitprice ne '' >+ ? ( >+ invoice_unitprice => $invoice_unitprice, >+ invoice_currency => $invoice_currency, >+ ) >+ : () >+ ), > }; > > logaction( >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 894af69294..d06b3e3e37 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >@@ -428,13 +428,13 @@ > <label style="font-weight: inherit; float:none;"><input type="checkbox" name="change_currency">Change currency</label> > </li> > <li id="select_currency"> >- <label for="unitprice_currency"></label> >- <input type="text" size="20" name="unitprice" id="unitprice_currency" value="" /> >+ <label for="invoice_unitprice"></label> >+ <input type="text" size="20" name="invoice_unitprice" id="invoice_unitprice" value="" /> > [% IF currencies.count %] >- <select name="currency"> >- <option value="[% active_currency.rate | html %]" selected="selected">[% active_currency.currency | html %] ([% active_currency.symbol | html %])</option> >+ <select name="invoice_currency"> >+ <option value="[% active_currency.currency | html %]" data-rate="[% active_currency.rate | html %]" selected="selected">[% active_currency.currency | html %] ([% active_currency.symbol | html %])</option> > [% FOR currency IN currencies %] >- <option value="[% currency.rate | html %]">[% currency.currency | html %] ([% currency.symbol | html %])</option> >+ <option value="[% currency.currency | html%]" data-rate="[% currency.rate | html %]">[% currency.currency | html %] ([% currency.symbol | html %])</option> > [% END %] > </select> > [% END %] >@@ -608,13 +608,13 @@ > }).change(); > > function update_unitprice() { >- var rate = Number($("select[name='currency'] option:selected").val()); >- var unitprice = $("#unitprice_currency").val(); >+ var rate = Number($("select[name='invoice_currency'] option:selected").data('rate')); >+ var unitprice = $("#invoice_unitprice").val(); > var new_unitprice = Number( unitprice * rate ).toFixed(2); > $("#unitprice").val(new_unitprice); > } >- $("select[name='currency']").on("change", function(){update_unitprice()} ); >- $("#unitprice_currency").on("change", function(){update_unitprice()} ); >+ $("select[name='invoice_currency']").on("change", function(){update_unitprice()} ); >+ $("#invoice_unitprice").on("change", function(){update_unitprice()} ); > > [% IF other_reason %] > $(".select-reason").hide(); >-- >2.30.2
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 25655
:
144618
|
145906
|
145907
|
145908
|
145909
|
145910
|
145911
|
145912
|
146082
|
146084
|
146085
|
146086
|
146087
|
146088
|
146089
|
146478
|
146479
|
146480
|
146481
|
146482
|
146483
|
146484
|
146658
|
146660
|
146818
|
146819
|
146820
| 146821 |
146822
|
146823
|
146824
|
146825
|
146826