Fix for 6426 - messaging not showing on patron categories
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / categorie.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Administration &rsaquo; Patron Categories &rsaquo; [% IF ( add_form ) %][% IF ( categorycode ) %]Modify category '[% categorycode |html %]'[% ELSE %]New category[% END %][% END %]
3 [% IF ( add_validate ) %]Data recorded[% END %]
4 [% IF ( delete_confirm ) %][% IF ( totalgtzero ) %]Cannot Delete: Category [% categorycode |html %] in Use[% ELSE %]Confirm Deletion of Category '[% categorycode |html %]'[% END %][% END %]
5 [% IF ( delete_confirmed ) %]Category Deleted[% END %]</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
8 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.pager.js"></script>
9 <script type="text/javascript" id="js">$(document).ready(function() {
10         $("#table_categorie").tablesorter({
11                 sortList: [[0,0]],
12                 widgets: ['zebra'],
13                 headers: { 11: { sorter: false}}
14         }).tablesorterPager({container: $("#pagertable_categorie"),positionFixed: false,size: 20});
15 }); </script>
16 [% INCLUDE 'calendar.inc' %]
17 <script type="text/javascript">
18 //<![CDATA[
19         //
20         function isNotNull(f,noalert) {
21                 if (f.value.length ==0) {
22    return false;
23                 }
24                 return true;
25         }
26         //
27         function toUC(f) {
28                 var x=f.value.toUpperCase();
29                 f.value=x;
30                 return true;
31         }
32         //
33         function isNum(v,maybenull) {
34         var n = new Number(v.value);
35         if (isNaN(n)) {
36                 return false;
37                 }
38         if (maybenull==0 && v.value=='') {
39                 return false;
40         }
41         return true;
42         }
43         //
44         function isDate(f) {
45                 var t = Date.parse(f.value);
46                 if (isNaN(t)) {
47                         return false;
48                 }
49         }
50         // to check if the data are correctly entered.
51         function Check(ff) {
52             var ok=0;
53                 var _alertString=_("Form not submitted because of the following problem(s)");
54                 _alertString +="\n-------------------------------------------------------------------\n\n";
55                 if (ff.categorycode.value.length==0) {
56                     ok=1;
57                         _alertString += _("- categorycode missing") + "\n";
58                 }
59                 if (!(ff.category_type.value)){
60                     ok=1;
61                     _alertString += _("- category type missing") + "\n";
62                 }
63                 if (!(isNotNull(ff.description,1))) {
64                     ok=1;
65                         _alertString += _("- description missing") + "\n";
66                 }
67                 if (!isNum(ff.upperagelimit,0) && ff.category_type.value=='C') {
68                     ok=1;
69                         _alertString += _("- upperagelimit is not a number") + "\n";
70                                 
71                 }
72                 if(!(ff.enrolmentperioddate.value || ff.enrolmentperiod.value)) {
73                     ok=1;
74                     _alertString += _("- either Enrollment period or Until date must be provided") + "\n";
75                 }
76                 if(ff.enrolmentperioddate.value && ff.enrolmentperiod.value){
77                         document.getElementById('enrolmentmessage').className = "error";
78                         return false;
79                 }
80                 
81                 if (ok) { // if there is a problem
82                     alert(_alertString);
83                     return false;
84                 }
85                 // if all is good
86                 ff.submit();
87         }
88         //]]>
89 </script>
90 </head>
91 <body>
92 [% INCLUDE 'header.inc' %]
93 [% INCLUDE 'patrons-admin-search.inc' %]
94
95 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; [% IF ( add_form ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron Categories</a> &rsaquo; [% IF ( categorycode ) %]Modify category '[% categorycode |html %]'[% ELSE %]New category[% END %][% END %]
96 [% IF ( add_validate ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron Categories</a> &rsaquo; Data recorded[% END %]
97 [% IF ( delete_confirm ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron Categories</a> &rsaquo; [% IF ( totalgtzero ) %]Cannot Delete: Category [% categorycode |html %] in Use[% ELSE %]Confirm Deletion of Category '[% categorycode |html %]'[% END %][% END %]
98 [% IF ( delete_confirmed ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron Categories</a> &rsaquo; Category Deleted[% END %]
99 [% IF ( else ) %]Patron Categories[% END %]</div>
100
101 <div id="doc3" class="yui-t2">
102    
103    <div id="bd">
104         <div id="yui-main">
105         <div class="yui-b">
106
107 [% IF ( add_form ) %]
108         
109
110
111         
112         <form name="Aform" action="[% script_name %]" method="post">
113         <input type="hidden" name="op" value="add_validate" />
114         <input type="hidden" name="checked" value="0" />
115 [% IF ( categorycode ) %]
116                 <h1>Modify category [% categorycode |html %]</h1>
117         [% ELSE %]
118                 <h1>New category</h1>
119         [% END %]
120         <fieldset class="rows">
121         <ol>[% IF ( categorycode ) %]
122         <li><span class="label">Category code</span>[% categorycode |html %]
123                                 <input type="hidden" name="categorycode" value="[% categorycode |html %]" /><input type="hidden" name="is_a_modif" value="1" /></li>
124         [% ELSE %]
125         <li><label for="categorycode">Category code: </label> &nbsp; <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" onblur="toUC(this)" /></li>
126         [% END %]
127         <li><label for="description">Description: </label> &nbsp; <input type="text" name="description" id="description" size="40" maxlength="80" value="[% description |html %]" /></li>
128         <li><label for="enrolmentperiod">Enrollment period: </label> &nbsp; 
129                 <input type="text" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="[% IF ( enrolmentperiod ) %][% enrolmentperiod %][% END %]" /> months <br />
130                 <label for="enrolmentperioddate">Until date: </label> &nbsp;
131                 <input type="text" name="enrolmentperioddate" id="enrolmentperioddate" value="[% enrolmentperioddate %]" /> <img src="[% themelang %]/lib/calendar/cal.gif" id="enrolmentperioddate_button" alt="Show Calendar" />
132                 <script type="text/javascript">
133             //<![CDATA[
134                Calendar.setup({
135                     inputField : "enrolmentperioddate",
136                     ifFormat : "[% DHTMLcalendar_dateformat %]",
137                         button : "enrolmentperioddate_button"
138                 });
139                 //]]>
140         </script>
141                 <div id="enrolmentmessage" class="hint">Cannot have "months" and "until date" at the same time</div>
142         </li>
143         <li><label for="dateofbirthrequired">Age required: </label> &nbsp; <input type="text" name="dateofbirthrequired" id="dateofbirthrequired" value="[% dateofbirthrequired %]" size="3" maxlength="3" /> years</li>
144         <li><label for="upperagelimit">Upperage limit: </label> &nbsp; <input type="text" name="upperagelimit" id="upperagelimit" size="3" maxlength="3" value="[% upperagelimit %]" /> years</li>
145         <li><label for="enrolmentfee">Enrollment fee: </label><input type="text" name="enrolmentfee" id="enrolmentfee" size="6" value="[% enrolmentfee %]" /></li>
146         <li><label for="overduenoticerequired">Overdue notice required: </label> &nbsp; <select name="overduenoticerequired" id="overduenoticerequired">
147                         [% IF ( overduenoticerequired ) %]
148                                                 <option value="0">No</option>
149                                                 <option value="1" selected="selected">Yes</option>
150                         [% ELSE %]
151                                                 <option value="0" selected="selected">No</option>
152                                                 <option value="1">Yes</option>
153                         [% END %]
154                                         </select></li>
155         <li><label for="hidelostitems">Lost items in staff client</label> &nbsp; <select name="hidelostitems" id="hidelostitems">
156                         [% IF ( hidelostitems ) %]
157                                                 <option value="0">Shown</option>
158                                                 <option value="1" selected="selected">Hidden by default</option>
159                         [% ELSE %]
160                                                 <option value="0" selected="selected">Shown</option>
161                                                 <option value="1">Hidden by default</option>
162                         [% END %]
163                                         </select></li>
164         <li><label for="reservefee">Hold fee: </label><input type="text" name="reservefee" id="reservefee" size="6" value="[% reservefee %]" /></li>
165         <li><label for="category_type">Category type: </label> &nbsp; <select name="category_type" id="category_type">
166                                                 [% IF ( type_n ) %]<option value="" selected="selected">Select a Category type</option>[% ELSE %]<option value="">Select a Category type</option>[% END %]
167                                         [% IF ( type_A ) %]<option value="A" selected="selected">Adult</option>[% ELSE %]<option value="A">Adult</option>[% END %]
168                                         [% IF ( type_C ) %]<option value="C" selected="selected">Child</option>[% ELSE %]<option value="C">Child</option>[% END %]
169                                         [% IF ( type_S ) %]<option value="S" selected="selected">Staff</option>[% ELSE %]<option value="S">Staff</option>[% END %]
170                                         [% IF ( type_I ) %]<option value="I" selected="selected">Organization</option>[% ELSE %]<option value="I">Organization</option>[% END %]
171                                         [% IF ( type_P ) %]<option value="P" selected="selected">Professional</option>[% ELSE %]<option value="P">Professional</option>[% END %]
172                                         [% IF ( type_X ) %]<option value="X" selected="selected">Statistical</option>[% ELSE %]<option value="X">Statistical</option>[% END %]
173                                         </select>
174         </li></ol>
175 </fieldset>
176
177     [% IF ( EnhancedMessagingPreferences ) %]
178       <fieldset class="rows">
179         <h4>Default messaging preferences for this patron category</h4>
180         [% INCLUDE 'messaging-preference-form.inc' %]
181       </fieldset>
182     [% END %]
183         <fieldset class="action"><input type="button" value="Save" onclick="Check(this.form);" /> </fieldset>
184         </form>
185
186 [% END %]
187
188 [% IF ( add_validate ) %]
189 <h3>Data recorded</h3>
190         <form action="[% script_name %]" method="post">
191                 <input type="submit" value="OK" />
192         </form>
193
194 [% END %]
195
196 [% IF ( delete_confirm ) %]
197         
198         <form action="[% script_name %]" method="post">
199         <fieldset><legend>      
200         [% IF ( totalgtzero ) %]
201         Category [% categorycode |html %] is in use.  Deletion not possible![% ELSE %]
202 Confirm Deletion of Category [% categorycode |html %][% END %]</legend>
203
204 [% IF ( totalgtzero ) %]<div class="dialog alert"><strong>This category is used [% total %] times</strong>. Deletion not possible</div>[% END %]
205         <table>
206         <tr><th scope="row">Category code: </th><td>[% categorycode |html %]</td></tr>
207         <tr><th scope="row">Description: </th><td>[% description |html %]</td></tr>
208         <tr><th scope="row">Enrollment period: </th>
209                 <td>
210                         [% IF ( enrolmentperiod ) %]
211                                 [% enrolmentperiod %] months
212                         [% ELSE %]
213                                 until [% enrolmentperioddate %]
214                         [% END %]
215                 </td>
216         </tr>
217         <tr><th scope="row">Age required: </th><td>[% dateofbirthrequired %] years</td></tr>
218         <tr><th scope="row">Upperage limit: </th><td>[% upperagelimit %] years</td></tr>
219         <tr><th scope="row">Enrollment fee: </th><td>[% enrolmentfee %]</td></tr>
220         <tr><th scope="row">Receives overdue notices: </th><td>[% IF ( overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td></tr>
221         <tr><th scope="row">Lost items in staff client</th><td>[% IF ( hidelostitems ) %]Hidden by default[% ELSE %]Shown[% END %]</td></tr>
222         <tr><th scope="row">Hold fee: </th><td>[% reservefee %]</td></tr>
223 </table>
224                 <fieldset class="action">[% IF ( totalgtzero ) %]
225 <input type="submit" value="OK" /></form>
226                 [% ELSE %]
227                         <input type="hidden" name="op" value="delete_confirmed" />
228                         <input type="hidden" name="categorycode" value="[% categorycode |html %]" /> <input type="submit" value="Delete this Category" /> <a class="cancel" href="/cgi-bin/koha/admin/categorie.pl">Cancel</a> 
229                 [% END %]</fieldset></fieldset></form>
230 [% END %]
231
232 [% IF ( delete_confirmed ) %]
233 <h3>Category Deleted</h3>
234
235         <form action="[% script_name %]" method="post">
236         <input type="submit" value="OK" />
237         </form>
238 [% END %]
239
240 [% IF ( else ) %]
241
242 <div id="toolbar">
243         <script type="text/javascript">
244         //<![CDATA[
245
246         // prepare DOM for YUI Toolbar
247
248          $(document).ready(function() {
249             yuiToolbar();
250          });
251
252         // YUI Toolbar Functions
253
254         function yuiToolbar() {
255             new YAHOO.widget.Button("newcategory");
256         }
257
258         //]]>
259         </script>
260         <ul class="toolbar">
261         <li><a id="newcategory" href="/cgi-bin/koha/admin/categorie.pl?op=add_form">New Category</a></li>
262 </ul></div>
263
264 <h2>Patron Category Administration</h2>
265 [% IF ( searchfield ) %]
266                 You Searched for [% searchfield %]</span>
267         [% END %]
268 <span id="pagertable_categorie" class="pager">
269         <form class="formpager">&nbsp;<strong>page(s)</strong>&nbsp;:
270                 <img src="[% interface %]/prog/img/first.png" class="first"/>
271                 <img src="[% interface %]/prog/img/prev.png" class="prev"/>
272                 <input type="text" size="5" class="pagedisplay"/>
273                 <img src="[% interface %]/prog/img/next.png" class="next"/>
274                 <img src="[% interface %]/prog/img/last.png" class="last"/>
275                 , entries/page : 
276                 <select class="pagesize">
277                 <option value="10">10</option>
278                         <option selected="selected" value="20">20</option>
279                         <option value="30">30</option>
280                         <option value="40">40</option>
281                         <option value="50">50</option>
282                         <option value="100">100</option>
283                 </select>
284         </form>
285 </span>
286         <table id="table_categorie">
287                 <thead>
288                         <th scope="col">Code</th>
289                         <th scope="col">Category name</th>
290                         <th scope="col">Type</th>
291                         <th scope="col">Enrollment period</th>
292                         <th scope="col">Age required</th>
293                         <th scope="col">Upper age limit</th>
294                         <th scope="col">Enrollment fee</th>
295                         <th scope="col">Overdue</th>
296                         <th scope="col">Lost Items</th>
297                         <th scope="col">Hold fee</th>
298             [% IF ( EnhancedMessagingPreferences ) %]
299             <th scope="col">Messaging</th>
300             [% END %]
301                         <th scope="col" colspan="2">&nbsp; </th>
302                 </thead>
303                 [% FOREACH loo IN loop %]
304                         <tr>
305                         <td>[% loo.categorycode |html %]</td>
306                         <td>
307                             <a href="[% loo.script_name %]?op=add_form&amp;categorycode=[% loo.categorycode |url %]">[% loo.description |html %]</a>
308                         </td>
309                         <td>
310                             [% IF ( loo.type_A ) %]Adult[% END %]
311                             [% IF ( loo.type_C ) %]Child[% END %]
312                             [% IF ( loo.type_P ) %]Prof.[% END %]
313                             [% IF ( loo.type_I ) %]Org.[% END %]
314                             [% IF ( loo.type_S ) %]Staff[% END %]
315                             [% IF ( loo.type_X ) %]Statistical[% END %]
316                         </td>
317                         <td>
318                                 [% IF ( loo.enrolmentperiod ) %]
319                                         [% loo.enrolmentperiod %] months
320                                 [% ELSE %]
321                                         until [% loo.enrolmentperioddate %]
322                                 [% END %]
323                         
324                         </td>
325                         <td>[% loo.dateofbirthrequired %] years</td>
326                         <td>[% loo.upperagelimit %] years</td>
327                         <td>[% loo.enrolmentfee %]</td>
328                         <td>[% IF ( loo.overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td>
329                         <td>[% IF ( loo.hidelostitems ) %]Hidden[% ELSE %]Shown[% END %]</td>
330                         <td>[% loo.reservefee %]</td>
331                         [% IF ( EnhancedMessagingPreferences ) %]
332                         <td style="white-space: nowrap; font-size:80%;">
333                             [% IF ( loo.messaging_prefs ) %]
334                               [% FOREACH prefs IN loo.messaging_prefs %]
335                                         [% FOREACH transport IN prefs.transports %]
336                                          [% IF ( transport.transport ) %]
337                                                         [% IF ( prefs.Item_Due ) %]Item Due
338                                                         [% ELSIF ( prefs.Advance_Notice ) %]Advance Notice
339                                                         [% ELSIF ( prefs.Upcoming_Events ) %]Upcoming Events
340                                                         [% ELSIF ( prefs.Hold_Filled ) %]Hold Filled
341                                                         [% ELSIF ( prefs.Item_Check_in ) %]Item Check-in
342                                                         [% ELSIF ( prefs.Item_Checkout ) %]Item Checkout
343                                                         [% ELSE %]Unknown
344                                                         [% END %]:
345                                                             <strong>[% transport.transport %]</strong><br />
346                                                          [% ELSE %]None<br />[% END %]
347                                         [% END %]
348                                 [% END %]
349                             [% ELSE %]
350                                 None
351                             [% END %]
352                         </td>
353                         [% END %]
354                         <td><a href="[% loo.script_name %]?op=add_form&amp;categorycode=[% loo.categorycode |url %]">Edit</a></td>
355                                                 <td><a href="[% loo.script_name %]?op=delete_confirm&amp;categorycode=[% loo.categorycode |url %]">Delete</a></td>
356                 </tr>
357                 [% END %]
358         </table>
359 [% END %]
360
361 </div>
362 </div>
363 <div class="yui-b">
364 [% INCLUDE 'admin-menu.inc' %]
365 </div>
366 </div>
367 [% INCLUDE 'intranet-bottom.inc' %]