From 551f12f02bc175d6c02696c11dd37d4521b5f4b2 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 14 Apr 2014 13:45:22 -0400 Subject: [PATCH] Bug 11703 [QA Followup] * Bold record title, fix table width * Change output_pref_due to output_pref * Retain functionality of IssuesDefaultSortOrder system preferences * Use datatables.inc in circulation.tt * Fix up holds table details * Add plugin to about * fix relatives' checkouts * add too_many string * remove dead syspref from db * Sort relatives' checkouts and holds tables client side * Provide context for translation of strings * Fix unterminated string literal, add missing paren * Add replacement of _AUTHOR_ with title's author for holds * Format prices correctly * Format checkout dates correctly Signed-off-by: Katrin Fischer --- installer/data/mysql/updatedatabase.pl | 10 ++ .../intranet-tmpl/prog/en/includes/strings.inc | 20 ++-- koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js | 62 ++++++++---- koha-tmpl/intranet-tmpl/prog/en/js/holds.js | 43 ++++---- koha-tmpl/intranet-tmpl/prog/en/modules/about.tt | 4 + .../prog/en/modules/circ/circulation.tt | 5 +- svc/checkin.pl | 2 - svc/checkouts.pl | 112 ++++++++++++-------- svc/holds.pl | 17 ++-- svc/renew.pl | 4 +- 10 files changed, 170 insertions(+), 109 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index c68ba51..fb2406a 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -8560,6 +8560,16 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.15.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do(q{ + DELETE FROM systempreferences WHERE variable = 'UseTableSortForCirc' + }); + + print "Upgrade to $DBversion done (Bug 11703 - Convert checkouts table to ajax datatable)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc index e22810a..3755dd1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc @@ -10,20 +10,18 @@ var REASON_UNKNOWN = _("reason unkown"); var TODAYS_CHECKOUTS = _("Today's checkouts"); var PREVIOUS_CHECKOUTS = _("Previous checkouts"); - var BY = _("by"); + var BY = _("by _AUTHOR_"); var ON_HOLD = _("On hold"); var NOT_RENEWABLE = _("Not renewable"); - var OF = _("of"); - var RENEWALS_REMAINING = _("renewals remaining"); - var HOLD_IS = _("Hold is"); - var SUSPENDED = _("suspended"); - var UNTIL = _("until"); - var ITEM_IS = _("Item is"); - var WAITING = _("waiting"); - var AT = _("at"); - var IN_TRANSIT = _("in transit"); + var NOT_RENEWABLE_TOO_SOON = _("Cannot renew, renewal is premature"); + var RENEWALS_REMAINING = _("_RENEWALS_REMAINING_ of _RENEWALS_ALLOWED_ renewals remaining"); + var HOLD_IS_SUSPENDED = _("Hold is suspended"); + var UNTIL = _("until _SUSPEND_UNTIL_"); + var ITEM_IS_WAITING = _("Item is waiting"); // + var AT = _("at _WAITING_AT_BRANCH_"); + var ITEM_IS_IN_TRANSIT = _("Item is in transit from _FROM_BRANCH_"); var FROM = _("from"); - var NOT_TRANSFERRED_YET = _("Item hasn't been transferred yet from"); + var NOT_TRANSFERRED_YET = _("Item hasn't been transferred yet from _FROM_BRANCH_"); var NO = _("No"); var YES = _("Yes"); //]]> diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js index 268eefe..eca940a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js @@ -127,12 +127,12 @@ $(document).ready(function() { var issuesTable; var drawn = 0; issuesTable = $("#issues-table").dataTable({ + "bAutoWidth": false, "sDom": "<'row-fluid'<'span6'><'span6'>r>t<'row-fluid'>t", - "aaSorting": [[ 0, "desc" ]], "aoColumns": [ { "mDataProp": function( oObj ) { - if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) { + if ( oObj.issued_today ) { return "" + TODAYS_CHECKOUTS + ""; } else { return "" + PREVIOUS_CHECKOUTS + ""; @@ -157,7 +157,7 @@ $(document).ready(function() { }, { "mDataProp": function ( oObj ) { - title = "" + oObj.title; @@ -166,10 +166,10 @@ $(document).ready(function() { title += " " + value.subfield; }); - title += ""; + title += ""; if ( oObj.author ) { - title += " " + BY + " " + oObj.author; + title += " " + BY.replace( "_AUTHOR_", " " + oObj.author ); } if ( oObj.itemnotes ) { @@ -195,18 +195,21 @@ $(document).ready(function() { } }, { "mDataProp": "itemtype" }, - { "mDataProp": "issuedate" }, + { "mDataProp": "issuedate_formatted" }, { "mDataProp": "branchname" }, { "mDataProp": "itemcallnumber" }, { - "bSortable": false, "mDataProp": function ( oObj ) { + if ( ! oObj.charge ) oObj.charge = 0; return parseFloat(oObj.charge).toFixed(2); } }, { - "bSortable": false, - "mDataProp": "price" }, + "mDataProp": function ( oObj ) { + if ( ! oObj.price ) oObj.price = 0; + return parseFloat(oObj.price).toFixed(2); + } + }, { "bSortable": false, "mDataProp": function ( oObj ) { @@ -233,6 +236,13 @@ $(document).ready(function() { span_style = "display: none"; span_class = "renewals-allowed"; + } else if ( oObj.can_renew_error == "too_soon" ) { + content += "" + + NOT_RENEWABLE_TOO_SOON + + ""; + + span_style = "display: none"; + span_class = "renewals-allowed"; } else { content += "" + oObj.can_renew_error @@ -248,10 +258,8 @@ $(document).ready(function() { if ( oObj.renewals_remaining ) { content += "(" - + oObj.renewals_remaining - + " " + OF + " " - + oObj.renewals_allowed + " " - + RENEWALS_REMAINING + ")"; + + RENEWALS_REMAINING.replace( "_RENEWALS_REMAINING_", oObj.renewals_remaining ).replace( "_RENEWALS_ALLOWED_", oObj.renewals_allowed ) + + ")"; } content += ""; @@ -333,10 +341,16 @@ $(document).ready(function() { $("#relatives-issues-tab").click( function() { if ( ! relativesIssuesTable ) { relativesIssuesTable = $("#relatives-issues-table").dataTable({ + "bAutoWidth": false, "sDom": "<'row-fluid'<'span6'><'span6'>r>t<'row-fluid'>t", "aaSorting": [], "aoColumns": [ { + "mDataProp": "date_due", + "bVisible": false, + }, + { + "iDataSort": 1, // Sort on hidden unformatted date due column "mDataProp": function( oObj ) { var today = new Date(); var due = new Date( oObj.date_due ); @@ -349,7 +363,7 @@ $(document).ready(function() { }, { "mDataProp": function ( oObj ) { - title = "" + oObj.title; @@ -358,7 +372,7 @@ $(document).ready(function() { title += " " + value.subfield; }); - title += ""; + title += ""; if ( oObj.author ) { title += " " + BY + " " + oObj.author; @@ -387,11 +401,21 @@ $(document).ready(function() { } }, { "mDataProp": "itemtype" }, - { "mDataProp": "issuedate" }, + { "mDataProp": "issuedate_formatted" }, { "mDataProp": "branchname" }, { "mDataProp": "itemcallnumber" }, - { "mDataProp": "charge" }, - { "mDataProp": "price" }, + { + "mDataProp": function ( oObj ) { + if ( ! oObj.charge ) oObj.charge = 0; + return parseFloat(oObj.charge).toFixed(2); + } + }, + { + "mDataProp": function ( oObj ) { + if ( ! oObj.price ) oObj.price = 0; + return parseFloat(oObj.price).toFixed(2); + } + }, { "mDataProp": function( oObj ) { return "" @@ -401,7 +425,7 @@ $(document).ready(function() { ], "bPaginate": false, "bProcessing": true, - "bServerSide": true, + "bServerSide": false, "sAjaxSource": '/cgi-bin/koha/svc/checkouts.pl', "fnServerData": function ( sSource, aoData, fnCallback ) { $.each(relatives_borrowernumbers, function( index, value ) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/holds.js b/koha-tmpl/intranet-tmpl/prog/en/js/holds.js index 76dfee5..eab5ae4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/holds.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/holds.js @@ -4,6 +4,7 @@ $(document).ready(function() { $("#holds-tab").click( function() { if ( ! holdsTable ) { holdsTable = $("#holds-table").dataTable({ + "bAutoWidth": false, "sDom": "<'row-fluid'<'span6'><'span6'>r>t<'row-fluid'>t", "aoColumns": [ { @@ -11,7 +12,7 @@ $(document).ready(function() { }, { "mDataProp": function ( oObj ) { - title = "" + oObj.title; @@ -23,7 +24,7 @@ $(document).ready(function() { title += ""; if ( oObj.author ) { - title += " " + BY + " " + oObj.author; + title += " " + BY.replace( "_AUTHOR_", oObj.author ); } if ( oObj.itemnotes ) { @@ -34,17 +35,6 @@ $(document).ready(function() { title += " - " + oObj.itemnotes + "" } - title += " " - + "" - + oObj.barcode - + ""; - return title; } }, @@ -58,9 +48,9 @@ $(document).ready(function() { var data = ""; if ( oObj.suspend == 1 ) { - data += "

" + HOLD_IS + " " + SUSPENDED + " "; + data += "

" + HOLD_IS_SUSPENDED; if ( oObj.suspend_until ) { - data += " " + UNTIL + " " + oObj.suspend_until_formatted; + data += " " + UNTIL.replace( "_SUSPEND_UNTIL_", oObj.suspend_until_formatted ); } data += "

"; } @@ -68,19 +58,27 @@ $(document).ready(function() { if ( oObj.barcode ) { data += ""; if ( oObj.found == "W" ) { - data += ITEM_IS + " " + WAITING + " "; + data += ITEM_IS_WAITING; if ( ! oObj.waiting_here ) { - data += " " + AT + " " + oObj.waiting_at; + data += " " + AT.replace("_WAITING_AT_BRANCH_", oObj.waiting_at ); } } else if ( oObj.transferred ) { - data += ITEM_IS + " " + IN_TRANSIT + " " + FROM + oObj.from_branch; + data += ITEM_IS_IN_TRANSIT.replace( "_FROM_BRANCH_", oObj.from_branch ); } else if ( oObj.not_transferred ) { - data += NOT_TRANSFERRED_YET + " " + oObj.not_transferred_by; - } data += ""; + data += NOT_TRANSFERRED_YET.replace( "_FROM_BRANCH_", oObj.not_transferred_by ); + } + data += ""; data += " " + oObj.barcode + ""; + + oObj.biblionumber + + "&itemnumber=" + + oObj.itemnumber + + "#" + + oObj.itemnumber + + "'>" + + oObj.barcode + + ""; } return data; @@ -97,6 +95,7 @@ $(document).ready(function() { } }, { + "bSortable": false, "mDataProp": function( oObj ) { return "