From bbd44ece3606eae878e51ca0c8ef072bbcbb689f Mon Sep 17 00:00:00 2001 From: Alex Arnaud Date: Thu, 25 Oct 2018 11:19:01 +0200 Subject: [PATCH] Bug 20194: Display both biblioitems.itemtype and items.itype in circulation screens Test plan: 1. Verify that biblioitems.itemtype, items.itype are mapped to a MARC field. Otherwise create those mappings. 2. Create a biblio with an itemtype 3. Create an item with a different itemtype for this biblio 4. Check out this item to a patron (P1) 5. Verify that both itemtypes are displayed in the checkouts table (moremember.pl, circulation.pl, returns.pl) 6. Create a patron whose guarantor is P1 and verify that both itemtypes and the ccode are displayed in the 'relatives checkouts' table Followed test plan, patch worked as described, also passes QA test tool Signed-off-by: Alex Buckley Signed-off-by: Nick Clemens --- admin/columns_settings.yml | 6 ++++++ circ/returns.pl | 4 +++- .../prog/en/includes/checkouts-table-footer.inc | 2 +- koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc | 1 + .../prog/en/includes/relatives-issues-table.inc | 1 + koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt | 8 ++++++-- koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 12 +++++++++++- svc/checkouts | 7 +++++-- 8 files changed, 34 insertions(+), 7 deletions(-) diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml index 1ea975dce2..0c4dd647e2 100644 --- a/admin/columns_settings.yml +++ b/admin/columns_settings.yml @@ -550,6 +550,8 @@ modules: - columnname: title - + columnname: record_type + - columnname: item_type - columnname: collection @@ -763,6 +765,8 @@ modules: - columnname: title - + columnname: record_type + - columnname: item_type - columnname: collection @@ -837,6 +841,8 @@ modules: columnname: dateaccessioned is_hidden: 1 - + columnname: record_type + - columnname: itype - columnname: borrower diff --git a/circ/returns.pl b/circ/returns.pl index 657229a10e..e56c4e59bf 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -587,6 +587,7 @@ foreach ( sort { $a <=> $b } keys %returneditems ) { my $item = Koha::Items->find({ barcode => $bar_code }); next unless $item; # FIXME The item has been deleted in the meantime, # we could handle that better displaying a message in the template + my $biblio = $item->biblio; # FIXME pass $item to the template and we are done here... $ri{itembiblionumber} = $biblio->biblionumber; @@ -594,7 +595,8 @@ foreach ( sort { $a <=> $b } keys %returneditems ) { $ri{itemauthor} = $biblio->author; $ri{itemcallnumber} = $item->itemcallnumber; $ri{dateaccessioned} = $item->dateaccessioned; - $ri{itemtype} = $item->effective_itemtype; + $ri{recordtype} = $biblio->itemtype; + $ri{itemtype} = $item->itype; $ri{itemnote} = $item->itemnotes; $ri{itemnotes_nonpublic} = $item->itemnotes_nonpublic; $ri{ccode} = $item->ccode; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc index 931d92f36c..9b62491d4a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc @@ -1,6 +1,6 @@ - Totals: + Totals: diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc index 1276e70ab1..c0535d7694 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc @@ -15,6 +15,7 @@ Due date Due date Title + Record-level item type Item type Collection Location diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/relatives-issues-table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/relatives-issues-table.inc index 28addf4815..97e9ba6bd1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/relatives-issues-table.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/relatives-issues-table.inc @@ -7,6 +7,7 @@ Due date (unformatted, hidden) Due date Title + Record-level item type Item type Collection code Location diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt index 42d7a19089..4485d122f8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -767,7 +767,8 @@ Shelving location Call number Date acquired - Type + Record-level itemtype + Item type Patron Note @@ -814,7 +815,10 @@ [% riloo.dateaccessioned | $KohaDates %] - + + [% ItemTypes.GetDescription( riloo.recordtype ) | html %] + + [% ItemTypes.GetDescription( riloo.itemtype ) | html %] [% AuthorisedValues.GetByCode('CCODE', riloo.ccode) | html %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js index da69276e4a..b3ded1b906 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js @@ -344,6 +344,11 @@ $(document).ready(function() { }, { "mDataProp": function ( oObj ) { + return oObj.recordtype_description.escapeHtml(); + } + }, + { + "mDataProp": function ( oObj ) { return oObj.itemtype_description.escapeHtml(); } }, @@ -589,7 +594,7 @@ $(document).ready(function() { // Build a summary of checkouts grouped by itemtype var checkoutsByItype = json.aaData.reduce(function (obj, row) { - obj[row.itemtype_description] = (obj[row.itemtype_description] || 0) + 1; + obj[row.type_for_stat] = (obj[row.type_for_stat] || 0) + 1; return obj; }, {}); var ul = $('
    '); @@ -708,6 +713,11 @@ $(document).ready(function() { }, { "mDataProp": function ( oObj ) { + return oObj.recordtype_description.escapeHtml(); + } + }, + { + "mDataProp": function ( oObj ) { return oObj.itemtype_description.escapeHtml(); } }, diff --git a/svc/checkouts b/svc/checkouts index 892eab84fe..55904081ba 100755 --- a/svc/checkouts +++ b/svc/checkouts @@ -153,7 +153,9 @@ while ( my $c = $sth->fetchrow_hashref() ) { my ( $renewals_count, $renewals_allowed, $renewals_remaining ) = GetRenewCount( $c->{borrowernumber}, $c->{itemnumber} ); - my $itemtype = Koha::ItemTypes->find( $item_level_itypes ? $c->{itype} : $c->{itemtype} ); + my $type_for_stat = Koha::ItemTypes->find( $item_level_itypes ? $c->{itype} : $c->{itemtype} ); + my $itemtype = Koha::ItemTypes->find( $c->{itype} ); + my $recordtype = Koha::ItemTypes->find( $c->{itemtype} ); my $location; if ( $c->{location} ) { my $av = Koha::AuthorisedValues->search({ category => 'LOC', authorised_value => $c->{location} }); @@ -184,8 +186,9 @@ while ( my $c = $sth->fetchrow_hashref() ) { part_name => $c->{part_name} // '', author => $c->{author}, barcode => $c->{barcode}, - itemtype => $item_level_itypes ? $c->{itype} : $c->{itemtype}, + type_for_stat => $type_for_stat ? $type_for_stat->translated_description : q{}, itemtype_description => $itemtype ? $itemtype->translated_description : q{}, + recordtype_description => $recordtype ? $recordtype->translated_description : q{}, collection => $collection, location => $location, homebranch => $c->{homebranch}, -- 2.11.0