From aa3dfa3922e93eb1a6f6d2c8948955037f08069f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 26 Jan 2024 11:33:02 +0100 Subject: [PATCH] Bug 34478: Rename action with op - circ/checkout-notes svc/checkout_notes will need to be adjusted as well Bug 34478: [TO SQUASH] Rename action with op - circ/checkout-notes Signed-off-by: Jonathan Druart --- circ/checkout-notes.pl | 12 ++++-------- .../prog/en/modules/circ/checkout-notes.tt | 14 +++++++------- svc/checkout_notes | 6 +++--- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/circ/checkout-notes.pl b/circ/checkout-notes.pl index 9f5e1c7bdf..0d3a80f4c0 100755 --- a/circ/checkout-notes.pl +++ b/circ/checkout-notes.pl @@ -36,20 +36,16 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); -my $action; -foreach (qw( seen notseen )) { - $action = $_ if ( $query->param("mark_selected-$_") ); -} -$action ||= 'none'; +my $op = $query->param("op") || 'none'; my @issue_ids = $query->multi_param('issue_ids'); -if ( $action eq 'seen' ) { +if ( $op eq 'cud-seen' ) { foreach my $issue_id ( @issue_ids ) { my $issue = Koha::Checkouts->find($issue_id); $issue->set({ noteseen => 1 })->store; } -} elsif ( $action eq 'notseen' ) { +} elsif ( $op eq 'cud-notseen' ) { foreach my $issue_id ( @issue_ids ) { my $issue = Koha::Checkouts->find($issue_id); $issue->set({ noteseen => 0 })->store; @@ -59,7 +55,7 @@ if ( $action eq 'seen' ) { my $notes = Koha::Checkouts->search({ 'me.note' => { '!=', undef } }, { prefetch => [ 'patron', { item => 'biblionumber' } ] }); $template->param( selected_count => scalar(@issue_ids), - action => $action, + op => $op, notes => $notes, ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/checkout-notes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/checkout-notes.tt index 8003a17ee6..86f486f2ae 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/checkout-notes.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/checkout-notes.tt @@ -50,9 +50,9 @@ [% IF ( selected_count ) %]
- [% IF ( action == 'seen' ) %] + [% IF ( op == 'cud-seen' ) %] [% selected_count | html %] note(s) marked as seen. - [% ELSIF ( action == 'notseen' ) %] + [% ELSIF ( op == 'cud-notseen' ) %] [% selected_count | html %] note(s) marked as not seen. [% ELSE %] Failed to change the status of [% selected_count | html %] item(s). @@ -64,8 +64,8 @@
[% INCLUDE 'csrf-token.inc' %]
- - + +
@@ -181,10 +181,10 @@ $("#notestable").on("click", "button.seen, button.notseen", function(event){ event.preventDefault(); // prevent form submission - var $action = $(this).attr("name"); + var $op = $(this).attr("name"); var $issue_id = $(this).data('issue_id'); var ajaxData = { - 'action': $action, + 'op': $op, 'issue_id': $issue_id, }; @@ -197,7 +197,7 @@ .done(function(data){ if (data.status == 'success'){ - if ( $action == 'notseen' ){ + if ( $op == 'notseen' ){ $("#status_" + $issue_id).text(_("Not seen")); $(event.target).parent().siblings(".seen1").removeClass("seen1").addClass("seen0"); $(event.target).siblings(".seen").prop("disabled", false); diff --git a/svc/checkout_notes b/svc/checkout_notes index c9443dba10..6b656d7db4 100755 --- a/svc/checkout_notes +++ b/svc/checkout_notes @@ -44,14 +44,14 @@ if ( $auth_status ne "ok" ) { if ($is_ajax) { my $issue_id = $query->param('issue_id'); my $issue = Koha::Checkouts->find($issue_id); - my $action = $query->param('action'); + my $op = $query->param('op'); my $status = 'success'; - if ($action eq 'seen'){ + if ($op eq 'seen'){ $issue->set({ noteseen => 1 })->store; if ( $issue->noteseen != 1 ) { $status = 'failure'; } - } elsif ($action eq 'notseen'){ + } elsif ($op eq 'notseen'){ $issue->set({ noteseen => 0 })->store; if ( $issue->noteseen != 0 ) { $status = 'failure'; -- 2.39.5