Bug 23495: Add SMS provider to moremember.tt

To test:
1 - Enable SMS using the Email driver
2 - Add an SMS provider under admimistration
3 - Add an SMS number and provider to a patron
4 - Note on the patron details you don't see the provider :-(
5 - Apply patch
6 - Reload
7 - Note you do see the provider :-)
8 - prove t/db_dependent/Koha/Patrons.t
9 - Sign off!

Signed-off-by: Lisette <lisetteslatah@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Nick Clemens 2020-04-23 18:50:18 +00:00 committed by Martin Renvoize
parent 8b99b6525e
commit 985c8f1da9
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F
3 changed files with 24 additions and 1 deletions

View file

@ -431,6 +431,17 @@ sub library {
return Koha::Library->_new_from_dbic($self->_result->branchcode);
}
=head3 sms_provider
Returns a Koha::SMS::Provider object representing the patron's SMS provider.
=cut
sub sms_provider {
my ( $self ) = @_;
return Koha::SMS::Provider->_new_from_dbic($self->_result->sms_provider);
}
=head3 guarantor_relationships
Returns Koha::Patron::Relationships object for this patron's guarantors

View file

@ -414,6 +414,10 @@
<span class="label">SMS number:</span>
<a href="sms:[% patron.smsalertnumber | uri %]">[% patron.smsalertnumber | html %]</a>
</li>
<li>
<span class="label">SMS provider:</span>
[% patron.sms_provider.name | html %]
</li>
</ol>
</div>
[% END %]

View file

@ -19,7 +19,7 @@
use Modern::Perl;
use Test::More tests => 40;
use Test::More tests => 41;
use Test::Warn;
use Test::Exception;
use Test::MockModule;
@ -88,6 +88,14 @@ subtest 'library' => sub {
is( ref($retrieved_patron_1->library), 'Koha::Library', 'Koha::Patron->library should return a Koha::Library object' );
};
subtest 'sms_provider' => sub {
plan tests => 2;
my $sms_provider = $builder->build({source => 'SmsProvider' });
$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' );
};
subtest 'guarantees' => sub {
plan tests => 13;