From 03be28e720a83e6438a1202943b6250edf02495c Mon Sep 17 00:00:00 2001 From: Owen Leonard <oleonard@myacpl.org> Date: Thu, 17 Apr 2014 09:40:25 -0400 Subject: [PATCH] Bug 12089 - [SIGNED OFF] Remove use of dt_add_type_uk_date() - Acquisitions This patch removes instances of dt_add_type_uk_date() from acquisitions templates and updates sorting configurations according to current guidelines. In cases where a formatted date was passed from a Perl script, the script has been modified to pass an unformatted date. Several instances of the no longer valid align attribute have been removed from <td> tags in favor of an existing "data" class which is suitable for display of currency values. To test, view the following pages in Acquisitions. Columns containing dates should sort correctly regardless of dateformat system preference setting. Columns containing bibliographic titles should ignore articles when sorting. - Add to an order from a staged file: The table of staged files should sort correctly. After clicking "add orders" for one of the staged files, the table of titles in that staged file should also be sorted correctly. - Add to an order from a subscription. The table of subscription search results should sort correctly. - Orders search results should sort correctly. - Late orders should sort correctly. - Search for a vendor. Click on the vendor name to view the vendor detail page. The table of contracts on this page should sort correctly. - From the Acquisitions home page click a number in the "spent" column of the table of available funds. The table of orders should sort correctly. - From the Acquisitions home page click a number in the "ordered" column of the table of available funds. The table of orders should sort correctly. - From a vendor detail page, click the "Receive shipments" button. On the receive shipments page the table of shipments should be sorted correctly. Signed-off-by: David Cook <dcook@prosentient.com.au> --- C4/Acquisition.pm | 2 - acqui/parcels.pl | 2 +- .../prog/en/modules/acqui/addorderiso2709.tt | 24 ++++++------ .../prog/en/modules/acqui/histsearch.tt | 21 ++++++----- .../prog/en/modules/acqui/lateorders.tt | 30 +++++++++------ .../prog/en/modules/acqui/newordersubscription.tt | 23 ++++++------ .../intranet-tmpl/prog/en/modules/acqui/ordered.tt | 27 +++++++------- .../intranet-tmpl/prog/en/modules/acqui/parcels.tt | 10 +++--- .../intranet-tmpl/prog/en/modules/acqui/spent.tt | 37 ++++++++++--------- .../prog/en/modules/acqui/supplier.tt | 20 +++------- 10 files changed, 99 insertions(+), 97 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index f7c1d23..a14ffe7 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -2191,8 +2191,6 @@ sub GetLateOrders { $sth->execute(@query_params); my @results; while (my $data = $sth->fetchrow_hashref) { - $data->{orderdate} = format_date($data->{orderdate}); - $data->{claimed_date} = format_date($data->{claimed_date}); push @results, $data; } return @results; diff --git a/acqui/parcels.pl b/acqui/parcels.pl index df02e21..3565d6d 100755 --- a/acqui/parcels.pl +++ b/acqui/parcels.pl @@ -169,7 +169,7 @@ for my $i ( $startfrom .. $last_row) { nullcode => $p->{invoicenumber} eq 'NULL', emptycode => $p->{invoicenumber} eq q{}, raw_datereceived => $p->{shipmentdate}, - datereceived => format_date( $p->{shipmentdate} ), + datereceived => $p->{shipmentdate}, bibcount => $p->{receivedbiblios} || 0, reccount => $p->{receiveditems} || 0, itemcount => $p->{itemsexpected} || 0, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt index 577d555..1bee666 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt @@ -14,16 +14,12 @@ <script type="text/javascript" src="[% themelang %]/js/cataloging.js"></script> <script type="text/JavaScript"> //<![CDATA[ - [% IF (dateformat == 'metric') %] - dt_add_type_uk_date(); - [% END %] $(document).ready(function() { - var srlt = $("#files").dataTable($.extend(true, {}, dataTablesDefaults, { - "aoColumns": [ - null,null,null,{ "sType": "title-string" },null,null - ], + $("#files,#recordst").dataTable($.extend(true, {}, dataTablesDefaults, { "aoColumnDefs": [ - { "aTargets": [ 5 ], "bSortable": false, "bSearchable": false }, + { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] }, + { "sType": "anti-the", "aTargets" : [ "anti-the" ] }, + { "sType": "title-string", "aTargets" : [ "title-string" ] } ], "sPaginationType": "four_button", "aaSorting": [] @@ -58,12 +54,15 @@ </h1> <div> <form action="[% scriptname %]" method="post" name="import_biblios"> - <table> + <table id="recordst"> + <thead> <tr> - <th>Citation</th> + <th class="anti-the">Citation</th> <th>Match?</th> <th>Order</th> </tr> + </thead> + <tbody> [% FOREACH biblio_lis IN biblio_list %] <tr> <td> @@ -89,6 +88,7 @@ </tr> [% END %] [% END %] + </tbody> </table> </form> </div> @@ -112,9 +112,9 @@ <th>File name</th> <th>Comments</th> <th>Status</th> - <th>Staged</th> + <th class="title-string">Staged</th> <th># Bibs</th> - <th> </th> + <th class="NoSort"> </th> </tr> </thead> <tbody> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt index e8666c5..3bb7fcb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt @@ -7,11 +7,12 @@ [% INCLUDE 'datatables.inc' %] <script type="text/javascript"> //<![CDATA[ -[% IF (dateformat == 'metric') %] - dt_add_type_uk_date(); -[% END %] $(document).ready(function() { - var histsearcht = $("#histsearcht").dataTable($.extend(true, {}, dataTablesDefaults, { + $("#histsearcht").dataTable($.extend(true, {}, dataTablesDefaults, { + "aoColumnDefs": [ + { "sType": "anti-the", "aTargets" : [ "anti-the" ] }, + { "sType": "title-string", "aTargets" : [ "title-string" ] } + ], "sPaginationType": "four_button" } ) ); }); @@ -136,10 +137,10 @@ <th>Basket</th> <th>Basket group</th> <th>Invoice number</th> - <th>Summary</th> + <th class="anti-the">Summary</th> <th>Vendor</th> - <th>Placed on</th> - <th>Received on</th> + <th class="title-string">Placed on</th> + <th class="title-string">Received on</th> <th>Quantity received</th> <th>Pending order</th> <th>Unit cost</th> @@ -181,10 +182,12 @@ <br />[% order.author %] <br /> [% order.isbn %] </td> <td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% order.id %]">[% order.name %]</a></td> - <td>[% order.creationdate | $KohaDates %]</td> + <td><span title="[% order.creationdate %]">[% order.creationdate | $KohaDates %]</span></td> <td> [% IF order.datereceived %] - [% order.datereceived | $KohaDates %] + <span title="[% order.datereceived %]">[% order.datereceived | $KohaDates %]</span> + [% ELSE %] + <span title="0000-00-00"></span> [% END %] </td> <td>[% order.quantityreceived %]</td> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt index 7229168..1de3161 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt @@ -9,9 +9,6 @@ [% INCLUDE 'calendar.inc' %] <script type="text/javascript"> //<![CDATA[ -[% IF (dateformat == 'metric') %] - dt_add_type_uk_date(); -[% END %] var late_orderst; function check_uncheck() { @@ -29,6 +26,8 @@ $(document).ready(function() { late_orderst = $("#late_orders").dataTable($.extend(true, {}, dataTablesDefaults, { "aoColumnDefs": [ { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false }, + { "sType": "anti-the", "aTargets" : [ "anti-the" ] }, + { "sType": "title-string", "aTargets" : [ "title-string" ] } ], "sPaginationType": "four_button", "bAutoWidth": false, @@ -112,17 +111,17 @@ $(document).ready(function() { [% ELSE %] <th></th> [% END %] - <th>Order date</th> - <th>Estimated delivery date</th> + <th class="title-string">Order date</th> + <th class="title-string">Estimated delivery date</th> <th>Vendor</th> - <th>Information</th> + <th class="anti-the">Information</th> <th>Total cost</th> <th>Basket</th> <th>Basket group</th> <th>Library</th> <th>Fund</th> <th>Claims count</th> - <th>Claimed date</th> + <th class="title-string">Claimed date</th> </tr> </thead> <tbody> @@ -133,12 +132,13 @@ $(document).ready(function() { <input type="checkbox" value="[% lateorder.ordernumber %]" data-booksellerid="[% lateorder.supplierid %]" name="ordernumber"> </td> <td> - [% lateorder.orderdate %] - ([% lateorder.latesince %] days) + <span title="[% lateorder.orderdate %]">[% lateorder.orderdate | $KohaDates %] ([% lateorder.latesince %] days)</span> </td> <td> [% IF ( lateorder.estimateddeliverydate ) %] - [% lateorder.estimateddeliverydate | $KohaDates %] + <span title="[% lateorder.estimateddeliverydate %]">[% lateorder.estimateddeliverydate | $KohaDates %]</span> + [% ELSE %] + <span title="0000-00-00"></span> [% END %] </td> <td> @@ -180,7 +180,13 @@ $(document).ready(function() { <td>[% lateorder.budget %] </td> <td>[% lateorder.claims_count %]</td> - <td>[% lateorder.claimed_date %]</td> + <td> + [% IF ( lateorder.claimed_date ) %] + <span title="[% lateorder.claimed_date %]">[% lateorder.claimed_date | $KohaDates %]</span> + [% ELSE %] + <span title="0000-00-00"></span> + [% END %] + </td> </tr> [% END %] </tbody> @@ -226,7 +232,7 @@ $(document).ready(function() { <li><label for="booksellerid">Vendor:</label> <select id="booksellerid" size="1" tabindex="" name="booksellerid"> - <option value=""/> + <option value=""></option> [% FOREACH SUPPLIER_LOO IN SUPPLIER_LOOP %] [% IF ( SUPPLIER_LOO.selected ) %]<option value="[% SUPPLIER_LOO.id %]" selected="selected">[% SUPPLIER_LOO.name %]</option> [% ELSE %]<option value="[% SUPPLIER_LOO.id %]">[% SUPPLIER_LOO.name %]</option>[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt index 6b37477..18cfdec 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt @@ -14,16 +14,13 @@ } } - [% IF (dateformat == 'metric') %] - dt_add_type_uk_date(); - [% END %] $(document).ready(function() { $("#srlt").dataTable($.extend(true, {}, dataTablesDefaults, { "aoColumnDefs": [ - [% IF (dateformat == 'metric') %] - { "aTargets": [ -2 ], "sType": "uk_date" }, - [% END %] - ], + { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] }, + { "sType": "anti-the", "aTargets" : [ "anti-the" ] }, + { "sType": "title-string", "aTargets" : [ "title-string" ] } + ] } ) ) $("#show_only_renewed").click(function(){ @@ -58,12 +55,12 @@ <thead> <tr> <th>ISSN</th> - <th>Title</th> + <th class="anti-the">Title</th> <th> Notes </th> <th>Library</th> <th>Call number</th> - <th>Expiration date</th> - <th></th> + <th class="title-string">Expiration date</th> + <th class="NoSort"></th> </tr> </thead> <tbody> @@ -84,7 +81,11 @@ [% IF (sub.callnumber) %][% sub.callnumber %][% END %] </td> <td> - [% IF (sub.enddate) %][% sub.enddate | $KohaDates %][% END %] + [% IF (sub.enddate) %] + <span title="[% sub.enddate %]">[% sub.enddate | $KohaDates %]</span> + [% ELSE %] + <span title="0000-00-00"></span> + [% END %] </td> <td> [% IF (sub.alreadyOnOrder) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt index 53cc51e..486e632 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt @@ -7,11 +7,12 @@ [% INCLUDE 'datatables.inc' %] <script type="text/javascript"> //<![CDATA[ -[% IF (dateformat == 'metric') %] - dt_add_type_uk_date(); -[% END %] $(document).ready(function() { - var spent = $("#spent").dataTable($.extend(true, {}, dataTablesDefaults, { + $("#spent").dataTable($.extend(true, {}, dataTablesDefaults, { + "aoColumnDefs": [ + { "sType": "anti-the", "aTargets" : [ "anti-the" ] }, + { "sType": "title-string", "aTargets" : [ "title-string" ] } + ], "sPaginationType": "four_button" } ) ); }); @@ -33,16 +34,16 @@ <h1>Fund: [% fund_code %]</h1> <h2>Ordered</h2> -<table cellspacing="0" cellpadding="0" border="0" id="spent" class="collapse"> +<table id="spent"> <thead> <tr> - <th> Title </th> + <th class="anti-the"> Title </th> <th> Order </th> <th> Vendor </th> - <th> Itemtype </th> + <th> Item type </th> <th> Left on order </th> <th> Estimated cost per unit </th> - <th> Date ordered </th> + <th class="title-string"> Date ordered </th> <th> Subtotal </th> </tr> </thead> @@ -72,13 +73,13 @@ <td class="cell"> [% order.left %] </td> - <td class="cell" align="right"> + <td class="data cell"> [% order.ecost %] </td> - <td class="cell" align="right"> - [% order.entrydate | $KohaDates %] + <td class="cell"> + <span title="[% order.entrydate %]">[% order.entrydate | $KohaDates %]</span> </td> - <td class="cell" align="right"> + <td class="data cell"> [% order.subtotal %] </td> </tr> @@ -93,7 +94,7 @@ <td> </td> <td> </td> <td> </td> - <td align="right"> + <td class="data"> [% total %] </td> </tr> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt index ba03ee6..8a4096f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt @@ -8,10 +8,10 @@ <script type="text/javascript"> //<![CDATA[ $(document).ready(function() { -[% IF (dateformat == 'metric') %] - dt_add_type_uk_date(); -[% END %] var parcelst = $("#parcelst").dataTable($.extend(true, {}, dataTablesDefaults, { + "aoColumnDefs": [ + { "sType": "title-string", "aTargets" : [ "title-string" ] } + ], "sPaginationType": "four_button" } ) ); @@ -88,7 +88,7 @@ <thead> <tr> <th>Line</th> - <th>Date received</th> + <th class="title-string">Date received</th> <th>Invoice number</th> <th>Item count</th> <th>Biblio count</th> @@ -107,7 +107,7 @@ [% searchresult.number %] </td> <td> - [% searchresult.datereceived %] + <span title="[% searchresult.datereceived %]">[% searchresult.datereceived | $KohaDates %]</span> </td> <td> [% IF ( searchresult.code ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt index 0d88dfd..dbc69d6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt @@ -8,10 +8,11 @@ <script type="text/javascript"> //<![CDATA[ $(document).ready(function() { - [% IF (dateformat == 'metric') %] - dt_add_type_uk_date(); - [% END %] - var spent = $("#spent").dataTable($.extend(true, {}, dataTablesDefaults, { + $("#spent").dataTable($.extend(true, {}, dataTablesDefaults, { + "aoColumnDefs": [ + { "sType": "anti-the", "aTargets" : [ "anti-the" ] }, + { "sType": "title-string", "aTargets" : [ "title-string" ] } + ], "sPaginationType": "four_button" } ) ); }); @@ -34,18 +35,18 @@ <h2>Spent</h2> -<table cellspacing="0" cellpadding="0" border="0" id="spent" class="collapse"> +<table id="spent"> <thead> <tr> - <th> Title </th> + <th class="anti-the"> Title </th> <th> Order </th> <th> Vendor </th> <th> Invoice </th> - <th> Itemtype </th> + <th> Item type </th> <th> Received </th> <th> Unit price </th> - <th> Date ordered </th> - <th> Date received </th> + <th class="title-string"> Date ordered </th> + <th class="title-string"> Date received </th> <th> Subtotal </th> </tr> </thead> @@ -75,16 +76,16 @@ <td class="cell"> [% order.quantityreceived %] </td> - <td class="cell" align="right"> + <td class="cell"> [% order.unitprice %] </td> - <td class="cell" align="right"> - [% order.entrydate | $KohaDates %] + <td class="cell"> + <span title="[% order.entrydate %]">[% order.entrydate | $KohaDates %]</span> </td> - <td class="cell" align="right"> - [% order.datereceived | $KohaDates %] + <td class="cell"> + <span title="[% order.datereceived %]">[% order.datereceived | $KohaDates %]</span> </td> - <td class="cell" align="right"> + <td class="data cell"> [% order.rowtotal %] </td> </tr> @@ -93,19 +94,19 @@ [% IF shipmentcosts.size %] <tr valign="top"> <td colspan="9"> Sub total </td> - <td align="right"> [% subtotal %] </td> + <td class="data"> [% subtotal %] </td> </tr> [% FOREACH shipmentcost IN shipmentcosts %] <tr> <td></td> <td colspan="8">Shipping cost for invoice [% shipmentcost.invoicenumber %]</td> - <td class="total">[% shipmentcost.shipmentcost %]</td> + <td class="data total">[% shipmentcost.shipmentcost %]</td> </tr> [% END %] [% END %] <tr> <td colspan="9">TOTAL</td> - <td class="total">[% total %]</td> + <td class="data total">[% total %]</td> </tr> </tfoot> </table> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt index 14faa11..f54b1ea 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt @@ -14,20 +14,12 @@ function confirm_deletion() { } $(document).ready(function() { - [% IF (dateformat == 'metric') %] - dt_add_type_uk_date(); - [% END %] var contractst = $("#contractst").dataTable($.extend(true, {}, dataTablesDefaults, { "aoColumnDefs": [ { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false }, - [% IF (dateformat == 'metric') %] - { "aTargets": [ 2, 3 ], "sType": "uk_date" }, - [% END %] + { "sType": "title-string", "aTargets" : [ "title-string" ] } ], - 'sDom': 't', - 'bPaginate': false, - 'bFilter': false, - 'bInfo': false, + 'sDom': 't' } ) ); }); //]]> @@ -249,8 +241,8 @@ function confirm_deletion() { <tr> <th scope="col">Name</th> <th scope="col">Description</th> - <th scope="col">Start date</th> - <th scope="col">End date</th> + <th scope="col" class="title-string">Start date</th> + <th scope="col" class="title-string">End date</th> <th scope="col"> </th> <th scope="col"> </th> </tr> @@ -262,8 +254,8 @@ function confirm_deletion() { <a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&contractnumber=[% contract.contractnumber %]&booksellerid=[% contract.booksellerid %]">[% contract.contractname %]</a> </td> <td>[% contract.contractdescription %]</td> - <td>[% contract.contractstartdate | $KohaDates %]</td> - <td>[% contract.contractenddate | $KohaDates %]</td> + <td><span title="[% contract.contractstartdate %]">[% contract.contractstartdate | $KohaDates %]</span></td> + <td><span title="[% contract.contractenddate %]">[% contract.contractenddate | $KohaDates %]</span></td> <td><a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&contractnumber=[% contract.contractnumber %]&booksellerid=[% contract.booksellerid %]">Edit</a></td> <td><a href="/cgi-bin/koha/admin/aqcontract.pl?op=delete_confirm&contractnumber=[% contract.contractnumber %]&booksellerid=[% contract.booksellerid %]">Delete</a></td> </tr> -- 1.7.7.4