Bugzilla – Attachment 173257 Details for
Bug 37115
Add the option to delete linked serials when deleting items
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37115: Batch delete linked serials
Bug-37115-Batch-delete-linked-serials.patch (text/plain), 6.92 KB, created by
Boubacar OUATTARA
on 2024-10-24 09:23:43 UTC
(
hide
)
Description:
Bug 37115: Batch delete linked serials
Filename:
MIME Type:
Creator:
Boubacar OUATTARA
Created:
2024-10-24 09:23:43 UTC
Size:
6.92 KB
patch
obsolete
>From 17e94ae87b898d947094ebb407ff6515dbf77697 Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> >Date: Thu, 4 Jul 2024 10:21:03 +0000 >Subject: [PATCH] Bug 37115: Batch delete linked serials > >Test plan: >- Add a new subscription to a serial record (with the option 'create an item record' selected) >- Receive several issues and create the linked items >- Return to the bibliographic record >- Select several items >- Click to 'Delete selected items' >- Tick the box 'delete serial issues linked to items' and confirm >- The items should be deleted correctly >- Back to subscription : the issues linked to items should no longer exist > >Signed-off-by: Boubacar OUATTARA <boubacar.ouattara@biblibre.com> >--- > Koha/BackgroundJob/BatchDeleteItem.pm | 17 ++++++----- > .../prog/en/modules/tools/batchMod-del.tt | 19 +++++++++---- > tools/batchMod.pl | 28 ++++++++++--------- > 3 files changed, 39 insertions(+), 25 deletions(-) > >diff --git a/Koha/BackgroundJob/BatchDeleteItem.pm b/Koha/BackgroundJob/BatchDeleteItem.pm >index 474450e57b..eacb33589a 100644 >--- a/Koha/BackgroundJob/BatchDeleteItem.pm >+++ b/Koha/BackgroundJob/BatchDeleteItem.pm >@@ -81,8 +81,9 @@ sub process { > > $self->start; > >- my @record_ids = @{ $args->{record_ids} }; >- my $delete_biblios = $args->{delete_biblios}; >+ my @record_ids = @{ $args->{record_ids} }; >+ my $delete_biblios = $args->{delete_biblios}; >+ my $delete_serial_issues = $args->{delete_serial_issues}; > > my $report = { > total_records => scalar @record_ids, >@@ -104,7 +105,7 @@ sub process { > > my $item = Koha::Items->find($record_id) || next; > >- my $return = $item->safe_delete({ skip_record_index => 1, skip_holds_queue => 1 }); >+ my $return = $item->safe_delete({ skip_record_index => 1, skip_holds_queue => 1, delete_serial_issues => $delete_serial_issues }); > unless ( $return ) { > > # FIXME Do we need to rollback the whole transaction if a deletion failed? >@@ -221,15 +222,17 @@ sub enqueue { > # TODO Raise exception instead > return unless exists $args->{record_ids}; > >- my @record_ids = @{ $args->{record_ids} }; >- my $delete_biblios = $args->{delete_biblios} || 0; >+ my @record_ids = @{ $args->{record_ids} }; >+ my $delete_biblios = $args->{delete_biblios} || 0; >+ my $delete_serial_issues = $args->{delete_serial_issues} || 0; > > $self->SUPER::enqueue( > { > job_size => scalar @record_ids, > job_args => { >- record_ids => \@record_ids, >- delete_biblios => $delete_biblios, >+ record_ids => \@record_ids, >+ delete_biblios => $delete_biblios, >+ delete_serial_issues => $delete_serial_issues, > }, > job_queue => 'long_tasks', > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt >index a6cdfa08a4..cc51abfe8d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt >@@ -167,12 +167,21 @@ > > [% IF ( itemresults ) %] > <div id="cataloguing_additem_newitem" class="item_edit_form"> >- <input type="hidden" name="op" value="[% op | html %]" /> >- <p>This will delete [% IF ( too_many_items_display ) %]all the[% ELSE %]the selected[% END %] items.</p> >- <input type="hidden" name="del" value="1" /> >- <input type="checkbox" name="del_records" id="del_records" /> <label for="del_records">Delete records if no items remain.</label> >+ <input type="hidden" name="op" value="[% op | html %]" /> >+ <p>This will delete [% IF ( too_many_items_display ) %]all the[% ELSE %]the selected[% END %] items.</p> >+ <input type="hidden" name="del" value="1" /> >+ <div style="display: flex; flex-direction: column; gap: 5px;"> >+ <div> >+ <input type="checkbox" name="del_records" id="del_records" /> >+ <label for="del_records">Delete records if no items remain.</label> >+ </div> >+ <div> >+ <input type="checkbox" name="del_serial_issues" id="del_serial_issues" /> >+ <label for="del_serial_issues">Delete serial issues linked to items.</label> >+ </div> >+ </div> > >- <fieldset class="action"> >+ <fieldset class="action"> > [% IF too_many_items_display %] > <input type="submit" name="mainformsubmit" class="btn btn-primary" value="Delete ALL submitted items" /> > [% ELSE %] >diff --git a/tools/batchMod.pl b/tools/batchMod.pl >index 1b43231857..e6dc6ded99 100755 >--- a/tools/batchMod.pl >+++ b/tools/batchMod.pl >@@ -41,18 +41,19 @@ use Koha::BackgroundJob::BatchUpdateItem; > use Koha::UI::Form::Builder::Item; > use Koha::UI::Table::Builder::Items; > >-my $input = CGI->new; >-my $dbh = C4::Context->dbh; >-my $error = $input->param('error'); >-my @itemnumbers = $input->multi_param('itemnumber'); >-my $biblionumber = $input->param('biblionumber'); >-my $op = $input->param('op'); >-my $del = $input->param('del'); >-my $del_records = $input->param('del_records'); >-my $src = $input->param('src'); >-my $use_default_values = $input->param('use_default_values'); >+my $input = CGI->new; >+my $dbh = C4::Context->dbh; >+my $error = $input->param('error'); >+my @itemnumbers = $input->multi_param('itemnumber'); >+my $biblionumber = $input->param('biblionumber'); >+my $op = $input->param('op'); >+my $del = $input->param('del'); >+my $del_records = $input->param('del_records'); >+my $del_serial_issues = $input->param('del_serial_issues'); >+my $src = $input->param('src'); >+my $use_default_values = $input->param('use_default_values'); > my $exclude_from_local_holds_priority = $input->param('exclude_from_local_holds_priority'); >-my $mark_items_returned = $input->param('mark_items_returned'); >+my $mark_items_returned = $input->param('mark_items_returned'); > > my $template_name; > my $template_flag; >@@ -91,8 +92,9 @@ if ( $op eq "cud-action" ) { > if ($del) { > try { > my $params = { >- record_ids => \@itemnumbers, >- delete_biblios => $del_records, >+ record_ids => \@itemnumbers, >+ delete_biblios => $del_records, >+ delete_serial_issues => $del_serial_issues, > }; > my $job_id = > Koha::BackgroundJob::BatchDeleteItem->new->enqueue($params); >-- >2.39.5
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 37115
:
167847
|
167848
|
168133
|
168134
|
168373
|
168374
|
168495
|
168496
|
168497
|
171208
|
171209
|
171210
|
171938
|
171939
|
171940
|
173256
| 173257 |
173258