Bugzilla – Attachment 49056 Details for
Bug 15656
Move the guarantor/guarantees code to Koha::Patron
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15656 [QA Followup] - Return without searching if patron has no guarantor
Bug-15656-QA-Followup---Return-without-searching-i.patch (text/plain), 2.04 KB, created by
Kyle M Hall (khall)
on 2016-03-11 18:37:01 UTC
(
hide
)
Description:
Bug 15656 [QA Followup] - Return without searching if patron has no guarantor
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2016-03-11 18:37:01 UTC
Size:
2.04 KB
patch
obsolete
>From 46a6178a57d82098b096f0a0f17667398f792ba6 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 11 Mar 2016 18:35:47 +0000 >Subject: [PATCH] Bug 15656 [QA Followup] - Return without searching if patron > has no guarantor > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Patron.pm | 7 +++++-- > t/db_dependent/Koha/Patrons.t | 2 +- > 2 files changed, 6 insertions(+), 3 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 4464731..684f274 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -45,6 +45,8 @@ Returns a Koha::Patron object for this patron's guarantor > sub guarantor { > my ( $self ) = @_; > >+ return undef unless $self->guarantorid(); >+ > return Koha::Patrons->find( $self->guarantorid() ); > } > >@@ -76,13 +78,14 @@ sub siblings { > my ( $self ) = @_; > > my $guarantor = $self->guarantor; >- my $guarantorid = $guarantor ? $guarantor->borrowernumber : undef; >+ >+ return undef unless $guarantor; > > return Koha::Patrons->search( > { > guarantorid => { > '!=' => undef, >- '=' => $guarantorid, >+ '=' => $guarantor->id, > }, > borrowernumber => { > '!=' => $self->borrowernumber, >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index 46eed31..fafd829 100644 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -80,7 +80,7 @@ subtest 'guarantees' => sub { > subtest 'siblings' => sub { > plan tests => 7; > my $siblings = $new_patron_1->siblings; >- is( ref($siblings), 'Koha::Patrons', 'Koha::Patron->siblings should not crashed if the patron has not guarantor' ); >+ is( $siblings, undef, 'Koha::Patron->siblings should not crashed if the patron has no guarantor' ); > my $guarantee_1 = $builder->build( { source => 'Borrower', value => { guarantorid => $new_patron_1->borrowernumber } } ); > my $retrieved_guarantee_1 = Koha::Patrons->find($guarantee_1); > $siblings = $retrieved_guarantee_1->siblings; >-- >2.1.4
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 15656
:
47267
|
47268
|
48108
|
48109
|
49054
|
49055
| 49056