diff --git a/base/src/org/compiere/process/CopyProduct.java b/base/src/org/compiere/process/CopyProduct.java new file mode 100644 index 0000000000..807b8fdab8 --- /dev/null +++ b/base/src/org/compiere/process/CopyProduct.java @@ -0,0 +1,273 @@ +package org.compiere.process; + +import java.util.Iterator; +import java.util.List; +import java.util.logging.Level; + +import org.compiere.model.MBPartnerProduct; +import org.compiere.model.MProductDownload; +import org.compiere.model.MProductPrice; +import org.compiere.model.Query; +import org.compiere.model.X_M_RelatedProduct; +import org.compiere.model.X_M_Replenish; +import org.compiere.model.X_M_Substitute; + +/** + * Process that copies product information such as substitutes, related, prices, downloads + * etc from another product. Purchase information and accounting is not copied at this + * moment. + * + * @author Daniel Tamm (usrdno) + * + */ +public class CopyProduct extends SvrProcess { + + private int m_copyFromId; + + @Override + protected void prepare() { + + ProcessInfoParameter[] para = getParameter(); + for (int i = 0; i < para.length; i++) + { + String name = para[i].getParameterName(); + if (para[i].getParameter() == null) + ; + else if (name.equals("C_CopyFrom_ID")) + m_copyFromId = para[i].getParameterAsInt(); + else if (name.equals("M_Product_ID")) + m_copyFromId = para[i].getParameterAsInt(); + else + log.log(Level.SEVERE, "prepare - Unknown Parameter: " + name); + } + + } + + @Override + protected String doIt() throws Exception { + + int toMProductID = getRecord_ID(); + log.info("From M_Product_ID=" + m_copyFromId + " to " + toMProductID); + if (toMProductID == 0) + throw new IllegalArgumentException("Target M_Product_ID == 0"); + if (m_copyFromId == 0) + throw new IllegalArgumentException("Source M_Product_ID == 0"); + + // Get product price from the source product + List prices = new Query(getCtx(), MProductPrice.Table_Name, "M_Product_ID=?", get_TrxName()) + .setParameters(new Object[]{m_copyFromId}) + .setOnlyActiveRecords(true) + .list(); + + // Copy prices + MProductPrice priceSrc; + MProductPrice priceDst; + for (Iterator it = prices.iterator(); it.hasNext();) { + priceSrc = it.next(); + priceDst = new MProductPrice(getCtx(), 0, get_TrxName()); + priceDst.setM_Product_ID(toMProductID); + priceDst.setM_PriceList_Version_ID(priceSrc.getM_PriceList_Version_ID()); + priceDst.setPrices(priceSrc.getPriceList(), priceSrc.getPriceStd(), priceSrc.getPriceLimit()); + priceDst.saveEx(get_TrxName()); + } + + int count = prices.size(); + + // Copy substitutes + List subs = new Query(getCtx(), X_M_Substitute.Table_Name, "M_Product_ID=? and NOT substitute_ID=?", get_TrxName()) + .setParameters(new Object[]{m_copyFromId, toMProductID}) + .setOnlyActiveRecords(true) + .list(); + + X_M_Substitute subSrc; + X_M_Substitute subDst; + for (Iterator it = subs.iterator(); it.hasNext();) { + subSrc = it.next(); + subDst = new X_M_Substitute(getCtx(), 0, get_TrxName()); + subDst.setM_Product_ID(toMProductID); + subDst.setSubstitute_ID(subSrc.getSubstitute_ID()); + subDst.setName(subSrc.getName()); + subDst.setDescription(subSrc.getDescription()); + subDst.saveEx(get_TrxName()); + } + + count += subs.size(); + + // Copy related + List related = new Query(getCtx(), X_M_RelatedProduct.Table_Name, "M_Product_ID=? and NOT relatedProduct_ID=?", get_TrxName()) + .setParameters(new Object[]{m_copyFromId, toMProductID}) + .setOnlyActiveRecords(true) + .list(); + + X_M_RelatedProduct relatedSrc; + X_M_RelatedProduct relatedDst; + for (Iterator it = related.iterator(); it.hasNext();) { + relatedSrc = it.next(); + relatedDst = new X_M_RelatedProduct(getCtx(), 0, get_TrxName()); + relatedDst.setM_Product_ID(toMProductID); + relatedDst.setRelatedProduct_ID(relatedSrc.getRelatedProduct_ID()); + relatedDst.setRelatedProductType(relatedSrc.getRelatedProductType()); + relatedDst.setName(relatedSrc.getName()); + relatedDst.setDescription(relatedSrc.getDescription()); + relatedDst.saveEx(get_TrxName()); + } + + count += related.size(); + + // Copy replenish + List replenish = new Query(getCtx(), X_M_Replenish.Table_Name, "M_Product_ID=?", get_TrxName()) + .setParameters(new Object[]{m_copyFromId}) + .setOnlyActiveRecords(true) + .list(); + + X_M_Replenish replenishSrc; + X_M_Replenish replenishDst; + for (Iterator it = replenish.iterator(); it.hasNext();) { + replenishSrc = it.next(); + replenishDst = new X_M_Replenish(getCtx(), 0, get_TrxName()); + replenishDst.setM_Product_ID(toMProductID); + replenishDst.setM_Warehouse_ID(replenishSrc.getM_Warehouse_ID()); + replenishDst.setM_WarehouseSource_ID(replenishSrc.getM_WarehouseSource_ID()); + replenishDst.setReplenishType(replenishSrc.getReplenishType()); + replenishDst.setM_Locator_ID(replenishSrc.getM_Locator_ID()); + replenishDst.setLevel_Min(replenishSrc.getLevel_Min()); + replenishDst.setLevel_Max(replenishSrc.getLevel_Max()); + replenishDst.saveEx(get_TrxName()); + } + + count += replenish.size(); + + // Don't copy purchasing since it demands a unique vendor product no + /* + List poList = new Query(getCtx(), MProductPO.Table_Name, "M_Product_ID=? AND Discontinued='N'", get_TrxName()) + .setParameters(new Object[]{m_copyFromId}) + .setOnlyActiveRecords(true) + .list(); + MProductPO poSrc; + MProductPO poDst; + for (Iterator it = poList.iterator(); it.hasNext();) { + poSrc = it.next(); + poDst = new MProductPO(getCtx(), 0, get_TrxName()); + poDst.setM_Product_ID(toMProductID); + poDst.setC_BPartner_ID(poSrc.getC_BPartner_ID()); + poDst.setC_Currency_ID(poSrc.getC_Currency_ID()); + poDst.setC_UOM_ID(poSrc.getC_UOM_ID()); + poDst.setCostPerOrder(poSrc.getCostPerOrder()); + poDst.setDeliveryTime_Actual(poSrc.getDeliveryTime_Actual()); + poDst.setDeliveryTime_Promised(poSrc.getDeliveryTime_Promised()); + poDst.setIsCurrentVendor(poSrc.isCurrentVendor()); + poDst.setManufacturer(poSrc.getManufacturer()); + poDst.setOrder_Min(poSrc.getOrder_Min()); + poDst.setOrder_Pack(poSrc.getOrder_Pack()); + poDst.setPriceEffective(poSrc.getPriceEffective()); + poDst.setPriceLastInv(poSrc.getPriceLastInv()); + poDst.setPriceLastPO(poSrc.getPriceLastPO()); + poDst.setPriceList(poSrc.getPriceList()); + poDst.setPricePO(poSrc.getPricePO()); + poDst.setQualityRating(poSrc.getQualityRating()); + poDst.setRoyaltyAmt(poSrc.getRoyaltyAmt()); + // Don't set vendor product no or UPC since that's likely to be different + poDst.setVendorCategory(poSrc.getVendorCategory()); + poDst.saveEx(get_TrxName()); + } + + count += poList.size(); + */ + + + // Copy business partner + List bpList = new Query(getCtx(), MBPartnerProduct.Table_Name, "M_Product_ID=?", get_TrxName()) + .setParameters(new Object[]{m_copyFromId}) + .setOnlyActiveRecords(true) + .list(); + + MBPartnerProduct bpSrc; + MBPartnerProduct bpDst; + for (Iterator it = bpList.iterator(); it.hasNext();) { + bpSrc = it.next(); + bpDst = new MBPartnerProduct(getCtx(), 0, get_TrxName()); + bpDst.setC_BPartner_ID(bpSrc.getC_BPartner_ID()); + bpDst.setDescription(bpSrc.getDescription()); + bpDst.setIsManufacturer(bpSrc.isManufacturer()); + bpDst.setM_Product_ID(toMProductID); + bpDst.setManufacturer(bpSrc.getManufacturer()); + bpDst.setQualityRating(bpSrc.getQualityRating()); + bpDst.setShelfLifeMinDays(bpSrc.getShelfLifeMinDays()); + bpDst.setShelfLifeMinPct(bpSrc.getShelfLifeMinPct()); + bpDst.setVendorCategory(bpSrc.getVendorCategory()); + bpDst.setVendorProductNo(bpSrc.getVendorProductNo()); + bpDst.saveEx(get_TrxName()); + } + count += bpList.size(); + + // Copy download + List dlList = new Query(getCtx(), MProductDownload.Table_Name, "M_Product_ID=?", get_TrxName()) + .setParameters(new Object[]{m_copyFromId}) + .setOnlyActiveRecords(true) + .list(); + + MProductDownload dlSrc; + MProductDownload dlDst; + for (Iterator it = dlList.iterator(); it.hasNext();) { + dlSrc = it.next(); + dlDst = new MProductDownload(getCtx(), 0, get_TrxName()); + dlDst.setM_Product_ID(toMProductID); + dlDst.setName(dlSrc.getName()); + dlDst.setDownloadURL(dlSrc.getDownloadURL()); + dlDst.saveEx(get_TrxName()); + } + count += dlList.size(); + + // Don't copy accounting because of constraints. + /* + // Delete any current accounting records + DB.executeUpdate("delete from " + X_M_Product_Acct.Table_Name + " where M_Product_ID=" + toMProductID, get_TrxName()); + + // Copy accounting + List acctList = new Query(getCtx(), X_M_Product_Acct.Table_Name, "M_Product_ID=?", get_TrxName()) + .setParameters(new Object[]{m_copyFromId}) + .setOnlyActiveRecords(true) + .list(); + + X_M_Product_Acct acctSrc; + X_M_Product_Acct acctDst; + for (Iterator it = acctList.iterator(); it.hasNext();) { + acctSrc = it.next(); + acctDst = new X_M_Product_Acct(getCtx(), 0, get_TrxName()); + acctDst.setC_AcctSchema_ID(acctSrc.getC_AcctSchema_ID()); + acctDst.setM_Product_ID(toMProductID); + acctDst.setP_Asset_Acct(acctSrc.getP_Asset_Acct()); + acctDst.setP_AverageCostVariance_Acct(acctSrc.getP_AverageCostVariance_Acct()); + acctDst.setP_Burden_Acct(acctSrc.getP_Burden_Acct()); + acctDst.setP_COGS_Acct(acctSrc.getP_COGS_Acct()); + acctDst.setP_CostAdjustment_Acct(acctSrc.getP_CostAdjustment_Acct()); + acctDst.setP_CostOfProduction_Acct(acctSrc.getP_CostOfProduction_Acct()); + acctDst.setP_Expense_Acct(acctSrc.getP_Expense_Acct()); + acctDst.setP_FloorStock_Acct(acctSrc.getP_FloorStock_Acct()); + acctDst.setP_InventoryClearing_Acct(acctSrc.getP_InventoryClearing_Acct()); + acctDst.setP_InvoicePriceVariance_Acct(acctSrc.getP_InvoicePriceVariance_Acct()); + acctDst.setP_Labor_Acct(acctSrc.getP_Labor_Acct()); + acctDst.setP_MethodChangeVariance_Acct(acctSrc.getP_MethodChangeVariance_Acct()); + acctDst.setP_MixVariance_Acct(acctSrc.getP_MixVariance_Acct()); + acctDst.setP_OutsideProcessing_Acct(acctSrc.getP_OutsideProcessing_Acct()); + acctDst.setP_Overhead_Acct(acctSrc.getP_Overhead_Acct()); + acctDst.setP_PurchasePriceVariance_Acct(acctSrc.getP_PurchasePriceVariance_Acct()); + acctDst.setP_RateVariance_Acct(acctSrc.getP_RateVariance_Acct()); + acctDst.setP_Revenue_Acct(acctSrc.getP_Revenue_Acct()); + acctDst.setP_Scrap_Acct(acctSrc.getP_Scrap_Acct()); + acctDst.setP_TradeDiscountGrant_Acct(acctSrc.getP_TradeDiscountGrant_Acct()); + acctDst.setP_TradeDiscountRec_Acct(acctSrc.getP_TradeDiscountRec_Acct()); + acctDst.setP_UsageVariance_Acct(acctSrc.getP_UsageVariance_Acct()); + acctDst.setP_WIP_Acct(acctSrc.getP_WIP_Acct()); + acctDst.saveEx(get_TrxName()); + } + count += acctList.size(); + */ + + // TODO Auto-generated method stub + return "@Copied@=" + count; + + } + + +} diff --git a/migration/360lts-release/oracle/739_FR3015882_CopyProduct.sql b/migration/360lts-release/oracle/739_FR3015882_CopyProduct.sql new file mode 100644 index 0000000000..419d4d447e --- /dev/null +++ b/migration/360lts-release/oracle/739_FR3015882_CopyProduct.sql @@ -0,0 +1,45 @@ +-- Jun 14, 2010 2:48:57 PM CEST +-- FR 3015882 - Copy process for product +INSERT INTO AD_Process (AccessLevel,AD_Client_ID,AD_Org_ID,AD_Process_ID,Classname,CopyFromProcess,Created,CreatedBy,Description,EntityType,IsActive,IsBetaFunctionality,IsDirectPrint,IsReport,IsServerProcess,Name,ShowHelp,Statistic_Count,Statistic_Seconds,Updated,UpdatedBy,Value) VALUES ('1',0,0,53206,'org.compiere.process.CopyProduct','N',TO_DATE('2010-06-14 14:48:55','YYYY-MM-DD HH24:MI:SS'),100,'Copy prices etc from other product','D','Y','N','N','N','N','Copy from product','Y',0,0,TO_DATE('2010-06-14 14:48:55','YYYY-MM-DD HH24:MI:SS'),100,'M_Product CopyFrom') +; + +-- Jun 14, 2010 2:48:57 PM CEST +-- FR 3015882 - Copy process for product +INSERT INTO AD_Process_Trl (AD_Language,AD_Process_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_ID=53206 AND NOT EXISTS (SELECT * FROM AD_Process_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_ID=t.AD_Process_ID) +; + +-- Jun 14, 2010 2:49:42 PM CEST +-- FR 3015882 - Copy process for product +INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsCentrallyMaintained,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,454,0,53206,53410,30,'M_Product_ID',TO_DATE('2010-06-14 14:49:41','YYYY-MM-DD HH24:MI:SS'),100,'Product identifier','U',0,'The product to copy from','Y','Y','Y','N','Product',10,TO_DATE('2010-06-14 14:49:41','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 14, 2010 2:49:42 PM CEST +-- FR 3015882 - Copy process for product +INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=53410 AND NOT EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) +; + +-- Jun 14, 2010 2:53:15 PM CEST +-- FR 3015882 - Copy process for product +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,59231,2037,0,53206,28,208,'CopyFrom',TO_DATE('2010-06-14 14:53:14','YYYY-MM-DD HH24:MI:SS'),100,'Copy From Record','D',1,'Copy From Record','Y','Y','N','N','N','N','N','N','N','N','N','N','Y','Copy From',0,TO_DATE('2010-06-14 14:53:14','YYYY-MM-DD HH24:MI:SS'),100,1.000000000000) +; + +-- Jun 14, 2010 2:53:15 PM CEST +-- FR 3015882 - Copy process for product +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=59231 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jun 14, 2010 2:53:28 PM CEST +-- FR 3015882 - Copy process for product +ALTER TABLE M_Product ADD CopyFrom CHAR(1) DEFAULT NULL +; + +-- Jun 14, 2010 2:58:52 PM CEST +-- FR 3015882 - Copy process for product +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,59231,58973,0,180,TO_DATE('2010-06-14 14:58:51','YYYY-MM-DD HH24:MI:SS'),100,'Copy From Record',23,'D','Copy From Record','Y','Y','Y','N','N','N','N','N','Copy From',540,0,TO_DATE('2010-06-14 14:58:51','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 14, 2010 2:58:52 PM CEST +-- FR 3015882 - Copy process for product +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=58973 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) +; + diff --git a/migration/360lts-release/postgresql/739_FR3015882_CopyProduct.sql b/migration/360lts-release/postgresql/739_FR3015882_CopyProduct.sql new file mode 100644 index 0000000000..5b941ff95d --- /dev/null +++ b/migration/360lts-release/postgresql/739_FR3015882_CopyProduct.sql @@ -0,0 +1,45 @@ +-- Jun 14, 2010 2:48:57 PM CEST +-- FR 3015882 - Copy process for product +INSERT INTO AD_Process (AccessLevel,AD_Client_ID,AD_Org_ID,AD_Process_ID,Classname,CopyFromProcess,Created,CreatedBy,Description,EntityType,IsActive,IsBetaFunctionality,IsDirectPrint,IsReport,IsServerProcess,Name,ShowHelp,Statistic_Count,Statistic_Seconds,Updated,UpdatedBy,Value) VALUES ('1',0,0,53206,'org.compiere.process.CopyProduct','N',TO_TIMESTAMP('2010-06-14 14:48:55','YYYY-MM-DD HH24:MI:SS'),100,'Copy prices etc from other product','D','Y','N','N','N','N','Copy from product','Y',0,0,TO_TIMESTAMP('2010-06-14 14:48:55','YYYY-MM-DD HH24:MI:SS'),100,'M_Product CopyFrom') +; + +-- Jun 14, 2010 2:48:57 PM CEST +-- FR 3015882 - Copy process for product +INSERT INTO AD_Process_Trl (AD_Language,AD_Process_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_ID=53206 AND NOT EXISTS (SELECT * FROM AD_Process_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_ID=t.AD_Process_ID) +; + +-- Jun 14, 2010 2:49:42 PM CEST +-- FR 3015882 - Copy process for product +INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsCentrallyMaintained,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,454,0,53206,53410,30,'M_Product_ID',TO_TIMESTAMP('2010-06-14 14:49:41','YYYY-MM-DD HH24:MI:SS'),100,'Product identifier','U',0,'The product to copy from','Y','Y','Y','N','Product',10,TO_TIMESTAMP('2010-06-14 14:49:41','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 14, 2010 2:49:42 PM CEST +-- FR 3015882 - Copy process for product +INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=53410 AND NOT EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) +; + +-- Jun 14, 2010 2:53:15 PM CEST +-- FR 3015882 - Copy process for product +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,59231,2037,0,53206,28,208,'CopyFrom',TO_TIMESTAMP('2010-06-14 14:53:14','YYYY-MM-DD HH24:MI:SS'),100,'Copy From Record','D',1,'Copy From Record','Y','Y','N','N','N','N','N','N','N','N','N','N','Y','Copy From',0,TO_TIMESTAMP('2010-06-14 14:53:14','YYYY-MM-DD HH24:MI:SS'),100,1.000000000000) +; + +-- Jun 14, 2010 2:53:15 PM CEST +-- FR 3015882 - Copy process for product +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=59231 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jun 14, 2010 2:53:29 PM CEST +-- FR 3015882 - Copy process for product +ALTER TABLE M_Product ADD COLUMN CopyFrom CHAR(1) DEFAULT NULL +; + +-- Jun 14, 2010 2:58:52 PM CEST +-- FR 3015882 - Copy process for product +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,59231,58973,0,180,TO_TIMESTAMP('2010-06-14 14:58:51','YYYY-MM-DD HH24:MI:SS'),100,'Copy From Record',23,'D','Copy From Record','Y','Y','Y','N','N','N','N','N','Copy From',540,0,TO_TIMESTAMP('2010-06-14 14:58:51','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Jun 14, 2010 2:58:52 PM CEST +-- FR 3015882 - Copy process for product +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=58973 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) +; +