From cd6e8db177d875cff09aaa173b76a451060bec63 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 10 Feb 2016 10:19:00 +0000 Subject: [PATCH] Bug 9021 [QA Followup] - Add feedback to delete button if provider is being used * Change links to buttons * Add warning class to delete button if provider is being used Signed-off-by: Mark Tompsett Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- Koha/SMS/Provider.pm | 16 +++++++++ .../prog/en/modules/admin/sms_providers.tt | 34 ++++++++++++++++--- 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/Koha/SMS/Provider.pm b/Koha/SMS/Provider.pm index 1aa70dcada..cc047dd569 100644 --- a/Koha/SMS/Provider.pm +++ b/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 diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/sms_providers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/sms_providers.tt index c33f21687a..706db5c251 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/sms_providers.tt +++ b/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 -- 2.39.5