details:   https://code.openbravo.com/erp/devel/pi/rev/eac492d3b3d2
changeset: 33828:eac492d3b3d2
user:      Mark <markmm82 <at> gmail.com>
date:      Mon Dec 11 10:45:43 2017 -0500
summary:   Fixes issue 37422: Reset Accounting finishes with error if it is 
launched
for an org with "Organization" type and the type name has been changed

As the process was expecting "Organization" as the organization type's name and 
it
can be changed, the process failed if the name is changed.

To avoid it, comparison is made with the organization type ID instead of the 
organization
type name, as the ID should not be changed.

diffstat:

 src-db/database/sourcedata/OBUISEL_SELECTOR.xml  |  2 +-
 src/org/openbravo/financial/ResetAccounting.java |  2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r 1b60eec1321a -r eac492d3b3d2 
src-db/database/sourcedata/OBUISEL_SELECTOR.xml
--- a/src-db/database/sourcedata/OBUISEL_SELECTOR.xml   Tue Mar 27 16:02:07 
2018 -0400
+++ b/src-db/database/sourcedata/OBUISEL_SELECTOR.xml   Mon Dec 11 10:45:43 
2017 -0500
@@ -94,7 +94,7 @@
 <!--1DB80A7D4BC244F0BE5615702D3BF91C-->  <NAME><![CDATA[Legal or Business 
Organizations Selector]]></NAME>
 <!--1DB80A7D4BC244F0BE5615702D3BF91C-->  
<AD_REFERENCE_ID><![CDATA[C205D56B07D74778A6D6A1AED8467690]]></AD_REFERENCE_ID>
 <!--1DB80A7D4BC244F0BE5615702D3BF91C-->  
<AD_TABLE_ID><![CDATA[155]]></AD_TABLE_ID>
-<!--1DB80A7D4BC244F0BE5615702D3BF91C-->  <WHERECLAUSE><![CDATA[exists (select 
1 from OrganizationType ot where ot.id = e.organizationType.id and 
(ot.legalEntity=true or ot.businessUnit=true or ot.name='Organization')) AND 
e.ready=true]]></WHERECLAUSE>
+<!--1DB80A7D4BC244F0BE5615702D3BF91C-->  <WHERECLAUSE><![CDATA[exists (select 
1 from OrganizationType ot where ot.id = e.organizationType.id and 
(ot.legalEntity=true or ot.businessUnit=true or ot.id='0')) AND 
e.ready=true]]></WHERECLAUSE>
 <!--1DB80A7D4BC244F0BE5615702D3BF91C-->  
<OBCLKER_TEMPLATE_ID><![CDATA[9314DE8599AD44E7BFC4CC50699042AB]]></OBCLKER_TEMPLATE_ID>
 <!--1DB80A7D4BC244F0BE5615702D3BF91C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--1DB80A7D4BC244F0BE5615702D3BF91C-->  
<SUGGESTIONTEXTMATCHSTYLE><![CDATA[startsWith]]></SUGGESTIONTEXTMATCHSTYLE>
diff -r 1b60eec1321a -r eac492d3b3d2 
src/org/openbravo/financial/ResetAccounting.java
--- a/src/org/openbravo/financial/ResetAccounting.java  Tue Mar 27 16:02:07 
2018 -0400
+++ b/src/org/openbravo/financial/ResetAccounting.java  Mon Dec 11 10:45:43 
2017 -0500
@@ -92,7 +92,7 @@
     List<String> tables = getTables(adTableId);
     try {
       Organization org = OBDal.getInstance().get(Organization.class, adOrgId);
-      Set<String> orgIds = 
StringUtils.equals(org.getOrganizationType().getName(), "Organization") ? 
getLegalOrBusinessOrgsChilds(
+      Set<String> orgIds = 
StringUtils.equals(org.getOrganizationType().getId(), "0") ? 
getLegalOrBusinessOrgsChilds(
           client, adOrgId) : new 
OrganizationStructureProvider().getChildTree(adOrgId, true);
       // Delete only if exists some organization to be affected.
       if (CollectionUtils.isNotEmpty(orgIds)) {

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to