X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=C4%2FAcquisition.pm;h=1bf41cbf65aaf8b5a1eccabccb8e6132cfb0bc4e;hb=e52b493611766b61a0018350adc590ab07e9c94b;hp=aabc0eddaab294d831820bba2dcdd2c2964a7a9b;hpb=54616c37e25b969907f9da2cf021e7e23ced836c;p=koha_fer diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index aabc0eddaa..1bf41cbf65 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -1678,6 +1678,8 @@ sub SearchOrders { aqbasket.closedate, aqbasket.creationdate, aqbasket.basketname, + aqbasketgroups.id as basketgroupid, + aqbasketgroups.name as basketgroupname, aqorders.* FROM aqorders LEFT JOIN aqbasket ON aqorders.basketno = aqbasket.basketno @@ -2140,10 +2142,19 @@ params: title author name + isbn + ean from_placed_on to_placed_on basket - search both basket name and number booksellerinvoicenumber + basketgroupname + budget + orderstatus (note that orderstatus '' will retrieve orders + of any status except cancelled) + biblionumber + get_canceled_order (if set to a true value, cancelled orders will + be included) returns: $order_loop is a list of hashrefs that each look like this: @@ -2185,6 +2196,8 @@ sub GetHistory { my $basketgroupname = $params{basketgroupname}; my $budget = $params{budget}; my $orderstatus = $params{orderstatus}; + my $biblionumber = $params{biblionumber}; + my $get_canceled_order = $params{get_canceled_order} || 0; my @order_loop; my $total_qty = 0; @@ -2237,10 +2250,17 @@ sub GetHistory { $query .= " WHERE 1 "; - $query .= " AND (datecancellationprinted is NULL or datecancellationprinted='0000-00-00') " if $orderstatus ne 'cancelled'; + unless ($get_canceled_order or (defined $orderstatus and $orderstatus eq 'cancelled')) { + $query .= " AND (datecancellationprinted is NULL or datecancellationprinted='0000-00-00') "; + } my @query_params = (); + if ( $biblionumber ) { + $query .= " AND biblio.biblionumber = ?"; + push @query_params, $biblionumber; + } + if ( $title ) { $query .= " AND biblio.title LIKE ? "; $title =~ s/\s+/%/g; @@ -2450,6 +2470,7 @@ sub AddClaim { my @invoices = GetInvoices( invoicenumber => $invoicenumber, + supplierid => $supplierid, suppliername => $suppliername, shipmentdatefrom => $shipmentdatefrom, # ISO format shipmentdateto => $shipmentdateto, # ISO format @@ -2494,6 +2515,8 @@ sub GetInvoices { FROM aqinvoices LEFT JOIN aqbooksellers ON aqbooksellers.id = aqinvoices.booksellerid LEFT JOIN aqorders ON aqorders.invoiceid = aqinvoices.invoiceid + LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno + LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber LEFT JOIN biblio ON aqorders.biblionumber = biblio.biblionumber LEFT JOIN biblioitems ON biblio.biblionumber = biblioitems.biblionumber LEFT JOIN subscription ON biblio.biblionumber = subscription.biblionumber @@ -2514,11 +2537,11 @@ sub GetInvoices { push @bind_args, "%$args{suppliername}%"; } if($args{shipmentdatefrom}) { - push @bind_strs, " aqinvoices.shipementdate >= ? "; + push @bind_strs, " aqinvoices.shipmentdate >= ? "; push @bind_args, $args{shipmentdatefrom}; } if($args{shipmentdateto}) { - push @bind_strs, " aqinvoices.shipementdate <= ? "; + push @bind_strs, " aqinvoices.shipmentdate <= ? "; push @bind_args, $args{shipmentdateto}; } if($args{billingdatefrom}) { @@ -2530,27 +2553,27 @@ sub GetInvoices { push @bind_args, $args{billingdateto}; } if($args{isbneanissn}) { - push @bind_strs, " (biblioitems.isbn LIKE ? OR biblioitems.ean LIKE ? OR biblioitems.issn LIKE ? ) "; + push @bind_strs, " (biblioitems.isbn LIKE CONCAT('%', ?, '%') OR biblioitems.ean LIKE CONCAT('%', ?, '%') OR biblioitems.issn LIKE CONCAT('%', ?, '%') ) "; push @bind_args, $args{isbneanissn}, $args{isbneanissn}, $args{isbneanissn}; } if($args{title}) { - push @bind_strs, " biblio.title LIKE ? "; + push @bind_strs, " biblio.title LIKE CONCAT('%', ?, '%') "; push @bind_args, $args{title}; } if($args{author}) { - push @bind_strs, " biblio.author LIKE ? "; + push @bind_strs, " biblio.author LIKE CONCAT('%', ?, '%') "; push @bind_args, $args{author}; } if($args{publisher}) { - push @bind_strs, " biblioitems.publishercode LIKE ? "; + push @bind_strs, " biblioitems.publishercode LIKE CONCAT('%', ?, '%') "; push @bind_args, $args{publisher}; } if($args{publicationyear}) { - push @bind_strs, " biblioitems.publicationyear = ? "; - push @bind_args, $args{publicationyear}; + push @bind_strs, " ((biblioitems.publicationyear LIKE CONCAT('%', ?, '%')) OR (biblio.copyrightdate LIKE CONCAT('%', ?, '%'))) "; + push @bind_args, $args{publicationyear}, $args{publicationyear}; } if($args{branchcode}) { - push @bind_strs, " aqorders.branchcode = ? "; + push @bind_strs, " borrowers.branchcode = ? "; push @bind_args, $args{branchcode}; }