Bug 13195 - Regression: Circulation checkouts table no longer shows item type description
authorKyle M Hall <kyle@bywatersolutions.com>
Thu, 13 Nov 2014 16:04:17 +0000 (11:04 -0500)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Mon, 17 Nov 2014 00:35:09 +0000 (21:35 -0300)
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 <f.demians@tamil.fr>
Works as described.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, no problems found.
Passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js
svc/checkouts

index c5fd02b..9a022df 100644 (file)
@@ -249,7 +249,7 @@ $(document).ready(function() {
                         return title;
                     }
                 },
-                { "mDataProp": "itemtype" },
+                { "mDataProp": "itemtype_description" },
                 { "mDataProp": "issuedate_formatted" },
                 { "mDataProp": "branchname" },
                 { "mDataProp": "itemcallnumber" },
index 7901d8d..51fd861 100755 (executable)
@@ -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,
@@ -96,6 +101,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
 ';
 
@@ -123,7 +130,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} ),
@@ -141,6 +148,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},