Bugzilla – Attachment 135442 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.09 KB, created by
David Nind
on 2022-05-29 00:26:46 UTC
(
hide
)
Description:
Bug 30725: Rename BatchDeleteItem job param from record_ids to item_ids
Filename:
MIME Type:
Creator:
David Nind
Created:
2022-05-29 00:26:46 UTC
Size:
5.09 KB
patch
obsolete
>From 8283b3b33efa2f782cfee0e68e0b247ea4ae6272 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 > >Signed-off-by: David Nind <david@davidnind.com> >--- > 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.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 30725
:
135179
| 135442