Merge remote-tracking branch 'kc/new/enh/bug_5263' into kcmaster
[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 <style type="text/css">#enrolmentmessage.hint { display : none; }</style>
91 </head>
92 <body>
93 [% INCLUDE 'header.inc' %]
94 [% INCLUDE 'patrons-admin-search.inc' %]
95
96 <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 %]
97 [% IF ( add_validate ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron Categories</a> &rsaquo; Data recorded[% END %]
98 [% 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 %]
99 [% IF ( delete_confirmed ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron Categories</a> &rsaquo; Category Deleted[% END %]
100 [% IF ( else ) %]Patron Categories[% END %]</div>
101
102 <div id="doc3" class="yui-t2">
103    
104    <div id="bd">
105         <div id="yui-main">
106         <div class="yui-b">
107
108 [% IF ( add_form ) %]
109         
110
111
112         
113         <form name="Aform" action="[% script_name %]" method="post">
114         <input type="hidden" name="op" value="add_validate" />
115         <input type="hidden" name="checked" value="0" />
116 [% IF ( categorycode ) %]
117                 <h1>Modify category [% categorycode |html %]</h1>
118         [% ELSE %]
119                 <h1>New category</h1>
120         [% END %]
121         <fieldset class="rows">
122         <ol>[% IF ( categorycode ) %]
123         <li><span class="label">Category code</span>[% categorycode |html %]
124                                 <input type="hidden" name="categorycode" value="[% categorycode |html %]" /><input type="hidden" name="is_a_modif" value="1" /></li>
125         [% ELSE %]
126         <li><label for="categorycode">Category code: </label> <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" onblur="toUC(this)" /></li>
127         [% END %]
128         <li><label for="description">Description: </label> <input type="text" name="description" id="description" size="40" maxlength="80" value="[% description |html %]" /></li>
129         <li><label for="enrolmentperiod">Enrollment period: </label>
130         <fieldset>
131         <legend>Choose one</legend>
132         <ol>
133         <li><label for="enrolmentperiod" style="width:6em;">In months: </label>
134                 <input type="text" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="[% IF ( enrolmentperiod ) %][% enrolmentperiod %][% END %]" /> months</li>
135         <li><label for="enrolmentperioddate" style="width:6em;">Until date: </label>
136                 <input type="text" name="enrolmentperioddate" id="enrolmentperioddate" value="[% enrolmentperioddate %]" /> <img src="[% themelang %]/lib/calendar/cal.gif" id="enrolmentperioddate_button" alt="Show Calendar" />
137                 <script type="text/javascript">
138             //<![CDATA[
139                Calendar.setup({
140                     inputField : "enrolmentperioddate",
141                     ifFormat : "[% DHTMLcalendar_dateformat %]",
142                         button : "enrolmentperioddate_button"
143                 });
144                 //]]>
145         </script>
146                 <div id="enrolmentmessage" class="hint" style="margin-left:0;">Cannot have "months" and "until date" at the same time</div>
147         </li>
148         </ol>
149         </fieldset>
150         </li>
151         <li><label for="dateofbirthrequired">Age required: </label> <input type="text" name="dateofbirthrequired" id="dateofbirthrequired" value="[% dateofbirthrequired %]" size="3" maxlength="3" /> years</li>
152         <li><label for="upperagelimit">Upperage limit: </label> <input type="text" name="upperagelimit" id="upperagelimit" size="3" maxlength="3" value="[% upperagelimit %]" /> years</li>
153         <li><label for="enrolmentfee">Enrollment fee: </label><input type="text" name="enrolmentfee" id="enrolmentfee" size="6" value="[% enrolmentfee %]" /></li>
154         <li><label for="overduenoticerequired">Overdue notice required: </label> <select name="overduenoticerequired" id="overduenoticerequired">
155                         [% IF ( overduenoticerequired ) %]
156                                                 <option value="0">No</option>
157                                                 <option value="1" selected="selected">Yes</option>
158                         [% ELSE %]
159                                                 <option value="0" selected="selected">No</option>
160                                                 <option value="1">Yes</option>
161                         [% END %]
162                                         </select></li>
163         <li><label for="hidelostitems">Lost items in staff client</label> <select name="hidelostitems" id="hidelostitems">
164                         [% IF ( hidelostitems ) %]
165                                                 <option value="0">Shown</option>
166                                                 <option value="1" selected="selected">Hidden by default</option>
167                         [% ELSE %]
168                                                 <option value="0" selected="selected">Shown</option>
169                                                 <option value="1">Hidden by default</option>
170                         [% END %]
171                                         </select></li>
172         <li><label for="reservefee">Hold fee: </label><input type="text" name="reservefee" id="reservefee" size="6" value="[% reservefee %]" /></li>
173         <li><label for="category_type">Category type: </label> <select name="category_type" id="category_type">
174                                                 [% IF ( type_n ) %]<option value="" selected="selected">Select a Category type</option>[% ELSE %]<option value="">Select a Category type</option>[% END %]
175                                         [% IF ( type_A ) %]<option value="A" selected="selected">Adult</option>[% ELSE %]<option value="A">Adult</option>[% END %]
176                                         [% IF ( type_C ) %]<option value="C" selected="selected">Child</option>[% ELSE %]<option value="C">Child</option>[% END %]
177                                         [% IF ( type_S ) %]<option value="S" selected="selected">Staff</option>[% ELSE %]<option value="S">Staff</option>[% END %]
178                                         [% IF ( type_I ) %]<option value="I" selected="selected">Organization</option>[% ELSE %]<option value="I">Organization</option>[% END %]
179                                         [% IF ( type_P ) %]<option value="P" selected="selected">Professional</option>[% ELSE %]<option value="P">Professional</option>[% END %]
180                                         [% IF ( type_X ) %]<option value="X" selected="selected">Statistical</option>[% ELSE %]<option value="X">Statistical</option>[% END %]
181                                         </select>
182         </li></ol>
183 </fieldset>
184
185     [% IF ( EnhancedMessagingPreferences ) %]
186       <fieldset class="rows">
187         <h4>Default messaging preferences for this patron category</h4>
188         [% INCLUDE 'messaging-preference-form.inc' %]
189       </fieldset>
190     [% END %]
191         <fieldset class="action"><input type="button" value="Save" onclick="Check(this.form);" /> </fieldset>
192         </form>
193
194 [% END %]
195
196 [% IF ( add_validate ) %]
197 <h3>Data recorded</h3>
198         <form action="[% script_name %]" method="post">
199                 <input type="submit" value="OK" />
200         </form>
201
202 [% END %]
203
204 [% IF ( delete_confirm ) %]
205         
206         <form action="[% script_name %]" method="post">
207         <fieldset><legend>      
208         [% IF ( totalgtzero ) %]
209         Category [% categorycode |html %] is in use.  Deletion not possible![% ELSE %]
210 Confirm Deletion of Category [% categorycode |html %][% END %]</legend>
211
212 [% IF ( totalgtzero ) %]<div class="dialog alert"><strong>This category is used [% total %] times</strong>. Deletion not possible</div>[% END %]
213         <table>
214         <tr><th scope="row">Category code: </th><td>[% categorycode |html %]</td></tr>
215         <tr><th scope="row">Description: </th><td>[% description |html %]</td></tr>
216         <tr><th scope="row">Enrollment period: </th>
217                 <td>
218                         [% IF ( enrolmentperiod ) %]
219                                 [% enrolmentperiod %] months
220                         [% ELSE %]
221                                 until [% enrolmentperioddate %]
222                         [% END %]
223                 </td>
224         </tr>
225         <tr><th scope="row">Age required: </th><td>[% dateofbirthrequired %] years</td></tr>
226         <tr><th scope="row">Upperage limit: </th><td>[% upperagelimit %] years</td></tr>
227         <tr><th scope="row">Enrollment fee: </th><td>[% enrolmentfee %]</td></tr>
228         <tr><th scope="row">Receives overdue notices: </th><td>[% IF ( overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td></tr>
229         <tr><th scope="row">Lost items in staff client</th><td>[% IF ( hidelostitems ) %]Hidden by default[% ELSE %]Shown[% END %]</td></tr>
230         <tr><th scope="row">Hold fee: </th><td>[% reservefee %]</td></tr>
231 </table>
232                 <fieldset class="action">[% IF ( totalgtzero ) %]
233 <input type="submit" value="OK" /></form>
234                 [% ELSE %]
235                         <input type="hidden" name="op" value="delete_confirmed" />
236                         <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> 
237                 [% END %]</fieldset></fieldset></form>
238 [% END %]
239
240 [% IF ( delete_confirmed ) %]
241 <h3>Category Deleted</h3>
242
243         <form action="[% script_name %]" method="post">
244         <input type="submit" value="OK" />
245         </form>
246 [% END %]
247
248 [% IF ( else ) %]
249
250 <div id="toolbar">
251         <script type="text/javascript">
252         //<![CDATA[
253
254         // prepare DOM for YUI Toolbar
255
256          $(document).ready(function() {
257             yuiToolbar();
258          });
259
260         // YUI Toolbar Functions
261
262         function yuiToolbar() {
263             new YAHOO.widget.Button("newcategory");
264         }
265
266         //]]>
267         </script>
268         <ul class="toolbar">
269         <li><a id="newcategory" href="/cgi-bin/koha/admin/categorie.pl?op=add_form">New Category</a></li>
270 </ul></div>
271
272 <h2>Patron Category Administration</h2>
273 [% IF ( searchfield ) %]
274                 You Searched for [% searchfield %]</span>
275         [% END %]
276 [% IF ( loop ) %]
277 <span id="pagertable_categorie" class="pager">
278         <form class="formpager">&nbsp;<strong>page(s)</strong>&nbsp;:
279                 <img src="[% interface %]/prog/img/first.png" class="first"/>
280                 <img src="[% interface %]/prog/img/prev.png" class="prev"/>
281                 <input type="text" size="5" class="pagedisplay"/>
282                 <img src="[% interface %]/prog/img/next.png" class="next"/>
283                 <img src="[% interface %]/prog/img/last.png" class="last"/>
284                 , entries/page : 
285                 <select class="pagesize">
286                 <option value="10">10</option>
287                         <option selected="selected" value="20">20</option>
288                         <option value="30">30</option>
289                         <option value="40">40</option>
290                         <option value="50">50</option>
291                         <option value="100">100</option>
292                 </select>
293         </form>
294 </span>
295         <table id="table_categorie">
296                 <thead>
297                         <th scope="col">Code</th>
298                         <th scope="col">Category name</th>
299                         <th scope="col">Type</th>
300                         <th scope="col">Enrollment period</th>
301                         <th scope="col">Age required</th>
302                         <th scope="col">Upper age limit</th>
303                         <th scope="col">Enrollment fee</th>
304                         <th scope="col">Overdue</th>
305                         <th scope="col">Lost Items</th>
306                         <th scope="col">Hold fee</th>
307             [% IF ( EnhancedMessagingPreferences ) %]
308             <th scope="col">Messaging</th>
309             [% END %]
310                         <th scope="col" colspan="2">&nbsp; </th>
311                 </thead>
312                 [% FOREACH loo IN loop %]
313                         <tr>
314                         <td>[% loo.categorycode |html %]</td>
315                         <td>
316                             <a href="[% loo.script_name %]?op=add_form&amp;categorycode=[% loo.categorycode |url %]">[% loo.description |html %]</a>
317                         </td>
318                         <td>
319                             [% IF ( loo.type_A ) %]Adult[% END %]
320                             [% IF ( loo.type_C ) %]Child[% END %]
321                             [% IF ( loo.type_P ) %]Prof.[% END %]
322                             [% IF ( loo.type_I ) %]Org.[% END %]
323                             [% IF ( loo.type_S ) %]Staff[% END %]
324                             [% IF ( loo.type_X ) %]Statistical[% END %]
325                         </td>
326                         <td>
327                                 [% IF ( loo.enrolmentperiod ) %]
328                                         [% loo.enrolmentperiod %] months
329                                 [% ELSE %]
330                                         until [% loo.enrolmentperioddate %]
331                                 [% END %]
332                         
333                         </td>
334                         <td>[% loo.dateofbirthrequired %] years</td>
335                         <td>[% loo.upperagelimit %] years</td>
336                         <td>[% loo.enrolmentfee %]</td>
337                         <td>[% IF ( loo.overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td>
338                         <td>[% IF ( loo.hidelostitems ) %]Hidden[% ELSE %]Shown[% END %]</td>
339                         <td>[% loo.reservefee %]</td>
340                         [% IF ( EnhancedMessagingPreferences ) %]
341                         <td style="white-space: nowrap; font-size:80%;">
342                             [% IF ( loo.messaging_prefs ) %]
343                               [% FOREACH prefs IN loo.messaging_prefs %]
344                                         [% FOREACH transport IN prefs.transports %]
345                                          [% IF ( transport.transport ) %]
346                                                         [% IF ( prefs.Item_Due ) %]Item Due
347                                                         [% ELSIF ( prefs.Advance_Notice ) %]Advance Notice
348                                                         [% ELSIF ( prefs.Upcoming_Events ) %]Upcoming Events
349                                                         [% ELSIF ( prefs.Hold_Filled ) %]Hold Filled
350                                                         [% ELSIF ( prefs.Item_Check_in ) %]Item Check-in
351                                                         [% ELSIF ( prefs.Item_Checkout ) %]Item Checkout
352                                                         [% ELSE %]Unknown
353                                                         [% END %]:
354                                                             <strong>[% transport.transport %]</strong><br />
355                                                          [% ELSE %]None<br />[% END %]
356                                         [% END %]
357                                 [% END %]
358                             [% ELSE %]
359                                 None
360                             [% END %]
361                         </td>
362                         [% END %]
363                         <td><a href="[% loo.script_name %]?op=add_form&amp;categorycode=[% loo.categorycode |url %]">Edit</a></td>
364                                                 <td><a href="[% loo.script_name %]?op=delete_confirm&amp;categorycode=[% loo.categorycode |url %]">Delete</a></td>
365                 </tr>
366                 [% END %]
367         </table>
368 [% ELSE %]
369         <div class="dialog alert">No categories have been defined. <a href="/cgi-bin/koha/admin/categorie.pl?op=add_form">Create a new category</a>.</div>
370 [% END %]
371 [% END %]
372
373 </div>
374 </div>
375 <div class="yui-b">
376 [% INCLUDE 'admin-menu.inc' %]
377 </div>
378 </div>
379 [% INCLUDE 'intranet-bottom.inc' %]