Bug 11170: make the pending order list only display orders to receive
authorJonathan Druart <jonathan.druart@biblibre.com>
Wed, 30 Oct 2013 14:34:15 +0000 (15:34 +0100)
committerGalen Charlton <gmc@esilibrary.com>
Tue, 11 Mar 2014 15:09:56 +0000 (15:09 +0000)
The order status ordered is set when the basket is closed.
The parcel page should only display status "ordered" and "partial".

Test plan:
- create a basket.
- create an order.
- verify the order is not listed on the parcel page (i.e. you cannot
  receive it).
- close the basket.
- verify the order is listed on the parcel page.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
C4/Acquisition.pm
acqui/parcel.pl

index 8c4bfdc..5b59519 100644 (file)
@@ -1654,6 +1654,7 @@ sub SearchOrders {
     my $basketgroupname = $params->{basketgroupname};
     my $owner = $params->{owner};
     my $pending = $params->{pending};
+    my $ordered = $params->{ordered};
 
     my $dbh = C4::Context->dbh;
     my @args = ();
@@ -1680,9 +1681,14 @@ sub SearchOrders {
         WHERE (datecancellationprinted is NULL)
     };
 
-    $query .= q{
-        AND (quantity > quantityreceived OR quantityreceived is NULL)
-    } if $pending;
+    if ( $pending ) {
+        $query .= q{ AND (quantity > quantityreceived OR quantityreceived is NULL)};
+    }
+    if ( $ordered ) {
+        $query .= q{ AND (quantity > quantityreceived OR quantityreceived is NULL)}
+            unless $pending;
+        $query .= q{ AND aqorders.orderstatus IN ( "ordered", "partial" )};
+    }
 
     my $userenv = C4::Context->userenv;
     if ( C4::Context->preference("IndependentBranches") ) {
index b45155c..557030c 100755 (executable)
@@ -238,6 +238,7 @@ unless( defined $invoice->{closedate} ) {
             ean => $ean,
             basketgroupname => $basketgroupname,
             pending => 1,
+            ordered => 1,
         });
         $template->param(
             summaryfilter => $search,
@@ -249,7 +250,7 @@ unless( defined $invoice->{closedate} ) {
     }else{
         $pendingorders = SearchOrders({
             booksellerid => $booksellerid,
-            pending => 1
+            ordered => 1
         });
     }
     my $countpendings = scalar @$pendingorders;