From d250f236454701d215d9488b31093366edfc4ff7 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 | 4 ++++ opac/opac-detail.pl | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 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 16599de..64631c0 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 %] [%#- This include takes two parameters: an item structure @@ -48,6 +49,9 @@ not use an API to fetch items that populates item.datedue. [% END %] [% ELSIF item.on_order %] On order + [% IF item.order_date %] + since [% item.order_date |$KohaDates %] + [% END %] [% ELSE %] Available [% IF ( item.restrictedopac ) %]([% item.restrictedopac %])[% END %] [% END %] diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index e4b1cd2..8eac03f 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -674,8 +674,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