Bug 12309: Adapt zipcode wording to match the other patron pages
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / modborrowers.tt
1 [% USE KohaDates %]
2 [% INCLUDE 'doc-head-open.inc'%]
3 <title>Koha &rsaquo; Tools &rsaquo; Batch patron modification</title>
4 [% INCLUDE 'doc-head-close.inc' %]
5 [% INCLUDE 'calendar.inc' %]
6 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
7 [% INCLUDE 'datatables.inc' %]
8 <script type="text/javascript">
9 //<![CDATA[
10         var patron_attributes_lib = new Array();
11         var patron_attributes_values = new Array();
12         $(document).ready(function() {
13             [% IF borrowers %]
14                 $("#borrowerst").dataTable($.extend(true, {}, dataTablesDefaults, {
15                     "sDom": 't',
16                     [% IF ( op == 'show_results' ) %]
17                         "aoColumnDefs": [
18                             { 'sType': "title-string", 'aTargets' : [ 'title-string'] }
19                         ],
20                     [% ELSE %]
21                         "aoColumnDefs": [
22                             { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
23                             { 'sType': "title-string", 'aTargets' : [ 'title-string'] }
24                         ],
25                     [% END %]
26                     "bPaginate": false
27                 }));
28                 $("#selectallbutton").click(function() {
29                     $("#borrowerst").find("input:checkbox").each(function() {
30                         $(this).attr("checked", true);
31                     });
32                     return false;
33                 });
34                 $("#clearallbutton").click(function() {
35                     $("#borrowerst").find("input:checkbox").each(function() {
36                         $(this).attr("checked", false);
37                     });
38                     return false;
39                 });
40             [% END %]
41
42             var values = new Array();
43             var lib = new Array();
44             [% FOREACH pav IN patron_attributes_values %]
45                 values = new Array();
46                 lib = new Array();
47                 [% FOREACH option IN pav.options %]
48                     values.push("[% option.lib %]");
49                     lib.push("[% option.authorised_value %]");
50                 [% END %]
51                 patron_attributes_lib["[% pav.attribute_code %]"] = values;
52                 patron_attributes_values["[% pav.attribute_code %]"] = lib;
53             [% END %]
54
55             $('select[name="patron_attributes"]').change(function() {
56                 updateAttrValues(this);
57             } );
58
59             $('select[name="patron_attributes"]').change();
60
61         } );
62
63         function updateAttrValues (select_attr) {
64             var attr_code = $(select_attr).val();
65             var type = $(select_attr).find("option:selected").attr('data-type');
66             var category = $(select_attr).find("option:selected").attr('data-category');
67             var span = $(select_attr).parent().parent().find('span.patron_attributes_value');
68             var information_category_node = $(select_attr).parent().parent().find('span.information_category');
69             information_category_node.html("");
70             if ( category.length > 0 ) {
71                 information_category_node.html(_("This attribute will be only applied to the patron's category %s").format(category));
72             }
73             if ( type == 'select' ) {
74                 var options = '<option value = ""></option>';
75                 for ( var i = 0 ; i < patron_attributes_values[attr_code].length ; i++ ) {
76                     options += '<option value="'+patron_attributes_values[attr_code][i]+'">'+patron_attributes_lib[attr_code][i]+'</option>';
77                 }
78                 span.html('<select name="patron_attributes_value">' + options + '</select>');
79             } else {
80                 span.html('<input type="text" name="patron_attributes_value"/>')
81             }
82         }
83
84         function add_attributes() {
85             var li_node = $("li.attributes:last");
86             var li_clone = $(li_node).clone();
87             if ( $(li_clone).find("a.delete").length == 0 ) {
88                 $(li_clone).append('<a href="#" title="Delete" class="delete clear-field" onclick="del_attributes(this);return false;">Delete</a>');
89             }
90             $(li_clone).find('select[name="patron_attributes"]').change(function() {
91                 updateAttrValues(this);
92             } );
93
94             $(li_clone).find('select[name="patron_attributes"]').change();
95
96             $("#fields_list>ol").append(li_clone);
97             update_attr_values();
98         }
99
100         function del_attributes(a_node) {
101             $(a_node).parent('li').remove();
102             update_attr_values();
103         }
104
105         function update_attr_values() {
106             $("li.attributes").each(function(i) {
107                 $(this).find("input:checkbox").val("attr"+i+"_value");
108             });
109         }
110         function clearDate(nodeid) {
111             $("#"+nodeid).val("");
112         }
113
114 //]]>
115 </script>
116 </head>
117 <body>
118 [% INCLUDE 'header.inc' %]
119 [% INCLUDE 'cat-search.inc' %]
120
121 <div id="breadcrumbs">
122     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
123     <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
124     <a href="/cgi-bin/koha/tools/modborrowers.pl">Batch patron modification</a>
125 </div>
126
127 <div id="doc3" class="yui-t2">
128     <div id="bd">
129         <div id="yui-main">
130             <div class="yui-b">
131                 [% IF ( op == 'show_form' ) %]
132                 <h1>Batch patron modification</h1>
133                 <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/modborrowers.pl">
134                     <fieldset class="rows">
135                         <legend>Use a file</legend>
136                         <ol>
137                             <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
138                         </ol>
139                     </fieldset>
140
141                     [% IF patron_lists %]
142                     <fieldset class="rows">
143                         <legend>Or use a patron list</legend>
144                         <ol>
145                             <li>
146                                 <label for="patron_list_id">Patron list: </label>
147                                 <select id="patron_list_id" name="patron_list_id">
148                                     <option value=""></option>
149                                     [% FOREACH pl IN patron_lists %]
150                                         <option value="[% pl.patron_list_id %]">[% pl.name %]</option>
151                                     [% END %]
152                                 </select>
153                             </li>
154                         </ol>
155                     </fieldset>
156                     [% END %]
157
158                     <fieldset class="rows">
159                         <legend>Or list cardnumbers one by one</legend>
160                         <ol>
161                             <li>
162                               <label for="cardnumberlist">Card number list (one cardnumber per line): </label>
163                               <textarea rows="10" cols="30" id="cardnumberlist" name="cardnumberlist">[% cardnumberlist %]</textarea>
164                             </li>
165                         </ol>
166                     </fieldset>
167                     <input type="hidden" name="op" value="show" />
168                     <fieldset class="action">
169                         <input type="submit" value="Continue" class="button" />
170                         <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
171                     </fieldset>
172                 </form>
173                 [% END %]
174
175                 [% IF ( op == 'show' or op == 'show_results' ) %]
176                     [% IF ( op == 'show' ) %]
177                         <h1>Batch patrons modification</h1>
178                     [% ELSE %]
179                         <h1>Batch patrons results</h1>
180                     [% END %]
181                     [% IF ( notfoundcardnumbers ) %]
182                         <div class="dialog alert"><p>Warning, the following cardnumbers were not found:</p></div>
183                         <table style="margin:auto;">
184                             <thead>
185                                 <tr><th>Cardnumbers not found</th></tr>
186                             </thead>
187                             <tbody>
188                                 [% FOREACH notfoundcardnumber IN notfoundcardnumbers %]
189                                     <tr><td>[% notfoundcardnumber.cardnumber %]</td></tr>
190                                 [% END %]
191                             </tbody>
192                         </table>
193                     [% END %]
194
195                     [% IF ( op == 'show_results' ) %]
196                         [% IF ( errors ) %]
197                             <div class="dialog alert">
198                             <h4>Errors occurred:</h4>
199                             <ul class="warnings">
200                             [% FOREACH error IN errors %]
201                                 [% IF ( error.error == 'can_not_update' ) %]
202                                     <li>Can not update patron with borrowernumber [% error.borrowernumber %]</li>
203                                 [% ELSE %]
204                                     <li>[% error.error %]</li>
205                                 [% END %]
206                             [% END %]
207                             </ul>
208                             </div>
209                         [% END %]
210                     [% END %]
211
212                     [% IF ( op == 'show' ) %]
213                     <form name="f" action="modborrowers.pl" method="post">
214                         <input type="hidden" name="op" value="do" />
215                         [% IF ( borrowers ) %]
216                             <div id="toolbar"><a id="selectallbutton" href="#">Select all</a> | <a id="clearallbutton" href="#">Clear all</a></div>
217                         [% END %]
218                     [% END %]
219                         [% IF borrowers %]
220                             <div id="cataloguing_additem_itemlist">
221                                 <div style="overflow:auto">
222                                     <table id="borrowerst">
223                                         <thead>
224                                             <tr>
225                                                 [% IF ( op == 'show' ) %]
226                                                     <th>&nbsp;</th>
227                                                 [% END %]
228                                                 <th>Card number</th>
229                                                 <th>Surname</th>
230                                                 <th>First name</th>
231                                                 <th>Library</th>
232                                                 <th>Category</th>
233                                                 <th>City</th>
234                                                 <th>State</th>
235                                                 <th>Zip/Postal code</th>
236                                                 <th>Country</th>
237                                                 <th class="title-string">Registration date</th>
238                                                 <th class="title-string">Expiry date</th>
239                                                 [% FOREACH attrh IN attributes_header %]
240                                                     <th>[% attrh.attribute %]</th>
241                                                 [% END %]
242                                             </tr>
243                                         </thead>
244                                         <tbody>
245                                             [% FOREACH borrower IN borrowers %]
246                                                 <tr>
247                                                     [% IF ( op == 'show' ) %]
248                                                         <td><input type="checkbox" name="borrowernumber" value="[% borrower.borrowernumber %]" checked="checked" /></td>
249                                                     [% END %]
250                                                     <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrower.borrowernumber %]">[% borrower.cardnumber %]</a></td>
251                                                     <td>[% borrower.surname %]</td>
252                                                     <td>[% borrower.firstname %]</td>
253                                                     <td>[% borrower.branchname %]</td>
254                                                     <td>[% borrower.categorycode %]</td>
255                                                     <td>[% borrower.city %]</td>
256                                                     <td>[% borrower.state %]</td>
257                                                     <td>[% borrower.zipcode %]</td>
258                                                     <td>[% borrower.country %]</td>
259                                                     <td><span title="[% borrower.dateenrolled %]">[% borrower.dateenrolled | $KohaDates %]</span></td>
260                                                     <td><span title="[% borrower.dateexpiry %]">[% borrower.dateexpiry | $KohaDates %]</span></td>
261                                                     [% FOREACH pa IN borrower.patron_attributes %]
262                                                         [% IF ( pa.code ) %]
263                                                             <td>[% pa.code %]=[% pa.value %]</td>
264                                                         [% ELSE %]
265                                                             <td></td>
266                                                         [% END %]
267                                                     [% END %]
268                                                 </tr>
269                                             [% END %]
270                                         </tbody>
271                                     </table>
272                                 </div>
273                             </div>
274
275                             [% IF ( op == 'show' ) %]
276                             <div id="cataloguing_additem_newitem">
277                                 <h2>Edit patrons</h2>
278                                 <div class="hint">Checking the box right next the label will disable the entry and delete the values of that field on all selected patrons</div>
279                                 <fieldset class="rows" id="fields_list">
280                                     <ol>
281                                         [% FOREACH field IN fields %]
282                                         <li>
283                                             [% IF ( field.mandatory ) %]
284                                             <label for="[% field.name %]" class="required">
285                                             [% ELSE %]
286                                             <label for="[% field.name %]">
287                                             [% END %]
288                                             [% SWITCH ( field.name ) %]
289                                                 [% CASE 'surname' %]
290                                                 Surname:
291                                                 [% CASE 'firstname' %]
292                                                 First name:
293                                                 [% CASE 'branchcode' %]
294                                                 Library:
295                                                 [% CASE 'categorycode' %]
296                                                 Category
297                                                 [% CASE 'city' %]
298                                                 City
299                                                 [% CASE 'state' %]
300                                                 State
301                                                 [% CASE 'zipcode' %]
302                                                 Zip/Postal code
303                                                 [% CASE 'country' %]
304                                                 Country
305                                                 [% CASE 'sort1' %]
306                                                 Sort 1:
307                                                 [% CASE 'sort2' %]
308                                                 Sort 2:
309                                                 [% CASE 'dateenrolled' %]
310                                                 Registration date:
311                                                 [% CASE 'dateexpiry' %]
312                                                 Expiry date:
313                                                 [% CASE 'borrowernotes' %]
314                                                 Circulation note:
315                                             [% END %]
316                                             </label>
317                                             [% IF field.mandatory %]
318                                                 <input type="checkbox" title="This field is mandatory" name="disable_input" value="[% field.name %]" readonly="readonly" onclick="return false;" />
319                                             [% ELSE %]
320                                                 <input type="checkbox" title="Check to delete this field" name="disable_input" value="[% field.name %]" />
321                                             [% END %]
322                                             [% IF ( field.type == 'text' ) %]
323                                                 <input type="text" name="[% field.name %]" value="" />
324                                             [% END %]
325                                             [% IF ( field.type == 'select' ) %]
326                                                 [% IF field.option.size %]
327                                                     <select name="[% field.name %]" >
328                                                         [% FOREACH opt IN field.option %]
329                                                             <option value="[% opt.value %]">[% opt.lib %]</option>
330                                                         [% END %]
331                                                     </select>
332                                                 [% ELSE %]
333                                                     There is no value defined for [% field.name %]
334                                                 [% END %]
335                                             [% END %]
336                                             [% IF ( field.type == 'date' ) %]
337                                                 <input type="text" name="[% field.name %]" id="[% field.name %]" value="" size="10" maxlength="10" readonly="readonly" class="datepicker" />
338                                                 <a href="#" class="clear-field" onclick="clearDate('[% field.name %]');return false;">Clear</a>
339                                                 [% END %]
340                                         </li>
341                                         [% END %]
342                                         [% IF ( patron_attributes_codes ) %]
343                                             <li class="attributes">
344                                                 <label style="width:auto;">Attribute:
345                                                     <select name="patron_attributes">
346                                                         [% FOREACH pac IN patron_attributes_codes %]
347                                                             <option value="[% pac.attribute_code %]" data-type="[% pac.type %]" data-category="[% pac.category_lib %]">[% pac.attribute_lib %]</option>
348                                                         [% END %]
349                                                     </select>
350                                                 </label>
351                                                 <input type="checkbox" title="check to delete this field" name="disable_input" value="attr0_value" />
352                                                 <span class="patron_attributes_value"></span>
353                                                 <a href="#" class="clone-field" title="Add an attribute" onclick="add_attributes(); return false;">New</a>
354                                                 <span class="information_category hint" style="width:25%;float:right;"></span>
355                                             </li>
356                                         [% END %]
357                                     </ol>
358                                 </fieldset>
359                                 <fieldset class="action">
360                                     <input type="submit" name="mainformsubmit" value="Save" />
361                                     <a href="/cgi-bin/koha/tools/modborrowers.pl" class="cancel">Cancel</a>
362                                 </fieldset>
363                             </div>
364                         </form>
365                         [% END %]
366                     [% END %]
367                 [% END %]
368                 [% IF ( op == 'show_results' ) %]
369                 <p>
370                     <a href="/cgi-bin/koha/tools/modborrowers.pl" title="New batch patrons modification">New batch patron modification</a>
371                 </p>
372                 [% END %]
373             </div>
374             </div>
375             <div class="yui-b">
376                 [% INCLUDE 'tools-menu.inc' %]
377             </div>
378         </div>
379     </div>
380 </div>
381 </body>
382 </html>