IDEMPIERE-5460 - Process Audit doesn't set printing related attribute… (#1543)

* IDEMPIERE-5460 - Process Audit doesn't set printing related attributes when editors are not set

* IDEMPIERE-5460 - fixes
This commit is contained in:
Peter Takács 2022-11-02 06:31:29 +01:00 committed by GitHub
parent d76c6257fa
commit ed7fb79cd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 115 additions and 3 deletions

View File

@ -0,0 +1,42 @@
-- IDEMPIERE-5460
SELECT register_migration_script('202210261110_IDEMPIERE-5460.sql') FROM dual;
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Oct 26, 2022, 11:10:42 AM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (207405,'Report Type',663,211830,'Y',0,130,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-10-26 11:10:42','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-10-26 11:10:42','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','93d34f06-05a8-469a-a012-b0f61763dd58','Y',130,1,1,1,'N','N','N','N')
;
-- Oct 26, 2022, 11:11:13 AM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (207406,'Print Format','Data Print Format','The print format determines how data is rendered for print.',663,211834,'Y',0,140,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-10-26 11:11:12','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-10-26 11:11:12','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','b7932bde-bef5-4233-8135-e82add84805d','Y',140,1,1,1,'N','N','N','N')
;
-- Oct 26, 2022, 11:11:32 AM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (207407,'Language ID',663,211868,'Y',0,150,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-10-26 11:11:32','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-10-26 11:11:32','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','01b827e1-545d-4fa7-a9c3-070e1e9af97d','Y',150,1,1,1,'N','N','N','N')
;
-- Oct 26, 2022, 11:12:29 AM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (207408,'Summary Level','This is a summary entity','A summary entity represents a branch in a tree rather than an end-node. Summary entities are used for reporting and do not have own values.',663,211837,'Y',0,160,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-10-26 11:12:29','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-10-26 11:12:29','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','00fa8185-63ee-4f49-914d-0d18ed342cc9','Y',160,1,1,1,'N','N','N','N')
;
-- Oct 26, 2022, 11:13:49 AM CEST
INSERT INTO AD_FieldGroup (AD_FieldGroup_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,EntityType,FieldGroupType,IsCollapsedByDefault,AD_FieldGroup_UU) VALUES (200030,0,0,'Y',TO_TIMESTAMP('2022-10-26 11:13:49','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-10-26 11:13:49','YYYY-MM-DD HH24:MI:SS'),100,'Printing','D','C','N','1f19e42f-dfb1-4375-b8ff-783947b37944')
;
-- Oct 26, 2022, 11:15:00 AM CEST
UPDATE AD_Field SET SeqNo=130, AD_FieldGroup_ID=200030, ColumnSpan=2,Updated=TO_TIMESTAMP('2022-10-26 11:15:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207405
;
-- Oct 26, 2022, 11:15:00 AM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=140, XPosition=4, ColumnSpan=2,Updated=TO_TIMESTAMP('2022-10-26 11:15:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207407
;
-- Oct 26, 2022, 11:15:00 AM CEST
UPDATE AD_Field SET SeqNo=150, ColumnSpan=2,Updated=TO_TIMESTAMP('2022-10-26 11:15:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207406
;
-- Oct 26, 2022, 11:15:00 AM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=160, XPosition=5,Updated=TO_TIMESTAMP('2022-10-26 11:15:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207408
;

View File

@ -0,0 +1,39 @@
-- IDEMPIERE-5460
SELECT register_migration_script('202210261110_IDEMPIERE-5460.sql') FROM dual;
-- Oct 26, 2022, 11:10:42 AM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (207405,'Report Type',663,211830,'Y',0,130,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-10-26 11:10:42','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-10-26 11:10:42','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','93d34f06-05a8-469a-a012-b0f61763dd58','Y',130,1,1,1,'N','N','N','N')
;
-- Oct 26, 2022, 11:11:13 AM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (207406,'Print Format','Data Print Format','The print format determines how data is rendered for print.',663,211834,'Y',0,140,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-10-26 11:11:12','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-10-26 11:11:12','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','b7932bde-bef5-4233-8135-e82add84805d','Y',140,1,1,1,'N','N','N','N')
;
-- Oct 26, 2022, 11:11:32 AM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (207407,'Language ID',663,211868,'Y',0,150,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-10-26 11:11:32','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-10-26 11:11:32','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','01b827e1-545d-4fa7-a9c3-070e1e9af97d','Y',150,1,1,1,'N','N','N','N')
;
-- Oct 26, 2022, 11:12:29 AM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (207408,'Summary Level','This is a summary entity','A summary entity represents a branch in a tree rather than an end-node. Summary entities are used for reporting and do not have own values.',663,211837,'Y',0,160,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-10-26 11:12:29','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-10-26 11:12:29','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','00fa8185-63ee-4f49-914d-0d18ed342cc9','Y',160,1,1,1,'N','N','N','N')
;
-- Oct 26, 2022, 11:13:49 AM CEST
INSERT INTO AD_FieldGroup (AD_FieldGroup_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,EntityType,FieldGroupType,IsCollapsedByDefault,AD_FieldGroup_UU) VALUES (200030,0,0,'Y',TO_TIMESTAMP('2022-10-26 11:13:49','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-10-26 11:13:49','YYYY-MM-DD HH24:MI:SS'),100,'Printing','D','C','N','1f19e42f-dfb1-4375-b8ff-783947b37944')
;
-- Oct 26, 2022, 11:15:00 AM CEST
UPDATE AD_Field SET SeqNo=130, AD_FieldGroup_ID=200030, ColumnSpan=2,Updated=TO_TIMESTAMP('2022-10-26 11:15:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207405
;
-- Oct 26, 2022, 11:15:00 AM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=140, XPosition=4, ColumnSpan=2,Updated=TO_TIMESTAMP('2022-10-26 11:15:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207407
;
-- Oct 26, 2022, 11:15:00 AM CEST
UPDATE AD_Field SET SeqNo=150, ColumnSpan=2,Updated=TO_TIMESTAMP('2022-10-26 11:15:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207406
;
-- Oct 26, 2022, 11:15:00 AM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=160, XPosition=5,Updated=TO_TIMESTAMP('2022-10-26 11:15:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207408
;

View File

@ -82,6 +82,7 @@ import org.compiere.model.MInventory;
import org.compiere.model.MInvoice; import org.compiere.model.MInvoice;
import org.compiere.model.MMovement; import org.compiere.model.MMovement;
import org.compiere.model.MOrder; import org.compiere.model.MOrder;
import org.compiere.model.MPInstance;
import org.compiere.model.MPaySelectionCheck; import org.compiere.model.MPaySelectionCheck;
import org.compiere.model.MProcess; import org.compiere.model.MProcess;
import org.compiere.model.MProject; import org.compiere.model.MProject;
@ -1838,6 +1839,8 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
int AD_PrintFormat_ID = 0; int AD_PrintFormat_ID = 0;
boolean IsForm = false; boolean IsForm = false;
int Client_ID = -1; int Client_ID = -1;
MPInstance instance = null;
// Get AD_Table_ID and TableName // Get AD_Table_ID and TableName
StringBuilder sql = new StringBuilder("SELECT rv.AD_ReportView_ID,rv.WhereClause,") StringBuilder sql = new StringBuilder("SELECT rv.AD_ReportView_ID,rv.WhereClause,")
@ -1867,6 +1870,10 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
AD_PrintFormat_ID = rs.getInt(5); // required AD_PrintFormat_ID = rs.getInt(5); // required
IsForm = "Y".equals(rs.getString(6)); // required IsForm = "Y".equals(rs.getString(6)); // required
Client_ID = rs.getInt(7); Client_ID = rs.getInt(7);
instance = new MPInstance(ctx, pi.getAD_PInstance_ID(), null);
instance.setAD_PrintFormat_ID(AD_PrintFormat_ID);
setDefaultReportTypeToPInstance(ctx, instance, AD_PrintFormat_ID);
instance.saveEx();
} }
} }
catch (SQLException e1) catch (SQLException e1)
@ -1899,6 +1906,7 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
AD_PrintFormat_ID = rs.getInt(3); // required AD_PrintFormat_ID = rs.getInt(3); // required
IsForm = "Y".equals(rs.getString(4)); // required IsForm = "Y".equals(rs.getString(4)); // required
Client_ID = AD_Client_ID; Client_ID = AD_Client_ID;
instance = new MPInstance(ctx, pi.getAD_PInstance_ID(), null);
} }
} }
catch (SQLException e1) catch (SQLException e1)
@ -1915,6 +1923,12 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
+ ",AD_Client_ID=" + AD_Client_ID); + ",AD_Client_ID=" + AD_Client_ID);
return null; return null;
} }
else if(instance != null)
{
instance.setAD_PrintFormat_ID(AD_PrintFormat_ID);
setDefaultReportTypeToPInstance(ctx, instance, AD_PrintFormat_ID);
instance.saveEx();
}
} }
// Create Query from Parameters // Create Query from Parameters
@ -2733,4 +2747,15 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
return src; return src;
} }
} }
public static void setDefaultReportTypeToPInstance(Properties ctx, MPInstance instance, int printFormatID) {
if(Util.isEmpty(instance.getReportType())) {
MPrintFormat pf = new MPrintFormat(ctx, printFormatID, null);
String type = pf.isForm()
// a42niem - provide explicit default and check on client/org specifics
? MSysConfig.getValue(MSysConfig.ZK_REPORT_FORM_OUTPUT_TYPE,"PDF",Env.getAD_Client_ID(ctx),Env.getAD_Org_ID(ctx))
: MSysConfig.getValue(MSysConfig.ZK_REPORT_TABLE_OUTPUT_TYPE,"PDF",Env.getAD_Client_ID(ctx),Env.getAD_Org_ID(ctx));
instance.setReportType(type);
}
}
} // ReportEngine } // ReportEngine

View File

@ -644,8 +644,10 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
} }
getProcessInfo().setIsSummary(chbIsSummary.isChecked()); getProcessInfo().setIsSummary(chbIsSummary.isChecked());
if (fLanguageType != null) if (fLanguageType != null && fLanguageType.getValue() != null)
getProcessInfo().setLanguageID(fLanguageType.getValue() == null?0:(int)fLanguageType.getValue()); getProcessInfo().setLanguageID(fLanguageType.getValue() == null?0:(int)fLanguageType.getValue());
else
getProcessInfo().setLanguageID(MLanguage.get(getCtx(), Env.getLanguage(getCtx())).getAD_Language_ID());
} }
protected void autoStart() protected void autoStart()

View File

@ -130,10 +130,14 @@ public class ReportCtl
MPInstance instance = new MPInstance(Env.getCtx(), pi.getAD_PInstance_ID(), null); MPInstance instance = new MPInstance(Env.getCtx(), pi.getAD_PInstance_ID(), null);
if (pi.getReportType() != null)
instance.setReportType(pi.getReportType());
if (pi.getSerializableObject() != null) if (pi.getSerializableObject() != null)
instance.setAD_PrintFormat_ID(((MPrintFormat)pi.getSerializableObject()).getAD_PrintFormat_ID()); instance.setAD_PrintFormat_ID(((MPrintFormat)pi.getSerializableObject()).getAD_PrintFormat_ID());
if (pi.getReportType() != null)
instance.setReportType(pi.getReportType());
else if(instance.getAD_PrintFormat_ID() > 0)
ReportEngine.setDefaultReportTypeToPInstance(Env.getCtx(), instance, instance.getAD_PrintFormat_ID());
instance.setIsSummary(pi.isSummary()); instance.setIsSummary(pi.isSummary());
instance.setAD_Language_ID(pi.getLanguageID()); instance.setAD_Language_ID(pi.getLanguageID());
instance.setIsProcessing(true); instance.setIsProcessing(true);