From 4ccfd57d8bfcee8b5315b281615c01fa02998bfe Mon Sep 17 00:00:00 2001 From: Nahuel ANGELINETTI Date: Wed, 18 Nov 2009 14:44:34 +0100 Subject: [PATCH] [3.0.x][followup](bug #3348) orderreceive problems This fix the way to search orders, some urls, and unused variable. --- C4/Acquisition.pm | 33 +++++++++---------- acqui/orderreceive.pl | 2 +- .../prog/en/modules/acqui/orderreceive.tmpl | 2 +- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index b3cd99c95f..f84ac7ea13 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -678,7 +678,7 @@ C<@results> is an array of references-to-hash with the following keys: =cut sub SearchOrder { - my ( $search, $id, $biblionumber, $catview ) = @_; + my ( $search, $id, $biblionumber ) = @_; my $dbh = C4::Context->dbh; my @data = split( ' ', $search ); my @searchterms; @@ -689,17 +689,20 @@ sub SearchOrder { push( @searchterms, $search, $search, $biblionumber ); my $query; ### FIXME THIS CAN raise a problem if more THAN ONE biblioitem is linked to one biblio - if($id and $search){ - @searchterms = ($id, $search); - $query = - "SELECT *,biblio.title - FROM aqorders - LEFT JOIN biblio ON aqorders.biblionumber=biblio.biblionumber - LEFT JOIN biblioitems ON biblioitems.biblionumber=biblio.biblionumber - LEFT JOIN aqbasket ON aqorders.basketno = aqbasket.basketno - WHERE aqbasket.booksellerid = ? AND aqorders.ordernumber = ? - " - }elsif ($id) { + if(not $id and $biblionumber and $search){ + $query = "SELECT *,biblio.title + FROM aqorders + LEFT JOIN biblio ON aqorders.biblionumber=biblio.biblionumber + LEFT JOIN biblioitems ON biblioitems.biblionumber=biblio.biblionumber + LEFT JOIN aqbasket ON aqorders.basketno = aqbasket.basketno + WHERE ((datecancellationprinted is NULL) + OR (datecancellationprinted = '0000-00-00')) + AND aqorders.biblionumber = ? + AND aqorders.ordernumber = ? + "; + @searchterms = ($biblionumber, $search); + } + elsif($id) { $query = "SELECT *,biblio.title FROM aqorders @@ -715,7 +718,6 @@ sub SearchOrder { map { "(biblio.title like ? or biblio.title like ?)" } @data ) ) . ") OR biblioitems.isbn=? OR (aqorders.ordernumber=? AND aqorders.biblionumber=?)) "; - } else { $query = @@ -735,11 +737,6 @@ sub SearchOrder { . ") or biblioitems.isbn=? OR (aqorders.ordernumber=? AND aqorders.biblionumber=?)) "; } - if ( $biblionumber ) { - $query .= "AND biblio.biblionumber = ? "; - push (@searchterms, $biblionumber); - } - $query .= " GROUP BY aqorders.ordernumber"; ### $query my $sth = $dbh->prepare($query); diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl index caabc932e5..0e952bb342 100755 --- a/acqui/orderreceive.pl +++ b/acqui/orderreceive.pl @@ -81,7 +81,7 @@ my $datereceived = C4::Dates->new($input->param('datereceived'),'iso') || C4::Da my $catview = $input->param('catview'); my $gst = $input->param('gst'); -my @results = SearchOrder( $search, $supplierid, $biblionumber, $catview ); +my @results = SearchOrder( $search, $supplierid, $biblionumber); my $count = scalar @results; my $order = GetOrder($search); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tmpl index f54ecff8b0..8ebd485998 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tmpl @@ -149,7 +149,7 @@ fieldset.rows .itemblock fieldset.action { padding:.5em; } - &receive=&biblio=&invoice=&freight=&gst=&id="> + &receive=&biblionumber=&invoice=&freight=&gst=&id="> -- 2.39.5