From d83315198889ca4816dc06d18f39c98a53c72e25 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 23 May 2013 16:42:38 +0200 Subject: [PATCH] Bug 10317: improve display when order receiving page is given an invalid invoiceid This patch fixes some things on the order receiving/parcel page. 1/ Removes dead code 2/ Displays an error message if invoiceid is unset or does not refer to an invoice 3/ Fixes a bug in the note ("change note" and "add note" links) Test plan: 1/ Try to call the invoice page with an existing invoiceid and check that order results are consistent. 2/ Try without invoiceid or a bad invoiceid and check that an error message is displayed. 3/ Add and change notes. Signed-off-by: Cedric Vita Signed-off-by: Katrin Fischer Works nicely for all tests done. - parcel.pl with invalid invoicenumber gives a nice error message - parcel.pl with a valid invoicenumber looks normal - changing and editing order notes works well Passes QA script. Signed-off-by: Galen Charlton (cherry picked from commit d932f6ff250c3a50db379b23abfc40a77620e94b) Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 3446a86f80313316c5f939e10b983c8703095030) Signed-off-by: Bernardo Gonzalez Kriegel (cherry picked from commit 3446a86f80313316c5f939e10b983c8703095030) --- acqui/parcel.pl | 31 +++++++------------ .../prog/en/modules/acqui/parcel.tt | 27 ++++++++++------ 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/acqui/parcel.pl b/acqui/parcel.pl index 8e82283279..ee96e3f333 100755 --- a/acqui/parcel.pl +++ b/acqui/parcel.pl @@ -118,6 +118,18 @@ my ($template, $loggedinuser, $cookie) }); my $invoiceid = $input->param('invoiceid'); +my $invoice; +$invoice = GetInvoiceDetails($invoiceid) if $invoiceid; + +unless( $invoiceid and $invoice->{invoiceid} ) { + $template->param( + error_invoice_not_known => 1, + no_orders_to_display => 1 + ); + output_html_with_http_headers $input, $cookie, $template->output; + exit; +} + my $op = $input->param('op') // ''; if ($op eq 'cancelreceipt') { @@ -128,29 +140,10 @@ if ($op eq 'cancelreceipt') { } } -my $invoice = GetInvoiceDetails($invoiceid); my $booksellerid = $invoice->{booksellerid}; my $bookseller = GetBookSellerFromId($booksellerid); my $gst = $bookseller->{gstrate} // C4::Context->preference("gist") // 0; my $datereceived = C4::Dates->new(); -my $code = $input->param('code'); -my @rcv_err = $input->param('error'); -my @rcv_err_barcode = $input->param('error_bc'); - - - -# If receiving error, report the error (coming from finishrecieve.pl(sic)). -if( scalar(@rcv_err) ) { - my $cnt=0; - my $error_loop; - for my $err (@rcv_err) { - push @$error_loop, { "error_$err" => 1 , barcode => $rcv_err_barcode[$cnt] }; - $cnt++; - } - $template->param( receive_error => 1 , - error_loop => $error_loop, - ); -} my $cfstr = "%.2f"; # currency format string -- could get this from currency table. my @parcelitems = @{ $invoice->{orders} }; 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 46057909bb..81b9c63fe7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt @@ -15,6 +15,7 @@ var rowsToCollapse = 5; $(document).ready(function(){ + if ( $("#pendingt").length ) { var pendingt = $("#pendingt").dataTable($.extend(true, {}, dataTablesDefaults, { "aoColumnDefs": [ { "aTargets": [ 3, 8, 9 ], "bSortable": false, "bSearchable": false }, @@ -33,6 +34,8 @@ ], "sPaginationType": "four_button" } ) ); + } + if ( $("#receivedt").length ) { var receivedt = $("#receivedt").dataTable($.extend(true, {}, dataTablesDefaults, { "aoColumnDefs": [ { "aTargets": [ 3, -1 ], "bSortable": false, "bSearchable": false }, @@ -50,11 +53,7 @@ ], "sPaginationType": "four_button" } ) ); -/* - $("#pendingt").tablesorter({ - headers: { 2: { sorter: 'articles' },3: { sorter: false },8:{sorter:false}} - }); -*/ + } rowCountPending = $("#pendingt tbody.filterclass tr").length; rowCountReceived = $("#receivedt tbody.filterclass tr").length; @@ -179,7 +178,7 @@ [% END %] [% IF (error_cancelling_receipt) %] -
+
Cannot cancel receipt. Possible reasons :
  • @@ -196,6 +195,13 @@
[% END %] + [% IF error_invoice_not_known %] +
+ The invoice referenced by this invoiceid does not exist. +
+ [% END %] + +[% UNLESS no_orders_to_display %]

Invoice number: [% invoice %] Received by: [% loggedinusername %] On: [% formatteddatereceived %]

@@ -235,9 +241,9 @@ [% END %]
[% IF ( loop_order.notes ) %] -

Note: [% loop_order.notes|html %] [Change note]

+

Note: [% loop_order.notes|html %] [Change note]

[% ELSE %] - [Add note] + [Add note] [% END %] MARC | Card @@ -368,7 +374,6 @@ [% ELSE %]There are no received orders.[% END %]
- [% IF (invoiceclosedate) %] View invoice [% ELSE %] @@ -380,8 +385,12 @@ [% END %] +[% END %] + + +
-- 2.39.5