Bugzilla – Attachment 146658 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 invoice price and currency even if no currency change
Bug-25655-Store-invoice-price-and-currency-even-if.patch (text/plain), 5.25 KB, created by
Jonathan Druart
on 2023-02-15 07:56:00 UTC
(
hide
)
Description:
Bug 25655: Store invoice price and currency even if no currency change
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-02-15 07:56:00 UTC
Size:
5.25 KB
patch
obsolete
>From 965ec07a492ae330798c53e9e9c601e1d5a2af97 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 15 Feb 2023 08:54:36 +0100 >Subject: [PATCH] Bug 25655: Store invoice price and currency even if no > currency change > >We could need these info to be stored even if the currency is the same >as the active one, for statistic purpose for instance. >--- > C4/Acquisition.pm | 3 +++ > t/db_dependent/Acquisition.t | 23 +++++++++++++++-------- > 2 files changed, 18 insertions(+), 8 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index f4e837db9a5..6873a67e854 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -1383,6 +1383,9 @@ sub ModReceiveOrder { > $datereceived = $datereceived ? dt_from_string( $datereceived ) : dt_from_string; > $datereceived = $datereceived->ymd; > >+ $order->{invoice_unitprice} ||= $order->{unitprice}; >+ $order->{invoice_currency} ||= Koha::Acquisition::Currencies->get_active->currency; >+ > my $suggestionid = GetSuggestionFromBiblionumber( $biblionumber ); > if ($suggestionid) { > ModSuggestion( {suggestionid=>$suggestionid, >diff --git a/t/db_dependent/Acquisition.t b/t/db_dependent/Acquisition.t >index 1560cf930f2..67e405d07dc 100755 >--- a/t/db_dependent/Acquisition.t >+++ b/t/db_dependent/Acquisition.t >@@ -803,6 +803,7 @@ subtest 'ModReceiveOrder invoice_unitprice and invoice_currency' => sub { > quantityreceived => 0, > ecost_tax_excluded => 42, > unitprice_tax_excluded => 42, >+ unitprice => 42, > } > } > ); >@@ -819,16 +820,17 @@ subtest 'ModReceiveOrder invoice_unitprice and invoice_currency' => sub { > budget_id => $order->budget_id, > } > ); >+ my $active_currency = Koha::Acquisition::Currencies->get_active; > my $received_order = > Koha::Acquisition::Orders->find($received_ordernumber); > is( $received_order->invoice_unitprice, >- undef, 'no price should be stored if none passed' ); >+ $order->unitprice, 'no price should be stored if none passed' ); > is( $received_order->invoice_currency, >- undef, 'no currency should be stored if none passed' ); >+ $active_currency->currency, 'no currency should be stored if none passed' ); > $order = $order->get_from_storage; >- is( $order->invoice_unitprice, undef, >+ is( $order->invoice_unitprice, $order->unitprice, > 'no price should be stored if none passed' ); >- is( $order->invoice_currency, undef, >+ is( $order->invoice_currency, $active_currency->currency, > 'no currency should be stored if none passed' ); > }; > subtest 'with invoice_unitprice' => sub { >@@ -841,6 +843,7 @@ subtest 'ModReceiveOrder invoice_unitprice and invoice_currency' => sub { > quantityreceived => 0, > ecost_tax_excluded => 42, > unitprice_tax_excluded => 42, >+ unitprice => 42, > } > } > ); >@@ -886,6 +889,7 @@ subtest 'ModReceiveOrder invoice_unitprice and invoice_currency' => sub { > quantityreceived => 0, > ecost_tax_excluded => 42, > unitprice_tax_excluded => 42, >+ unitprice => 42, > } > } > ); >@@ -902,17 +906,19 @@ subtest 'ModReceiveOrder invoice_unitprice and invoice_currency' => sub { > budget_id => $order->budget_id, > } > ); >+ my $active_currency = Koha::Acquisition::Currencies->get_active; > my $received_order = > Koha::Acquisition::Orders->find($received_ordernumber); > is( $received_order->invoice_unitprice, >- undef, 'no price should be stored if none passed' ); >+ $order->unitprice, 'no price should be stored if none passed' ); > is( $received_order->invoice_currency, >- undef, 'no currency should be stored if none passed' ); >+ $active_currency->currency, 'no currency should be stored if none passed' ); > $order = $order->get_from_storage; >- is( $order->invoice_unitprice, undef, >+ is( $order->invoice_unitprice, $order->unitprice, > 'no price should be stored if none passed' ); >- is( $order->invoice_currency, undef, >+ is( $order->invoice_currency, $active_currency->currency, > 'no currency should be stored if none passed' ); >+ > }; > > subtest 'with invoice_unitprice' => sub { >@@ -925,6 +931,7 @@ subtest 'ModReceiveOrder invoice_unitprice and invoice_currency' => sub { > quantityreceived => 0, > ecost_tax_excluded => 42, > unitprice_tax_excluded => 42, >+ unitprice => 42, > } > } > ); >-- >2.25.1
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