Bug 11243: make vendor list distinguish between active and canceled items
authorJonathan Druart <jonathan.druart@biblibre.com>
Wed, 13 Nov 2013 13:57:55 +0000 (14:57 +0100)
committerGalen Charlton <gmc@esilibrary.com>
Sun, 20 Apr 2014 15:17:31 +0000 (15:17 +0000)
On the vendor result list, the "Item count" columns contain the sum of
all items ordered for a basket. But if an order is canceled, the item
count is not really meaningful.

This patch just adds, in parenthesis, the number of items canceled.

Test plan:
- create a basket and 3 orders with different number of items
- cancel 1 order
- verify on the supplier list that the number of items is correct and
  the number of canceled items is correct too.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.

Note: In case the biblio was deleted when the order was cancelled,
the number of biblios will be off.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
C4/Acquisition.pm
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt

index c565db6..dbc2714 100644 (file)
@@ -635,6 +635,9 @@ sub GetBasketsInfosByBookseller {
     my $query = qq{
         SELECT aqbasket.*,
           SUM(aqorders.quantity) AS total_items,
+          SUM(
+            IF ( aqorders.orderstatus = 'cancelled', aqorders.quantity, 0 )
+          ) AS total_items_cancelled,
           COUNT(DISTINCT aqorders.biblionumber) AS total_biblios,
           SUM(
             IF(aqorders.datereceived IS NULL
index 3fa12e2..1e90ebf 100644 (file)
@@ -116,7 +116,12 @@ $(document).ready(function() {
                                     [% END %]
                                         <td>[% basket.basketno %]</td>
                                         <td>[% basket.basketname %]</td>
-                                        <td>[% basket.total_items %]</td>
+                                        <td>
+                                            [% basket.total_items %]
+                                            [% IF basket.total_items_cancelled %]
+                                                ([% basket.total_items_cancelled %] cancelled)
+                                            [% END %]
+                                        </td>
                                         <td>[% basket.total_biblios %]</td>
                                         <td>[% basket.expected_items %]</td>
                                         <td>