From 248816f77b606ea8af1cc17ed08f5607687d16e4 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 8 May 2018 13:31:55 -0300 Subject: [PATCH] Bug 20366: Add subscription info to the acq tab on the biblio detail page On the "Acquisition details" tab of the bibliographic detail page, the subscription information are missing. This patch replace the call to GetHistory with Koha::Acquisition::Orders in order to simplify the code and make use of new Koha:: packages/methods. TODO: Add column settings (show/hide columns) to this table (?) Sponsored-by: BULAC - http://www.bulac.fr/ Signed-off-by: Josef Moravec Signed-off-by: Katrin Fischer --- catalogue/detail.pl | 10 ++++-- .../prog/en/modules/catalogue/detail.tt | 41 ++++++++++++++-------- 2 files changed, 35 insertions(+), 16 deletions(-) diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 1c6b234651..fe59fa12cc 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -20,7 +20,6 @@ use Modern::Perl; use CGI qw ( -utf8 ); use HTML::Entities; -use C4::Acquisition qw( GetHistory ); use C4::Auth; use C4::Koha; use C4::Serials; #uses getsubscriptionfrom biblionumber @@ -180,7 +179,14 @@ foreach my $subscription (@subscriptions) { # Get acquisition details if ( C4::Context->preference('AcquisitionDetails') ) { - my $orders = C4::Acquisition::GetHistory( biblionumber => $biblionumber, get_canceled_order => 1 ); + my $orders = Koha::Acquisition::Orders->search( + { biblionumber => $biblionumber }, + { + join => 'basketno', + order_by => 'basketno.booksellerid' + } + ); # GetHistory sorted by aqbooksellerid, but does it make sense? + $template->param( orders => $orders, ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 0a7d6f4972..21cc5cd1e1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -710,44 +710,47 @@ Receive date Status Quantity + Subscription + Subscription callnumber [% FOR order IN orders %] + [% SET basket = order.basket %] + [% SET vendor = basket.bookseller %] - [% IF (order.id) %] - [% order.name | html %] - [% END %] + [% vendor.name | html %] - [% IF (order.invoiceid) %] + [% IF order.invoiceid %] [% IF CAN_user_acquisition %] - - [% order.invoicenumber | html %] + [% order.invoice.invoicenumber | hrml %] [% ELSE %] - [% order.invoicenumber | html %] + [% order.invoice.invoicenumber | html %] [% END %] [% END %] - [% IF (order.basketgroupid) %] + [% IF basket.basketgroupid %] + [% SET basket_group = basket.basket_group %] [% IF CAN_user_acquisition_group_manage %] - [% order.groupname | html %] ([% order.basketgroupid | html %]) + [% basket_group.name | html%] ([% basket_group.id | html %]) [% ELSE %] - [% order.groupname | html %] ([% order.basketgroupid | html %]) + [% basket_group.name | html %] ([% basket_group.id | html %]) [% END %] [% END %] [% IF CAN_user_acquisition_order_manage %] - [% order.basketname | html %] ([% order.basketno | html %]) + [% basket.basketname | html %] ([% basket.basketno | html %]) [% ELSE %] - [% order.basketname | html %] ([% order.basketno | html %]) + [% basket.basketname | html %] ([% basket.basketno | html %]) [% END %] [% order.ordernumber | html %] - [% order.creationdate | $KohaDates%] - [% order.datereceived | $KohaDates%] + [% basket.creationdate | $KohaDates%] + [% order.datereceived | $KohaDates%] [% SWITCH order.orderstatus %] [% CASE 'new' %]New @@ -758,6 +761,16 @@ [% END %] [% order.quantity | html %] + + [% IF order.subscriptionid %] + [% order.subscriptionid | html %] + [% END %] + + + [% IF order.subscriptionid %] + [% order.subscription.callnumber | html %] + [% END %] + [% END %] -- 2.11.0