From 3941dd649a7d0cb9d1ecb3e64c7c9f071faa0231 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Tue, 22 Oct 2013 00:14:47 +0000 Subject: [PATCH] Bug 11108: fix duplicate display of basket whose receipt has just been cancelled After receiving an order basket, before finishing receiving the shipment, one has an option to cancel the receipt. This patch fixes a bug where a basket whose receipt was just cancelled displays on both the pending orders and already received tabs. This patch also fixes a minor unitialized variable warning. To test: [1] Create a basket with at least one order and close it. [2] Receive the order, then on the row in the 'Already received' table, click the cancel receipt link. [3] In the page that displays, the basket just cancelled displays on both tables. Clicking the cancel receipt link again results in an error message. [4] Apply the patch. [5] Repeat steps 1 and 2. This time, the cancelled basket displays only in the pending orders table, as expected. [6] Verify that after applying the patch, the following no longer is logged in the Apache error log: parcel.pl: Use of uninitialized value in string eq at acqui/parcel.pl line... Signed-off-by: Galen Charlton Signed-off-by: Ed Veal Signed-off-by: Katrin Fischer Passes test plan, all tests and QA script. Works as described. Signed-off-by: Galen Charlton (cherry picked from commit 0010c27ea17a515683f5ae01b9e97d4f80e3d55f) Signed-off-by: Tomas Cohen Arazi --- acqui/parcel.pl | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/acqui/parcel.pl b/acqui/parcel.pl index ee96e3f333..ef323ecf11 100755 --- a/acqui/parcel.pl +++ b/acqui/parcel.pl @@ -117,6 +117,18 @@ my ($template, $loggedinuser, $cookie) debug => 1, }); +my $op = $input->param('op') // ''; + +# process cancellation first so that list of +# orders to display is calculated after +if ($op eq 'cancelreceipt') { + my $ordernumber = $input->param('ordernumber'); + my $parent_ordernumber = CancelReceipt($ordernumber); + unless($parent_ordernumber) { + $template->param(error_cancelling_receipt => 1); + } +} + my $invoiceid = $input->param('invoiceid'); my $invoice; $invoice = GetInvoiceDetails($invoiceid) if $invoiceid; @@ -130,16 +142,6 @@ unless( $invoiceid and $invoice->{invoiceid} ) { exit; } -my $op = $input->param('op') // ''; - -if ($op eq 'cancelreceipt') { - my $ordernumber = $input->param('ordernumber'); - my $parent_ordernumber = CancelReceipt($ordernumber); - unless($parent_ordernumber) { - $template->param(error_cancelling_receipt => 1); - } -} - my $booksellerid = $invoice->{booksellerid}; my $bookseller = GetBookSellerFromId($booksellerid); my $gst = $bookseller->{gstrate} // C4::Context->preference("gist") // 0; @@ -204,7 +206,7 @@ push @book_foot_loop, map { $_ } values %foot; my @loop_orders = (); if(!defined $invoice->{closedate}) { my $pendingorders; - if($input->param('op') eq "search"){ + if($op eq "search"){ my $search = $input->param('summaryfilter') || ''; my $ean = $input->param('eanfilter') || ''; my $basketno = $input->param('basketfilter') || ''; -- 2.39.5