(bug #3726) fix ISBD url translation
[koha.git] / C4 / Acquisition.pm
index 5fc05ce..b3cd99c 100644 (file)
@@ -196,7 +196,7 @@ Results are ordered from most to least recent.
 =cut
 
 sub GetPendingOrders {
-    my ($supplierid,$grouped) = @_;
+    my ($supplierid,$grouped, $closed) = @_;
     my $dbh = C4::Context->dbh;
     my $strsth = "
         SELECT    ".($grouped?"count(*),":"")."aqbasket.basketno,
@@ -206,10 +206,14 @@ sub GetPendingOrders {
         LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno
         LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber
         WHERE booksellerid=?
-            AND (quantity > quantityreceived OR quantityreceived is NULL)
             AND datecancellationprinted IS NULL
             AND (to_days(now())-to_days(closedate) < 180 OR closedate IS NULL)
     ";
+    if($closed){
+        $strsth .= "
+        AND (quantity > quantityreceived OR quantityreceived is NULL) 
+        AND closedate IS NOT NULL ";
+    }
     ## FIXME  Why 180 days ???
     my @query_params = ( $supplierid );
     if ( C4::Context->preference("IndependantBranches") ) {
@@ -731,7 +735,7 @@ sub SearchOrder {
           . ") or biblioitems.isbn=? OR (aqorders.ordernumber=? AND aqorders.biblionumber=?)) ";
     }
     
-    if( $biblionumber and $biblionumber ne "" ){
+    if ( $biblionumber ) {
         $query .= "AND biblio.biblionumber = ? ";
         push (@searchterms, $biblionumber);
     }