From c66fefb27f820a1764e4fb6b4e08b7d554d09e40 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Fri, 1 Aug 2014 10:34:33 +0200 Subject: [PATCH] Bug 11847: Display basketgroup closed date at OPAC in Holdings table, on detail page. Test plan: 1/ Enable OPACAcquisitionDetails syspref 2/ Set AcqCreateItem syspref to "ordering" 3/ Create a basket with 1 order, close this basket then create a basketgroup with this basket and close the basketgroup 4/ Create another basket with 1 order on the same biblio record as previous order. Close the basket then create a basketgroup with this basket but do not close it. 5/ Go to the OPAC detail page of the biblio record. 6/ In holdings table, under "Status" column, you should see: - for the first item ordered: "On order since DATE" - for the second item ordered: "On order" Signed-off-by: Chris Cormack --- koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc | 8 +++++++- opac/opac-detail.pl | 11 +++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc index 23b3a19..a80d984 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc @@ -1,4 +1,5 @@ [% USE AuthorisedValues %] +[% USE KohaDates %] [% SET itemavailable = 1 %] [%#- @@ -79,7 +80,12 @@ not use an API to fetch items that populates item.datedue. [% IF item.on_order %] [% SET itemavailable = 0 %] - On order + + On order + [% IF item.order_date %] + since [% item.order_date |$KohaDates %] + [% END %] + [% END %] [% IF ( itemavailable ) %] diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index b8cd194..c36f4d7 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -676,8 +676,15 @@ if ( not $viewallitems and @items > $max_items_to_display ) { if ( C4::Context->preference('OPACAcquisitionDetails') and C4::Context->preference('AcqCreateItem') eq 'ordering' ) { - $itm->{on_order} = 1 - if grep /^$itm->{itemnumber}$/, @itemnumbers_on_order; + if (grep /^$itm->{itemnumber}$/, @itemnumbers_on_order) { + $itm->{on_order} = 1; + my $order = C4::Acquisition::GetOrderFromItemnumber($itm->{itemnumber}); + my $basket = C4::Acquisition::GetBasket($order->{basketno}); + my $basketgroup = C4::Acquisition::GetBasketgroup($basket->{basketgroupid}); + if ($basketgroup and $basketgroup->{closeddate}) { + $itm->{order_date} = $basketgroup->{closeddate}; + } + } } my $itembranch = $itm->{$separatebranch}; -- 1.9.1