From 4e176e1c9227fc7b427ecfe8cf3b9b5e440deb87 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 24 May 2023 09:44:49 -0300 Subject: [PATCH] Bug 33784: Make buttons more meaningful This patch makes dismissing the modal equivalent to cancelling the receipt and thus returning to parcel.pl. The 'Save' button is renamed to 'Confirm' and is disabled when no items are selected for receiving. Signed-off-by: Tomas Cohen Arazi --- .../prog/en/modules/acqui/orderreceive.tt | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) 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 7bbffea00be..9f006ad862b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -94,7 +94,7 @@

Receive items from : [% name | html %] [% IF ( invoice ) %][[% invoice | html %]] [% END %] (order #[% multiple_orders | html %])

- +[% SET only_one_order = ( multiple_orders.split(',').size == 1 ) %] [% IF multiple_orders %] @@ -393,10 +393,15 @@ @@ -625,7 +630,7 @@ } } ], - [% IF multiple_orders.split(',').size == 1 %] + [% IF only_one_order %] "drawCallback": function( settings ) { $(this).find("tbody tr td:last-child a.order_edit_toggle").click(); }, @@ -873,6 +878,9 @@ $("#quantity").val(qty); var row = $("#order_edit").data('row'); row.quantity_received = qty; + [% IF only_one_order %] + $('.modal-save').prop('disabled', qty < 1 ); + [% END %] }) $("#order_edit").on("change", "#tax_rate", function() { @@ -1298,7 +1306,7 @@ var saved_rows = save_row(); if(Object.keys(saved_rows).length) $('.save').prop('disabled', false); $("#order_edit").modal('hide'); - [% IF multiple_orders.split(',').size == 1 %] + [% IF only_one_order %] $(".save").click(); [% END %] }) @@ -1317,7 +1325,11 @@ }); $("#order_edit").on("hide.bs.modal", function() { + [% IF only_one_order %] [%# On the single case, dismissing the modal equals to cancelling %] + location.href = "/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | html %]&sticky_filters=1"; + [% ELSE %] $("#child_orders_table").DataTable().off('preDraw').destroy(); + [% END %] }); }); -- 2.34.1