From 21226b440bd6889e9b071d50c06d6c56e4741940 Mon Sep 17 00:00:00 2001 From: Alex Arnaud <alex.arnaud@biblibre.com> 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 <alexbuckley@catalyst.net.nz> --- 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 + koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt | 1 + koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt | 5 +++-- .../intranet-tmpl/prog/en/modules/members/moremember.tt | 2 ++ koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 12 +++++++++++- svc/checkouts | 7 +++++-- 9 files changed, 33 insertions(+), 7 deletions(-) diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml index 1480019..d2d8dd3 100644 --- a/admin/columns_settings.yml +++ b/admin/columns_settings.yml @@ -329,6 +329,8 @@ modules: - columnname: title - + columnname: record_type + - columnname: item_type - columnname: collection @@ -486,6 +488,8 @@ modules: - columnname: title - + columnname: record_type + - columnname: item_type - columnname: collection @@ -538,6 +542,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 c2f20ef..75fc732 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -582,6 +582,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; @@ -589,7 +590,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 b831c1e..40d2195 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 @@ <tfoot> <tr> - <td colspan="11" style="text-align: right; font-weight:bold;">Totals:</td> + <td colspan="13" style="text-align: right; font-weight:bold;">Totals:</td> <td id="totaldue" style="text-align: right;">[% totaldue | html %]</td> <td id="totalfine" style="text-align: right;">[% finetotal | html %]</td> <td id="totalprice" style="text-align: right;">[% totalprice | html %]</td> 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 d78e001..3d106ee 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 @@ <th scope="col">Due date</th> <th scope="col">Due date</th> <th scope="col">Title</th> + <th scope="col">Record type</th> <th scope="col">Item type</th> <th scope="col">Collection</th> <th scope="col">Location</th> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index 2b273e0..bc411a4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -851,6 +851,7 @@ No patron matched <span class="ex">[% message | html %]</span> <th scope="col">Due date (unformatted, hidden)</th> <th scope="col">Due date</th> <th scope="col">Title</th> + <th scope="col">Record type</th> <th scope="col">Item type</th> <th scope="col">Collection code</th> <th scope="col">Location</th> 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 5763e97..dd502d9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -683,7 +683,7 @@ [% IF ( riloop ) %] <h2>Checked-in items</h2> <table id="checkedintable"> - <thead><tr><th class="ci-duedate">Due date</th><th class="ci-title">Title</th><th class="ci-author">Author</th><th class="ci-barcode">Barcode</th><th class="ci-homelibrary">Home library</th><th class="ci-holdinglibrary">Holding library</th><th class="ci-shelvinglocation">Shelving location</th><th class="ci-callnumber">Call number</th><th class="ci-dateaccessioned">Date acquired</th><th class="ci-type">Type</th><th class="ci-patron">Patron</th><th class="ci-note">Note</th></tr></thead> + <thead><tr><th class="ci-duedate">Due date</th><th class="ci-title">Title</th><th class="ci-author">Author</th><th class="ci-barcode">Barcode</th><th class="ci-homelibrary">Home library</th><th class="ci-holdinglibrary">Holding library</th><th class="ci-shelvinglocation">Shelving location</th><th class="ci-callnumber">Call number</th><th class="ci-dateaccessioned">Date acquired</th><th class="ci-recodtype">Record type</th><th class="ci-itemtype">Item type</th><th class="ci-patron">Patron</th><th class="ci-note">Note</th></tr></thead> [% FOREACH riloo IN riloop %] <tr> @@ -710,7 +710,8 @@ <td class="ci-shelvinglocation">[% riloo.location | html %]</td> <td class="ci-callnumber">[% riloo.itemcallnumber | html %]</td> <td class="ci-dateaccessioned">[% riloo.dateaccessioned | $KohaDates %]</td> - <td class="ci-type">[% ItemTypes.GetDescription( riloo.itemtype ) | html %] [% AuthorisedValues.GetByCode('CCODE', riloo.ccode) | html %]</td> + <td class="ci-recordtype">[% ItemTypes.GetDescription( riloo.recordtype ) | html %]</td> + <td class="ci-itemtype">[% ItemTypes.GetDescription( riloo.itemtype ) | html %] [% AuthorisedValues.GetByCode('CCODE', riloo.ccode) | html %]</td> <td class="ci-patron">[% IF ( riloo.duedate ) %] <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% riloo.patron.borrowernumber | html %]"> [% riloo.patron.surname | html %], [% riloo.patron.firstname | html %] ([% riloo.patron.category.description | html %]) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index a88a98e..3411c8d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -690,7 +690,9 @@ <th scope="col">Due date hidden not formatted</th> <th scope="col">Due date</th> <th scope="col">Title</th> + <th scope="col">Record type</th> <th scope="col">Item type</th> + <th scope="col">Collection</th> <th scope="col">Location</th> <th scope="col">Checked out on</th> <th scope="col">Checked out from</th> diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js index b964a9c..c850e98 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js @@ -292,6 +292,11 @@ $(document).ready(function() { }, { "mDataProp": function ( oObj ) { + return oObj.recordtype_description.escapeHtml(); + } + }, + { + "mDataProp": function ( oObj ) { return oObj.itemtype_description.escapeHtml(); } }, @@ -516,7 +521,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 = $('<ul>'); @@ -633,6 +638,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 9a1b3a5..8d4e9e7 100755 --- a/svc/checkouts +++ b/svc/checkouts @@ -150,7 +150,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} }); @@ -176,8 +178,9 @@ while ( my $c = $sth->fetchrow_hashref() ) { title => $c->{title}, 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.1.4