From 000702e4cb54c7999da849077890a8175330433a Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Wed, 18 Dec 2024 17:34:16 +0000 Subject: [PATCH] Add some JS checks --- .../Com/ByWaterSolutions/ItemMessages.pm | 8 +- .../ItemMessages/tool-step2.tt | 80 ++++++++++++++++--- .../ItemMessages/tool-step3.tt | 5 +- 3 files changed, 76 insertions(+), 17 deletions(-) diff --git a/Koha/Plugin/Com/ByWaterSolutions/ItemMessages.pm b/Koha/Plugin/Com/ByWaterSolutions/ItemMessages.pm index ec309b2..c1bbc0c 100644 --- a/Koha/Plugin/Com/ByWaterSolutions/ItemMessages.pm +++ b/Koha/Plugin/Com/ByWaterSolutions/ItemMessages.pm @@ -127,7 +127,7 @@ sub tool { my ( $self, $args ) = @_; my $cgi = $self->{'cgi'}; - if ( $cgi->param('submitted2') || $cgi->param('submitted3') ) { + if ( $cgi->param('update') || $cgi->param('delete') ) { $self->tool_step3(); } elsif ( $cgi->param('submitted') ) { @@ -238,12 +238,12 @@ sub tool_step3 { my $template = $self->get_template({ file => 'tool-step3.tt' }); my @itemnumbers = $cgi->param('itemnumber'); - my $action = $cgi->param('submitted2'); + my $action = $cgi->param('action'); my $type = $cgi->param('type'); my $dbh = C4::Context->dbh; my @updated_items; - if ( $cgi->param('submitted2') ) { + if ( $action eq 'update' ) { my $new_message = $cgi->param('new_message'); unless ($type) { @@ -289,7 +289,7 @@ sub tool_step3 { $select_sth->finish; - } elsif ( $cgi->param('submitted3') ) { + } elsif ( $action eq 'delete' ) { unless (@itemnumbers) { warn "No itemnumbers provided!"; return; diff --git a/Koha/Plugin/Com/ByWaterSolutions/ItemMessages/tool-step2.tt b/Koha/Plugin/Com/ByWaterSolutions/ItemMessages/tool-step2.tt index 9b5ef5d..2d18ed9 100644 --- a/Koha/Plugin/Com/ByWaterSolutions/ItemMessages/tool-step2.tt +++ b/Koha/Plugin/Com/ByWaterSolutions/ItemMessages/tool-step2.tt @@ -38,6 +38,7 @@

Update item messages

+

Scanned items:

[% INCLUDE 'csrf-token.inc' %] @@ -52,7 +53,7 @@ [% FOREACH item IN scanned_items %] [% IF item.messages.size > 0 %] [% FOREACH message IN item.messages %] - + @@ -60,7 +61,7 @@ [% END %] [% ELSE %] - + @@ -75,7 +76,7 @@

Bulk update item messages by type:

- [% IF action == 'update_type' %] + [% IF action == 'update' %] [% ELSE %] @@ -64,6 +64,7 @@ [% END %]
[% item.title | html %] [% item.barcode | html %] [% message.message | html %]
[% item.title | html %] [% item.barcode | html %]
[% item.title | html %] [% item.barcode | html %][% item.message | html %]deleted
+ Return to tool