From beb6bd866779a93373ae493c784afbcbd470e4a0 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 16 Apr 2018 17:41:42 -0300 Subject: [PATCH] Bug 19030: Preserve link between order and subscription when editing an order MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The aqorders.subscriptionid info is not sent to the template when the order is edited. Which means we lose this link. Test plan: Create an order from a subscription Edit the order => Without this patch, the aqorders.subscriptionid value is set to NULL and items are created when receiving serial. => With this patch applied the link is preserved and expected behaviors are preserved during all the acquisition workflow You should also try and create several orders from the same subscription Sponsored-by: BULAC - http://www.bulac.fr/ Signed-off-by: Séverine QUEUNE Signed-off-by: Julian Maurice Signed-off-by: Jonathan Druart --- acqui/neworderempty.pl | 13 +++++++++---- .../prog/en/modules/acqui/newordersubscription.tt | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index 54feb36f40..6326eaf39b 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -108,7 +108,7 @@ my $suggestionid = $input->param('suggestionid'); my $close = $input->param('close'); my $uncertainprice = $input->param('uncertainprice'); my $import_batch_id = $input->param('import_batch_id'); # if this is filled, we come from a staged file, and we will return here after saving the order ! -my $subscriptionid = $input->param('subscriptionid'); +my $from_subscriptionid = $input->param('from_subscriptionid'); my $data; my $new = 'no'; @@ -262,6 +262,10 @@ else { #modify order $biblionumber = $data->{'biblionumber'}; $budget_id = $data->{'budget_id'}; + $template->param( + subscriptionid => $data->{subscriptionid}, + ); + $basket = GetBasket( $data->{'basketno'} ); $basketno = $basket->{'basketno'}; @@ -358,8 +362,8 @@ if ($basketobj->effective_create_items eq 'ordering' && !$ordernumber) { my @itemtypes; @itemtypes = Koha::ItemTypes->search unless C4::Context->preference('item-level_itypes'); -if ( defined $subscriptionid ) { - my $lastOrderReceived = GetLastOrderReceivedFromSubscriptionid $subscriptionid; +if ( defined $from_subscriptionid ) { + my $lastOrderReceived = GetLastOrderReceivedFromSubscriptionid $from_subscriptionid; if ( defined $lastOrderReceived ) { $budget_id = $lastOrderReceived->{budgetid}; $data->{listprice} = $lastOrderReceived->{listprice}; @@ -377,6 +381,8 @@ if ( defined $subscriptionid ) { $basket = GetBasket( $input->param('basketno') ); } + + $template->param( subscriptionid => $from_subscriptionid ); } # Find the items.barcode subfield for barcode validations @@ -457,7 +463,6 @@ $template->param( publishercode => $data->{'publishercode'}, barcode_subfield => $barcode_subfield, import_batch_id => $import_batch_id, - subscriptionid => $subscriptionid, acqcreate => $basketobj->effective_create_items eq "ordering" ? 1 : "", users_ids => join(':', @order_user_ids), users => \@order_users, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt index fd225b9c15..aad7d34efe 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt @@ -70,7 +70,7 @@ [% IF (sub.alreadyOnOrder) %] Outstanding order (only one order per subscription is allowed) [% ELSIF not sub.aqbooksellerid || booksellerid == sub.aqbooksellerid%] - + Order [% ELSE %] -- 2.39.5