Merge branch 'bug_7368' into 3.14-master
[koha_fer] / acqui / orderreceive.pl
index ec60f54..fc79ccb 100755 (executable)
@@ -215,7 +215,6 @@ $template->param(
     quantityreceived      => $order->{'quantityreceived'},
     rrp                   => sprintf( "%.2f", $rrp ),
     ecost                 => sprintf( "%.2f", $ecost ),
-    unitprice             => sprintf( "%.2f", $unitprice),
     memberfirstname       => $member->{firstname} || "",
     membersurname         => $member->{surname} || "",
     invoiceid             => $invoice->{invoiceid},
@@ -228,6 +227,15 @@ $template->param(
     firstnamesuggestedby  => $suggestion->{firstnamesuggestedby},
 );
 
+# regardless of the content of $unitprice e.g 0 or '' or any string will return in these cases 0.00
+# and the 'IF' in the .tt will show 0.00 and not 'ecost' (see BZ 7129)
+# So if $unitprice == 0 we don't create unitprice
+if ( $unitprice != 0) {
+    $template->param(
+        unitprice             => sprintf( "%.2f", $unitprice),
+    );
+}
+
 my $op = $input->param('op');
 if ($op and $op eq 'edit'){
     $template->param(edit   =>   1);