Fixes issue 27918, fixes issue 27930. Prevents breaking the int-inc tests
authorAugusto Mauch <augusto.mauch@openbravo.com>
Tue, 21 Oct 2014 13:09:51 +0200
changeset 25066 8a23d66e2f6b
parent 25065 203b797e4189
child 25067 d3523cde088b
Fixes issue 27918, fixes issue 27930. Prevents breaking the int-inc tests

The problem was that due to this design defect [1], the oracle and postgres int-inc tests were failing. This is because a value 'AR' was being set to the treetype of a table and then being set to null in other table whose treetype was also 'AR'. Treetype has a unique constraint that was enabled when the application data was updated, so the constraint failed.

To prevent this error, the treetype of the second table is going to be set to null in a modulescript, that is executed before updating the application data.

[1] https://issues.openbravo.com/view.php?id=12577
src-util/modulescript/build/classes/org/openbravo/modulescript/UpdateADTrees.class
src-util/modulescript/build/classes/org/openbravo/modulescript/UpdateADTreesData.class
src-util/modulescript/src/org/openbravo/modulescript/UpdateADTrees.java
src-util/modulescript/src/org/openbravo/modulescript/UpdateADTrees_Data.xsql
Binary file src-util/modulescript/build/classes/org/openbravo/modulescript/UpdateADTrees.class has changed
Binary file src-util/modulescript/build/classes/org/openbravo/modulescript/UpdateADTreesData.class has changed
--- a/src-util/modulescript/src/org/openbravo/modulescript/UpdateADTrees.java	Tue Oct 21 11:28:25 2014 +0200
+++ b/src-util/modulescript/src/org/openbravo/modulescript/UpdateADTrees.java	Tue Oct 21 13:09:51 2014 +0200
@@ -37,6 +37,8 @@
       UpdateADTreesData.update(cp);
       // See issue https://issues.openbravo.com/view.php?id=27918
       UpdateADTreesData.fixAccountingReportSetup(cp);
+      // Manually set to null the TreeType column of the FinancialMgmtAccountingReport table. Needs to be done manually to prevent a constraint exception that happens because of this design defect https://issues.openbravo.com/view.php?id=12577
+      UpdateADTreesData.deleteTreeTypeFromFinancialMgmtAccountingReport(cp);
     } catch (Exception e) {
       handleError(e);
     }
--- a/src-util/modulescript/src/org/openbravo/modulescript/UpdateADTrees_Data.xsql	Tue Oct 21 11:28:25 2014 +0200
+++ b/src-util/modulescript/src/org/openbravo/modulescript/UpdateADTrees_Data.xsql	Tue Oct 21 13:09:51 2014 +0200
@@ -43,4 +43,12 @@
       ]]>
     </Sql>
   </SqlMethod>  
+  <SqlMethod name="deleteTreeTypeFromFinancialMgmtAccountingReport" type="preparedStatement" return="rowcount">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql>
+      <![CDATA[
+        update ad_table set treetype = null where ad_table_id = '800223'
+      ]]>
+    </Sql>
+  </SqlMethod>    
 </SqlClass>
\ No newline at end of file