From fcc1b83bb0fa3406d0e7e648fa979a5e2183dc5a Mon Sep 17 00:00:00 2001
From: Christophe Croullebois <christophe.croullebois@biblibre.com>
Date: Mon, 18 Mar 2013 18:46:03 +0100
Subject: [PATCH] (MT #11060) correction of a bug due to bz 7129

See comments in the patch

Signed-off-by: Mathieu Saby <mathieu.saby@univ-rennes2.fr>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
---
 acqui/orderreceive.pl |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl
index f25b5a9..2b80cd4 100755
--- a/acqui/orderreceive.pl
+++ b/acqui/orderreceive.pl
@@ -214,7 +214,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},
@@ -227,6 +226,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);
-- 
1.7.9.5