details: /erp/devel/pi/rev/0a0215b9cd0b
changeset: 9060:0a0215b9cd0b
user: Adrián Romero <adrianromero <at> openbravo.com>
date: Wed Dec 01 18:10:51 2010 +0100
summary: Fixes issue 0014986: In some special cases you could apply the same
dataset multiple times
It has been added a condition that verifies if the reference data has been
created before executing the process, and in this case displaying a message
accordingly
diffstat:
src-db/database/sourcedata/AD_MESSAGE.xml | 11 +
src/org/openbravo/erpCommon/ad_forms/UpdateReferenceData.java | 90
+++++----
src/org/openbravo/erpCommon/ad_forms/UpdateReferenceData_data.xsql | 17 +
3 files changed, 78 insertions(+), 40 deletions(-)
diffs (149 lines):
diff -r bcc76c8a4527 -r 0a0215b9cd0b src-db/database/sourcedata/AD_MESSAGE.xml
--- a/src-db/database/sourcedata/AD_MESSAGE.xml Wed Dec 01 18:25:23 2010 +0530
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml Wed Dec 01 18:10:51 2010 +0100
@@ -32726,6 +32726,17 @@
<!--B077B434599241F6B04A8D01E8302C9C-->
<AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
<!--B077B434599241F6B04A8D01E8302C9C--></AD_MESSAGE>
+<!--B0F06A09C43940E4A1479DB87D2B7B7D--><AD_MESSAGE>
+<!--B0F06A09C43940E4A1479DB87D2B7B7D-->
<AD_MESSAGE_ID><![CDATA[B0F06A09C43940E4A1479DB87D2B7B7D]]></AD_MESSAGE_ID>
+<!--B0F06A09C43940E4A1479DB87D2B7B7D-->
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--B0F06A09C43940E4A1479DB87D2B7B7D--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--B0F06A09C43940E4A1479DB87D2B7B7D--> <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--B0F06A09C43940E4A1479DB87D2B7B7D-->
<VALUE><![CDATA[CreateReferenceDataAlreadyCreated]]></VALUE>
+<!--B0F06A09C43940E4A1479DB87D2B7B7D--> <MSGTEXT><![CDATA[Create reference
data process not executed. The reference data has been created
previously.]]></MSGTEXT>
+<!--B0F06A09C43940E4A1479DB87D2B7B7D--> <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--B0F06A09C43940E4A1479DB87D2B7B7D-->
<AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--B0F06A09C43940E4A1479DB87D2B7B7D--></AD_MESSAGE>
+
<!--B1A49D5F755A4497AB6FF3D4214CEF80--><AD_MESSAGE>
<!--B1A49D5F755A4497AB6FF3D4214CEF80-->
<AD_MESSAGE_ID><![CDATA[B1A49D5F755A4497AB6FF3D4214CEF80]]></AD_MESSAGE_ID>
<!--B1A49D5F755A4497AB6FF3D4214CEF80-->
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
diff -r bcc76c8a4527 -r 0a0215b9cd0b
src/org/openbravo/erpCommon/ad_forms/UpdateReferenceData.java
--- a/src/org/openbravo/erpCommon/ad_forms/UpdateReferenceData.java Wed Dec
01 18:25:23 2010 +0530
+++ b/src/org/openbravo/erpCommon/ad_forms/UpdateReferenceData.java Wed Dec
01 18:10:51 2010 +0100
@@ -212,47 +212,57 @@
continue;
}
- String strXml = Utility.fileToString(datasetFile.getPath());
- ImportResult myResult = myData.importDataFromXML((Client)
OBDal.getInstance().get(
- Client.class, vars.getClient()), (Organization)
OBDal.getInstance().get(
- Organization.class, strOrganization), strXml, (Module)
OBDal.getInstance().get(
- Module.class, data[j].adModuleId));
- m_info.append(SALTO_LINEA).append("File:
").append(datasetFile.getName()).append(":")
- .append(SALTO_LINEA);
- if (myResult.getLogMessages() != null &&
!myResult.getLogMessages().equals("")
- && !myResult.getLogMessages().equals("null")) {
- m_info.append(SALTO_LINEA).append("LOG:").append(SALTO_LINEA);
-
m_info.append(SALTO_LINEA).append(replaceNL(myResult.getLogMessages())).append(
- SALTO_LINEA);
- }
- if (myResult.getWarningMessages() != null &&
!myResult.getWarningMessages().equals("")
- && !myResult.getWarningMessages().equals("null")) {
- m_info.append(SALTO_LINEA).append("WARNINGS:").append(SALTO_LINEA);
-
m_info.append(SALTO_LINEA).append(replaceNL(myResult.getWarningMessages())).append(
- SALTO_LINEA);
- }
- if (myResult.getErrorMessages() != null &&
!myResult.getErrorMessages().equals("")
- && !myResult.getErrorMessages().equals("null")) {
- m_info.append(SALTO_LINEA).append("ERRORS:").append(SALTO_LINEA);
-
m_info.append(SALTO_LINEA).append(replaceNL(myResult.getErrorMessages())).append(
- SALTO_LINEA);
- }
- if (myResult.getErrorMessages() != null &&
!myResult.getErrorMessages().equals("")
- && !myResult.getErrorMessages().equals("null"))
- strError = strError.append(myResult.getErrorMessages());
- if (!strError.toString().equals(""))
- return strError.toString();
- else {
- if (UpdateReferenceDataData.selectRegister(this,
data[j].adModuleId, strOrganization)
- .equals("0"))
- InitialOrgSetupData.insertOrgModule(this, vars.getClient(),
strOrganization, vars
- .getUser(), data[j].adModuleId, data[j].version);
- else
- UpdateReferenceDataData.updateOrgModule(this, data[j].version,
vars.getUser(), vars
- .getClient(), strOrganization, data[j].adModuleId);
+ if (UpdateReferenceDataData.existsOrgModule(this, vars.getClient(),
strOrganization,
+ data[j].adModuleId, data[j].version).equals("0")) {
+ // Not installed previously
+ String strXml = Utility.fileToString(datasetFile.getPath());
+ ImportResult myResult = myData.importDataFromXML((Client)
OBDal.getInstance().get(
+ Client.class, vars.getClient()), (Organization)
OBDal.getInstance().get(
+ Organization.class, strOrganization), strXml, (Module)
OBDal.getInstance().get(
+ Module.class, data[j].adModuleId));
+ m_info.append(SALTO_LINEA).append("File:
").append(datasetFile.getName()).append(":")
+ .append(SALTO_LINEA);
+ if (myResult.getLogMessages() != null &&
!myResult.getLogMessages().equals("")
+ && !myResult.getLogMessages().equals("null")) {
+ m_info.append(SALTO_LINEA).append("LOG:").append(SALTO_LINEA);
+
m_info.append(SALTO_LINEA).append(replaceNL(myResult.getLogMessages())).append(
+ SALTO_LINEA);
+ }
+ if (myResult.getWarningMessages() != null &&
!myResult.getWarningMessages().equals("")
+ && !myResult.getWarningMessages().equals("null")) {
+
m_info.append(SALTO_LINEA).append("WARNINGS:").append(SALTO_LINEA);
+
m_info.append(SALTO_LINEA).append(replaceNL(myResult.getWarningMessages())).append(
+ SALTO_LINEA);
+ }
+ if (myResult.getErrorMessages() != null &&
!myResult.getErrorMessages().equals("")
+ && !myResult.getErrorMessages().equals("null")) {
+ m_info.append(SALTO_LINEA).append("ERRORS:").append(SALTO_LINEA);
+
m_info.append(SALTO_LINEA).append(replaceNL(myResult.getErrorMessages())).append(
+ SALTO_LINEA);
+ }
+ if (myResult.getErrorMessages() != null &&
!myResult.getErrorMessages().equals("")
+ && !myResult.getErrorMessages().equals("null"))
+ strError = strError.append(myResult.getErrorMessages());
+ if (!strError.toString().equals(""))
+ return strError.toString();
+ else {
+ if (UpdateReferenceDataData.selectRegister(this,
data[j].adModuleId, strOrganization)
+ .equals("0"))
+ InitialOrgSetupData.insertOrgModule(this, vars.getClient(),
strOrganization, vars
+ .getUser(), data[j].adModuleId, data[j].version);
+ else
+ UpdateReferenceDataData.updateOrgModule(this, data[j].version,
vars.getUser(), vars
+ .getClient(), strOrganization, data[j].adModuleId);
+ m_info.append(SALTO_LINEA).append(
+ Utility.messageBD(this, "CreateReferenceDataSuccess",
vars.getLanguage()))
+ .append(SALTO_LINEA);
+ }
+ } else {
+ m_info.append(SALTO_LINEA).append("File:
").append(datasetFile.getName()).append(":")
+ .append(SALTO_LINEA);
m_info.append(SALTO_LINEA).append(
- Utility.messageBD(this, "CreateReferenceDataSuccess",
vars.getLanguage())).append(
- SALTO_LINEA);
+ Utility.messageBD(this, "CreateReferenceDataAlreadyCreated",
vars.getLanguage()))
+ .append(SALTO_LINEA);
}
}
HashMap<String, String> checksums = new HashMap<String, String>();
diff -r bcc76c8a4527 -r 0a0215b9cd0b
src/org/openbravo/erpCommon/ad_forms/UpdateReferenceData_data.xsql
--- a/src/org/openbravo/erpCommon/ad_forms/UpdateReferenceData_data.xsql
Wed Dec 01 18:25:23 2010 +0530
+++ b/src/org/openbravo/erpCommon/ad_forms/UpdateReferenceData_data.xsql
Wed Dec 01 18:10:51 2010 +0100
@@ -81,6 +81,23 @@
<Parameter name="AD_Module_ID"/>
<Parameter name="AD_Org_ID"/>
</SqlMethod>
+ <SqlMethod name="existsOrgModule" type="preparedStatement" return="string">
+ <SqlMethodComment></SqlMethodComment>
+ <Sql>
+ <![CDATA[
+ SELECT COUNT(*)
+ FROM AD_ORGMODULE
+ WHERE AD_CLIENT_ID = ?
+ AND AD_ORG_ID = ?
+ AND AD_MODULE_ID = ?
+ AND VERSION = ?
+ ]]>
+ </Sql>
+ <Parameter name="AD_Client_ID"/>
+ <Parameter name="AD_Org_ID"/>
+ <Parameter name="AD_Module_ID"/>
+ <Parameter name="version"/>
+ </SqlMethod>
<SqlMethod name="updateOrgModule" type="preparedStatement" return="rowCount">
<SqlMethodComment></SqlMethodComment>
<Sql>
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits