Bug 25033: Display both local and all pending suggestions counts if the numbers differ
[koha-ffzg.git] / acqui / ordered.pl
index f6796f2..8f09530 100755 (executable)
@@ -58,9 +58,10 @@ SELECT
     ecost_tax_included, budgetdate, entrydate,
     aqbasket.booksellerid,
     aqbooksellers.name as vendorname,
-    itype,
+    GROUP_CONCAT(DISTINCT itype SEPARATOR '|') AS itypes,
     title
-FROM (aqorders, aqbasket)
+FROM aqorders
+JOIN aqbasket USING (basketno)
 LEFT JOIN biblio ON
     biblio.biblionumber=aqorders.biblionumber
 LEFT JOIN aqorders_items ON
@@ -70,7 +71,6 @@ LEFT JOIN items ON
 LEFT JOIN aqbooksellers ON
     aqbasket.booksellerid = aqbooksellers.id
 WHERE
-    aqorders.basketno=aqbasket.basketno AND
     budget_id=? AND
     (datecancellationprinted IS NULL OR
         datecancellationprinted='0000-00-00') AND
@@ -80,7 +80,6 @@ WHERE
              ecost_tax_included, budgetdate, entrydate,
              aqbasket.booksellerid,
              aqbooksellers.name,
-             itype,
              title
 EOQ
 
@@ -94,6 +93,7 @@ my @ordered;
 
 my $total = 0;
 while ( my $data = $sth->fetchrow_hashref ) {
+    $data->{'itemtypes'} = [split('\|', $data->{itypes})];
     my $left = $data->{'tleft'};
     if ( !$left || $left eq '' ) {
         $left = $data->{'quantity'};