Bug 7288: (follow-up) set a boolean if the invoice if linked to subscriptions
[srvgit] / C4 / Acquisition.pm
index c7d0951..a597937 100644 (file)
@@ -2587,6 +2587,13 @@ sub GetInvoices {
               NULL
             )
           ) AS receivedbiblios,
+          COUNT(
+             DISTINCT IF(
+              aqorders.subscriptionid IS NOT NULL,
+              aqorders.subscriptionid,
+              NULL
+            )
+          ) AS is_linked_to_subscriptions,
           SUM(aqorders.quantityreceived) AS receiveditems
         FROM aqinvoices
           LEFT JOIN aqbooksellers ON aqbooksellers.id = aqinvoices.booksellerid