Bug 26922: Regression tests
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / overduerules.tt
blob22d4050fe0802d229eff2aa545c6f2f5486d5798
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE Branches %]
5 [% SET footerjs = 1 %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Koha &rsaquo; Tools &rsaquo; Overdue notice/status triggers</title>
8 [% INCLUDE 'doc-head-close.inc' %]
9 </head>
11 <body id="tools_overduerules" class="tools">
12 [% INCLUDE 'header.inc' %]
13 [% INCLUDE 'cat-search.inc' %]
15 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; Overdue notice/status triggers</div>
17 <div class="main container-fluid">
18     <div class="row">
19         <div class="col-sm-10 col-sm-push-2">
20             <main>
22         <h1>Defining [% IF ( branch ) %]overdue actions for [% Branches.GetName( branch ) | html %][% ELSE %]default overdue actions[% END %]</h1>
23         <div class="help">
24             <p>Delay is the number of days after a checkout is due before an action is triggered. </p>
25             <p>If you want Koha to trigger an action (send a letter or restrict a member), a delay value is required.</p>
26             <p>Columns must be filled left to right: if the first column is blank, other columns will be ignored. </p>
27         </div>
28             <form method="post" action="/cgi-bin/koha/tools/overduerules.pl" id="selectlibrary">
29             <label for="branch">Select a library:</label>
30                 <select id="branch" name="branch">
31                     <option value="">Default</option>
32                     [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
33                 </select>
34                 <input type="submit" value="Select" />
35             </form>
36             [% IF ( ERROR ) %]
37             <div class="dialog alert">
38                 <h3>Data error</h3>
39                 <p>The following errors were found. Please correct them and submit again:</p>
40                 <ul>
41                 [% IF ( ERRORDELAY ) %]
42                     <li>Delay [% ERRORDELAY | html %] for [% BORERR | html %] patron category has some unexpected characters. There should be only numerical characters. </li>
43                 [% END %]
44                 [% IF ( ERRORUSELESSDELAY ) %]
45                     <li>No letter or restriction action specified for delay [% ERRORUSELESSDELAY | html %] for [% BORERR | html %] patron category.  If a delay is supplied, either a letter, restrict action, or both should be specified.</li>
46                 [% END %]
47                 [% IF ( ERRORORDER ) %]
48                     <li>The first notice's delay should be less than the second, which should be less than the third for the <strong>[% BORERR | html %]</strong> patron category </li>
49                 [% END %]
50                 </ul>
51             </div>
52             [% END %]
53             [% IF ( table ) %]
54             <form method="post" action="/cgi-bin/koha/tools/overduerules.pl">
55                 <input type="hidden" name="op" value="save" />
56                 <input type="hidden" name="branch" value="[% branch | html %]" />
57                 <h3>Rules for overdue actions: [% IF ( branch ) %][% Branches.GetName( branch ) | html %][% ELSE %] default library [% END %]</h3>
58                     [% IF ( datasaved ) %]<div class="dialog message">Changes saved.</div> [% END %]
60   <div id="rulestabs" class="toptabs">
61     <ul class="ui-tabs-nav">
62       [% FOR tab IN tabs %]
63           <li><a href="#[% tab.id | uri %]" class="tab [% tab.id | html %]" data-number="[% tab.number | html %]"></a></li>
64       [% END %]
65     </ul>
66     [% FOR tab IN tabs %]
67       <div id="[% tab.id | html %]">
68         <table>
69           <thead>
70             <tr>
71               <th>&nbsp;</th>
72               <th scope="col">Delay</th>
73               <th scope="col">Letter</th>
74               <th scope="col">Restrict</th>
75               [% FOREACH mtt IN message_transport_types %]
76                 <th scpre="col">
77                   [% SWITCH mtt %]
78                   [% CASE 'email' %]
79                     Email
80                   [% CASE 'print' %]
81                     Print
82                   [% CASE 'sms' %]
83                     SMS
84                   [% CASE 'feed' %]
85                     Feed
86                   [% CASE 'itiva' %]
87                     Phone (i-tiva)
88                   [% CASE 'phone' %]
89                     Phone
90                   [% CASE %]
91                     [% mtt | html %]
92                   [% END %]
93                 </th>
94               [% END %]
95             </tr>
96           </thead>
97           <tbody>
98           [% FOREACH value IN tab.values %]
99             <tr>
100               <th scope="row">[% value.line | html %]</th>
101               <td>
102               <input type="number" min="1" name="delay[% tab.number | html %]-[% value.overduename | html %]" value="[% value.delay | html %]" />
103               </td>
104               <td>
105                 <select name="letter[% tab.number | html %]-[% value.overduename | html %]">
106                   <option value="">No notice</option>
107                   [% FOREACH letter IN letters %]
108                     [% IF letter.code == value.selected_lettercode %]
109                       <option value="[% letter.code | html %]" selected="selected">[% letter.name | html %]</option>
110                     [% ELSE %]
111                       <option value="[% letter.code | html %]">[% letter.name | html %]</option>
112                     [% END %]
113                   [% END %]
114                 </select>
115               </td>
116               <td>
117               [% IF ( value.debarred ) %]
118                 <input type="checkbox" name="debarred[% tab.number | html %]-[% value.overduename | html %]" checked="checked" value="1" />
119               [% ELSE %]
120                 <input type="checkbox" name="debarred[% tab.number | html %]-[% value.overduename | html %]" value="1" />
121               [% END %]
122               </td>
123               [% FOREACH mtt IN value.message_transport_types %]
124                 <td>
125                   [% IF mtt.selected %]
126                     <input type="checkbox" name="mtt[% tab.number | html %]-[% value.overduename | html %]" value="[% mtt.value | html %]" checked="checked" />
127                   [% ELSE %]
128                     [% IF mtt.value == "sms" and not Koha.Preference("SMSSendDriver") %]
129                       <input type="checkbox" name="mtt[% tab.number | html %]-[% value.overduename | html %]" value="[% mtt.value | html %]" disabled="disabled" />
130                     [% ELSIF mtt.value == "itiva" and not Koha.Preference("TalkingTechItivaPhoneNotification") %]
131                       <input type="checkbox" name="mtt[% tab.number | html %]-[% value.overduename | html %]" value="[% mtt.value | html %]" disabled="disabled" />
132                     [% ELSIF mtt.value == "phone" and not Koha.Preference("PhoneNotification") %]
133                         <input type="checkbox" name="mtt[% tab.number | html %]-[% value.overduename | html %]" value="[% mtt.value | html %]" disabled="disabled" />
134                     [% ELSE %]
135                       <input type="checkbox" name="mtt[% tab.number | html %]-[% value.overduename | html %]" value="[% mtt.value | html %]" />
136                     [% END %]
137                   [% END %]
138                 </td>
139               [% END %]
140             </tr>
141           [% END %]
142           </tbody>
143         </table>
144       </div>
145     [% END %]
148 </div>
150                 <fieldset class="action"><input type="submit" value="Save changes" /></fieldset>
151             </form>
152             [% ELSE %]
153                 <div class="warning">You don't have patron categories defined, or the patron categories are not set to receive overdue notices.</div>
154                 <div class="warning">If this is not what you were expecting, go to <a href="../admin/categories.pl">patron categories</p></div>
155             [% END %]
157             </main>
158         </div> <!-- /.col-sm-10.col-sm-push-2 -->
160         <div class="col-sm-2 col-sm-pull-10">
161             <aside>
162                 [% INCLUDE 'tools-menu.inc' %]
163             </aside>
164         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
165      </div> <!-- /.row -->
167 [% MACRO jsinclude BLOCK %]
168     [% Asset.js("js/tools-menu.js") | $raw %]
169     <script>
170         var tab_map = { "1" : _("First"), "2" : _("Second"), "3" : _("Third")};
171         $(document).ready(function() {
172             $('#selectlibrary').find("input:submit").hide();
173             $('#branch').change(function() {
174                 $('#selectlibrary').submit();
175             });
176             $("li>a.tab").each( function(){
177                 var id = $(this).attr("data-number");
178                 $(this).html(tab_map[id]);
179             });
180             $('#rulestabs').tabs();
181         });
182     </script>
183 [% END %]
185 [% INCLUDE 'intranet-bottom.inc' %]