Bugzilla – Attachment 125631 Details for
Bug 23678
Cancel holds in bulk
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23678: Include file for batch_hold_cancel
Bug-23678-Include-file-for-batchholdcancel.patch (text/plain), 5.43 KB, created by
Jonathan Druart
on 2021-10-01 14:09:45 UTC
(
hide
)
Description:
Bug 23678: Include file for batch_hold_cancel
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-10-01 14:09:45 UTC
Size:
5.43 KB
patch
obsolete
>From 04f6fb363e1e3134bc43c7fdd59550f78c343721 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 1 Oct 2021 11:42:10 +0200 >Subject: [PATCH] Bug 23678: Include file for batch_hold_cancel > >Use additional_report to retrieve patron and biblio's info. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/BackgroundJob/BatchCancelHold.pm | 31 ++++++++---- > .../background_jobs/batch_hold_cancel.inc | 47 +++++++++++++++++++ > 2 files changed, 68 insertions(+), 10 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_hold_cancel.inc > >diff --git a/Koha/BackgroundJob/BatchCancelHold.pm b/Koha/BackgroundJob/BatchCancelHold.pm >index fb009483f67..cc9ec6ad3c5 100644 >--- a/Koha/BackgroundJob/BatchCancelHold.pm >+++ b/Koha/BackgroundJob/BatchCancelHold.pm >@@ -21,6 +21,8 @@ use JSON qw( encode_json decode_json ); > use Koha::BackgroundJobs; > use Koha::DateUtils qw( dt_from_string ); > use Koha::Holds; >+use Koha::Patrons; >+use Koha::Holds; > > use base 'Koha::BackgroundJob'; > >@@ -89,16 +91,11 @@ sub process { > type => 'error', > code => 'hold_not_cancelled', > patron_id => defined $patron ? $patron->borrowernumber : '', >- patron_name => defined $patron >- ? ( $patron->firstname ? $patron->firstname . ', ' : '' ) >- . $patron->surname >- : '', > biblio_id => defined $biblio ? $biblio->biblionumber : '', >- biblio_title => defined $biblio ? $biblio->title : '', > hold_id => $hold_id, > error => defined $hold > ? ( $@ ? $@ : 0 ) >- : 'No hold with id ' . $hold_id . ' found', >+ : 'hold_not_found', > }; > } > else { >@@ -107,11 +104,7 @@ sub process { > type => 'success', > code => 'hold_cancelled', > patron_id => $patron->borrowernumber, >- patron_name => >- ( $patron->firstname ? $patron->firstname . ', ' : '' ) >- . $patron->surname, > biblio_id => $biblio->biblionumber, >- biblio_title => $biblio->title, > hold_id => $hold_id, > }; > $report->{total_success}++; >@@ -151,4 +144,22 @@ sub enqueue { > ); > } > >+=head3 additional_report >+ >+Pass the biblio's title and patron's name >+ >+=cut >+ >+sub additional_report { >+ my ( $self, $args ) = @_; >+ >+ my $job = Koha::BackgroundJobs->find( $args->{job_id} ); >+ my $messages = $job->messages; >+ for my $m ( @$messages ) { >+ $m->{patron} = Koha::Patrons->find($m->{patron_id}); >+ $m->{biblio} = Koha::Biblios->find($m->{biblio_id}); >+ } >+ return { report_messages => $messages }; >+} >+ > 1; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_hold_cancel.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_hold_cancel.inc >new file mode 100644 >index 00000000000..655ca32c150 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_hold_cancel.inc >@@ -0,0 +1,47 @@ >+[% BLOCK report %] >+ [% SET report = job.report %] >+ [% IF report %] >+ [% IF report.total_holds == report.total_success %] >+ <div class="dialog message"> >+ All holds have successfully been cancelled! >+ </div> >+ [% ELSE %] >+ <div class="dialog message"> >+ [% report.total_success | html %] / [% report.total_holds | html %] holds have successfully been modified. Some errors occurred. >+ [% IF job.status == 'cancelled' %]The job has been cancelled before it finished.[% END %] >+ </div> >+ [% END %] >+ [% END %] >+ >+[% END %] >+ >+[% BLOCK detail %] >+ [% FOR m IN report_messages %] >+ <div class="dialog message"> >+ [% IF m.type == 'success' %] >+ <i class="fa fa-check success"></i> >+ [% ELSIF m.type == 'warning' %] >+ <i class="fa fa-warning warn"></i> >+ [% ELSIF m.type == 'error' %] >+ <i class="fa fa-exclamation error"></i> >+ [% END %] >+ [% SWITCH m.code %] >+ [% CASE 'hold_not_cancelled' %] >+ [% IF m.biblio && m.patron %] >+ Hold on <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% m.biblio.biblionumber | uri %]">[% m.biblio.title | html %]</a> for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% m.patron.borrowernumber | uri %]">[% INCLUDE 'patron-title.inc' patron=m.patron %]</a> has not been cancelled. >+ [% END %] >+ An error occurred on cancelling. >+ [% SWITCH m.error %] >+ [% CASE 'hold_not_found' %] >+ No hold with id [% m.hold_id | html %] found. >+ [% CASE %]Unknown error '[% m.error | html %]'. >+ [% END %] >+ [% CASE 'hold_cancelled' %] >+ Hold on <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% m.biblio_id | uri %]">[% m.biblio.title | html %]</a> for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% m.patron_id | uri %]">[% INCLUDE 'patron-title.inc' patron=m.patron %]</a> has successfully been cancelled. >+ [% END %] >+ </div> >+ [% END %] >+[% END %] >+ >+[% BLOCK js %] >+[% END %] >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23678
:
118338
|
118553
|
120265
|
123185
|
123186
|
123187
|
125404
|
125405
|
125406
|
125470
|
125577
|
125578
|
125579
|
125589
|
125590
|
125600
|
125627
|
125628
|
125629
| 125631