Bug 23397: (follow-up) Split and display itemtypes
authorNick Clemens <nick@bywatersolutions.com>
Fri, 23 Aug 2019 13:14:57 +0000 (13:14 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 6 Sep 2019 12:17:46 +0000 (13:17 +0100)
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

acqui/ordered.pl
acqui/spent.pl
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt

index 7899cb8..b490f42 100755 (executable)
@@ -58,7 +58,7 @@ SELECT
     ecost_tax_included, budgetdate, entrydate,
     aqbasket.booksellerid,
     aqbooksellers.name as vendorname,
-    GROUP_CONCAT(DISTINCT itype),
+    GROUP_CONCAT(DISTINCT itype SEPARATOR '|') AS itypes,
     title
 FROM (aqorders, aqbasket)
 LEFT JOIN biblio ON
@@ -93,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'};
index 95b2de6..083429a 100755 (executable)
@@ -59,7 +59,7 @@ SELECT
     quantity-quantityreceived AS tleft,
     budgetdate, entrydate,
     aqbasket.booksellerid,
-    GROUP_CONCAT(DISTINCT itype),
+    GROUP_CONCAT(DISTINCT itype SEPARATOR '|') as itypes,
     title,
     aqorders.invoiceid,
     aqinvoices.invoicenumber,
@@ -106,6 +106,7 @@ my $subtotal = 0;
 my @spent;
 while ( my $data = $sth->fetchrow_hashref ) {
     my $recv = $data->{'quantityreceived'};
+    $data->{'itemtypes'} = [split('\|', $data->{itypes})];
     if ( $recv > 0 ) {
         my $rowtotal = $recv * get_rounded_price($data->{'unitprice_tax_included'});
         $data->{'rowtotal'}  = sprintf( "%.2f", $rowtotal );
index 483cc8c..275559f 100644 (file)
@@ -29,7 +29,7 @@
     <th class="anti-the"> Title </th>
     <th> Order </th>
     <th> Vendor </th>
-    <th> Item type </th>
+    <th> Item types </th>
     <th> Left on order </th>
     <th> Estimated cost per unit </th>
     <th class="title-string"> Date ordered </th>
         <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% order.booksellerid | uri %]">[% order.vendorname | html %]</a>
     </td>
     <td class="cell">
-        [% ItemTypes.GetDescription( order.itype ) | html %]
+        [% FOREACH itemtype IN order.itemtypes %]
+            [% IF !(loop.count() mod 2) %] | [% END %]
+            [% ItemTypes.GetDescription( itemtype ) | html %]
+        [% END %]
     </td>
     <td class="cell">
         [% order.left | html %]
index 010f3e1..e5687c3 100644 (file)
@@ -30,7 +30,7 @@
            <th>Order</th>
            <th>Vendor</th>
            <th>Invoice</th>
-           <th>Item type</th>
+           <th>Item types</th>
            <th>Received</th>
            <th>Unit price</th>
            <th class="title-string">Date ordered</th>
                 <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% order.invoiceid | uri %]">[% order.invoicenumber | html %]</a>
             </td>
             <td class="cell">
-                [% ItemTypes.GetDescription( order.itype ) | html %]
+                [% FOREACH itemtype IN order.itemtypes %]
+                    [% IF !(loop.count() mod 2) %] | [% END %]
+                    [% ItemTypes.GetDescription( itemtype ) | html %]
+                [% END %]
             </td>
             <td class="cell">
                 [% order.quantityreceived | html %]