Bug 19166: (follow-up) Add ADJ_REASON auhtorised value category and minor fixes
authorNick Clemens <nick@bywatersolutions.com>
Fri, 30 Mar 2018 13:35:12 +0000 (13:35 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Thu, 19 Jul 2018 17:28:37 +0000 (17:28 +0000)
This patch adds the ADJ_REASON authorised value category tot he atomic
update, and fixes code to display a hint of no reasons are defined

other minor updates to remove warns in logs

To test:
Apply patches
Run updates
Check authorised value categories to see ADJ_REASON exists
Add an adjustment, not you have no reaosn drop down
Note there is a hint if you hover
Add a value to ADJ_REASON
add another adjustment, note you can now add reasons (or not)

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

acqui/invoice.pl
installer/data/mysql/atomicupdate/bug_19166.perl
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt

index 66c3582..4fe4b22 100755 (executable)
@@ -157,6 +157,7 @@ my @orders_loop = ();
 my $orders = $details->{'orders'};
 my @foot_loop;
 my %foot;
+my $shipmentcost = $details->{shipmentcost} || 0;
 my $total_quantity = 0;
 my $total_tax_excluded = 0;
 my $total_tax_included = 0;
@@ -211,15 +212,15 @@ $template->param(
     shipmentdate     => $details->{'shipmentdate'},
     billingdate      => $details->{'billingdate'},
     invoiceclosedate => $details->{'closedate'},
-    shipmentcost     => $details->{'shipmentcost'},
+    shipmentcost     => $shipmentcost,
     orders_loop      => \@orders_loop,
     foot_loop        => \@foot_loop,
     total_quantity   => $total_quantity,
     total_tax_excluded => $total_tax_excluded,
     total_tax_included => $total_tax_included,
     total_tax_value  => $total_tax_value,
-    total_tax_excluded_shipment => $total_tax_excluded + $details->{shipmentcost},
-    total_tax_included_shipment => $total_tax_included + $details->{shipmentcost},
+    total_tax_excluded_shipment => $total_tax_excluded + $shipmentcost,
+    total_tax_included_shipment => $total_tax_included + $shipmentcost,
     invoiceincgst    => $bookseller->invoiceincgst,
     currency         => Koha::Acquisition::Currencies->get_active,
     budgets_loop     => \@budgets_loop,
index 5539daa..76a901c 100644 (file)
@@ -15,6 +15,7 @@ if( CheckVersion( $DBversion ) ) {
             CONSTRAINT invoice_adjustments_fk_budget_id FOREIGN KEY (budget_id) REFERENCES aqbudgets (budget_id) ON DELETE SET NULL ON UPDATE CASCADE
         )
         " );
+    $dbh->do("INSERT IGNORE INTO authorised_value_categories (category_name) VALUES ('ADJ_REASON')");
     SetVersion( $DBversion );
     print "Upgrade to $DBversion done (Bug 19166 - Add the ability to add adjustments to an invoice)\n";
 }
index d872b41..7295eb1 100644 (file)
                       <td><input type="text" name="adjustment" id="adjustment_[% adjustment.adjustment_id %]" value="[% adjustment.adjustment | $Price %]" /></td>
                       <td>
                           [% reasons = AuthorisedValues.Get("ADJ_REASON") %]
-                          [% IF reasons %]
+                          [% IF reasons.0 %]
                           <select id="reason_[% adjustment.adjustment_id %]" name="reason">
                                   <option value="">No reason</option>
                               [% FOREACH reason IN reasons %]
                       <td><input type="text" name="adjustment" id="adjustment_new]" /></td>
                       <td>
                           [% reasons = AuthorisedValues.Get("ADJ_REASON") %]
-                          [% IF reasons %]
+                          [% IF reasons.0 %]
                           <select id="reason_[% adjustment.adjustment_id %]" name="reason">
                                   <option value="">No reason</option>
                                 [% FOREACH reason IN reasons %]
           </table>
         [% ELSE %]
             <div class="dialog message"><p>No orders yet</p>
-            [% IF adjustments.count > 0 || shipmentcost > 0 %]
+            [% IF adjustments && adjustments.count > 0 || shipmentcost && shipmentcost > 0 %]
             <p>Adjustments plus shipping:[% total_adj + shipmentcost | $Price %]</p>
             [% END %]
             </div>