Bugzilla – Attachment 103642 Details for
Bug 23495
Show SMS provider on details tab in patron account in staff
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23495: Fix if no sms provider defined
Bug-23495-Fix-if-no-sms-provider-defined.patch (text/plain), 1.80 KB, created by
Jonathan Druart
on 2020-04-24 10:48:47 UTC
(
hide
)
Description:
Bug 23495: Fix if no sms provider defined
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-04-24 10:48:47 UTC
Size:
1.80 KB
patch
obsolete
>From c78236422be1a91b569d8cfecfc7c3cbf163657a Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 24 Apr 2020 12:45:04 +0200 >Subject: [PATCH] Bug 23495: Fix if no sms provider defined > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > Koha/Patron.pm | 4 +++- > t/db_dependent/Koha/Patrons.t | 3 ++- > 2 files changed, 5 insertions(+), 2 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 486406842a..5436ccc448 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -439,7 +439,9 @@ Returns a Koha::SMS::Provider object representing the patron's SMS provider. > > sub sms_provider { > my ( $self ) = @_; >- return Koha::SMS::Provider->_new_from_dbic($self->_result->sms_provider); >+ my $sms_provider_rs = $self->_result->sms_provider; >+ return unless $sms_provider_rs; >+ return Koha::SMS::Provider->_new_from_dbic($sms_provider_rs); > } > > =head3 guarantor_relationships >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index 3461bee9f4..4f434adc3c 100644 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -89,8 +89,9 @@ subtest 'library' => sub { > }; > > subtest 'sms_provider' => sub { >- plan tests => 2; >+ plan tests => 3; > my $sms_provider = $builder->build({source => 'SmsProvider' }); >+ is( $retrieved_patron_1->sms_provider, undef, '->sms_provider should return undef if none defined' ); > $retrieved_patron_1->sms_provider_id( $sms_provider->{id} )->store; > is_deeply( $retrieved_patron_1->sms_provider->unblessed, $sms_provider, 'Koha::Patron->sms_provider returns the correct SMS provider' ); > is( ref($retrieved_patron_1->sms_provider), 'Koha::SMS::Provider', 'Koha::Patron->sms_provider should return a Koha::SMS::Provider object' ); >-- >2.20.1
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 23495
:
103602
|
103604
|
103641
| 103642