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 <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
e2c3348ec8
commit
aa3dfa3922
3 changed files with 14 additions and 18 deletions
|
@ -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,
|
||||
);
|
||||
|
||||
|
|
|
@ -50,9 +50,9 @@
|
|||
|
||||
[% IF ( selected_count ) %]
|
||||
<div class="dialog message">
|
||||
[% IF ( action == 'seen' ) %]
|
||||
[% IF ( op == 'cud-seen' ) %]
|
||||
<span>[% selected_count | html %] note(s) marked as seen.</span>
|
||||
[% ELSIF ( action == 'notseen' ) %]
|
||||
[% ELSIF ( op == 'cud-notseen' ) %]
|
||||
<span>[% selected_count | html %] note(s) marked as not seen.</span>
|
||||
[% ELSE %]
|
||||
<span>Failed to change the status of [% selected_count | html %] item(s).</span>
|
||||
|
@ -64,8 +64,8 @@
|
|||
<form id="mark_selected" method="post" action="/cgi-bin/koha/circ/checkout-notes.pl">
|
||||
[% INCLUDE 'csrf-token.inc' %]
|
||||
<div id="toolbar" class="btn-toolbar">
|
||||
<button type="submit" class="btn btn-default markseen" name="mark_selected-seen" value="seen" disabled="disabled"><i class="fa-solid fa-eye"></i> Mark seen</button>
|
||||
<button type="submit" class="btn btn-default markseen" name="mark_selected-notseen" value="notseen" disabled="disabled"><i class="fa-solid fa-eye-slash"></i> Mark not seen</button>
|
||||
<button type="submit" class="btn btn-default markseen" name="op" value="cud-seen" disabled="disabled"><i class="fa-solid fa-eye"></i> Mark seen</button>
|
||||
<button type="submit" class="btn btn-default markseen" name="op" value="cud-notseen" disabled="disabled"><i class="fa-solid fa-eye-slash"></i> Mark not seen</button>
|
||||
</div>
|
||||
|
||||
<div class="btn-toolbar selections-toolbar">
|
||||
|
@ -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);
|
||||
|
|
|
@ -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';
|
||||
|
|
Loading…
Reference in a new issue