@@ -, +, @@ provider is being used --- Koha/SMS/Provider.pm | 16 ++++++++++ .../prog/en/modules/admin/sms_providers.tt | 34 ++++++++++++++++++---- 2 files changed, 45 insertions(+), 5 deletions(-) --- a/Koha/SMS/Provider.pm +++ a/Koha/SMS/Provider.pm @@ -21,6 +21,8 @@ use Modern::Perl; use Carp; +use Koha::Borrowers; + use base qw(Koha::Object); =head1 NAME @@ -34,6 +36,20 @@ Koha::SMS::Provider - Koha SMS Provider object class =cut +=head3 patrons_using + +my $count = $provider->patrons_using() + +Gives the number of patrons using this provider + +=cut + +sub patrons_using { + my ( $self ) = @_; + + return Koha::Borrowers->search( { sms_provider_id => $self->id } )->count(); +} + =head3 type =cut --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/sms_providers.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/sms_providers.tt @@ -60,6 +60,7 @@ function delete_provider( id ) { Name Domain + Patrons     @@ -70,8 +71,23 @@ function delete_provider( id ) { [% p.name %] [% p.domain %] - Edit - Delete + [% p.patrons_using %] + + + Edit + + + + [% IF p.patrons_using %] + + Delete + + [% ELSE %] + + Delete + + [% END %] + [% END %] @@ -83,11 +99,19 @@ function delete_provider( id ) { + + + + - - + + Cancel + - Cancel --