IDEMPIERE-5247 : ReportLineSet_Copy do not copy Operands (#1271)

This commit is contained in:
Nicolas Micoud 2022-03-31 19:33:56 +02:00 committed by GitHub
parent d949963135
commit d6bd0b2247
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 88 additions and 1 deletions

View File

@ -0,0 +1,34 @@
-- IDEMPIERE-5247
SELECT register_migration_script('202203291027_IDEMPIERE-5247.sql') FROM dual;
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Mar 29, 2022, 10:27:13 AM CEST
UPDATE AD_Element SET Name='Posting Type', PrintName='Posting Type',Updated=TO_TIMESTAMP('2022-03-29 10:27:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Element_ID=514
;
-- Mar 29, 2022, 10:27:13 AM CEST
UPDATE AD_Column SET ColumnName='PostingType', Name='Posting Type', Description='The type of posted amount for the transaction', Help='The Posting Type indicates the type of amount (Actual, Budget, Reservation, Commitment, Statistical) the transaction.', Placeholder=NULL WHERE AD_Element_ID=514
;
-- Mar 29, 2022, 10:27:13 AM CEST
UPDATE AD_Process_Para SET ColumnName='PostingType', Name='Posting Type', Description='The type of posted amount for the transaction', Help='The Posting Type indicates the type of amount (Actual, Budget, Reservation, Commitment, Statistical) the transaction.', AD_Element_ID=514 WHERE UPPER(ColumnName)='POSTINGTYPE' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Mar 29, 2022, 10:27:13 AM CEST
UPDATE AD_Process_Para SET ColumnName='PostingType', Name='Posting Type', Description='The type of posted amount for the transaction', Help='The Posting Type indicates the type of amount (Actual, Budget, Reservation, Commitment, Statistical) the transaction.', Placeholder=NULL WHERE AD_Element_ID=514 AND IsCentrallyMaintained='Y'
;
-- Mar 29, 2022, 10:27:13 AM CEST
UPDATE AD_InfoColumn SET ColumnName='PostingType', Name='Posting Type', Description='The type of posted amount for the transaction', Help='The Posting Type indicates the type of amount (Actual, Budget, Reservation, Commitment, Statistical) the transaction.', Placeholder=NULL WHERE AD_Element_ID=514 AND IsCentrallyMaintained='Y'
;
-- Mar 29, 2022, 10:27:14 AM CEST
UPDATE AD_Field SET Name='Posting Type', Description='The type of posted amount for the transaction', Help='The Posting Type indicates the type of amount (Actual, Budget, Reservation, Commitment, Statistical) the transaction.', Placeholder=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=514) AND IsCentrallyMaintained='Y'
;
-- Mar 29, 2022, 10:27:14 AM CEST
UPDATE AD_PrintFormatItem SET PrintName='Posting Type', Name='Posting Type' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=AD_PrintFormatItem.AD_Column_ID AND c.AD_Element_ID=514)
;

View File

@ -0,0 +1,31 @@
-- IDEMPIERE-5247
SELECT register_migration_script('202203291027_IDEMPIERE-5247.sql') FROM dual;
-- Mar 29, 2022, 10:27:13 AM CEST
UPDATE AD_Element SET Name='Posting Type', PrintName='Posting Type',Updated=TO_TIMESTAMP('2022-03-29 10:27:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Element_ID=514
;
-- Mar 29, 2022, 10:27:13 AM CEST
UPDATE AD_Column SET ColumnName='PostingType', Name='Posting Type', Description='The type of posted amount for the transaction', Help='The Posting Type indicates the type of amount (Actual, Budget, Reservation, Commitment, Statistical) the transaction.', Placeholder=NULL WHERE AD_Element_ID=514
;
-- Mar 29, 2022, 10:27:13 AM CEST
UPDATE AD_Process_Para SET ColumnName='PostingType', Name='Posting Type', Description='The type of posted amount for the transaction', Help='The Posting Type indicates the type of amount (Actual, Budget, Reservation, Commitment, Statistical) the transaction.', AD_Element_ID=514 WHERE UPPER(ColumnName)='POSTINGTYPE' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Mar 29, 2022, 10:27:13 AM CEST
UPDATE AD_Process_Para SET ColumnName='PostingType', Name='Posting Type', Description='The type of posted amount for the transaction', Help='The Posting Type indicates the type of amount (Actual, Budget, Reservation, Commitment, Statistical) the transaction.', Placeholder=NULL WHERE AD_Element_ID=514 AND IsCentrallyMaintained='Y'
;
-- Mar 29, 2022, 10:27:13 AM CEST
UPDATE AD_InfoColumn SET ColumnName='PostingType', Name='Posting Type', Description='The type of posted amount for the transaction', Help='The Posting Type indicates the type of amount (Actual, Budget, Reservation, Commitment, Statistical) the transaction.', Placeholder=NULL WHERE AD_Element_ID=514 AND IsCentrallyMaintained='Y'
;
-- Mar 29, 2022, 10:27:14 AM CEST
UPDATE AD_Field SET Name='Posting Type', Description='The type of posted amount for the transaction', Help='The Posting Type indicates the type of amount (Actual, Budget, Reservation, Commitment, Statistical) the transaction.', Placeholder=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=514) AND IsCentrallyMaintained='Y'
;
-- Mar 29, 2022, 10:27:14 AM CEST
UPDATE AD_PrintFormatItem SET PrintName='Posting Type', Name='Posting Type' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=AD_PrintFormatItem.AD_Column_ID AND c.AD_Element_ID=514)
;

View File

@ -17,6 +17,7 @@
package org.compiere.process; package org.compiere.process;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.HashMap;
import java.util.logging.Level; import java.util.logging.Level;
import org.compiere.report.MReportLine; import org.compiere.report.MReportLine;
@ -76,10 +77,15 @@ public class ReportLineSet_Copy extends SvrProcess
MReportLineSet to = new MReportLineSet(getCtx(), to_ID, get_TrxName()); MReportLineSet to = new MReportLineSet(getCtx(), to_ID, get_TrxName());
MReportLineSet rlSet = new MReportLineSet(getCtx(), m_PA_ReportLineSet_ID, get_TrxName()); MReportLineSet rlSet = new MReportLineSet(getCtx(), m_PA_ReportLineSet_ID, get_TrxName());
MReportLine[] rls = rlSet.getLiness(); MReportLine[] rls = rlSet.getLiness();
HashMap<Integer, Integer> mapLines = new HashMap<Integer, Integer>();
for (int i = 0; i < rls.length; i++) for (int i = 0; i < rls.length; i++)
{ {
MReportLine rl = MReportLine.copy (getCtx(), to.getAD_Client_ID(), to.getAD_Org_ID(), to_ID, rls[i], get_TrxName()); MReportLine rl = MReportLine.copy (getCtx(), to.getAD_Client_ID(), to.getAD_Org_ID(), to_ID, rls[i], get_TrxName());
rl.saveEx(); rl.saveEx();
mapLines.put(rls[i].getPA_ReportLine_ID(), rl.getPA_ReportLine_ID());
MReportSource[] rss = rls[i].getSources(); MReportSource[] rss = rls[i].getSources();
if (rss != null) if (rss != null)
{ {
@ -89,8 +95,24 @@ public class ReportLineSet_Copy extends SvrProcess
rs.saveEx(); rs.saveEx();
} }
} }
// Oper 1/2 were set to Null !
} }
for (int i = 0; i < rls.length; i++)
{
if (rls[i].getOper_1_ID() > 0 || rls[i].getOper_2_ID() > 0) {
int toID = mapLines.get(rls[i].getPA_ReportLine_ID());
MReportLine rl = new MReportLine(getCtx(), toID, get_TrxName());
if (rls[i].getOper_1_ID() > 0)
rl.setOper_1_ID(mapLines.get(rls[i].getOper_1_ID()));
if (rls[i].getOper_2_ID() > 0)
rl.setOper_2_ID(mapLines.get(rls[i].getOper_2_ID()));
rl.saveEx();
}
}
StringBuilder msgreturn = new StringBuilder("@Copied@=").append(rls.length); StringBuilder msgreturn = new StringBuilder("@Copied@=").append(rls.length);
return msgreturn.toString(); return msgreturn.toString();
} // doIt } // doIt