Bugzilla – Attachment 166791 Details for
Bug 36873
Koha::Objects->delete should accept parameters and pass them through
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36873: Make Koha::Objects->delete pass parameters to the underlying method
Bug-36873-Make-KohaObjects-delete-pass-parameters-.patch (text/plain), 1.69 KB, created by
Tomás Cohen Arazi (tcohen)
on 2024-05-15 19:19:21 UTC
(
hide
)
Description:
Bug 36873: Make Koha::Objects->delete pass parameters to the underlying method
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2024-05-15 19:19:21 UTC
Size:
1.69 KB
patch
obsolete
>From 766f3a26c611309d2019488e5fa2ecd46e37762d Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 15 May 2024 16:13:04 -0300 >Subject: [PATCH] Bug 36873: Make Koha::Objects->delete pass parameters to the > underlying method > >This patch makes the generic method pass any parameters it got passed to >the underlying `delete()` method. > >To test: >1. Apply the unit tests patch >2. Run: > $ ktd --shell > k$ prove t/db_dependent/Koha/Objects.t >=> FAIL: Tests fail, parameters are not passed >3. Apply this patch >4. Repeat 2 >=> SUCCESS: Tests pass! >5. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Objects.pm | 16 +++++++++------- > 1 file changed, 9 insertions(+), 7 deletions(-) > >diff --git a/Koha/Objects.pm b/Koha/Objects.pm >index a59e5d57125..3bd1e778863 100644 >--- a/Koha/Objects.pm >+++ b/Koha/Objects.pm >@@ -167,17 +167,19 @@ sub search_related { > =cut > > sub delete { >- my ($self) = @_; >+ my ( $self, $params ) = @_; > > if ( Class::Inspector->function_exists( $self->object_class, 'delete' ) ) { > my $objects_deleted; >- $self->_resultset->result_source->schema->txn_do( sub { >- $self->reset; # If we iterated already over the set >- while ( my $o = $self->next ) { >- $o->delete; >- $objects_deleted++; >+ $self->_resultset->result_source->schema->txn_do( >+ sub { >+ $self->reset; # If we iterated already over the set >+ while ( my $o = $self->next ) { >+ $o->delete($params); >+ $objects_deleted++; >+ } > } >- }); >+ ); > return $objects_deleted; > } > >-- >2.45.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 36873
:
166790
|
166791
|
166799
|
166800
|
168246
|
168247