From 3eb3484e9620680c3a1ebd90e24a7f8658972a98 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 13 Nov 2014 11:04:17 -0500 Subject: [PATCH] [PASSED QA] Bug 13195 - Regression: Circulation checkouts table no longer shows item type description Another regression caused by Bug 11703: The list of checkouts on the circulation and patron detail page shows item type codes instead of the full description. Test Plan: 1) View a patron's checkouts, note the Item type column displays the code rather than the description. 2) Apply this patch 3) Refresh the page, note the description is now displayed Signed-off-by: Frederic Demians Works as described. Signed-off-by: Katrin Fischer Works as described, no problems found. Passes tests and QA script. --- koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js | 2 +- svc/checkouts | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js index ece3ff2..6ecd1eb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js @@ -235,7 +235,7 @@ $(document).ready(function() { return title; } }, - { "mDataProp": "itemtype" }, + { "mDataProp": "itemtype_description" }, { "mDataProp": "issuedate_formatted" }, { "mDataProp": "branchname" }, { "mDataProp": "itemcallnumber" }, diff --git a/svc/checkouts b/svc/checkouts index 9dc4881..a3b9717 100755 --- a/svc/checkouts +++ b/svc/checkouts @@ -46,9 +46,12 @@ my @sort_columns = qw/date_due title itype issuedate branchcode itemcallnumber/; my @borrowernumber = $input->param('borrowernumber'); my $offset = $input->param('iDisplayStart'); my $results_per_page = $input->param('iDisplayLength') || -1; -my $sorting_column = $sort_columns[ $input->param('iSortCol_0') ] - || 'issuedate'; -my $sorting_direction = $input->param('sSortDir_0') eq 'asc' ? 'asc' : 'desc'; + +my $sorting_column = $input->param('iSortCol_0') || q{}; +$sorting_column = ( $sorting_column && $sort_columns[$sorting_column] ) ? $sort_columns[$sorting_column] : 'issuedate'; + +my $sorting_direction = $input->param('sSortDir_0') || q{}; +$sorting_direction = $sorting_direction eq 'asc' ? 'asc' : 'desc'; $results_per_page = undef if ( $results_per_page == -1 ); @@ -78,8 +81,10 @@ my $sql = ' issues.branchcode, branchname, - itype, - itemtype, + items.itype, + itemtype_item.description AS itype_description, + biblioitems.itemtype, + itemtype_bib.description AS itemtype_description, borrowernumber, surname, @@ -93,6 +98,8 @@ my $sql = ' LEFT JOIN biblioitems USING ( biblionumber ) LEFT JOIN borrowers USING ( borrowernumber ) LEFT JOIN branches ON ( issues.branchcode = branches.branchcode ) + LEFT JOIN itemtypes itemtype_bib ON ( biblioitems.itemtype = itemtype_bib.itemtype ) + LEFT JOIN itemtypes itemtype_item ON ( items.itype = itemtype_item.itemtype ) WHERE borrowernumber '; @@ -120,7 +127,7 @@ while ( my $c = $sth->fetchrow_hashref() ) { my ( $can_renew, $can_renew_error ) = CanBookBeRenewed( $c->{borrowernumber}, $c->{itemnumber} ); my $can_renew_date = - $can_renew_error eq 'too_soon' + $can_renew_error && $can_renew_error eq 'too_soon' ? output_pref( { dt => GetSoonestRenewDate( $c->{borrowernumber}, $c->{itemnumber} ), @@ -138,6 +145,7 @@ while ( my $c = $sth->fetchrow_hashref() ) { author => $c->{author}, barcode => $c->{barcode}, itemtype => $item_level_itypes ? $c->{itype} : $c->{itemtype}, + itemtype_description => $item_level_itypes ? $c->{itype_description} : $c->{itemtype_description}, itemnotes => $c->{itemnotes}, branchcode => $c->{branchcode}, branchname => $c->{branchname}, -- 1.9.1