Kyle M Hall
80897930b7
This patch adds a more extensible and flexible debarments system to Koha. The fields borrowers.debarred and borrowers.debarredcomment are retained for compatibility and speed. This system supports having debarments for multiple reasons. There are currently three types of debarments: OVERDUES - Generated by overdue_notices.pl if the notice should debar a patron SUSPENSION - A punative debarment generated on checkin via an issuing rule MANUAL - A debarment created manually by a librarian OVERDUE debarments are cleared automatically when all overdue items have been returned, if the new system preference AutoRemoveOverduesRestrictions is enabled. It is disabled by default to retain current default functionality. Whenever a borrowers debarments are modified, the system updates the borrowers debarment fields with the highest expiration from all the borrowers debarments, and concatenates the comments from the debarments together. Test plan: 1) Apply patch 2) Run updatedatabase.pl 3) Verify the borrower_debarments table has been created and populated with the pre-existing debarments 4) Run t/db_dependent/Borrower_Debarments.t 5) Manually debar a patron, with an expiration date 6) Verify the patron cannot be issued to 7) Add another manual debarment with a different expiration date 8) Verify the 'restricted' message lists the date farthest into the future 9) Add another manual debarment with no expiration date 10) Verify the borrower is now debarred indefinitely 11) Delete the indefinite debarment 12) Verify the debarment message lists an expiration date dagain 13) Enable the new system preference AutoRemoveOverduesRestrictions 14) Set an overdue notice to debar after 1 day of being overdue 15) Check out an item to a patron and backdate the due date to yesterday 16) Run overdue_notices.pl 17) Verify the OVERDUES debarment was created 18) Return the item 19) Verify the OVERDUES debarment was removed 20) Disable AutoRemoveOverduesRestrictions 21) Repeat steps 15 though 18, verify the OVERDUES debarment was *not* removed 22) Add issuing rules so that an overdue item causes a temporary debarment 23) Check out an item to a patron and backdate the due date by a year 24) Return the item 25) Verify the SUSPENSION debarment was added to the patron Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
362 lines
20 KiB
Text
362 lines
20 KiB
Text
[% USE KohaDates %]
|
|
[% INCLUDE 'doc-head-open.inc'%]
|
|
<title>Koha › Tools › Batch patron modification</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
[% INCLUDE 'calendar.inc' %]
|
|
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/en/css/datatables.css" />
|
|
<script type="text/javascript" src="[% interface %]/[% theme %]/en/lib/jquery/plugins/jquery.dataTables.min.js"></script>
|
|
[% INCLUDE 'datatables-strings.inc' %]
|
|
<script type="text/javascript" src="[% interface %]/[% theme %]/en/js/datatables.js"></script>
|
|
<script type="text/javascript">
|
|
//<![CDATA[
|
|
[% IF (dateformat == 'metric') %]dt_add_type_uk_date();[% END %]
|
|
var patron_attributes_lib = new Array();
|
|
var patron_attributes_values = new Array();
|
|
$(document).ready(function() {
|
|
[% IF borrowers %]
|
|
$("#borrowerst").dataTable($.extend(true, {}, dataTablesDefaults, {
|
|
"sDom": 't',
|
|
"aoColumnDefs": [
|
|
{ "aTargets": [ 0 ], "bSortable": false, "bSearchable": false }
|
|
],
|
|
"bPaginate": false
|
|
}));
|
|
$("#selectallbutton").click(function() {
|
|
$("#borrowerst").find("input:checkbox").each(function() {
|
|
$(this).attr("checked", true);
|
|
});
|
|
return false;
|
|
});
|
|
$("#clearallbutton").click(function() {
|
|
$("#borrowerst").find("input:checkbox").each(function() {
|
|
$(this).attr("checked", false);
|
|
});
|
|
return false;
|
|
});
|
|
[% END %]
|
|
|
|
var values = new Array();
|
|
var lib = new Array();
|
|
[% FOREACH pav IN patron_attributes_values %]
|
|
values = new Array();
|
|
lib = new Array();
|
|
[% FOREACH option IN pav.options %]
|
|
values.push("[% option.lib %]");
|
|
lib.push("[% option.authorised_value %]");
|
|
[% END %]
|
|
patron_attributes_lib["[% pav.attribute_code %]"] = values;
|
|
patron_attributes_values["[% pav.attribute_code %]"] = lib;
|
|
[% END %]
|
|
|
|
$('select[name="patron_attributes"]').change(function() {
|
|
updateAttrValues(this);
|
|
} );
|
|
|
|
$('select[name="patron_attributes"]').change();
|
|
|
|
} );
|
|
|
|
function updateAttrValues (select_attr) {
|
|
var attr_code = $(select_attr).val();
|
|
var type = $(select_attr).find("option:selected").attr('data-type');
|
|
var category = $(select_attr).find("option:selected").attr('data-category');
|
|
var span = $(select_attr).parent().parent().find('span.patron_attributes_value');
|
|
var information_category_node = $(select_attr).parent().parent().find('span.information_category');
|
|
information_category_node.html("");
|
|
if ( category.length > 0 ) {
|
|
information_category_node.html(_("This attribute will be only applied to the patron\'s category") +' "' + category + '"');
|
|
}
|
|
if ( type == 'select' ) {
|
|
var options = '<option value = ""></option>';
|
|
for ( var i = 0 ; i < patron_attributes_values[attr_code].length ; i++ ) {
|
|
options += '<option value="'+patron_attributes_values[attr_code][i]+'">'+patron_attributes_lib[attr_code][i]+'</option>';
|
|
}
|
|
span.html('<select name="patron_attributes_value">' + options + '</select>');
|
|
} else {
|
|
span.html('<input type="text" name="patron_attributes_value"/>')
|
|
}
|
|
}
|
|
|
|
function add_attributes() {
|
|
var li_node = $("li.attributes:last");
|
|
var li_clone = $(li_node).clone();
|
|
if ( $(li_clone).find("a.delete").length == 0 ) {
|
|
$(li_clone).append('<a href="#" title="Delete" class="delete clear-field" onclick="del_attributes(this);return false;">Delete</a>');
|
|
}
|
|
$(li_clone).find('select[name="patron_attributes"]').change(function() {
|
|
updateAttrValues(this);
|
|
} );
|
|
|
|
$(li_clone).find('select[name="patron_attributes"]').change();
|
|
|
|
$("#fields_list>ol").append(li_clone);
|
|
update_attr_values();
|
|
}
|
|
|
|
function del_attributes(a_node) {
|
|
$(a_node).parent('li').remove();
|
|
update_attr_values();
|
|
}
|
|
|
|
function update_attr_values() {
|
|
$("li.attributes").each(function(i) {
|
|
$(this).find("input:checkbox").val("attr"+i+"_value");
|
|
});
|
|
}
|
|
function clearDate(nodeid) {
|
|
$("#"+nodeid).val("");
|
|
}
|
|
|
|
//]]>
|
|
</script>
|
|
</head>
|
|
<body>
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'cat-search.inc' %]
|
|
|
|
<div id="breadcrumbs">
|
|
<a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
|
|
<a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
|
|
<a href="/cgi-bin/koha/tools/modborrowers.pl">Batch patron modification</a>
|
|
</div>
|
|
|
|
<div id="doc3" class="yui-t2">
|
|
<div id="bd">
|
|
<div id="yui-main">
|
|
<div class="yui-b">
|
|
[% IF ( op == 'show_form' ) %]
|
|
<h1>Batch patron modification</h1>
|
|
<form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/modborrowers.pl">
|
|
<fieldset class="rows">
|
|
<legend>Use a file</legend>
|
|
<ol>
|
|
<li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
|
|
</ol>
|
|
</fieldset>
|
|
|
|
[% IF patron_lists %]
|
|
<fieldset class="rows">
|
|
<legend>Or use a patron list</legend>
|
|
<ol>
|
|
<li>
|
|
<label for="patron_list_id">Patron list: </label>
|
|
<select id="patron_list_id" name="patron_list_id">
|
|
<option value=""></option>
|
|
[% FOREACH pl IN patron_lists %]
|
|
<option value="[% pl.patron_list_id %]">[% pl.name %]</option>
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
[% END %]
|
|
|
|
<fieldset class="rows">
|
|
<legend>Or list cardnumbers one by one</legend>
|
|
<ol>
|
|
<li>
|
|
<label for="cardnumberlist">Card number list (one cardnumber per line): </label>
|
|
<textarea rows="10" cols="30" id="cardnumberlist" name="cardnumberlist">[% cardnumberlist %]</textarea>
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
<input type="hidden" name="op" value="show" />
|
|
<fieldset class="action">
|
|
<input type="submit" value="Continue" class="button" />
|
|
<a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
|
|
</fieldset>
|
|
</form>
|
|
[% END %]
|
|
|
|
[% IF ( op == 'show' or op == 'show_results' ) %]
|
|
[% IF ( op == 'show' ) %]
|
|
<h1>Batch patrons modification</h1>
|
|
[% ELSE %]
|
|
<h1>Batch patrons results</h1>
|
|
[% END %]
|
|
[% IF ( notfoundcardnumbers ) %]
|
|
<div class="dialog alert"><p>Warning, the following cardnumbers were not found:</p></div>
|
|
<table style="margin:auto;">
|
|
<thead>
|
|
<tr><th>Cardnumbers not found</th></tr>
|
|
</thead>
|
|
<tbody>
|
|
[% FOREACH notfoundcardnumber IN notfoundcardnumbers %]
|
|
<tr><td>[% notfoundcardnumber.cardnumber %]</td></tr>
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
[% END %]
|
|
|
|
[% IF ( op == 'show_results' ) %]
|
|
[% IF ( errors ) %]
|
|
<div class="dialog alert">
|
|
<h4>Errors occured:</h4>
|
|
<ul class="warnings">
|
|
[% FOREACH error IN errors %]
|
|
[% IF ( error.error == 'can_not_update' ) %]
|
|
<li>Can not update patron with borrowernumber [% error.borrowernumber %]</li>
|
|
[% ELSE %]
|
|
<li>[% error.error %]</li>
|
|
[% END %]
|
|
[% END %]
|
|
</ul>
|
|
</div>
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[% IF ( op == 'show' ) %]
|
|
<form name="f" action="modborrowers.pl" method="post">
|
|
<input type="hidden" name="op" value="do" />
|
|
[% IF ( borrowers ) %]
|
|
<div id="toolbar"><a id="selectallbutton" href="#">Select All</a> | <a id="clearallbutton" href="#">Clear All</a></div>
|
|
[% END %]
|
|
[% END %]
|
|
[% IF borrowers %]
|
|
<div id="cataloguing_additem_itemlist">
|
|
<div style="overflow:auto">
|
|
<table id="borrowerst">
|
|
<thead>
|
|
<tr>
|
|
[% IF ( op == 'show' ) %]
|
|
<th> </th>
|
|
[% END %]
|
|
<th>Card number</th>
|
|
<th>Surname</th>
|
|
<th>Firstname</th>
|
|
<th>Library</th>
|
|
<th>Category</th>
|
|
<th>Registration date</th>
|
|
<th>Expiry date</th>
|
|
[% FOREACH attrh IN attributes_header %]
|
|
<th>[% attrh.attribute %]</th>
|
|
[% END %]
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
[% FOREACH borrower IN borrowers %]
|
|
<tr>
|
|
[% IF ( op == 'show' ) %]
|
|
<td><input type="checkbox" name="borrowernumber" value="[% borrower.borrowernumber %]" checked="checked" /></td>
|
|
[% END %]
|
|
<td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrower.borrowernumber %]">[% borrower.cardnumber %]</a></td>
|
|
<td>[% borrower.surname %]</td>
|
|
<td>[% borrower.firstname %]</td>
|
|
<td>[% borrower.branchname %]</td>
|
|
<td>[% borrower.categorycode %]</td>
|
|
<td>[% borrower.dateenrolled | $KohaDates %]</td>
|
|
<td>[% borrower.dateexpiry | $KohaDates %]</td>
|
|
[% FOREACH pa IN borrower.patron_attributes %]
|
|
[% IF ( pa.code ) %]
|
|
<td>[% pa.code %]=[% pa.value %]</td>
|
|
[% ELSE %]
|
|
<td></td>
|
|
[% END %]
|
|
[% END %]
|
|
</tr>
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
[% IF ( op == 'show' ) %]
|
|
<div id="cataloguing_additem_newitem">
|
|
<h2>Edit Patrons</h2>
|
|
<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>
|
|
<fieldset class="rows" id="fields_list">
|
|
<ol>
|
|
[% FOREACH field IN fields %]
|
|
<li>
|
|
[% IF ( field.mandatory ) %]
|
|
<label for="[% field.name %]" class="required">
|
|
[% ELSE %]
|
|
<label for="[% field.name %]">
|
|
[% END %]
|
|
[% SWITCH ( field.name ) %]
|
|
[% CASE 'surname' %]
|
|
Surname:
|
|
[% CASE 'firstname' %]
|
|
First name:
|
|
[% CASE 'branchcode' %]
|
|
Library:
|
|
[% CASE 'categorycode' %]
|
|
Category
|
|
[% CASE 'sort1' %]
|
|
Sort 1:
|
|
[% CASE 'sort2' %]
|
|
Sort 2:
|
|
[% CASE 'dateenrolled' %]
|
|
Registration date:
|
|
[% CASE 'dateexpiry' %]
|
|
Expiry date:
|
|
[% CASE 'borrowernotes' %]
|
|
Circulation note:
|
|
[% END %]
|
|
</label>
|
|
[% IF field.mandatory %]
|
|
<input type="checkbox" title="This field is mandatory" name="disable_input" value="[% field.name %]" readonly="readonly" onclick="return false;" />
|
|
[% ELSE %]
|
|
<input type="checkbox" title="Check to delete this field" name="disable_input" value="[% field.name %]" />
|
|
[% END %]
|
|
[% IF ( field.type == 'text' ) %]
|
|
<input type="text" name="[% field.name %]" value="" />
|
|
[% END %]
|
|
[% IF ( field.type == 'select' ) %]
|
|
[% IF field.option.size %]
|
|
<select name="[% field.name %]" >
|
|
[% FOREACH opt IN field.option %]
|
|
<option value="[% opt.value %]">[% opt.lib %]</option>
|
|
[% END %]
|
|
</select>
|
|
[% ELSE %]
|
|
There is no value defined for [% field.name %]
|
|
[% END %]
|
|
[% END %]
|
|
[% IF ( field.type == 'date' ) %]
|
|
<input type="text" name="[% field.name %]" id="[% field.name %]" value="" size="10" maxlength="10" readonly="readonly" class="datepicker" />
|
|
<a href="#" class="clear-field" onclick="clearDate('[% field.name %]');return false;">Clear</a>
|
|
[% END %]
|
|
</li>
|
|
[% END %]
|
|
[% IF ( patron_attributes_codes ) %]
|
|
<li class="attributes">
|
|
<label style="width:auto;">Attribute:
|
|
<select name="patron_attributes">
|
|
[% FOREACH pac IN patron_attributes_codes %]
|
|
<option value="[% pac.attribute_code %]" data-type="[% pac.type %]" data-category="[% pac.category_lib %]">[% pac.attribute_lib %]</option>
|
|
[% END %]
|
|
</select>
|
|
</label>
|
|
<input type="checkbox" title="check to delete this field" name="disable_input" value="attr0_value" />
|
|
<span class="patron_attributes_value"></span>
|
|
<a href="#" class="clone-field" title="Add an attribute" onclick="add_attributes(); return false;">New</a>
|
|
<span class="information_category hint" style="width:25%;float:right;"></span>
|
|
</li>
|
|
[% END %]
|
|
</ol>
|
|
</fieldset>
|
|
<fieldset class="action">
|
|
<input type="submit" name="mainformsubmit" value="Save" />
|
|
<a href="/cgi-bin/koha/tools/modborrowers.pl" class="cancel">Cancel</a>
|
|
</fieldset>
|
|
</div>
|
|
</form>
|
|
[% END %]
|
|
[% END %]
|
|
[% END %]
|
|
[% IF ( op == 'show_results' ) %]
|
|
<p>
|
|
<a href="/cgi-bin/koha/tools/modborrowers.pl" title="New batch patrons modification">New batch patron modification</a>
|
|
</p>
|
|
[% END %]
|
|
</div>
|
|
</div>
|
|
<div class="yui-b">
|
|
[% INCLUDE 'tools-menu.inc' %]
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|