Bugzilla – Attachment 135179 Details for
Bug 30725
BatchDeleteItem job param named wrongly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30725: Rename BatchDeleteItem job param from record_ids to item_ids
Bug-30725-Rename-BatchDeleteItem-job-param-from-re.patch (text/plain), 5.04 KB, created by
Fridolin Somers
on 2022-05-19 04:05:52 UTC
(
hide
)
Description:
Bug 30725: Rename BatchDeleteItem job param from record_ids to item_ids
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2022-05-19 04:05:52 UTC
Size:
5.04 KB
patch
obsolete
>From 2b4206eea03f69f5ef45bd572256870215771a77 Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Wed, 18 May 2022 18:04:09 -1000 >Subject: [PATCH] Bug 30725: Rename BatchDeleteItem job param from record_ids > to item_ids > >It is clearly a copy and paste error, but the parameter is called 'record_ids' when it should be 'item_ids'. > >Test plan : >Run prove t/db_dependent/Koha/BackgroundJobs/BatchDeleteItem.t >Perform a batch items deletion via staff interface >--- > Koha/BackgroundJob/BatchDeleteItem.pm | 20 +++++++++---------- > .../Koha/BackgroundJobs/BatchDeleteItem.t | 8 ++++---- > tools/batchMod.pl | 2 +- > 3 files changed, 15 insertions(+), 15 deletions(-) > >diff --git a/Koha/BackgroundJob/BatchDeleteItem.pm b/Koha/BackgroundJob/BatchDeleteItem.pm >index 57371289a9..4d902d2a6a 100644 >--- a/Koha/BackgroundJob/BatchDeleteItem.pm >+++ b/Koha/BackgroundJob/BatchDeleteItem.pm >@@ -49,7 +49,7 @@ sub job_type { > > Koha::BackgroundJobs->find($id)->process( > { >- record_ids => \@itemnumbers, >+ item_ids => \@itemnumbers, > deleted_biblios => 0|1, > } > ); >@@ -85,11 +85,11 @@ sub process { > $self->started_on(dt_from_string)->progress($job_progress) > ->status('started')->store; > >- my @record_ids = @{ $args->{record_ids} }; >+ my @item_ids = @{ $args->{item_ids} }; > my $delete_biblios = $args->{delete_biblios}; > > my $report = { >- total_records => scalar @record_ids, >+ total_records => scalar @item_ids, > total_success => 0, > }; > my @messages; >@@ -102,11 +102,11 @@ sub process { > $schema->txn_do( > sub { > my (@biblionumbers); >- for my $record_id ( sort { $a <=> $b } @record_ids ) { >+ for my $item_id ( sort { $a <=> $b } @item_ids ) { > > last if $self->get_from_storage->status eq 'cancelled'; > >- my $item = Koha::Items->find($record_id) || next; >+ my $item = Koha::Items->find($item_id) || next; > > my $return = $item->safe_delete({ skip_record_index => 1, skip_holds_queue => 1 }); > unless ( $return ) { >@@ -212,7 +212,7 @@ sub process { > > Koha::BackgroundJob::BatchDeleteItem->new->enqueue( > { >- record_ids => \@itemnumbers, >+ item_ids => \@itemnumbers, > deleted_biblios => 0|1, > } > ); >@@ -225,16 +225,16 @@ sub enqueue { > my ( $self, $args ) = @_; > > # TODO Raise exception instead >- return unless exists $args->{record_ids}; >+ return unless exists $args->{item_ids}; > >- my @record_ids = @{ $args->{record_ids} }; >+ my @item_ids = @{ $args->{item_ids} }; > my $delete_biblios = $args->{delete_biblios} || 0; > > $self->SUPER::enqueue( > { >- job_size => scalar @record_ids, >+ job_size => scalar @item_ids, > job_args => { >- record_ids => \@record_ids, >+ item_ids => \@item_ids, > delete_biblios => $delete_biblios, > }, > queue => 'long_tasks', >diff --git a/t/db_dependent/Koha/BackgroundJobs/BatchDeleteItem.t b/t/db_dependent/Koha/BackgroundJobs/BatchDeleteItem.t >index ee40088c8c..db087d6aa8 100755 >--- a/t/db_dependent/Koha/BackgroundJobs/BatchDeleteItem.t >+++ b/t/db_dependent/Koha/BackgroundJobs/BatchDeleteItem.t >@@ -57,7 +57,7 @@ subtest "process() tests" => sub { > borrowernumber => undef, > type => 'batch_item_record_deletion', > data => encode_json { >- record_ids => [ $item_1->id, $item_2->id ], >+ item_ids => [ $item_1->id, $item_2->id ], > delete_biblios => 1, > } > } >@@ -65,7 +65,7 @@ subtest "process() tests" => sub { > > $job->process( > { >- record_ids => [ $item_1->id, $item_2->id ], >+ item_ids => [ $item_1->id, $item_2->id ], > delete_biblios => 1, > } > ); >@@ -84,7 +84,7 @@ subtest "process() tests" => sub { > borrowernumber => undef, > type => 'batch_item_record_deletion', > data => encode_json { >- record_ids => [ $item->id ], >+ item_ids => [ $item->id ], > delete_biblios => 1, > } > } >@@ -92,7 +92,7 @@ subtest "process() tests" => sub { > > $job->process( > { >- record_ids => [ $item->id ], >+ item_ids => [ $item->id ], > delete_biblios => 1, > } > ); >diff --git a/tools/batchMod.pl b/tools/batchMod.pl >index e24db19104..34334e734a 100755 >--- a/tools/batchMod.pl >+++ b/tools/batchMod.pl >@@ -90,7 +90,7 @@ if ( $op eq "action" ) { > if ($del) { > try { > my $params = { >- record_ids => \@itemnumbers, >+ item_ids => \@itemnumbers, > delete_biblios => $del_records, > }; > my $job_id = >-- >2.35.3
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 30725
:
135179
|
135442