From e7a380e5dc7e291b60149ee7862b54bee499d89c Mon Sep 17 00:00:00 2001
From: Vera Kurpas <vk@raskon.org>
Date: Thu, 2 Jun 2011 20:28:00 +0400
Subject: [PATCH] Added Ifnull to ZSQL method for correcting the FIFO value if
 there were no outgoing transactions.

---
 .../portal_skins/erp5_core/Resource_zGetAssetPrice.xml        | 4 ++--
 product/ERP5/bootstrap/erp5_core/bt/revision                  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetAssetPrice.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetAssetPrice.xml
index 165839b65b..ca06ea2d84 100644
--- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetAssetPrice.xml
+++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetAssetPrice.xml
@@ -121,7 +121,7 @@ quantity at each step:\n
 */\n
 SET\n
  @unbalanced_output:=\n
-   (SELECT\n
+   IFNULL((SELECT\n
       SUM(-quantity)\n
     FROM\n
       stock, catalog\n
@@ -129,7 +129,7 @@ SET\n
       quantity < 0\n
     AND\n
       <dtml-var where_expression>\n
-    ),\n
+    ),0),\n
  @total_asset_price=0\n
 <dtml-var sql_delimiter>\n
 \n
diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision
index 199b0cbdaa..6b2c4f4d86 100644
--- a/product/ERP5/bootstrap/erp5_core/bt/revision
+++ b/product/ERP5/bootstrap/erp5_core/bt/revision
@@ -1 +1 @@
-40958
\ No newline at end of file
+40959
\ No newline at end of file
-- 
2.30.9