Bug 13196 - "Always show checkouts immediately" cookie should persist across sessions

This patch modifies the way the checkouts script sets the "Always show
checkouts" cookie so that it is set with an explicit expiration date
(+365 days). This will allow the cookie to persist across browser
sesssions.

To test, apply the patch and clear your browser cookies to start with a
clean slate.

- Check out to a patron who has existing checkouts. Their checkouts
  should not load by default.
- Check the "Always show checkouts immediately" checkbox.
- Close your browser.
- Reopen your browser and check out to that patron again. Checkouts
  should now be displayed by default.

Signed-off-by: Frederic Demians <f.demians@tamil.fr>

Works as described. I confirm that without this patch, the un-persistance of
"show checkouts" choice is very perturbing for librarians coming from previous
version of Koha.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>

Passes tests and QA script, no problems found.
Signed-off-by: Mason James <mtj@kohaaloha.com>
This commit is contained in:
Owen Leonard 2014-11-04 12:03:13 -05:00 committed by Mason James
parent 2a1ba095cb
commit cb7e1c6066
1 changed files with 39 additions and 15 deletions

View File

@ -126,21 +126,45 @@ $(document).ready(function() {
var ymd = $.datepicker.formatDate('yy-mm-dd', new Date());
var issuesTable;
var drawn = 0;
issuesTable = $("#issues-table").dataTable({
"oLanguage": {
"sEmptyTable" : MSG_DT_LOADING_RECORDS,
},
"bAutoWidth": false,
"sDom": "<'row-fluid'<'span6'><'span6'>r>t<'row-fluid'>t",
"aoColumns": [
{
"mDataProp": function( oObj ) {
if ( oObj.issued_today ) {
return "0";
} else {
return "100";
$('#issues-table').hide();
$('#issues-table-actions').hide();
$('#issues-table-load-immediately').change(function(){
if ( this.checked && typeof issuesTable === 'undefined') {
$('#issues-table-load-now-button').click();
}
});
$('#issues-table-load-now-button').click(function(){
LoadIssuesTable();
return false;
});
if ( $.cookie("issues-table-load-immediately-" + script) == "true" ) {
LoadIssuesTable();
$('#issues-table-load-immediately').prop('checked', true);
}
$('#issues-table-load-immediately').on( "change", function(){
$.cookie("issues-table-load-immediately-" + script, $(this).is(':checked'), { expires: 365 });
});
function LoadIssuesTable() {
$('#issues-table-loading-message').hide();
$('#issues-table').show();
$('#issues-table-actions').show();
issuesTable = $("#issues-table").dataTable({
"oLanguage": {
"sEmptyTable" : MSG_DT_LOADING_RECORDS,
},
"bAutoWidth": false,
"sDom": "<'row-fluid'<'span6'><'span6'>r>t<'row-fluid'>t",
"aoColumns": [
{
"mDataProp": function( oObj ) {
if ( oObj.issued_today ) {
return "1" + oObj.timestamp;
} else {
return "0" + oObj.date_due;
}
}
}
},