From be3fce92a0127ca713b0e3878f7c482b583cf55e Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Tue, 25 Feb 2014 14:13:58 +0100 Subject: [PATCH] Bug 11870: Add more informations to histsearch.pl results - Basket group closed date and delivery place (in basketgroup column) - Additional order fields (one column for each additional field) Depends on bugs 11844 and 11708 --- C4/Acquisition.pm | 2 ++ acqui/histsearch.pl | 14 ++++++++++++++ .../prog/en/modules/acqui/histsearch.tt | 21 +++++++++++++++++++-- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index e0a49f942b..92f3079cdd 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -2352,6 +2352,8 @@ sub GetHistory { aqbasket.authorisedby, concat( borrowers.firstname,' ',borrowers.surname) AS authorisedbyname, aqbasketgroups.name as groupname, + aqbasketgroups.closeddate as groupcloseddate, + IF(aqbasketgroups.freedeliveryplace != '', aqbasketgroups.freedeliveryplace, aqbasketgroups.deliveryplace) as groupdeliveryplace, aqbooksellers.name, aqbasket.creationdate, aqorders.datereceived, diff --git a/acqui/histsearch.pl b/acqui/histsearch.pl index 9273fb0388..323434479a 100755 --- a/acqui/histsearch.pl +++ b/acqui/histsearch.pl @@ -128,6 +128,20 @@ if ($do_search) { created_by => \@created_by, additional_fields => \@additional_field_filters, ); + + foreach my $order (@$order_loop) { + my %additional_field_values; + my $o = Koha::Acquisition::Orders->find($order->{ordernumber}); + foreach my $afv ($o->additional_field_values) { + $additional_field_values{$afv->field->id} = $afv->value; + } + $order->{additional_field_values} = \%additional_field_values; + } + + my @aqorders_additional_fields = Koha::AdditionalFields->search({ tablename => 'aqorders' }) + $template->param( + aqorders_additional_fields => \@aqorders_additional_fields, + ); } my $budgetperiods = C4::Budgets::GetBudgetPeriods; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt index 6c59b44335..4aa8d2ceb8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt @@ -1,6 +1,7 @@ [% USE Asset %] [% USE KohaDates %] [% USE ColumnsSettings %] +[% USE AuthorisedValues %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Acquisitions › [% IF ( order_loop ) %]Orders search › Search results[% ELSE %]Order search[% END %] @@ -144,6 +145,9 @@ Pending order Unit cost Fund + [% FOREACH field IN aqorders_additional_fields %] + [% field.name %] + [% END %] @@ -167,8 +171,12 @@ [% IF ( order.basketgroupid ) %] [% order.groupname %] ([% order.basketgroupid %]) - [% ELSE %] -   + [% IF order.groupcloseddate %] +
Closed on [% order.groupcloseddate |$KohaDates %]. + [% END %] + [% IF order.groupdeliveryplace %] +
Delivery place: [% order.groupdeliveryplace %] + [% END %] [% END %] [% IF ( order.invoicenumber ) %] @@ -194,6 +202,15 @@ [% order.quantity %] [% order.ecost %] [% order.budget_name %] + [% FOREACH field IN aqorders_additional_fields %] + [% value = order.additional_field_values.item(field.id) %] + [% authorised_value_category = field.effective_authorised_value_category %] + [% IF authorised_value_category %] + [% value = AuthorisedValues.GetByCode(authorised_value_category, value) %] + [% END %] + [% END %] + [% value %] + [% END %] [% END %] -- 2.14.2