IDEMPIERE-4262 on some condition, record insert by direct sql missing UUID (#1072)
* IDEMPIERE-4262 on some condition, record insert by direct sql missing UUID Solve AD_Element_Trl, AD_Process_Para_Trl, AD_PrintForm * Add AcctSchemaDefaultCopy *_Acct tables, M_Product_PO, Fact_Reconciliation
This commit is contained in:
parent
5bfcedd0ca
commit
b69fd6a329
|
@ -3,6 +3,9 @@
|
|||
INSERT INTO AD_ELEMENT_TRL (AD_Element_ID, AD_LANGUAGE, AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy, Name, PrintName, Description, Help, Placeholder, IsTranslated) SELECT m.AD_Element_ID, l.AD_LANGUAGE, m.AD_Client_ID, m.AD_Org_ID, m.IsActive, m.Created, m.CreatedBy, m.Updated, m.UpdatedBy, m.Name, m.PrintName, m.Description, m.Help, m.Placeholder, 'N' FROM AD_ELEMENT m, AD_LANGUAGE l WHERE l.IsActive = 'Y' AND l.IsSystemLanguage = 'Y' AND AD_Element_ID || AD_LANGUAGE NOT IN (SELECT AD_Element_ID || AD_LANGUAGE FROM AD_ELEMENT_TRL)
|
||||
;
|
||||
|
||||
UPDATE AD_Element_Trl SET AD_Element_Trl_UU=generate_uuid() WHERE AD_Element_Trl_UU IS NULL
|
||||
;
|
||||
|
||||
UPDATE AD_COLUMN c SET AD_Element_id = (SELECT AD_Element_ID FROM AD_ELEMENT e WHERE UPPER(c.ColumnName)=UPPER(e.ColumnName)) WHERE AD_Element_ID IS NULL
|
||||
;
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
INSERT INTO AD_ELEMENT_TRL (AD_Element_ID, AD_LANGUAGE, AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy, Name, PrintName, Description, Help, Placeholder, IsTranslated) SELECT m.AD_Element_ID, l.AD_LANGUAGE, m.AD_Client_ID, m.AD_Org_ID, m.IsActive, m.Created, m.CreatedBy, m.Updated, m.UpdatedBy, m.Name, m.PrintName, m.Description, m.Help, m.Placeholder, 'N' FROM AD_ELEMENT m, AD_LANGUAGE l WHERE l.IsActive = 'Y' AND l.IsSystemLanguage = 'Y' AND AD_Element_ID || AD_LANGUAGE NOT IN (SELECT AD_Element_ID || AD_LANGUAGE FROM AD_ELEMENT_TRL)
|
||||
;
|
||||
|
||||
UPDATE AD_Element_Trl SET AD_Element_Trl_UU=generate_uuid() WHERE AD_Element_Trl_UU IS NULL
|
||||
;
|
||||
|
||||
UPDATE AD_COLUMN SET AD_Element_id = (SELECT AD_Element_ID FROM AD_ELEMENT e WHERE UPPER(AD_COLUMN.ColumnName)=UPPER(e.ColumnName)) WHERE AD_Element_ID IS NULL
|
||||
;
|
||||
|
||||
|
|
|
@ -19,8 +19,22 @@ package org.compiere.process;
|
|||
import java.math.BigDecimal;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.process.UUIDGenerator;
|
||||
import org.compiere.model.MAcctSchema;
|
||||
import org.compiere.model.MAcctSchemaDefault;
|
||||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.MProductCategoryAcct;
|
||||
import org.compiere.model.PO;
|
||||
import org.compiere.model.X_C_BP_Customer_Acct;
|
||||
import org.compiere.model.X_C_BP_Group_Acct;
|
||||
import org.compiere.model.X_C_BP_Vendor_Acct;
|
||||
import org.compiere.model.X_C_BankAccount_Acct;
|
||||
import org.compiere.model.X_C_CashBook_Acct;
|
||||
import org.compiere.model.X_C_Charge_Acct;
|
||||
import org.compiere.model.X_C_Project_Acct;
|
||||
import org.compiere.model.X_C_Tax_Acct;
|
||||
import org.compiere.model.X_M_Product_Acct;
|
||||
import org.compiere.model.X_M_Warehouse_Acct;
|
||||
import org.compiere.util.AdempiereSystemError;
|
||||
import org.compiere.util.DB;
|
||||
|
||||
|
@ -129,6 +143,10 @@ public class AcctSchemaDefaultCopy extends SvrProcess
|
|||
.append("WHERE pa.M_Product_Category_ID=p.M_Product_Category_ID")
|
||||
.append(" AND pa.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
|
||||
created = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
if (DB.isGenerateUUIDSupported())
|
||||
DB.executeUpdateEx("UPDATE M_Product_Category_Acct SET M_Product_Category_Acct_UU=generate_uuid() WHERE M_Product_Category_Acct_UU IS NULL", get_TrxName());
|
||||
else
|
||||
UUIDGenerator.updateUUID(MColumn.get(getCtx(), MProductCategoryAcct.Table_Name, PO.getUUIDColumnName(MProductCategoryAcct.Table_Name)), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(created), "@Created@ @M_Product_Category_ID@");
|
||||
createdTotal += created;
|
||||
if (!p_CopyOverwriteAcct) // Insert new Products
|
||||
|
@ -154,6 +172,10 @@ public class AcctSchemaDefaultCopy extends SvrProcess
|
|||
.append("WHERE pa.M_Product_ID=p.M_Product_ID")
|
||||
.append(" AND pa.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
|
||||
created = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
if (DB.isGenerateUUIDSupported())
|
||||
DB.executeUpdateEx("UPDATE M_Product_Acct SET M_Product_Acct_UU=generate_uuid() WHERE M_Product_Acct_UU IS NULL", get_TrxName());
|
||||
else
|
||||
UUIDGenerator.updateUUID(MColumn.get(getCtx(), X_M_Product_Acct.Table_Name, PO.getUUIDColumnName(X_M_Product_Acct.Table_Name)), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(created), "@Created@ @M_Product_ID@");
|
||||
createdTotal += created;
|
||||
}
|
||||
|
@ -203,6 +225,10 @@ public class AcctSchemaDefaultCopy extends SvrProcess
|
|||
.append("WHERE a.C_BP_Group_ID=x.C_BP_Group_ID")
|
||||
.append(" AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
|
||||
created = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
if (DB.isGenerateUUIDSupported())
|
||||
DB.executeUpdateEx("UPDATE C_BP_Group_Acct SET C_BP_Group_Acct_UU=generate_uuid() WHERE C_BP_Group_Acct_UU IS NULL", get_TrxName());
|
||||
else
|
||||
UUIDGenerator.updateUUID(MColumn.get(getCtx(), X_C_BP_Group_Acct.Table_Name, PO.getUUIDColumnName(X_C_BP_Group_Acct.Table_Name)), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(created), "@Created@ @C_BP_Group_ID@");
|
||||
createdTotal += created;
|
||||
|
||||
|
@ -224,6 +250,10 @@ public class AcctSchemaDefaultCopy extends SvrProcess
|
|||
.append("WHERE ca.C_BPartner_ID=p.C_BPartner_ID")
|
||||
.append(" AND ca.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
|
||||
created = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
if (DB.isGenerateUUIDSupported())
|
||||
DB.executeUpdateEx("UPDATE C_BP_Customer_Acct SET C_BP_Customer_Acct_UU=generate_uuid() WHERE C_BP_Customer_Acct_UU IS NULL", get_TrxName());
|
||||
else
|
||||
UUIDGenerator.updateUUID(MColumn.get(getCtx(), X_C_BP_Customer_Acct.Table_Name, PO.getUUIDColumnName(X_C_BP_Customer_Acct.Table_Name)), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(created), "@Created@ @C_BPartner_ID@ @IsCustomer@");
|
||||
createdTotal += created;
|
||||
//
|
||||
|
@ -241,6 +271,10 @@ public class AcctSchemaDefaultCopy extends SvrProcess
|
|||
.append(" AND NOT EXISTS (SELECT * FROM C_BP_Vendor_Acct va ")
|
||||
.append("WHERE va.C_BPartner_ID=p.C_BPartner_ID AND va.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
|
||||
created = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
if (DB.isGenerateUUIDSupported())
|
||||
DB.executeUpdateEx("UPDATE C_BP_Vendor_Acct SET C_BP_Vendor_Acct_UU=generate_uuid() WHERE C_BP_Vendor_Acct_UU IS NULL", get_TrxName());
|
||||
else
|
||||
UUIDGenerator.updateUUID(MColumn.get(getCtx(), X_C_BP_Vendor_Acct.Table_Name, PO.getUUIDColumnName(X_C_BP_Vendor_Acct.Table_Name)), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(created), "@Created@ @C_BPartner_ID@ @IsVendor@");
|
||||
createdTotal += created;
|
||||
}
|
||||
|
@ -273,6 +307,10 @@ public class AcctSchemaDefaultCopy extends SvrProcess
|
|||
.append("WHERE a.M_Warehouse_ID=x.M_Warehouse_ID")
|
||||
.append(" AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
|
||||
created = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
if (DB.isGenerateUUIDSupported())
|
||||
DB.executeUpdateEx("UPDATE M_Warehouse_Acct SET M_Warehouse_Acct_UU=generate_uuid() WHERE M_Warehouse_Acct_UU IS NULL", get_TrxName());
|
||||
else
|
||||
UUIDGenerator.updateUUID(MColumn.get(getCtx(), X_M_Warehouse_Acct.Table_Name, PO.getUUIDColumnName(X_M_Warehouse_Acct.Table_Name)), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(created), "@Created@ @M_Warehouse_ID@");
|
||||
createdTotal += created;
|
||||
|
||||
|
@ -306,6 +344,10 @@ public class AcctSchemaDefaultCopy extends SvrProcess
|
|||
.append("WHERE a.C_Project_ID=x.C_Project_ID")
|
||||
.append(" AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
|
||||
created = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
if (DB.isGenerateUUIDSupported())
|
||||
DB.executeUpdateEx("UPDATE C_Project_Acct SET C_Project_Acct_UU=generate_uuid() WHERE C_Project_Acct_UU IS NULL", get_TrxName());
|
||||
else
|
||||
UUIDGenerator.updateUUID(MColumn.get(getCtx(), X_C_Project_Acct.Table_Name, PO.getUUIDColumnName(X_C_Project_Acct.Table_Name)), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(created), "@Created@ @C_Project_ID@");
|
||||
createdTotal += created;
|
||||
|
||||
|
@ -340,6 +382,10 @@ public class AcctSchemaDefaultCopy extends SvrProcess
|
|||
.append("WHERE a.C_Tax_ID=x.C_Tax_ID")
|
||||
.append(" AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
|
||||
created = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
if (DB.isGenerateUUIDSupported())
|
||||
DB.executeUpdateEx("UPDATE C_Tax_Acct SET C_Tax_Acct_UU=generate_uuid() WHERE C_Tax_Acct_UU IS NULL", get_TrxName());
|
||||
else
|
||||
UUIDGenerator.updateUUID(MColumn.get(getCtx(), X_C_Tax_Acct.Table_Name, PO.getUUIDColumnName(X_C_Tax_Acct.Table_Name)), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(created), "@Created@ @C_Tax_ID@");
|
||||
createdTotal += created;
|
||||
|
||||
|
@ -379,6 +425,10 @@ public class AcctSchemaDefaultCopy extends SvrProcess
|
|||
.append("WHERE a.C_BankAccount_ID=x.C_BankAccount_ID")
|
||||
.append(" AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
|
||||
created = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
if (DB.isGenerateUUIDSupported())
|
||||
DB.executeUpdateEx("UPDATE C_BankAccount_Acct SET C_BankAccount_Acct_UU=generate_uuid() WHERE C_BankAccount_Acct_UU IS NULL", get_TrxName());
|
||||
else
|
||||
UUIDGenerator.updateUUID(MColumn.get(getCtx(), X_C_BankAccount_Acct.Table_Name, PO.getUUIDColumnName(X_C_BankAccount_Acct.Table_Name)), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(created), "@Created@ @C_BankAccount_ID@");
|
||||
createdTotal += created;
|
||||
|
||||
|
@ -410,6 +460,10 @@ public class AcctSchemaDefaultCopy extends SvrProcess
|
|||
.append("WHERE a.C_Charge_ID=x.C_Charge_ID")
|
||||
.append(" AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
|
||||
created = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
if (DB.isGenerateUUIDSupported())
|
||||
DB.executeUpdateEx("UPDATE C_Charge_Acct SET C_Charge_Acct_UU=generate_uuid() WHERE C_Charge_Acct_UU IS NULL", get_TrxName());
|
||||
else
|
||||
UUIDGenerator.updateUUID(MColumn.get(getCtx(), X_C_Charge_Acct.Table_Name, PO.getUUIDColumnName(X_C_Charge_Acct.Table_Name)), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(created), "@Created@ @C_Charge_ID@");
|
||||
createdTotal += created;
|
||||
|
||||
|
@ -449,6 +503,10 @@ public class AcctSchemaDefaultCopy extends SvrProcess
|
|||
.append(" AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
|
||||
created = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(created), "@Created@ @C_Cashbook_ID@");
|
||||
if (DB.isGenerateUUIDSupported())
|
||||
DB.executeUpdateEx("UPDATE C_Cashbook_Acct SET C_Cashbook_Acct_UU=generate_uuid() WHERE C_Cashbook_Acct_UU IS NULL", get_TrxName());
|
||||
else
|
||||
UUIDGenerator.updateUUID(MColumn.get(getCtx(), X_C_CashBook_Acct.Table_Name, PO.getUUIDColumnName(X_C_CashBook_Acct.Table_Name)), get_TrxName());
|
||||
createdTotal += created;
|
||||
|
||||
StringBuilder msgreturn = new StringBuilder("@Created@=").append(createdTotal).append(", @Updated@=").append(updatedTotal);
|
||||
|
|
|
@ -25,9 +25,13 @@ import java.util.logging.Level;
|
|||
|
||||
import org.adempiere.model.ImportValidator;
|
||||
import org.adempiere.process.ImportProcess;
|
||||
import org.adempiere.process.UUIDGenerator;
|
||||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.MProduct;
|
||||
import org.compiere.model.MProductPO;
|
||||
import org.compiere.model.MProductPrice;
|
||||
import org.compiere.model.ModelValidationEngine;
|
||||
import org.compiere.model.PO;
|
||||
import org.compiere.model.X_I_Product;
|
||||
import org.compiere.util.DB;
|
||||
|
||||
|
@ -600,6 +604,10 @@ public class ImportProduct extends SvrProcess implements ImportProcess
|
|||
no = pstmt_insertProductPO.executeUpdate();
|
||||
if (log.isLoggable(Level.FINER)) log.finer("Insert Product_PO = " + no);
|
||||
noInsertPO++;
|
||||
if (DB.isGenerateUUIDSupported())
|
||||
DB.executeUpdateEx("UPDATE M_Product_PO SET M_Product_PO_UU=generate_uuid() WHERE M_Product_PO_UU IS NULL", get_TrxName());
|
||||
else
|
||||
UUIDGenerator.updateUUID(MColumn.get(getCtx(), MProductPO.Table_Name, PO.getUUIDColumnName(MProductPO.Table_Name)), get_TrxName());
|
||||
}
|
||||
catch (SQLException ex)
|
||||
{
|
||||
|
|
|
@ -17,6 +17,8 @@ import java.sql.PreparedStatement;
|
|||
import java.sql.ResultSet;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.process.UUIDGenerator;
|
||||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.M_Element;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Trx;
|
||||
|
@ -88,6 +90,11 @@ public class SynchronizeTerminology extends SvrProcess
|
|||
+" (SELECT AD_Element_ID || AD_LANGUAGE FROM AD_ELEMENT_TRL)";
|
||||
no = DB.executeUpdate(sql, false, get_TrxName());
|
||||
if (log.isLoggable(Level.INFO)) log.info(" rows updated: "+no);
|
||||
if (DB.isGenerateUUIDSupported())
|
||||
DB.executeUpdateEx("UPDATE AD_Element_Trl SET AD_Element_Trl_UU=generate_uuid() WHERE AD_Element_Trl_UU IS NULL", get_TrxName());
|
||||
else
|
||||
UUIDGenerator.updateUUID(MColumn.get(getCtx(), "AD_Element_Trl", "AD_Element_Trl_UU"), get_TrxName());
|
||||
|
||||
trx.commit(true);
|
||||
|
||||
log.info("Creating link from Element to Column");
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.sql.ResultSet;
|
|||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.process.UUIDGenerator;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
|
@ -306,6 +307,10 @@ public class MProcessPara extends X_AD_Process_Para implements ImmutablePOSuppor
|
|||
" FROM AD_Process_Para_Trl WHERE AD_Process_Para_ID = ? ";
|
||||
count = DB.executeUpdateEx(sql, new Object[] { getAD_Process_Para_ID(), source.getAD_Process_Para_ID() }, get_TrxName());
|
||||
if (log.isLoggable(Level.FINE))log.log(Level.FINE, "AD_Process_Para_Trl inserted: " + count);
|
||||
if (DB.isGenerateUUIDSupported())
|
||||
DB.executeUpdateEx("UPDATE AD_Process_Para_Trl SET AD_Process_Para_Trl_UU=generate_uuid() WHERE AD_Process_Para_Trl_UU IS NULL", get_TrxName());
|
||||
else
|
||||
UUIDGenerator.updateUUID(MColumn.get(getCtx(), "AD_Process_Para_Trl", "AD_Process_Para_Trl_UU"), get_TrxName());
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -609,12 +609,12 @@ public final class MRole extends X_AD_Role implements ImmutablePOSupport
|
|||
}
|
||||
|
||||
loadAccess(true);
|
||||
return "@AD_Window_ID@ #" + win
|
||||
return Msg.parseTranslation(getCtx(), "@AD_Window_ID@ #" + win
|
||||
+ " - @AD_Process_ID@ #" + proc
|
||||
+ " - @AD_Form_ID@ #" + form
|
||||
+ " - @AD_Workflow_ID@ #" + wf
|
||||
+ " - @DocAction@ #" + docact
|
||||
+ " - @AD_InfoWindow_ID@ #" + info;
|
||||
+ " - @AD_InfoWindow_ID@ #" + info);
|
||||
|
||||
} // createAccessRecords
|
||||
|
||||
|
|
|
@ -47,6 +47,10 @@ import javax.print.attribute.standard.JobPriority;
|
|||
import javax.print.attribute.standard.OrientationRequested;
|
||||
import javax.swing.JDialog;
|
||||
|
||||
import org.adempiere.process.UUIDGenerator;
|
||||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.PO;
|
||||
import org.compiere.model.X_AD_PrintForm;
|
||||
import org.compiere.util.CLogMgt;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
|
@ -484,6 +488,12 @@ public class PrintUtil
|
|||
int no = DB.executeUpdate(sql, trxName);
|
||||
if (no != 1)
|
||||
log.log(Level.SEVERE, "PrintForm NOT inserted");
|
||||
|
||||
if (DB.isGenerateUUIDSupported())
|
||||
DB.executeUpdateEx("UPDATE AD_PrintForm SET AD_PrintForm_UU=generate_uuid() WHERE AD_PrintForm_UU IS NULL", trxName);
|
||||
else
|
||||
UUIDGenerator.updateUUID(MColumn.get(ctx, X_AD_PrintForm.Table_Name, PO.getUUIDColumnName(X_AD_PrintForm.Table_Name)), trxName);
|
||||
|
||||
//
|
||||
CLogMgt.enable(true);
|
||||
} // createDocuments
|
||||
|
|
|
@ -21,10 +21,13 @@ import java.sql.SQLException;
|
|||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.adempiere.process.UUIDGenerator;
|
||||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.MElementValue;
|
||||
import org.compiere.model.MFactReconciliation;
|
||||
import org.compiere.model.MRule;
|
||||
import org.compiere.model.MSequence;
|
||||
import org.compiere.model.PO;
|
||||
import org.compiere.util.DB;
|
||||
|
||||
/**
|
||||
|
@ -145,6 +148,10 @@ public class FactReconcile extends SvrProcess
|
|||
count = pstmt.executeUpdate();
|
||||
DB.close(pstmt); pstmt = null;
|
||||
if (log.isLoggable(Level.FINE))log.log(Level.FINE, "Inserted " + count + " new facts into Fact_Reconciliation");
|
||||
if (DB.isGenerateUUIDSupported())
|
||||
DB.executeUpdateEx("UPDATE Fact_Reconciliation SET Fact_Reconciliation_UU=generate_uuid() WHERE Fact_Reconciliation_UU IS NULL", get_TrxName());
|
||||
else
|
||||
UUIDGenerator.updateUUID(MColumn.get(getCtx(), MFactReconciliation.Table_Name, PO.getUUIDColumnName(MFactReconciliation.Table_Name)), get_TrxName());
|
||||
|
||||
// set the matchcode based on the rule found in AD_Rule
|
||||
// which is a sql fragment that returns a string based on the accounting fact
|
||||
|
|
Loading…
Reference in New Issue