4 [% INCLUDE 'doc-head-open.inc'%]
5 <title>Koha › Tools › Batch patron modification</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 [% INCLUDE 'calendar.inc' %]
8 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
9 [% INCLUDE 'datatables.inc' %]
10 <script type="text/javascript">
12 var patron_attributes_lib = new Array();
13 var patron_attributes_values = new Array();
14 $(document).ready(function() {
16 $("#borrowerst").dataTable($.extend(true, {}, dataTablesDefaults, {
18 [% IF ( op == 'show_results' ) %]
20 { 'sType': "title-string", 'aTargets' : [ 'title-string'] }
24 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
25 { 'sType': "title-string", 'aTargets' : [ 'title-string'] }
30 $("#selectallbutton").click(function() {
31 $("#borrowerst").find("input:checkbox").each(function() {
32 $(this).prop("checked", true);
36 $("#clearallbutton").click(function() {
37 $("#borrowerst").find("input:checkbox").each(function() {
38 $(this).prop("checked", false);
44 var values = new Array();
45 var lib = new Array();
46 [% FOREACH pav IN patron_attributes_values %]
49 [% FOREACH option IN pav.options %]
50 values.push("[% option.lib %]");
51 lib.push("[% option.authorised_value %]");
53 patron_attributes_lib["[% pav.attribute_code %]"] = values;
54 patron_attributes_values["[% pav.attribute_code %]"] = lib;
57 $('select[name="patron_attributes"]').change(function() {
58 updateAttrValues(this);
61 $('select[name="patron_attributes"]').change();
63 $(".clear-date").on("click",function(e){
65 var fieldID = this.id.replace("clear-date-","");
66 $("#" + fieldID).val("");
68 $("#cataloguing_additem_newitem").on("click",".add_attributes",function(e){
72 $("#cataloguing_additem_newitem").on("click",".del_attributes",function(e){
78 function updateAttrValues (select_attr) {
79 var attr_code = $(select_attr).val();
80 var type = $(select_attr).find("option:selected").attr('data-type');
81 var category = $(select_attr).find("option:selected").attr('data-category');
82 var span = $(select_attr).parent().parent().find('span.patron_attributes_value');
83 var information_category_node = $(select_attr).parent().parent().find('span.information_category');
84 information_category_node.html("");
85 if ( category.length > 0 ) {
86 information_category_node.html(_("This attribute will be only applied to the patron's category %s").format(category));
88 if ( type == 'select' ) {
89 var options = '<option value = ""></option>';
90 for ( var i = 0 ; i < patron_attributes_values[attr_code].length ; i++ ) {
91 options += '<option value="'+patron_attributes_values[attr_code][i]+'">'+patron_attributes_lib[attr_code][i]+'</option>';
93 span.html('<select name="patron_attributes_value">' + options + '</select>');
95 span.html('<input type="text" name="patron_attributes_value"/>')
99 function add_attributes() {
100 var li_node = $("li.attributes:last");
101 var li_clone = $(li_node).clone();
102 if ( $(li_clone).find("a.del_attributes").length == 0 ) {
103 $(li_clone).append('<a href="#" title="Delete" class="del_attributes"><i class="fa fa-fw fa-trash"></i> Delete</a>');
105 $(li_clone).find('select[name="patron_attributes"]').change(function() {
106 updateAttrValues(this);
109 $(li_clone).find('select[name="patron_attributes"]').change();
111 $("#fields_list>ol").append(li_clone);
112 update_attr_values();
115 function del_attributes(a_node) {
116 $(a_node).parent('li').remove();
117 update_attr_values();
120 function update_attr_values() {
121 $("li.attributes").each(function(i) {
122 $(this).find("input:checkbox").val("attr"+i+"_value");
125 function clearDate(nodeid) {
126 $("#"+nodeid).val("");
132 <body id="tools_modborrowers" class="tools">
133 [% INCLUDE 'header.inc' %]
134 [% INCLUDE 'cat-search.inc' %]
136 <div id="breadcrumbs">
137 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
138 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
139 <a href="/cgi-bin/koha/tools/modborrowers.pl">Batch patron modification</a>
142 <div id="doc3" class="yui-t2">
146 [% IF ( op == 'show_form' ) %]
147 <h1>Batch patron modification</h1>
148 <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/modborrowers.pl">
149 <fieldset class="rows">
150 <legend>Use a file</legend>
152 <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
156 [% IF patron_lists %]
157 <fieldset class="rows">
158 <legend>Or use a patron list</legend>
161 <label for="patron_list_id">Patron list: </label>
162 <select id="patron_list_id" name="patron_list_id">
163 <option value=""></option>
164 [% FOREACH pl IN patron_lists %]
165 <option value="[% pl.patron_list_id %]">[% pl.name %]</option>
173 <fieldset class="rows">
174 <legend>Or list cardnumbers one by one</legend>
177 <label for="cardnumberlist">Card number list (one cardnumber per line): </label>
178 <textarea rows="10" cols="30" id="cardnumberlist" name="cardnumberlist">[% cardnumberlist %]</textarea>
182 <input type="hidden" name="op" value="show" />
183 <fieldset class="action">
184 <input type="submit" value="Continue" class="button" />
185 <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
190 [% IF ( op == 'show') && (!borrowers) && (!notfoundcardnumbers) # Alert if no patrons given%]
191 [% op = 'noshow' # Change op to prevent display in code below %]
192 <h1>Batch patrons modification</h1>
193 <div class="dialog alert">
194 <p>No patron card numbers given.</p>
195 <form action="/cgi-bin/koha/tools/modborrowers.pl" method="get">
196 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
199 [% END #Alert if no patrons %]
201 [% IF ( op == 'show' or op == 'show_results' ) %]
202 [% IF ( op == 'show' ) %]
203 <h1>Batch patrons modification</h1>
205 <h1>Batch patrons results</h1>
207 [% IF ( notfoundcardnumbers ) %]
208 <div class="dialog alert"><p>Warning, the following cardnumbers were not found:</p></div>
209 <table style="margin:auto;">
211 <tr><th>Cardnumbers not found</th></tr>
214 [% FOREACH notfoundcardnumber IN notfoundcardnumbers %]
215 <tr><td>[% notfoundcardnumber.cardnumber %]</td></tr>
221 [% IF ( op == 'show_results' ) %]
223 <div class="dialog alert">
224 <h4>Errors occurred:</h4>
225 <ul class="warnings">
226 [% FOREACH error IN errors %]
227 [% IF ( error.error == 'can_not_update' ) %]
228 <li>Can not update patron.
229 [% IF ( error.cardnumber ) %] Cardnumber: [% error.cardnumber %] [% END %]
230 (Borrowernumber: [% error.borrowernumber %])
233 <li>[% error.error %]</li>
241 [% IF ( op == 'show' ) %]
242 <form name="f" action="modborrowers.pl" method="post">
243 <input type="hidden" name="op" value="do" />
244 [% IF ( borrowers ) %]
245 <div id="toolbar"><a id="selectallbutton" href="#"><i class="fa fa-check"></i> Select all</a> | <a id="clearallbutton" href="#"><i class="fa fa-remove"></i> Clear all</a></div>
249 <div id="cataloguing_additem_itemlist">
250 <div style="overflow:auto">
251 <table id="borrowerst">
254 [% IF ( op == 'show' ) %]
264 <th>ZIP/Postal code</th>
266 <th class="title-string">Registration date</th>
267 <th class="title-string">Expiry date</th>
268 <th>Circulation note</th>
270 [% FOREACH attrh IN attributes_header %]
271 <th>[% attrh.attribute %]</th>
276 [% FOREACH borrower IN borrowers %]
278 [% IF ( op == 'show' ) %]
279 <td><input type="checkbox" name="borrowernumber" value="[% borrower.borrowernumber %]" checked="checked" /></td>
281 <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrower.borrowernumber %]">[% borrower.cardnumber %]</a></td>
282 <td>[% borrower.surname %]</td>
283 <td>[% borrower.firstname %]</td>
284 <td>[% Branches.GetName( borrower.branchcode ) %]</td>
285 <td>[% borrower.categorycode %]</td>
286 <td>[% borrower.city %]</td>
287 <td>[% borrower.state %]</td>
288 <td>[% borrower.zipcode %]</td>
289 <td>[% borrower.country %]</td>
290 <td><span title="[% borrower.dateenrolled %]">[% borrower.dateenrolled | $KohaDates %]</span></td>
291 <td><span title="[% borrower.dateexpiry %]">[% borrower.dateexpiry | $KohaDates %]</span></td>
292 <td>[% borrower.borrowernotes %]</td>
293 <td>[% borrower.opacnote %]</td>
294 [% FOREACH pa IN borrower.patron_attributes %]
296 <td>[% pa.code %]=[% pa.value %]</td>
308 [% IF ( op == 'show' ) %]
309 <div id="cataloguing_additem_newitem">
310 <h2>Edit patrons</h2>
311 <div class="hint">Checking the box right next to the label will disable the entry and delete the values of that field on all selected patrons</div>
312 <fieldset class="rows" id="fields_list">
314 [% FOREACH field IN fields %]
316 [% IF ( field.mandatory ) %]
317 <label for="[% field.name %]" class="required">
319 <label for="[% field.name %]">
321 [% SWITCH ( field.name ) %]
324 [% CASE 'firstname' %]
326 [% CASE 'branchcode' %]
328 [% CASE 'categorycode' %]
342 [% CASE 'dateenrolled' %]
344 [% CASE 'dateexpiry' %]
346 [% CASE 'borrowernotes' %]
348 [% CASE 'opacnote' %]
352 [% IF ( field.type == 'text' ) %]
353 <input type="text" name="[% field.name %]" value="" />
355 [% IF ( field.type == 'select' ) %]
356 [% IF field.option.size %]
357 <select name="[% field.name %]" >
358 [% FOREACH opt IN field.option %]
359 <option value="[% opt.value %]">[% opt.lib %]</option>
363 There is no value defined for [% field.name %]
366 [% IF ( field.type == 'date' ) %]
367 <input type="text" name="[% field.name %]" id="[% field.name %]" value="" size="10" maxlength="10" class="datepicker" />
368 <a href="#" class="clear-date" id="clear-date-[% field.name %]" ><i class="fa fa-fw fa-trash"></i> Clear</a>
370 [% IF field.mandatory %]
371 <input type="checkbox" title="This field is mandatory" name="disable_input" value="[% field.name %]" disabled="disabled" readonly="readonly" />
372 <span class="required">Required fields cannot be cleared</span>
374 <input type="checkbox" title="Check to delete this field" name="disable_input" value="[% field.name %]" />
378 [% IF ( patron_attributes_codes ) %]
379 <li class="attributes">
380 <label style="width:auto;">Attribute:
381 <select name="patron_attributes">
382 [% FOREACH pac IN patron_attributes_codes %]
383 <option value="[% pac.attribute_code %]" data-type="[% pac.type %]" data-category="[% pac.category_lib %]">[% pac.attribute_lib %]</option>
387 <input type="checkbox" title="check to delete this field" name="disable_input" value="attr0_value" />
388 <span class="patron_attributes_value"></span>
389 <a href="#" class="add_attributes" title="Add an attribute"><i class="fa fa-fw fa-plus"></i> New</a>
390 <span class="information_category hint" style="width:25%;float:right;"></span>
395 <fieldset class="action">
396 <input type="submit" name="mainformsubmit" value="Save" />
397 <a href="/cgi-bin/koha/tools/modborrowers.pl" class="cancel">Cancel</a>
404 [% IF ( op == 'show_results' ) %]
406 <a href="/cgi-bin/koha/tools/modborrowers.pl" title="New batch patrons modification">New batch patron modification</a>
412 [% INCLUDE 'tools-menu.inc' %]
415 [% INCLUDE 'intranet-bottom.inc' %]