[% USE KohaDates %]
[% USE Price %]
[% INCLUDE 'doc-head-open.inc' %]
-<title>Koha › Administration › Patron categories › [% IF op == 'add_form' %][% IF ( categorycode ) %]Modify category '[% categorycode %]'[% ELSE %]New category[% END %][% END %]
-[% IF op == 'delete_confirm' %][% IF ( patrons_in_category > 0 ) %]Cannot delete: category [% categorycode %] in use[% ELSE %]Confirm deletion of category '[% categorycode %]'[% END %][% END %]
+<title>Koha › Administration › Patron categories › [% IF op == 'add_form' %][% IF ( categorycode ) %]Modify category '[% categorycode |html %]'[% ELSE %]New category[% END %][% END %]
+[% IF op == 'delete_confirm' %][% IF ( patrons_in_category > 0 ) %]Cannot delete: category [% categorycode |html %] in use[% ELSE %]Confirm deletion of category '[% categorycode |html %]'[% END %][% END %]
</title>
[% INCLUDE 'doc-head-close.inc' %]
[% INCLUDE 'calendar.inc' %]
-<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
+<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
[% INCLUDE 'datatables.inc' %]
-<script type="text/javascript" id="js">
-//<![CDATA[
- $(document).ready(function() {
- $("#table_categorie").dataTable($.extend(true, {}, dataTablesDefaults, {
- "aoColumnDefs": [{
- "aTargets": [-1, -2],
- "bSortable": false,
- "bSearchable": false
- }, {
- "aTargets": [3, 4, 5],
- "sType": "natural"
- }, ],
- "aaSorting": [
- [1, "asc"]
- ],
- "sPaginationType": "four_button"
- }));
-
- $("#enrolmentperioddate").datepicker({
- minDate: 1
- }); // Require that "until date" be in the future
-
- if ($("#branches option:selected").length < 1) {
- $("#branches option:first").attr("selected", "selected");
- }
- });
-
- function isNotNull(f, noalert) {
- if (f.value.length == 0) {
- return false;
- }
- return true;
- }
-
- function isNum(v, maybenull) {
- var n = new Number(v.value);
- if (isNaN(n)) {
- return false;
- }
- if (maybenull == 0 && v.value == '') {
- return false;
- }
- return true;
- }
-
- // to check if the data are correctly entered.
- function Check(ff) {
- var ok = 0;
- var _alertString = _("Form not submitted because of the following problem(s)");
- _alertString += "\n-------------------------------------------------------------------\n\n";
- ff.categorycode.value = $.trim(ff.categorycode.value);
- if (ff.categorycode.value.length == 0) {
- ok = 1;
- _alertString += _("- categorycode missing") + "\n";
- } else {
- var patt = /^[a-zA-Z0-9\-_]+$/g;
- if (!patt.test(ff.categorycode.value)) {
- ok = 1;
- _alertString += _("- category code can only contain the following characters: letters, numbers, - and _") + "\n";
- }
- }
- if (!(ff.category_type.value)) {
- ok = 1;
- _alertString += _("- category type missing") + "\n";
- }
- if (!(isNotNull(ff.description, 1))) {
- ok = 1;
- _alertString += _("- description missing") + "\n";
- }
- if (!isNum(ff.upperagelimit, 0) && ff.category_type.value == 'C') {
- ok = 1;
- _alertString += _("- upperagelimit is not a number") + "\n";
-
- }
- if (!(ff.enrolmentperioddate.value || ff.enrolmentperiod.value)) {
- ok = 1;
- _alertString += _("- either Enrollment period or Until date must be provided") + "\n";
- }
- if (ff.enrolmentperioddate.value && ff.enrolmentperiod.value) {
- document.getElementById('enrolmentmessage').className = "error";
- return false;
- }
-
- if (ok) { // if there is a problem
- alert(_alertString);
- return false;
- }
- // if all is good
- ff.submit();
- }
-//]]>
+<script type="text/javascript">
+ var MSG_CATEGORYCODE_CHARS = _("Category code can only contain the following characters: letters, numbers, - and _.");
+ var MSG_BOTH_ENROLLMENTPERIODS = _("Please choose only one enrollment period setting.");
+ var MSG_ONE_ENROLLMENTPERIOD = ("Please choose an enrollment period in months OR by date.");
</script>
+<script type="text/javascript" src="[% themelang %]/js/categories.js"></script>
<style type="text/css">#enrolmentmessage.hint { display : none; }</style>
</head>
<body id="admin_categorie" class="admin">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'patrons-admin-search.inc' %]
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> › [% IF op == 'add_form' %] <a href="/cgi-bin/koha/admin/categories.pl">Patron categories</a> › [% IF ( categorycode ) %]Modify category '[% categorycode %]'[% ELSE %]New category[% END %][% END %]
-[% IF op == 'delete_confirm' %] <a href="/cgi-bin/koha/admin/categories.pl">Patron categories</a> › [% IF ( patrons_in_category > 0 ) %]Cannot delete: Category [% categorycode %] in use[% ELSE %]Confirm deletion of category '[% categorycode %]'[% END %][% END %]
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> › [% IF op == 'add_form' %] <a href="/cgi-bin/koha/admin/categories.pl">Patron categories</a> › [% IF ( categorycode ) %]Modify category '[% categorycode |html %]'[% ELSE %]New category[% END %][% END %]
+[% IF op == 'delete_confirm' %] <a href="/cgi-bin/koha/admin/categories.pl">Patron categories</a> › [% IF ( patrons_in_category > 0 ) %]Cannot delete: Category [% categorycode |html %] in use[% ELSE %]Confirm deletion of category '[% categorycode |html %]'[% END %][% END %]
[% IF op == 'delete_confirmed' %] <a href="/cgi-bin/koha/admin/categories.pl">Patron categories</a> › Category deleted[% END %]
[% IF op == 'list' %]Patron categories[% END %]</div>
[% END %]
[% IF op == 'add_form' %]
- <form name="Aform" action="/cgi-bin/koha/admin/categories.pl" method="post">
+ <form id="category_form" action="/cgi-bin/koha/admin/categories.pl" method="post">
<input type="hidden" name="op" value="add_validate" />
<input type="hidden" name="checked" value="0" />
[% IF category %]
- <h1>Modify category [% categorycode %]</h1>
+ <h1>Modify category [% categorycode |html %]</h1>
[% ELSE %]
<h1>New category</h1>
[% END %]
<ol>
[% IF category %]
<li>
- <span class="label">Category code: </span>[% categorycode %]
- <input type="hidden" name="categorycode" value="[% category.categorycode %]" /><input type="hidden" name="is_a_modif" value="1" />
+ <span class="label">Category code: </span>[% categorycode |html %]
+ <input type="hidden" name="categorycode" value="[% category.categorycode |html %]" /><input type="hidden" name="is_a_modif" value="1" />
</li>
[% ELSE %]
<li>
<label for="categorycode" class="required">Category code: </label>
- <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" onblur="toUC(this)" />
+ <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" class="required" required="required" />
<span class="required">Required</span>
</li>
[% END %]
<li>
<label for="description" class="required">Description: </label>
- <input type="text" name="description" id="description" size="40" maxlength="80" value="[% category.description %]" />
+ <input type="text" name="description" id="description" size="40" maxlength="80" class="required" required="required" value="[% category.description |html %]" />
<span class="required">Required</span>
</li>
<li>
- <label for="enrolmentperiod" class="required">Enrollment period: </label>
+ <span class="label">Enrollment period: </span>
<fieldset>
<legend>Choose one</legend>
<ol>
<li>
<label for="enrolmentperiod" style="width:6em;">In months: </label>
- <input type="text" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="[% IF category.enrolmentperiod %][% category.enrolmentperiod %][% END %]" /> months
+ [% IF category.enrolmentperiod %]
+ <input type="text" class="enrollmentperiod" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="[% category.enrolmentperiod %]" /> months
+ [% ELSE %]
+ <input type="text" class="enrollmentperiod" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="" /> months
+ [% END %]
</li>
<li>
<label for="enrolmentperioddate" style="width:6em;">Until date: </label>
- <input type="text" name="enrolmentperioddate" id="enrolmentperioddate" value="[% category.enrolmentperioddate | $KohaDates %]" />
- <div id="enrolmentmessage" class="hint" style="margin-left:0;">Cannot have "months" and "until date" at the same time</div>
+ <input type="text" class="enrollmentperiod datepicker" name="enrolmentperioddate" id="enrolmentperioddate" value="[% category.enrolmentperioddate | $KohaDates %]" />
</li>
</ol>
</fieldset>
<span>Select <i>All branches</i> if this category type must to be displayed all the time. Otherwise select libraries you want to associate with this value.
</span>
</li>
- <li><label for="block_expired">Block expired patrons</label>
+ <li><label for="block_expired">Block expired patrons:</label>
<select name="BlockExpiredPatronOpacActions" id="block_expired">
[% IF not category or category.BlockExpiredPatronOpacActions == -1%]
<option value="-1" selected="selected"> Follow system preference BlockExpiredPatronOpacActions </option>
Choose whether patrons of this category be blocked from public catalog actions such as renewing and placing holds when their cards have expired.
</span>
</li>
+ [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %]
+ <li><label for="checkprevcheckout">Check for previous checkouts: </label>
+ <select name="checkprevcheckout" id="checkprevcheckout">
+ [% IF category.checkprevcheckout == 'yes' %]
+ <option value="yes" selected="selected">Yes and try to override system preferences</option>
+ <option value="no">No and try to override system preferences</option>
+ <option value="inherit">Inherit from system preferences</option>
+ [% ELSIF category.checkprevcheckout == 'no' %]
+ <option value="yes">Yes and try to override system preferences</option>
+ <option value="no" selected="selected">No and try to override system preferences</option>
+ <option value="inherit">Inherit from system preferences</option>
+ [% ELSE %]
+ <option value="yes">Yes and try to override system preferences</option>
+ <option value="no">No and try to override system preferences</option>
+ <option value="inherit" selected="selected">Inherit from system preferences</option>
+ [% END %]
+ </select>
+ <span>
+ Choose whether patrons of this category by default are reminded if they try to borrow an item they borrowed before.
+ </span>
+ </li>
+ [% END %]
<li>
<label for="default_privacy">Default privacy: </label>
<select id="default_privacy" name="default_privacy">
[% INCLUDE 'messaging-preference-form.inc' %]
</fieldset>
[% END %]
- <fieldset class="action"><input type="button" value="Save" onclick="Check(this.form);" /> </fieldset>
+ <fieldset class="action">
+ <input type="submit" value="Save" />
+ <a href="/cgi-bin/koha/admin/categories.pl" class="cancel">Cancel</a>
+ </fieldset>
</form>
[% END %]
<fieldset>
<legend>
[% IF patrons_in_category > 0 %]
- Category [% categorycode %] is in use. Deletion not possible!
+ Category [% categorycode |html %] is in use. Deletion not possible!
[% ELSE %]
- Confirm deletion of category [% categorycode %]
+ Confirm deletion of category [% categorycode |html %]
[% END %]
</legend>
</div>
[% END %]
<table>
- <tr><th scope="row">Category code: </th><td>[% category.categorycode %]</td></tr>
- <tr><th scope="row">Description: </th><td>[% category.description %]</td></tr>
+ <tr><th scope="row">Category code: </th><td>[% category.categorycode |html %]</td></tr>
+ <tr><th scope="row">Description: </th><td>[% category.description |html %]</td></tr>
<tr><th scope="row">Enrollment period: </th>
<td>
[% IF category.enrolmentperiod %]
<tr><th scope="row">Receives overdue notices: </th><td>[% IF category. overduenoticerequired %]Yes[% ELSE %]No[% END %]</td></tr>
<tr><th scope="row">Lost items in staff client</th><td>[% IF category.hidelostitems %]Hidden by default[% ELSE %]Shown[% END %]</td></tr>
<tr><th scope="row">Hold fee: </th><td>[% category.reservefee | $Price %]</td></tr>
+
+ [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %]
+ <tr>
+ <th scope="row">Check previous checkouts: </th>
+ <td>
+ [% SWITCH category.checkprevcheckout %]
+ [% CASE 'yes' %]
+ Yes
+ [% CASE 'no' %]
+ No
+ [% CASE 'inherit' %]
+ Inherit
+ [% END %]
+ </td>
+ </tr>
+ [% END %]
<tr>
<th scope="row">Default privacy: </th>
<td>
<input type="submit" value="OK" />
[% ELSE %]
<input type="hidden" name="op" value="delete_confirmed" />
- <input type="hidden" name="categorycode" value="[% categorycode %]" />
+ <input type="hidden" name="categorycode" value="[% categorycode |html %]" />
<input type="submit" value="Delete this category" />
<a class="cancel" href="/cgi-bin/koha/admin/categories.pl">Cancel</a>
[% END %]
[% IF op == 'list' %]
<div id="toolbar" class="btn-toolbar">
- <a class="btn btn-small" id="newcategory" href="/cgi-bin/koha/admin/categories.pl?op=add_form"><i class="fa fa-plus"></i> New category</a>
+ <a class="btn btn-default btn-sm" id="newcategory" href="/cgi-bin/koha/admin/categories.pl?op=add_form"><i class="fa fa-plus"></i> New category</a>
</div>
- <h2>Patron category administration</h2>
+ <h2>Patron categories</h2>
[% IF searchfield %]
- You Searched for [% searchfield %]</span>
+ You Searched for [% searchfield |html %]</span>
[% END %]
[% IF categories%]
<table id="table_categorie">
<th scope="col">Messaging</th>
[% END %]
<th scope="col">Branches limitations</th>
+ [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %]
+ <th scope="col">Check previous checkout?</th>
+ [% END %]
<th scope="col">Default privacy</th>
- <th scope="col"> </th>
- <th scope="col"> </th>
+ <th scope="col">Actions</th>
</tr>
</thead>
<tbody>
[% FOREACH category IN categories %]
<tr>
- <td>[% category.categorycode %]</td>
+ <td>[% category.categorycode |html %]</td>
<td>
- <a href="/cgi-bin/koha/admin/categories.pl?op=add_form&categorycode=[% category.categorycode |uri %]">[% category.description %]</a>
+ <a href="/cgi-bin/koha/admin/categories.pl?op=add_form&categorycode=[% category.categorycode |uri %]">[% category.description |html %]</a>
</td>
<td>
[% SWITCH category.category_type %]
until [% category.enrolmentperioddate | $KohaDates %]
[% END %]
</td>
- <td>[% category.dateofbirthrequired %] years</td>
- <td>[% category.upperagelimit %] years</td>
- <td>[% category.enrolmentfee | $Price %]</td>
+ [% IF (category.dateofbirthrequired) %]
+ <td>[% category.dateofbirthrequired %] years</td>
+ [% ELSE %]
+ <td>-</td>
+ [% END %]
+ [% IF (category.upperagelimit) %]
+ <td>[% category.upperagelimit %] years</td>
+ [% ELSE %]
+ <td>-</td>
+ [% END %]
+ [% IF (category.enrolmentfee > 0) %]
+ <td>[% category.enrolmentfee | $Price %]</td>
+ [% ELSE %]
+ <td>-</td>
+ [% END %]
<td>[% IF ( category.overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td>
<td>[% IF ( category.hidelostitems ) %]Hidden[% ELSE %]Shown[% END %]</td>
- <td>[% category.reservefee | $Price %]</td>
+ [% IF (category.reservefee > 0) %]
+ <td>[% category.reservefee | $Price %]</td>
+ [% ELSE %]
+ <td>-</td>
+ [% END %]
[% IF Koha.Preference('EnhancedMessagingPreferences') %]
<td style="white-space: nowrap; font-size:80%;">
[% SET default_messaging = category.default_messaging %]
No limitation
[% END %]
</td>
+ [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %]
+ <td>
+ [% SWITCH category.checkprevcheckout %]
+ [% CASE 'yes' %]
+ Yes
+ [% CASE 'no' %]
+ No
+ [% CASE 'inherit' %]
+ Inherit
+ [% END %]
+ </td>
+ [% END %]
<td>
[% SWITCH category.default_privacy %]
[% CASE 'default' %]
Forever
[% END %]
</td>
- <td><a href="/cgi-bin/koha/admin/categories.pl?op=add_form&categorycode=[% category.categorycode |uri %]">Edit</a></td>
- <td><a href="/cgi-bin/koha/admin/categories.pl?op=delete_confirm&categorycode=[% category.categorycode |uri %]">Delete</a></td>
+ <td class="actions">
+ <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/categories.pl?op=add_form&categorycode=[% category.categorycode |uri %]"><i class="fa fa-pencil"></i> Edit</a>
+ <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/categories.pl?op=delete_confirm&categorycode=[% category.categorycode |uri %]"><i class="fa fa-trash"></i> Delete</a>
+ </td>
</tr>
[% END %]
</tbody>