Bugzilla – Attachment 65840 Details for
Bug 19074
Show patron category description instead of code in patron batch modification list
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19074: Do not crash if cardnumber does not exist
Bug-19074-Do-not-crash-if-cardnumber-does-not-exis.patch (text/plain), 1.78 KB, created by
Jonathan Druart
on 2017-08-10 18:22:25 UTC
(
hide
)
Description:
Bug 19074: Do not crash if cardnumber does not exist
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-08-10 18:22:25 UTC
Size:
1.78 KB
patch
obsolete
>From d0a018a449b3efc63c8c679f4fef481f0891f4bb Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 10 Aug 2017 15:20:43 -0300 >Subject: [PATCH] Bug 19074: Do not crash if cardnumber does not exist > >If a cardnumber does not exist, $borrower will be undef and the ->category call will explode >Can't call method "category" on an undefined value at >/home/vagrant/kohaclone/tools/modborrowers.pl line 370. > >This patch makes sure the patron exists before calling any methods. > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > tools/modborrowers.pl | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > >diff --git a/tools/modborrowers.pl b/tools/modborrowers.pl >index 7acc9a8a33..3b83f2bb35 100755 >--- a/tools/modborrowers.pl >+++ b/tools/modborrowers.pl >@@ -366,10 +366,10 @@ exit; > > sub GetBorrowerInfos { > my ( %info ) = @_; >- my $borrower = Koha::Patrons->find( \%info ); >- my $catdesc = $borrower->category->description; >- if ( $borrower ) { >- $borrower = $borrower->unblessed; >+ my $patron = Koha::Patrons->find( \%info ); >+ my $borrower; >+ if ( $patron ) { >+ $borrower = $patron->unblessed; > for ( qw(dateenrolled dateexpiry) ) { > my $userdate = $borrower->{$_}; > unless ($userdate && $userdate ne "0000-00-00" and $userdate ne "9999-12-31") { >@@ -378,7 +378,7 @@ sub GetBorrowerInfos { > } > $borrower->{$_} = $userdate || ''; > } >- $borrower->{category_description} = $catdesc; >+ $borrower->{category_description} = $patron->category->description; > my $attr_loop = C4::Members::Attributes::GetBorrowerAttributes( $borrower->{borrowernumber} ); > $borrower->{patron_attributes} = $attr_loop; > } >-- >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 19074
:
65798
|
65800
|
65806
|
65839
| 65840