Bugzilla – Attachment 134340 Details for
Bug 29346
Real-time holds queue update
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29346: Add better reporting
Bug-29346-Add-better-reporting.patch (text/plain), 5.24 KB, created by
Nick Clemens (kidclamp)
on 2022-04-29 01:03:35 UTC
(
hide
)
Description:
Bug 29346: Add better reporting
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2022-04-29 01:03:35 UTC
Size:
5.24 KB
patch
obsolete
>From 6d2d2c61080457a02114bf746382b323f0a7d497 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 28 Apr 2022 10:57:04 -0300 >Subject: [PATCH] Bug 29346: Add better reporting > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > .../BatchUpdateBiblioHoldsQueue.pm | 23 ++++------- > .../update_holds_queue_for_biblios.inc | 41 +++++++++++++++++++ > .../prog/en/modules/admin/background_jobs.tt | 2 + > 3 files changed, 52 insertions(+), 14 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/update_holds_queue_for_biblios.inc > >diff --git a/Koha/BackgroundJob/BatchUpdateBiblioHoldsQueue.pm b/Koha/BackgroundJob/BatchUpdateBiblioHoldsQueue.pm >index 852ff065ac..c85de205ff 100644 >--- a/Koha/BackgroundJob/BatchUpdateBiblioHoldsQueue.pm >+++ b/Koha/BackgroundJob/BatchUpdateBiblioHoldsQueue.pm >@@ -20,6 +20,7 @@ use Modern::Perl; > use JSON qw( encode_json decode_json ); > use Try::Tiny; > >+use Koha::Biblios; > use Koha::Exceptions; > > use C4::HoldsQueue >@@ -59,12 +60,10 @@ sub process { > > my $schema = Koha::Database->new->schema; > >- my $job_progress = 0; >- > $self->set( > { > started_on => \'NOW()', >- progress => $job_progress, >+ progress => 0, > status => 'started', > } > )->store; >@@ -100,26 +99,25 @@ sub process { > type => 'success', > code => 'holds_queue_updated', > biblio_id => $biblio_id, >- available_items => $result->{available_items}, >- mapped_items => $result->{mapped_items}, >- requests => $result->{requests}, > }; > $report->{total_success}++; > > $schema->storage->txn_commit; > } > catch { >- push @messages, { >+ >+ push @messages, >+ { > type => 'error', > code => 'holds_queue_update_error', > biblio_id => $biblio_id, > error => "$_", >- }; >+ }; > > $schema->storage->txn_rollback; > }; > >- $self->progress( $job_progress++ )->store; >+ $self->progress( $self->progress + 1 )->store; > } > > my $job_data = decode_json $self->data; >@@ -130,12 +128,9 @@ sub process { > { > ended_on => \'NOW()', > data => encode_json $job_data, >+ status => 'finished', > } >- ); >- $self->status('finished') >- unless $self->status ne 'cancelled'; >- >- $self->store; >+ )->store; > } > > =head3 enqueue >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/update_holds_queue_for_biblios.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/update_holds_queue_for_biblios.inc >new file mode 100644 >index 0000000000..2928785ffb >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/update_holds_queue_for_biblios.inc >@@ -0,0 +1,41 @@ >+[% USE KohaSpan %] >+[% BLOCK report %] >+ [% SET report = job.report %] >+ [% IF report %] >+ [% IF report.total_biblios == report.total_success %] >+ <div class="dialog message"> >+ Holds queue successfully updated. >+ </div> >+ [% ELSE %] >+ <div class="dialog message"> >+ <span>Holds queue for [% report.total_success | html %] / [% report.total_biblios | html %] has been successfully updated. Some errors occurred.</span> >+ [% IF job.status == 'cancelled' %]<span>The job has been cancelled before it finished.</span>[% 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 'holds_queue_update_error' %] >+ [% IF m.biblio_id %] >+ <span>Holds queue for biblio <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% m.biblio_id | uri %]">[% m.biblio.title | html %]</a>.</span> >+ [% END %] >+ <span>An error occurred ([% m.error | html %])</span> >+ [% END %] >+ </div> >+ [% END %] >+[% END %] >+ >+[% BLOCK js %] >+[% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt >index f516c39506..7ed943f3f0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt >@@ -37,6 +37,8 @@ > <span>Batch item record deletion</span> > [% CASE "batch_hold_cancel" %] > <span>Batch hold cancellation</span> >+ [% CASE 'update_holds_queue_for_biblios' %] >+ <span>Holds queue update</span> > [% CASE %]<span>Unknown job type '[% job_type | html %]'</span> > [% END %] > >-- >2.30.2
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 29346
:
131088
|
131089
|
131811
|
131812
|
131813
|
131815
|
132078
|
132079
|
132080
|
132081
|
132082
|
132083
|
133183
|
133184
|
133185
|
133186
|
133187
|
133188
|
133189
|
133190
|
133191
|
133205
|
133991
|
133992
|
133993
|
133994
|
133995
|
133996
|
133997
|
133998
|
133999
|
134000
|
134001
|
134010
|
134225
|
134227
|
134309
|
134310
|
134311
|
134312
|
134313
|
134314
|
134315
|
134316
|
134317
|
134318
|
134319
|
134320
|
134321
|
134322
|
134328
|
134329
|
134330
|
134331
|
134332
|
134333
|
134334
|
134335
|
134336
|
134337
|
134338
|
134339
| 134340 |
134341
|
134342
|
134343