From fce3ca13a51041cea873768b3fb4d1038016e1d5 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 5 Mar 2024 16:21:31 +0000 Subject: [PATCH] Bug 36193: (follow-up) Use buttons and don't nest forms When changing action links into forms, we should use a submit button rather than JS to submit Receipt cancelling needed a form embedded in the page as we cannot nest forms Fixed searching on invoice.pl Fixed resetting mappings (original button did not need cud-) Signed-off-by: Nick Clemens Signed-off-by: Tomas Cohen Arazi Signed-off-by: Katrin Fischer --- acqui/invoices.pl | 4 +-- .../prog/en/modules/acqui/parcel.tt | 15 ++++---- .../prog/en/modules/admin/cash_registers.tt | 35 ++++--------------- .../prog/en/modules/admin/credit_types.tt | 15 ++------ .../prog/en/modules/admin/debit_types.tt | 15 ++------ .../prog/en/modules/admin/restrictions.tt | 8 +---- .../searchengine/elasticsearch/mappings.tt | 2 +- 7 files changed, 22 insertions(+), 72 deletions(-) diff --git a/acqui/invoices.pl b/acqui/invoices.pl index dce1a4d668..5cf2e338aa 100755 --- a/acqui/invoices.pl +++ b/acqui/invoices.pl @@ -80,7 +80,7 @@ for my $field (@additional_fields) { } my $invoices = []; -if ( $op and $op eq 'cud-do_search' ) { +if ( $op and $op eq 'do_search' ) { @{$invoices} = GetInvoices( invoicenumber => $invoicenumber, supplierid => $supplierid, @@ -142,7 +142,7 @@ $template->{'VARS'}->{'budgets_loop'} = \@budgets_loop; $template->param( openedinvoices => \@openedinvoices, closedinvoices => \@closedinvoices, - do_search => ( $op and $op eq 'cud-do_search' ) ? 1 : 0, + do_search => ( $op and $op eq 'do_search' ) ? 1 : 0, invoices => $invoices, invoicenumber => $invoicenumber, booksellerid => $supplierid, 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 74badf6d47..33dd94ba60 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt @@ -294,12 +294,6 @@ Can't cancel receipt [% ELSE %] -
- [% INCLUDE 'csrf-token.inc' %] - - - -
Cancel receipt [% END %] @@ -308,6 +302,12 @@ +
+ [% INCLUDE 'csrf-token.inc' %] + + + +
[% ELSE %]There are no received orders.[% END %] @@ -367,7 +367,8 @@ $(".cancel_receipt").on( 'click', function(e){ e.preventDefault(); - $('#cancel_receipt_' + $(this).data('ordernumber')).submit(); + $('#cancel_ordernumber').val( $(this).data('ordernumber') ); + $('#cancel_receipt').submit(); }); if ( $("#receivedt").length ) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cash_registers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cash_registers.tt index 06ef94bcae..e8a733149d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cash_registers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cash_registers.tt @@ -189,39 +189,39 @@ [% cash_register.library.branchname | html %] [% IF cash_register.branch_default %]Yes[% ELSE %]No[% END %] [% cash_register.starting_float | $Price %] - [% IF cash_register.archived == '0' %] + [% IF cash_register.archived == '0' %] Edit [% IF cash_register.branch_default %]
[% INCLUDE 'csrf-token.inc' %] +
- Drop default [% ELSE %]
[% INCLUDE 'csrf-token.inc' %] +
- Make default [% END %]
[% INCLUDE 'csrf-token.inc' %] +
- Archive - [% ELSE %]
[% INCLUDE 'csrf-token.inc' %] +
- Restore [% END %] + [% END %] @@ -277,29 +277,6 @@ filterDataTable( crtable, 2, opt ); }); - $("#drop_default_button").on("click", function(e){ - e.preventDefault(); - var id = $(this).data('id'); - $('#drop_default_'+id).submit(); - }); - - $(".make_default_button").on("click", function(e){ - e.preventDefault(); - var id = $(this).data('id'); - $('#make_default_'+id).submit(); - }); - - $(".archive_button").on("click", function(e){ - e.preventDefault(); - var id = $(this).data('id'); - $('#archive_'+id).submit(); - }); - - $(".unarchive_button").on("click", function(e){ - e.preventDefault(); - var id = $(this).data('id'); - $('#unarchive_'+id).submit(); - }); }); [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/credit_types.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/credit_types.tt index 6d378cf293..3415d0141a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/credit_types.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/credit_types.tt @@ -206,16 +206,16 @@ [% INCLUDE 'csrf-token.inc' %] + - Archive [% END %] [% IF !credit_type.is_system && credit_type.archived %]
[% INCLUDE 'csrf-token.inc' %] +
- Restore [% END %] @@ -275,17 +275,6 @@ //Start filtered $('#filter_system').click(); - $(".archive_button").on("click", function(e){ - e.preventDefault(); - var code = $(this).data('code'); - $('#archive_'+code).submit(); - }); - - $(".unarchive_button").on("click", function(e){ - e.preventDefault(); - var code = $(this).data('code'); - $('#unarchive_'+code).submit(); - }); }); [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt index e42ab70a51..df3737ed16 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt @@ -227,16 +227,16 @@ [% INCLUDE 'csrf-token.inc' %] + - Archive [% END %] [% ELSIF debit_type.archived %]
[% INCLUDE 'csrf-token.inc' %] +
- Restore [% END %] @@ -295,17 +295,6 @@ //Start filtered $('#filter_system').click(); - $(".archive_button").on("click", function(e){ - e.preventDefault(); - var code = $(this).data('code'); - $('#archive_'+code).submit(); - }); - - $(".unarchive_button").on("click", function(e){ - e.preventDefault(); - var code = $(this).data('code'); - $('#unarchive_'+code).submit(); - }); }); [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/restrictions.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/restrictions.tt index 0ed1afdc3f..b6de318752 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/restrictions.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/restrictions.tt @@ -229,8 +229,8 @@ [% INCLUDE 'csrf-token.inc' %] + - Make default [% END %] @@ -276,12 +276,6 @@ } }); - $(".make_default_button").on("click", function(e){ - e.preventDefault(); - var code = $(this).data('code'); - $('#make_default_'+code).submit(); - }); - [% Asset.js("js/restrictiontypes.js") | $raw %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt index cd6dc0dd9f..3ade4c3c1e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt @@ -506,7 +506,7 @@ a.add, a.delete {
- +
-- 2.39.5