Bug 11868: MTT: disable SMS and phone if not in use
authorJonathan Druart <jonathan.druart@biblibre.com>
Thu, 27 Feb 2014 13:30:50 +0000 (14:30 +0100)
committerGalen Charlton <gmc@esilibrary.com>
Fri, 2 May 2014 20:29:19 +0000 (20:29 +0000)
On both pages "Notices and slips" and "Overdue rules", it would be great
to disable SMS and phone if there are not in use.  This patch implements
this.

Test plan:
1/ Edit a notice
2/ Enable/disable the SMSSendDriver pref and verify the sms block is
enabled/disabled.
3/ Enable/disable the TalkingTechItivaPhoneNotification pref and verify
the phone block is enabled/disabled.

4/ Go on tools/overdues.pl
5/ Enable/disable the SMSSendDriver pref and verify the sms checkboxes
are enabled/disabled.
6/ Enable/disable the TalkingTechItivaPhoneNotification pref and verify
the phone checkboxes are enabled/disabled.

Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
---------------
Testing report:
---------------
Followed the test plan. Reviewed the code modifications.
Feature works as expected.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt
koha-tmpl/intranet-tmpl/prog/en/modules/tools/overduerules.tt

index eb0b8a2..f2a7051 100644 (file)
@@ -1,3 +1,4 @@
+[% USE Koha %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Tools &rsaquo; Notices[% IF ( add_form ) %][% IF ( modify ) %] &rsaquo; Modify notice[% ELSE %] &rsaquo; Add notice[% END %][% END %][% IF ( add_validate ) %] &rsaquo; Notice added[% END %][% IF ( delete_confirm ) %] &rsaquo; Confirm deletion[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
@@ -310,7 +311,15 @@ $(document).ready(function() {
 
         [% FOREACH letter IN letters %]
           <li>
-            <fieldset class="rows mtt" id="[% letter.message_transport_type %]">
+            [% IF letter.message_transport_type == "sms" and not Koha.Preference("SMSSendDriver") %]
+              <fieldset class="rows mtt" id="[% letter.message_transport_type %]" disabled="disabled">
+                <div class="dialog message">You should enable the SMSSendDriver preference to use the sms templates.</div>
+            [% ELSIF letter.message_transport_type == "phone" and not Koha.Preference("TalkingTechItivaPhoneNotification") %]
+              <fieldset class="rows mtt" id="[% letter.message_transport_type %]" disabled="disabled">
+                <div class="dialog message">You should enable the TalkingTechItivaPhoneNotification preference to use the phone templates.</div>
+            [% ELSE %]
+              <fieldset class="rows mtt" id="[% letter.message_transport_type %]">
+            [% END %]
               <legend>
                 [% SWITCH letter.message_transport_type %]
                 [% CASE 'email' %]
index dba8493..387f93f 100644 (file)
@@ -1,3 +1,4 @@
+[% USE Koha %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Tools &rsaquo; Notice triggers</title>
 [% INCLUDE 'doc-head-close.inc' %]
@@ -146,7 +147,13 @@ $(document).ready(function() {
                   [% IF mtt.selected %]
                     <input type="checkbox" name="mtt[% tab.number %]-[% value.overduename %]" value="[% mtt.value %]" checked="checked" />
                   [% ELSE %]
-                    <input type="checkbox" name="mtt[% tab.number %]-[% value.overduename %]" value="[% mtt.value %]" />
+                    [% IF mtt.value == "sms" and not Koha.Preference("SMSSendDriver") %]
+                      <input type="checkbox" name="mtt[% tab.number %]-[% value.overduename %]" value="[% mtt.value %]" disabled="disabled" />
+                    [% ELSIF mtt.value == "phone" and not Koha.Preference("TalkingTechItivaPhoneNotification") %]
+                      <input type="checkbox" name="mtt[% tab.number %]-[% value.overduename %]" value="[% mtt.value %]" disabled="disabled" />
+                    [% ELSE %]
+                      <input type="checkbox" name="mtt[% tab.number %]-[% value.overduename %]" value="[% mtt.value %]" />
+                    [% END %]
                   [% END %]
                 </td>
               [% END %]