Koha/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js
Jonathan Druart 2e72eb8880 Bug 10860: In-House Use
This patch implements the In-House Use feature for Koha.

It adds:
- 2 new sysprefs:
  'In-House Use' to enable/disable this feature
  'In-House Use Forced' to enable/disable the feature for *all* users.
- 2 new columns issues.inhouse_use and old_issues.inhouse_use
- Datatable on the circulation history pages (readingrec) at the OPAC
  and the intranet.

A new checkbox in the Circulation tab. If checked, the issue become a
in-house use (in the statistics and issues tables).
When you check it, the due date changes to the today date.

The syspref "In-House Use Force" allows to force the in-house use to
permit the checkout even if the borrower is debarred or others problems.

In the issue table, a new string (in red) marks the issue as "in-house use".

The circulation history contains 3 tabs : "all", "checkout" and
"in-house use" (OPAC and intranet).

The cronjob script:
If AutomaticItemReturn if off, a library would like not to do a transit
operation manually. This script (to launch each night) do returns
for a specific branches.

Test plan:
1/ Execute the updatedatabase entry
2/ Enable the 'In-House Use' pref.
3/ Checkout a biblio for a patron and check the 'in-house use' checkbox.
4/ Check that the due date is the today date (with 23:59) and is not modifiable.
5/ Click on the check out button and check that the new check out
appears in the table bellow with the "(In-house use)" string.
6/ Go on the circulation history pages (readingrec and opac-readingrec)
and try the 3 tabs. In the last one, your last checkout should appear.
7/ Check in.
8/ Check readingrec pages.
9/ Choose a debarred patron and check that you cannot checkout a biblio
for him.
10/ Switch on the 'In-House Use Forced' pref
11/ You are now allowed to checkout a biblio for the debarred patron.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-03 10:26:19 -03:00

100 lines
3.6 KiB
JavaScript

// These default options are for translation but can be used
// for any other datatables settings
// MSG_DT_* variables comes from datatables-strings.inc
// To use it, write:
// $("#table_id").dataTable($.extend(true, {}, dataTableDefaults, {
// // other settings
// } ) );
var dataTablesDefaults = {
"oLanguage": {
"oPaginate": {
"sFirst" : window.MSG_DT_FIRST || "First",
"sLast" : window.MSG_DT_LAST || "Last",
"sNext" : window.MSG_DT_NEXT || "Next",
"sPrevious" : window.MSG_DT_PREVIOUS || "Previous"
},
"sEmptyTable" : window.MSG_DT_EMPTY_TABLE || "No data available in table",
"sInfo" : window.MSG_DT_INFO || "Showing _START_ to _END_ of _TOTAL_ entries",
"sInfoEmpty" : window.MSG_DT_INFO_EMPTY || "No entries to show",
"sInfoFiltered" : window.MSG_DT_INFO_FILTERED || "(filtered from _MAX_ total entries)",
"sLengthMenu" : window.MSG_DT_LENGTH_MENU || "Show _MENU_ entries",
"sLoadingRecords" : window.MSG_DT_LOADING_RECORDS || "Loading...",
"sProcessing" : window.MSG_DT_PROCESSING || "Processing...",
"sSearch" : window.MSG_DT_SEARCH || "Search:",
"sZeroRecords" : window.MSG_DT_ZERO_RECORDS || "No matching records found"
},
// "aaSorting": [$(" - select row position of th -")],
"sDom": 't',
"bPaginate": false,
// "fnHeaderCallback": function() {
// return $('th.sorting.nosort,th.sorting_desc.nosort,th.sorting_asc.nosort').removeClass("sorting sorting_desc sorting_asc").unbind("click");
// }
};
/* Plugin to allow sorting on data stored in a span's title attribute
*
* Ex: <td><span title="[% ISO_date %]">[% formatted_date %]</span></td>
*
* In DataTables config:
* "aoColumns": [
* { "sType": "title-string" },
* ]
* http://datatables.net/plug-ins/sorting#hidden_title_string
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"title-string-pre": function ( a ) {
return a.match(/title="(.*?)"/)[1].toLowerCase();
},
"title-string-asc": function ( a, b ) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"title-string-desc": function ( a, b ) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
(function() {
/* Plugin to allow text sorting to ignore articles
*
* In DataTables config:
* "aoColumns": [
* { "sType": "anti-the" },
* ]
* Based on the plugin found here:
* http://datatables.net/plug-ins/sorting#anti_the
* Modified to exclude HTML tags from sorting
* Extended to accept a string of space-separated articles
* from a configuration file (in English, "a," "an," and "the")
*/
if(CONFIG_EXCLUDE_ARTICLES_FROM_SORT){
var articles = CONFIG_EXCLUDE_ARTICLES_FROM_SORT.split(" ");
var rpattern = "";
for(i=0;i<articles.length;i++){
rpattern += "^" + articles[i] + " ";
if(i < articles.length - 1){ rpattern += "|"; }
}
var re = new RegExp(rpattern, "i");
}
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"anti-the-pre": function ( a ) {
var x = String(a).replace( /<[\s\S]*?>/g, "" );
var y = x.trim();
var z = y.replace(re, "").toLowerCase();
return z;
},
"anti-the-asc": function ( a, b ) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"anti-the-desc": function ( a, b ) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
});
}());