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