@@ -, +, @@ - go on the order advanced search form (acqui/histsearch.pl) - use the autocomplete input to search patrons - launch the search and verify the results are consistent with the values you have filled. --- C4/Acquisition.pm | 13 +++++++++---- acqui/histsearch.pl | 2 ++ .../prog/en/modules/acqui/histsearch.tt | 21 ++++++++++++++++++++- 3 files changed, 31 insertions(+), 5 deletions(-) --- a/C4/Acquisition.pm +++ a/C4/Acquisition.pm @@ -2252,6 +2252,7 @@ sub GetHistory { my $get_canceled_order = $params{get_canceled_order} || 0; my $ordernumber = $params{ordernumber}; my $search_children_too = $params{search_children_too} || 0; + my $created_by = $params{created_by} || []; my @order_loop; my $total_qty = 0; @@ -2268,6 +2269,8 @@ sub GetHistory { aqorders.basketno, aqbasket.basketname, aqbasket.basketgroupid, + aqbasket.authorisedby, + concat( borrowers.firstname,' ',borrowers.surname) AS authorisedbyname, aqbasketgroups.name as groupname, aqbooksellers.name, aqbasket.creationdate, @@ -2296,12 +2299,9 @@ sub GetHistory { LEFT JOIN aqinvoices ON aqorders.invoiceid = aqinvoices.invoiceid LEFT JOIN deletedbiblio ON deletedbiblio.biblionumber=aqorders.biblionumber LEFT JOIN deletedbiblioitems ON deletedbiblioitems.biblionumber=aqorders.biblionumber + LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber "; - if ( C4::Context->preference("IndependentBranches") ) { - $query .= " LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber"; - } - $query .= " WHERE 1 "; unless ($get_canceled_order or (defined $orderstatus and $orderstatus eq 'cancelled')) { @@ -2389,6 +2389,11 @@ sub GetHistory { $query .= ") "; } + if ( @$created_by ) { + $query .= ' AND aqbasket.authorisedby IN ( ' . join( ',', ('?') x @$created_by ) . ')'; + push @query_params, @$created_by; + } + if ( C4::Context->preference("IndependentBranches") ) { unless ( C4::Context->IsSuperLibrarian() ) { --- a/acqui/histsearch.pl +++ a/acqui/histsearch.pl @@ -76,6 +76,7 @@ my $budget = $input->param( 'budget' ); my $orderstatus = $input->param( 'orderstatus' ); my $ordernumber = $input->param( 'ordernumber' ); my $search_children_too = $input->param( 'search_children_too' ); +my @created_by = $input->param('created_by'); if ( not $input->param('from') ) { # FIXME Dirty but we can't sent a Date::Calc to C4::Dates ? @@ -121,6 +122,7 @@ if ($do_search) { orderstatus => $orderstatus, ordernumber => $ordernumber, search_children_too => $search_children_too, + created_by => \@created_by, ); } --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt @@ -5,6 +5,8 @@ [% INCLUDE 'doc-head-close.inc' %] [% INCLUDE 'calendar.inc' %] [% INCLUDE 'datatables.inc' %] + + @@ -43,6 +54,12 @@ [% END %]
  • +
  • + +
    +
    +
    +
  • @@ -135,6 +152,7 @@ Order line (parent) Status Basket + Basket creator Basket group Invoice number Summary @@ -164,6 +182,7 @@ [% END %] [% order.basketname %] ([% order.basketno %]) + [% order.authorisedbyname %] [% IF ( order.basketgroupid ) %] [% order.groupname %] ([% order.basketgroupid %]) --