Bugzilla – Attachment 123990 Details for
Bug 26080
Use the task queue for the batch delete records tool
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26080: Some refactoring
Bug-26080-Some-refactoring.patch (text/plain), 20.47 KB, created by
Fridolin Somers
on 2021-08-20 07:09:14 UTC
(
hide
)
Description:
Bug 26080: Some refactoring
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2021-08-20 07:09:14 UTC
Size:
20.47 KB
patch
obsolete
>From 354c71110782e22da7265e89b1305c9d598b78af Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 29 Jul 2020 12:12:59 +0200 >Subject: [PATCH] Bug 26080: Some refactoring > >A new include file is created per background job to avoid >background_jobs.tt to grow too much > >Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> >--- > .../batch_authority_record_modification.inc | 39 +++++ > .../batch_biblio_record_deletion.inc | 49 ++++++ > .../batch_biblio_record_modification.inc | 64 ++++++++ > .../prog/en/modules/admin/background_jobs.tt | 148 +----------------- > 4 files changed, 159 insertions(+), 141 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_authority_record_modification.inc > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_biblio_record_deletion.inc > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_biblio_record_modification.inc > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_authority_record_modification.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_authority_record_modification.inc >new file mode 100644 >index 0000000000..47bfc08a0a >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_authority_record_modification.inc >@@ -0,0 +1,39 @@ >+[% BLOCK report %] >+ [% SET report = job.report %] >+ [% IF report %] >+ [% IF report.total_records == report.total_success %] >+ <div class="dialog message"> >+ All records have successfully been modified! <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a> >+ </div> >+ [% ELSE %] >+ <div class="dialog message"> >+ [% report.total_success | html %] / [% report.total_records | html %] records have successfully been modified. Some errors occurred. >+ [% IF job.status == 'cancelled' %]The job has been cancelled before it finished.[% END %] >+ <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a> >+ </div> >+ [% END %] >+ [% END %] >+[% END %] >+ >+[% BLOCK detail %] >+ [% FOR m IN job.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 'authority_not_modified' %] >+ Authority record <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% m.authid | uri %]">[% m.authid | html %]</a> has not been modified. An error occurred on modifying it[% IF m.error %] ([% m.error %])[% END %]. >+ [% CASE 'authority_modified' %] >+ Authority record <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% m.authid | uri %]">[% m.authid | html %]</a> has successfully been modified.. >+ [% END %] >+ </div> >+ [% END %] >+[% END %] >+ >+[% BLOCK js %] >+[% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_biblio_record_deletion.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_biblio_record_deletion.inc >new file mode 100644 >index 0000000000..83f81cb538 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_biblio_record_deletion.inc >@@ -0,0 +1,49 @@ >+[% BLOCK report %] >+ [% SET report = job.report %] >+ [% IF report %] >+ [% IF report.total_records == report.total_success %] >+ <div class="dialog message"> >+ All records have been deleted successfully! >+ </div> >+ [% ELSIF report.total_success == 0 %] >+ <div class="dialog message"> >+ No record has been deleted. An error occurred. >+ </div> >+ [% ELSE %] >+ <div class="dialog message"> >+ [% report.total_success | html %] / [% report.total_records | html %] records have been deleted successfully but some errors occurred. >+ </div> >+ [% END %] >+ [% END %] >+[% END %] >+ >+[% BLOCK detail %] >+ [% FOR m IN job.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 'biblio_not_exists' %] >+ The biblionumber [% m.biblionumber | html %] does not exist in the database. >+ [% CASE 'item_issued' %] >+ At least one item is checked out on bibliographic record [% m.biblionumber | html %]. >+ [% CASE 'reserve_not_cancelled' %] >+ Bibliographic record [% m.biblionumber | html %] was not deleted. A hold could not be canceled (reserve_id [% m.reserve_id | html %]). >+ [% CASE 'item_not_deleted' %] >+ The bibliographic record [% m.biblionumber | html %] was not deleted. An error was encountered when deleting an item (itemnumber [% m.itemnumber | html %]). >+ [% CASE 'biblio_not_deleted' %] >+ Bibliographic record [% m.biblionumber | html %] was not deleted. An error occurred. >+ [% CASE 'biblio_deleted' %] >+ Bibliographic record [% m.biblionumber | html %] has been deleted successfully. >+ [% END %] >+ </div> >+ [% END %] >+[% END %] >+ >+[% BLOCK js %] >+[% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_biblio_record_modification.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_biblio_record_modification.inc >new file mode 100644 >index 0000000000..51a447e3b2 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_biblio_record_modification.inc >@@ -0,0 +1,64 @@ >+[% BLOCK report %] >+ [% SET report = job.report %] >+ [% IF report %] >+ [% IF report.total_records == report.total_success %] >+ <div class="dialog message"> >+ All records have successfully been modified! <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a> >+ [% IF lists.count %] >+ <br /> >+ Add modified records to the following list: >+ <select name="add_bibs_to_list" id="add_bibs_to_list"> >+ <option value="">Select a list</option> >+ [% FOREACH list IN lists %] >+ <option class="shelf" value="[% list.shelfnumber | html %]">[% list.shelfname | html %]</option> >+ [% END %] >+ </select> >+ [% END %] >+ </div> >+ [% ELSE %] >+ <div class="dialog message"> >+ [% report.total_success | html %] / [% report.total_records | html %] records have successfully been modified. Some errors occurred. >+ [% IF job.status == 'cancelled' %]The job has been cancelled before it finished.[% END %] >+ <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a> >+ </div> >+ [% END %] >+ [% END %] >+[% END %] >+ >+[% BLOCK detail %] >+ [% FOR m IN job.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 'biblio_not_modified' %] >+ Bibliographic record <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% m.biblionumber | uri %]">[% m.biblionumber | html %]</a> has not been modified. An error occurred on modifying it.[% IF m.error %] ([% m.error | html %])[% END %]. >+ [% CASE 'biblio_modified' %] >+ Bibliographic record <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% m.biblionumber | uri %]">[% m.biblionumber | html %]</a> has successfully been modified. >+ [% END %] >+ </div> >+ [% END %] >+[% END %] >+ >+[% BLOCK js %] >+ $("#add_bibs_to_list").change(function(){ >+ var selected = $("#add_bibs_to_list").find("option:selected"); >+ if ( selected.attr("class") == "shelf" ){ >+ var shelfnumber = selected.attr("value"); >+ var bibs = new Array(); >+ [% FOREACH message IN job.messages %] >+ [% IF message.code == 'biblio_modified' %] >+ bibs.push("biblionumber="+[% message.biblionumber | html %]); >+ [% END %] >+ [% END %] >+ var bibstring = bibs.join("&"); >+ window.open('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?shelfnumber='+shelfnumber+'&confirm=1&'+bibstring, 'popup', 'width=500,height=500,toolbar=false,scrollbars=yes,resizeable=yes'); >+ return false; >+ } >+ }); >+[% 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 b667a51acb..50cd37d740 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 >@@ -57,6 +57,8 @@ Administration › Koha > [% IF op == 'view' %] > <h1>Detail of job #[% job.id | html %]</h1> > >+ [% PROCESS "background_jobs/${job.type}.inc" %] >+ > <fieldset class="rows"> > <ol> > <li><span class="label">Job ID: </span>[% job.id | html %]</li> >@@ -67,134 +69,10 @@ Administration › Koha > <li><label for="job_started_on">Started: </label>[% job.started_on | html %]</li> > <li><label for="job_ended_on">Ended: </label>[% job.ended_on | html %]</li> > <li><label for="job_data">Report: </label> >- [% SWITCH job.type %] >- [% CASE 'batch_biblio_record_modification' %] >- [% SET report = job.report %] >- [% IF report %] >- [% IF report.total_records == report.total_success %] >- <div class="dialog message"> >- All records have successfully been modified! <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a> >- [% IF lists.count %] >- <br /> >- Add modified records to the following list: >- <select name="add_bibs_to_list" id="add_bibs_to_list"> >- <option value="">Select a list</option> >- [% FOREACH list IN lists %] >- <option class="shelf" value="[% list.shelfnumber | html %]">[% list.shelfname | html %]</option> >- [% END %] >- </select> >- [% END %] >- </div> >- [% ELSE %] >- <div class="dialog message"> >- [% report.total_success | html %] / [% report.total_records | html %] records have successfully been modified. Some errors occurred. >- [% IF job.status == 'cancelled' %]The job has been cancelled before it finished.[% END %] >- <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a> >- </div> >- [% END %] >- [% END %] >- [% CASE 'batch_authority_record_modification' %] >- [% SET report = job.report %] >- [% IF report %] >- [% IF report.total_records == report.total_success %] >- <div class="dialog message"> >- All records have successfully been modified! <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a> >- </div> >- [% ELSE %] >- <div class="dialog message"> >- [% report.total_success | html %] / [% report.total_records | html %] records have successfully been modified. Some errors occurred. >- [% IF job.status == 'cancelled' %]The job has been cancelled before it finished.[% END %] >- <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a> >- </div> >- [% END %] >- [% END %] >- [% CASE 'batch_biblio_record_deletion' %] >- [% SET report = job.report %] >- [% IF report %] >- [% IF report.total_records == report.total_success %] >- <div class="dialog message"> >- All records have been deleted successfully! >- </div> >- [% ELSIF report.total_success == 0 %] >- <div class="dialog message"> >- No record has been deleted. An error occurred. >- </div> >- [% ELSE %] >- <div class="dialog message"> >- [% report.total_success | html %] / [% report.total_records | html %] records have been deleted successfully but some errors occurred. >- </div> >- [% END %] >- [% END %] >- [% CASE %]Job type "[% job.type | html %]" not handled in the template >- [% END %] >+ [% PROCESS 'report' %] > </li> > <li><label for="job_data">Detailed messages: </label> >- [% SWITCH job.type %] >- [% CASE 'batch_biblio_record_modification' %] >- [% FOR m IN job.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 'biblio_not_modified' %] >- Bibliographic record <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% m.biblionumber | uri %]">[% m.biblionumber | html %]</a> has not been modified. An error occurred on modifying it.[% IF m.error %] ([% m.error | html %])[% END %]. >- [% CASE 'biblio_modified' %] >- Bibliographic record <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% m.biblionumber | uri %]">[% m.biblionumber | html %]</a> has successfully been modified. >- [% END %] >- </div> >- [% END %] >- [% CASE 'batch_authority_record_modification' %] >- [% FOR m IN job.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 'authority_not_modified' %] >- Authority record <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% m.authid | uri %]">[% m.authid | html %]</a> has not been modified. An error occurred on modifying it[% IF m.error %] ([% m.error | html %])[% END %]. >- [% CASE 'authority_modified' %] >- Authority record <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% m.authid | uri %]">[% m.authid | html %]</a> has successfully been modified. >- [% END %] >- </div> >- [% END %] >- [% CASE 'batch_biblio_record_deletion' %] >- [% FOR m IN job.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 'biblio_not_exists' %] >- The biblionumber [% m.biblionumber | html %] does not exist in the database. >- [% CASE 'item_issued' %] >- At least one item is checked out on bibliographic record [% m.biblionumber | html %]. >- [% CASE 'reserve_not_cancelled' %] >- Bibliographic record [% m.biblionumber | html %] was not deleted. A hold could not be canceled (reserve_id [% m.reserve_id | html %]). >- [% CASE 'item_not_deleted' %] >- The bibliographic record [% m.biblionumber | html %] was not deleted. An error was encountered when deleting an item (itemnumber [% m.itemnumber | html %]). >- [% CASE 'biblio_not_deleted' %] >- Bibliographic record [% m.biblionumber | html %] was not deleted. An error occurred. >- [% CASE 'biblio_deleted' %] >- Bibliographic record [% m.biblionumber | html %] has been deleted successfully. >- [% END %] >- </div> >- [% END %] >- >- [% CASE %]Job type "[% job.type | html %]" not handled in the template >- [% END %] >+ [% PROCESS 'detail' %] > </li> > </ol> > </fieldset> >@@ -280,21 +158,9 @@ Administration › Koha > "sPaginationType": "full_numbers" > })); > >- $("#add_bibs_to_list").change(function(){ >- var selected = $("#add_bibs_to_list").find("option:selected"); >- if ( selected.attr("class") == "shelf" ){ >- var shelfnumber = selected.attr("value"); >- var bibs = new Array(); >- [% FOREACH message IN job.messages %] >- [% IF message.code == 'biblio_modified' %] >- bibs.push("biblionumber="+[% message.biblionumber | html %]); >- [% END %] >- [% END %] >- var bibstring = bibs.join("&"); >- window.open('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?shelfnumber='+shelfnumber+'&confirm=1&'+bibstring, 'popup', 'width=500,height=500,toolbar=false,scrollbars=yes,resizable=yes'); >- return false; >- } >- }); >+ [% IF op == 'view' %] >+ [% PROCESS 'js' %] >+ [% END %] > }); > </script> > [% END %] >-- >2.32.0
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 26080
:
107483
|
107484
|
107485
|
122347
|
122348
|
122349
|
123214
|
123215
|
123216
|
123989
|
123990
|
123991
|
124408
|
124409
|
124410
|
124411
|
124412