Merge remote-tracking branch 'origin/new/bug_8251'
[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 [% INCLUDE 'calendar.inc' %]
8 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
9 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.pager.js"></script>
10 <script type="text/javascript" id="js">$(document).ready(function() {
11         $("#table_categorie").tablesorter({
12                 sortList: [[0,0]],
13                 widgets: ['zebra'],
14                 headers: { 11: { sorter: false}}
15         }).tablesorterPager({container: $("#pagertable_categorie"),positionFixed: false,size: 20});
16     $( "#enrolmentperioddate" ).datepicker({ minDate: 1 }); // Require that "until date" be in the future
17 }); </script>
18 <script type="text/javascript">
19 //<![CDATA[
20         //
21         function isNotNull(f,noalert) {
22                 if (f.value.length ==0) {
23    return false;
24                 }
25                 return true;
26         }
27         //
28         function toUC(f) {
29                 var x=f.value.toUpperCase();
30                 f.value=x;
31                 return true;
32         }
33         //
34         function isNum(v,maybenull) {
35         var n = new Number(v.value);
36         if (isNaN(n)) {
37                 return false;
38                 }
39         if (maybenull==0 && v.value=='') {
40                 return false;
41         }
42         return true;
43         }
44         //
45         function isDate(f) {
46                 var t = Date.parse(f.value);
47                 if (isNaN(t)) {
48                         return false;
49                 }
50         }
51         // to check if the data are correctly entered.
52         function Check(ff) {
53             var ok=0;
54                 var _alertString=_("Form not submitted because of the following problem(s)");
55                 _alertString +="\n-------------------------------------------------------------------\n\n";
56                 if (ff.categorycode.value.length==0) {
57                     ok=1;
58                         _alertString += _("- categorycode missing") + "\n";
59                 }
60                 if (!(ff.category_type.value)){
61                     ok=1;
62                     _alertString += _("- category type missing") + "\n";
63                 }
64                 if (!(isNotNull(ff.description,1))) {
65                     ok=1;
66                         _alertString += _("- description missing") + "\n";
67                 }
68                 if (!isNum(ff.upperagelimit,0) && ff.category_type.value=='C') {
69                     ok=1;
70                         _alertString += _("- upperagelimit is not a number") + "\n";
71                                 
72                 }
73                 if(!(ff.enrolmentperioddate.value || ff.enrolmentperiod.value)) {
74                     ok=1;
75                     _alertString += _("- either Enrollment period or Until date must be provided") + "\n";
76                 }
77                 if(ff.enrolmentperioddate.value && ff.enrolmentperiod.value){
78                         document.getElementById('enrolmentmessage').className = "error";
79                         return false;
80                 }
81                 
82                 if (ok) { // if there is a problem
83                     alert(_alertString);
84                     return false;
85                 }
86                 // if all is good
87                 ff.submit();
88         }
89         //]]>
90 </script>
91 <style type="text/css">#enrolmentmessage.hint { display : none; }</style>
92 </head>
93 <body id="admin_categorie" class="admin">
94 [% INCLUDE 'header.inc' %]
95 [% INCLUDE 'patrons-admin-search.inc' %]
96
97 <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 %]
98 [% IF ( add_validate ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> &rsaquo; Data recorded[% END %]
99 [% 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 %]
100 [% IF ( delete_confirmed ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> &rsaquo; Category deleted[% END %]
101 [% IF ( else ) %]Patron categories[% END %]</div>
102
103 <div id="doc3" class="yui-t2">
104    
105    <div id="bd">
106         <div id="yui-main">
107         <div class="yui-b">
108
109 [% IF ( add_form ) %]
110         
111
112
113         
114         <form name="Aform" action="[% script_name %]" method="post">
115         <input type="hidden" name="op" value="add_validate" />
116         <input type="hidden" name="checked" value="0" />
117 [% IF ( categorycode ) %]
118                 <h1>Modify category [% categorycode |html %]</h1>
119         [% ELSE %]
120                 <h1>New category</h1>
121         [% END %]
122         <fieldset class="rows">
123         <ol>[% IF ( categorycode ) %]
124         <li><span class="label">Category code</span>[% categorycode |html %]
125                                 <input type="hidden" name="categorycode" value="[% categorycode |html %]" /><input type="hidden" name="is_a_modif" value="1" /></li>
126         [% ELSE %]
127         <li><label for="categorycode">Category code: </label> <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" onblur="toUC(this)" /></li>
128         [% END %]
129         <li><label for="description">Description: </label> <input type="text" name="description" id="description" size="40" maxlength="80" value="[% description |html %]" /></li>
130         <li><label for="enrolmentperiod">Enrollment period: </label>
131         <fieldset>
132         <legend>Choose one</legend>
133         <ol>
134         <li><label for="enrolmentperiod" style="width:6em;">In months: </label>
135                 <input type="text" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="[% IF ( enrolmentperiod ) %][% enrolmentperiod %][% END %]" /> months</li>
136         <li><label for="enrolmentperioddate" style="width:6em;">Until date: </label>
137         <input type="text" name="enrolmentperioddate" id="enrolmentperioddate" value="[% enrolmentperioddate %]" />
138                 <div id="enrolmentmessage" class="hint" style="margin-left:0;">Cannot have "months" and "until date" at the same time</div>
139         </li>
140         </ol>
141         </fieldset>
142         </li>
143         <li><label for="dateofbirthrequired">Age required: </label> <input type="text" name="dateofbirthrequired" id="dateofbirthrequired" value="[% dateofbirthrequired %]" size="3" maxlength="3" /> years</li>
144         <li><label for="upperagelimit">Upperage limit: </label> <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> <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> <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> <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 [% IF ( loop ) %]
269 <div id="pagertable_categorie">
270 [% INCLUDE 'table-pager.inc' perpage='20' %]
271 </div>
272         <table id="table_categorie">
273                 <thead>
274                         <th scope="col">Code</th>
275                         <th scope="col">Category name</th>
276                         <th scope="col">Type</th>
277                         <th scope="col">Enrollment period</th>
278                         <th scope="col">Age required</th>
279                         <th scope="col">Upper age limit</th>
280                         <th scope="col">Enrollment fee</th>
281                         <th scope="col">Overdue</th>
282             <th scope="col">Lost items</th>
283                         <th scope="col">Hold fee</th>
284             [% IF ( EnhancedMessagingPreferences ) %]
285             <th scope="col">Messaging</th>
286             [% END %]
287                         <th scope="col" colspan="2">&nbsp; </th>
288                 </thead>
289                 [% FOREACH loo IN loop %]
290                         <tr>
291                         <td>[% loo.categorycode |html %]</td>
292                         <td>
293                             <a href="[% loo.script_name %]?op=add_form&amp;categorycode=[% loo.categorycode |url %]">[% loo.description |html %]</a>
294                         </td>
295                         <td>
296                             [% IF ( loo.type_A ) %]Adult[% END %]
297                             [% IF ( loo.type_C ) %]Child[% END %]
298                             [% IF ( loo.type_P ) %]Prof.[% END %]
299                             [% IF ( loo.type_I ) %]Org.[% END %]
300                             [% IF ( loo.type_S ) %]Staff[% END %]
301                             [% IF ( loo.type_X ) %]Statistical[% END %]
302                         </td>
303                         <td>
304                                 [% IF ( loo.enrolmentperiod ) %]
305                                         [% loo.enrolmentperiod %] months
306                                 [% ELSE %]
307                                         until [% loo.enrolmentperioddate %]
308                                 [% END %]
309                         
310                         </td>
311                         <td>[% loo.dateofbirthrequired %] years</td>
312                         <td>[% loo.upperagelimit %] years</td>
313                         <td>[% loo.enrolmentfee %]</td>
314                         <td>[% IF ( loo.overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td>
315                         <td>[% IF ( loo.hidelostitems ) %]Hidden[% ELSE %]Shown[% END %]</td>
316                         <td>[% loo.reservefee %]</td>
317                         [% IF ( EnhancedMessagingPreferences ) %]
318                         <td style="white-space: nowrap; font-size:80%;">
319                             [% IF ( loo.messaging_prefs ) %]
320                               [% FOREACH prefs IN loo.messaging_prefs %]
321                                         [% FOREACH transport IN prefs.transports %]
322                                          [% IF ( transport.transport ) %]
323                                             [% IF ( prefs.Item_Due ) %]Item due
324                                             [% ELSIF ( prefs.Advance_Notice ) %]Advance notice
325                                             [% ELSIF ( prefs.Upcoming_Events ) %]Upcoming events
326                                             [% ELSIF ( prefs.Hold_Filled ) %]Hold filled
327                                             [% ELSIF ( prefs.Item_Check_in ) %]Item check-in
328                                             [% ELSIF ( prefs.Item_Checkout ) %]Item checkout
329                                                         [% ELSE %]Unknown
330                                                         [% END %]:
331                                                             <strong>[% transport.transport %]</strong><br />
332                                                          [% ELSE %]None<br />[% END %]
333                                         [% END %]
334                                 [% END %]
335                             [% ELSE %]
336                                 None
337                             [% END %]
338                         </td>
339                         [% END %]
340                         <td><a href="[% loo.script_name %]?op=add_form&amp;categorycode=[% loo.categorycode |url %]">Edit</a></td>
341                                                 <td><a href="[% loo.script_name %]?op=delete_confirm&amp;categorycode=[% loo.categorycode |url %]">Delete</a></td>
342                 </tr>
343                 [% END %]
344         </table>
345 [% ELSE %]
346         <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>
347 [% END %]
348 [% END %]
349
350 </div>
351 </div>
352 <div class="yui-b">
353 [% INCLUDE 'admin-menu.inc' %]
354 </div>
355 </div>
356 [% INCLUDE 'intranet-bottom.inc' %]