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 selected_option = $(select_attr).find("option:selected");
81 var type = $(selected_option).attr('data-type');
82 var category = $(selected_option).attr('data-category');
83 var li_node = $(select_attr).parent().parent();
84 var span = $(li_node).find('span.patron_attributes_value');
85 var information_category_node = $(li_node).find('span.information_category');
86 information_category_node.html("");
87 if ( category && category.length > 0 ) {
88 information_category_node.html(_("This attribute will be only applied to the patron's category %s").format(category));
90 var disable_input_node = $(li_node).find("input:checkbox[name='disable_input']");
91 if ( type == 'select' ) {
92 var options = '<option value = ""></option>';
93 for ( var i = 0 ; i < patron_attributes_values[attr_code].length ; i++ ) {
94 options += '<option value="'+patron_attributes_values[attr_code][i]+'">'+patron_attributes_lib[attr_code][i]+'</option>';
96 span.html('<select name="patron_attributes_value">' + options + '</select>');
97 $(disable_input_node).show();
98 } else if ( $(selected_option).val() != "" ) {
99 span.html('<input type="text" name="patron_attributes_value"/>');
100 $(disable_input_node).show();
103 $(disable_input_node).hide();
107 function add_attributes() {
108 var li_node = $("li.attributes:last");
109 var li_clone = $(li_node).clone();
110 if ( $(li_clone).find("a.del_attributes").length == 0 ) {
111 $(li_clone).append('<a href="#" title="Delete" class="del_attributes"><i class="fa fa-fw fa-trash"></i> ' + _("Delete") + '</a>');
113 $(li_clone).find('select[name="patron_attributes"]').change(function() {
114 updateAttrValues(this);
117 $(li_clone).find('select[name="patron_attributes"]').change();
119 $("#fields_list>ol").append(li_clone);
120 update_attr_values();
123 function del_attributes(a_node) {
124 $(a_node).parent('li').remove();
125 update_attr_values();
128 function update_attr_values() {
129 $("li.attributes").each(function(i) {
130 $(this).find("input:checkbox").val("attr"+i+"_value");
133 function clearDate(nodeid) {
134 $("#"+nodeid).val("");
140 <body id="tools_modborrowers" class="tools">
141 [% INCLUDE 'header.inc' %]
142 [% INCLUDE 'cat-search.inc' %]
144 <div id="breadcrumbs">
145 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
146 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
147 <a href="/cgi-bin/koha/tools/modborrowers.pl">Batch patron modification</a>
150 <div id="doc3" class="yui-t2">
154 [% IF ( op == 'show_form' ) %]
155 <h1>Batch patron modification</h1>
156 <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/modborrowers.pl">
157 <fieldset class="rows">
158 <legend>Use a file</legend>
160 <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
164 [% IF patron_lists %]
165 <fieldset class="rows">
166 <legend>Or use a patron list</legend>
169 <label for="patron_list_id">Patron list: </label>
170 <select id="patron_list_id" name="patron_list_id">
171 <option value=""></option>
172 [% FOREACH pl IN patron_lists %]
173 <option value="[% pl.patron_list_id %]">[% pl.name %]</option>
181 <fieldset class="rows">
182 <legend>Or list cardnumbers one by one</legend>
185 <label for="cardnumberlist">Card number list (one cardnumber per line): </label>
186 <textarea rows="10" cols="30" id="cardnumberlist" name="cardnumberlist">[% cardnumberlist %]</textarea>
190 <input type="hidden" name="op" value="show" />
191 <fieldset class="action">
192 <input type="submit" value="Continue" class="button" />
193 <a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
198 [% IF ( op == 'show') && (!borrowers) && (!notfoundcardnumbers) # Alert if no patrons given%]
199 [% op = 'noshow' # Change op to prevent display in code below %]
200 <h1>Batch patrons modification</h1>
201 <div class="dialog alert">
202 <p>No patron card numbers given.</p>
203 <form action="/cgi-bin/koha/tools/modborrowers.pl" method="get">
204 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
207 [% END #Alert if no patrons %]
209 [% IF ( op == 'show' or op == 'show_results' ) %]
210 [% IF ( op == 'show' ) %]
211 <h1>Batch patrons modification</h1>
213 <h1>Batch patrons results</h1>
215 [% IF ( notfoundcardnumbers ) %]
216 <div class="dialog alert"><p>Warning, the following cardnumbers were not found:</p></div>
217 <table style="margin:auto;">
219 <tr><th>Cardnumbers not found</th></tr>
222 [% FOREACH notfoundcardnumber IN notfoundcardnumbers %]
223 <tr><td>[% notfoundcardnumber.cardnumber %]</td></tr>
229 [% IF ( op == 'show_results' ) %]
231 <div class="dialog alert">
232 <h4>Errors occurred:</h4>
233 <ul class="warnings">
234 [% FOREACH error IN errors %]
235 [% IF ( error.error == 'can_not_update' ) %]
236 <li>Can not update patron.
237 [% IF ( error.cardnumber ) %] Cardnumber: [% error.cardnumber %] [% END %]
238 (Borrowernumber: [% error.borrowernumber %])
241 <li>[% error.error %]</li>
249 [% IF ( op == 'show' ) %]
250 <form name="f" action="modborrowers.pl" method="post">
251 <input type="hidden" name="op" value="do" />
252 [% IF ( borrowers ) %]
253 <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>
257 <div id="cataloguing_additem_itemlist">
258 <div style="overflow:auto">
259 <table id="borrowerst">
262 [% IF ( op == 'show' ) %]
272 <th>ZIP/Postal code</th>
274 <th class="title-string">Registration date</th>
275 <th class="title-string">Expiry date</th>
276 <th>Circulation note</th>
278 [% FOREACH attrh IN attributes_header %]
279 <th>[% attrh.attribute %]</th>
284 [% FOREACH borrower IN borrowers %]
286 [% IF ( op == 'show' ) %]
287 <td><input type="checkbox" name="borrowernumber" value="[% borrower.borrowernumber %]" checked="checked" /></td>
289 <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrower.borrowernumber %]">[% borrower.cardnumber %]</a></td>
290 <td>[% borrower.surname %]</td>
291 <td>[% borrower.firstname %]</td>
292 <td>[% Branches.GetName( borrower.branchcode ) %]</td>
293 <td>[% borrower.category_description %]</td>
294 <td>[% borrower.city %]</td>
295 <td>[% borrower.state %]</td>
296 <td>[% borrower.zipcode %]</td>
297 <td>[% borrower.country %]</td>
298 <td><span title="[% borrower.dateenrolled %]">[% borrower.dateenrolled | $KohaDates %]</span></td>
299 <td><span title="[% borrower.dateexpiry %]">[% borrower.dateexpiry | $KohaDates %]</span></td>
300 <td>[% borrower.borrowernotes %]</td>
301 <td>[% borrower.opacnote %]</td>
302 [% FOREACH pa IN borrower.patron_attributes %]
304 <td>[% pa.code %]=[% pa.value %]</td>
316 [% IF ( op == 'show' ) %]
317 <div id="cataloguing_additem_newitem">
318 <h2>Edit patrons</h2>
319 <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>
320 <fieldset class="rows" id="fields_list">
322 [% FOREACH field IN fields %]
324 [% IF ( field.mandatory ) %]
325 <label for="[% field.name %]" class="required">
327 <label for="[% field.name %]">
329 [% SWITCH ( field.name ) %]
332 [% CASE 'firstname' %]
334 [% CASE 'branchcode' %]
336 [% CASE 'categorycode' %]
350 [% CASE 'dateenrolled' %]
352 [% CASE 'dateexpiry' %]
354 [% CASE 'borrowernotes' %]
356 [% CASE 'opacnote' %]
360 [% IF ( field.type == 'text' ) %]
361 <input type="text" name="[% field.name %]" value="" />
363 [% IF ( field.type == 'select' ) %]
364 [% IF field.option.size %]
365 <select name="[% field.name %]" >
366 [% FOREACH opt IN field.option %]
367 <option value="[% opt.value %]">[% opt.lib %]</option>
371 There is no value defined for [% field.name %]
374 [% IF ( field.type == 'date' ) %]
375 <input type="text" name="[% field.name %]" id="[% field.name %]" value="" size="10" maxlength="10" class="datepicker" />
376 <a href="#" class="clear-date" id="clear-date-[% field.name %]" ><i class="fa fa-fw fa-trash"></i> Clear</a>
378 [% IF field.mandatory %]
379 <input type="checkbox" title="This field is mandatory" name="disable_input" value="[% field.name %]" disabled="disabled" readonly="readonly" />
380 <span class="required">Required fields cannot be cleared</span>
382 <input type="checkbox" title="Check to delete this field" name="disable_input" value="[% field.name %]" />
386 [% IF ( patron_attributes_codes ) %]
387 <li class="attributes">
388 <label style="width:auto;">Attribute:
389 <select name="patron_attributes">
390 <option value=""></option>
391 [% FOREACH pac IN patron_attributes_codes %]
392 <option value="[% pac.attribute_code %]" data-type="[% pac.type %]" data-category="[% pac.category_lib %]">[% pac.attribute_lib %]</option>
396 <input type="checkbox" title="check to delete this field" name="disable_input" value="attr0_value" />
397 <span class="patron_attributes_value"></span>
398 <a href="#" class="add_attributes" title="Add an attribute"><i class="fa fa-fw fa-plus"></i> New</a>
399 <span class="information_category hint" style="width:25%;float:right;"></span>
404 <fieldset class="action">
405 <input type="submit" name="mainformsubmit" value="Save" />
406 <a href="/cgi-bin/koha/tools/modborrowers.pl" class="cancel">Cancel</a>
413 [% IF ( op == 'show_results' ) %]
415 <a href="/cgi-bin/koha/tools/modborrowers.pl" title="New batch patrons modification">New batch patron modification</a>
421 [% INCLUDE 'tools-menu.inc' %]
424 [% INCLUDE 'intranet-bottom.inc' %]