Fixes Issue 12842: Currency value not assigned in Requsition header page.
authorHarikrishnan Raja <harikrishnan.raja@openbravo.com>
Fri, 23 Apr 2010 15:40:23 +0530
changeset 7492 a4b239536534
parent 7491 4d38fb7b8b3c
child 7493 1b3b2e2ae942
Fixes Issue 12842: Currency value not assigned in Requsition header page.
src-db/database/sourcedata/AD_VAL_RULE.xml
src/org/openbravo/erpCommon/ad_callouts/SL_Requisition_BPartner.java
src/org/openbravo/erpCommon/ad_callouts/SL_Requisition_BPartner_data.xsql
--- a/src-db/database/sourcedata/AD_VAL_RULE.xml	Fri Apr 23 10:00:29 2010 +0200
+++ b/src-db/database/sourcedata/AD_VAL_RULE.xml	Fri Apr 23 15:40:23 2010 +0530
@@ -1202,7 +1202,7 @@
 <!--1004400000-->  <NAME><![CDATA[C_Currency of PriceList]]></NAME>
 <!--1004400000-->  <DESCRIPTION><![CDATA[Sets the currency of the pricelist]]></DESCRIPTION>
 <!--1004400000-->  <TYPE><![CDATA[S]]></TYPE>
-<!--1004400000-->  <CODE><![CDATA[C_Currency.C_Currency_ID IN (SELECT C_Currency_ID FROM M_Pricelist WHERE M_Pricelist_ID = @M_Pricelist_ID@)]]></CODE>
+<!--1004400000-->  <CODE><![CDATA[C_Currency.C_Currency_ID IN (SELECT C_Currency_ID FROM M_Pricelist WHERE ISACTIVE='Y')]]></CODE>
 <!--1004400000-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--1004400000--></AD_VAL_RULE>
 
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Requisition_BPartner.java	Fri Apr 23 10:00:29 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Requisition_BPartner.java	Fri Apr 23 15:40:23 2010 +0530
@@ -66,12 +66,13 @@
 
     XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
         "org/openbravo/erpCommon/ad_callouts/CallOut").createXmlDocument();
-    String strPriceList = SLRequisitionBPartnerData.select(this, strBPartner);
+    SLRequisitionBPartnerData[] data = SLRequisitionBPartnerData.select(this, strBPartner);
 
     StringBuffer resultado = new StringBuffer();
     resultado.append("var calloutName='SL_Requisition_BPartner';\n\n");
     resultado.append("var respuesta = new Array(");
-    resultado.append("new Array(\"inpmPricelistId\", \"" + strPriceList + "\")");
+    resultado.append("new Array(\"inpmPricelistId\", \"" + data[0].poPricelistId + "\"),");
+    resultado.append("new Array(\"inpcCurrencyId\", \"" + data[0].cCurrencyId + "\")");
     resultado.append(");");
     xmlDocument.setParameter("array", resultado.toString());
     xmlDocument.setParameter("frameName", "appFrame");
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Requisition_BPartner_data.xsql	Fri Apr 23 10:00:29 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Requisition_BPartner_data.xsql	Fri Apr 23 15:40:23 2010 +0530
@@ -18,13 +18,14 @@
  ************************************************************************
 -->
 <SqlClass name="SLRequisitionBPartnerData" package="org.openbravo.erpCommon.ad_callouts">
-  <SqlMethod name="select" type="preparedStatement" return="string" default="">
+  <SqlMethod name="select" type="preparedStatement" return="multiple" default="">
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-      SELECT p.PO_PriceList_ID
-      FROM C_BPartner p
+      SELECT p.PO_PriceList_ID, m.c_currency_id
+      FROM C_BPartner p,M_Pricelist m
       WHERE p.C_BPartner_ID = ?
+      AND m.M_Pricelist_ID = p.PO_PriceList_ID
       ]]>
     </Sql>
     <Parameter name="cBpartnerId"/>