Bugzilla – Attachment 80624 Details for
Bug 21337
Add Koha::Patrons->delete
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21337: Koha::Objects->delete must return the number of deleted rows
Bug-21337-KohaObjects-delete-must-return-the-numbe.patch (text/plain), 1.81 KB, created by
Jonathan Druart
on 2018-10-15 17:38:50 UTC
(
hide
)
Description:
Bug 21337: Koha::Objects->delete must return the number of deleted rows
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-10-15 17:38:50 UTC
Size:
1.81 KB
patch
obsolete
>From f787131569314b069eadfc004d306964e047e972 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 15 Oct 2018 14:38:14 -0300 >Subject: [PATCH] Bug 21337: Koha::Objects->delete must return the number of > deleted rows > >To follow DBIC behaviour > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > Koha/Patrons.pm | 4 +++- > t/db_dependent/Koha/Patrons.t | 2 +- > 2 files changed, 4 insertions(+), 2 deletions(-) > >diff --git a/Koha/Patrons.pm b/Koha/Patrons.pm >index 0068f340ac..21061cd37f 100644 >--- a/Koha/Patrons.pm >+++ b/Koha/Patrons.pm >@@ -224,14 +224,16 @@ sub anonymise_issue_history { > > sub delete { > my ( $self, $params ) = @_; >+ my $patrons_deleted; > $self->_resultset->result_source->schema->txn_do( sub { > my ( $set, $params ) = @_; > while( my $patron = $set->next ) { > $patron->move_to_deleted if $params->{move}; > $patron->delete == 1 || Koha::Exceptions::Patron::Delete->throw; >+ $patrons_deleted++; > } > }, $self, $params ); >- return 1; >+ return $patrons_deleted; > } > > =head3 _type >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index 88fcc6cabb..e2e80197c6 100644 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -435,7 +435,7 @@ subtest 'Koha::Patrons->delete' => sub { > my $id1 = $patron1->borrowernumber; > my $set = Koha::Patrons->search({ borrowernumber => { '>=' => $id1 }}); > is( $set->count, 2, 'Two patrons found as expected' ); >- is( $set->delete({ move => 1 }), 1, 'Two patrons deleted' ); >+ is( $set->delete({ move => 1 }), 2, 'Two patrons deleted' ); > is( $moved_to_deleted, 2, 'Patrons moved to deletedborrowers' ); > > # Add again, test if we can raise an exception >-- >2.11.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 21337
:
78586
|
78619
|
78621
|
79461
|
79462
|
79708
|
79709
|
79915
|
79916
|
79917
| 80624 |
81251
|
81252
|
81257