IDEMPIERE-4753 Make printing filename configurable / peer review (#1274)

This commit is contained in:
Carlos Ruiz 2022-03-31 15:01:09 +02:00 committed by GitHub
parent a1d58852ed
commit 1eae34965f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 122 additions and 4 deletions

View File

@ -83,4 +83,60 @@ INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,Displa
ALTER TABLE AD_PrintFormat_Trl ADD FileNamePattern VARCHAR2(255 CHAR) DEFAULT NULL ALTER TABLE AD_PrintFormat_Trl ADD FileNamePattern VARCHAR2(255 CHAR) DEFAULT NULL
; ;
-- Mar 31, 2022, 2:51:46 PM CEST
UPDATE AD_Field SET SeqNo=130, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:51:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205584
;
-- Mar 31, 2022, 2:51:46 PM CEST
UPDATE AD_Field SET SeqNo=140, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:51:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5762
;
-- Mar 31, 2022, 2:51:46 PM CEST
UPDATE AD_Field SET SeqNo=150, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:51:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6503
;
-- Mar 31, 2022, 2:51:46 PM CEST
UPDATE AD_Field SET SeqNo=160, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:51:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5657
;
-- Mar 31, 2022, 2:51:46 PM CEST
UPDATE AD_Field SET SeqNo=170, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:51:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5661
;
-- Mar 31, 2022, 2:51:46 PM CEST
UPDATE AD_Field SET SeqNo=180, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:51:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5654
;
-- Mar 31, 2022, 2:51:46 PM CEST
UPDATE AD_Field SET SeqNo=190, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:51:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5658
;
-- Mar 31, 2022, 2:51:46 PM CEST
UPDATE AD_Field SET SeqNo=200, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:51:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50179
;
-- Mar 31, 2022, 2:51:46 PM CEST
UPDATE AD_Field SET SeqNo=210, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:51:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202368
;
-- Mar 31, 2022, 2:51:46 PM CEST
UPDATE AD_Field SET SeqNo=230, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:51:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205242
;
-- Mar 31, 2022, 2:51:46 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=240, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=2, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:51:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206663
;
-- Mar 31, 2022, 2:52:31 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=70, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, ColumnSpan=2, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:52:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206916
;
-- Mar 31, 2022, 2:52:31 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=80, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:52:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203046
;
-- Mar 31, 2022, 2:52:31 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=90, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:52:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203047
;
SELECT register_migration_script('202203151632_IDEMPIERE-4753.sql') FROM dual; SELECT register_migration_script('202203151632_IDEMPIERE-4753.sql') FROM dual;

View File

@ -80,4 +80,60 @@ INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,Displa
ALTER TABLE AD_PrintFormat_Trl ADD COLUMN FileNamePattern VARCHAR(255) DEFAULT NULL ALTER TABLE AD_PrintFormat_Trl ADD COLUMN FileNamePattern VARCHAR(255) DEFAULT NULL
; ;
-- Mar 31, 2022, 2:51:46 PM CEST
UPDATE AD_Field SET SeqNo=130, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:51:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205584
;
-- Mar 31, 2022, 2:51:46 PM CEST
UPDATE AD_Field SET SeqNo=140, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:51:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5762
;
-- Mar 31, 2022, 2:51:46 PM CEST
UPDATE AD_Field SET SeqNo=150, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:51:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6503
;
-- Mar 31, 2022, 2:51:46 PM CEST
UPDATE AD_Field SET SeqNo=160, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:51:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5657
;
-- Mar 31, 2022, 2:51:46 PM CEST
UPDATE AD_Field SET SeqNo=170, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:51:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5661
;
-- Mar 31, 2022, 2:51:46 PM CEST
UPDATE AD_Field SET SeqNo=180, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:51:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5654
;
-- Mar 31, 2022, 2:51:46 PM CEST
UPDATE AD_Field SET SeqNo=190, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:51:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5658
;
-- Mar 31, 2022, 2:51:46 PM CEST
UPDATE AD_Field SET SeqNo=200, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:51:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50179
;
-- Mar 31, 2022, 2:51:46 PM CEST
UPDATE AD_Field SET SeqNo=210, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:51:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202368
;
-- Mar 31, 2022, 2:51:46 PM CEST
UPDATE AD_Field SET SeqNo=230, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:51:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205242
;
-- Mar 31, 2022, 2:51:46 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=240, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=2, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:51:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206663
;
-- Mar 31, 2022, 2:52:31 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=70, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, ColumnSpan=2, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:52:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206916
;
-- Mar 31, 2022, 2:52:31 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=80, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:52:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203046
;
-- Mar 31, 2022, 2:52:31 PM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=90, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-31 14:52:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203047
;
SELECT register_migration_script('202203151632_IDEMPIERE-4753.sql') FROM dual; SELECT register_migration_script('202203151632_IDEMPIERE-4753.sql') FROM dual;

View File

@ -397,8 +397,14 @@ public class ReportStarter implements ProcessCall, ClientProcess
} }
if (pi.getAD_Process_ID()>0) { if (pi.getAD_Process_ID()>0) {
MProcess process = new MProcess(Env.getCtx(), processInfo.getAD_Process_ID(), processInfo.getTransactionName()); MProcess process = new MProcess(Env.getCtx(), processInfo.getAD_Process_ID(), processInfo.getTransactionName());
Language language = printFormat.getLanguage(); String processFileNamePattern = null;
String processFileNamePattern = printFormat.get_Translation("FileNamePattern", language.getAD_Language()); if (printFormat != null) {
Language language = printFormat.getLanguage();
processFileNamePattern = printFormat.get_Translation("FileNamePattern", language.getAD_Language());
}
if (processFileNamePattern == null && process.getFileNamePattern() != null) {
processFileNamePattern = process.getFileNamePattern();
}
if (process !=null && !Util.isEmpty(processFileNamePattern)) { if (process !=null && !Util.isEmpty(processFileNamePattern)) {
String filename=FileUtil.parseTitle(Env.getCtx(), processFileNamePattern, pi.getTable_ID(), Record_ID, 0, trxName); String filename=FileUtil.parseTitle(Env.getCtx(), processFileNamePattern, pi.getTable_ID(), Record_ID, 0, trxName);
pi.setTitle(filename); pi.setTitle(filename);

View File

@ -887,7 +887,7 @@ public class ZkJRViewer extends Window implements EventListener<Event>, ITabOnCl
MTable table = MTable.get(tableId); MTable table = MTable.get(tableId);
PO po = table.getPO(recordId, null); PO po = table.getPO(recordId, null);
MAttachment attachment = po.createAttachment(); MAttachment attachment = po.createAttachment();
String fileName = m_title.replace(" ", "_")+ "_" + m_printInfo.getName() + "." + media.getFormat(); String fileName = m_title.replace(" ", "_") + "." + media.getFormat();
byte[] data = media.isBinary() ? media.getByteData() : media.getStringData().getBytes(); byte[] data = media.isBinary() ? media.getByteData() : media.getStringData().getBytes();
attachment.addEntry(fileName, data); attachment.addEntry(fileName, data);
success = attachment.save(); success = attachment.save();

View File

@ -1379,7 +1379,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
PO po = table.getPO(recordId, null); PO po = table.getPO(recordId, null);
MAttachment attachment = po.createAttachment(); MAttachment attachment = po.createAttachment();
byte[] data = media.isBinary() ? media.getByteData() : media.getStringData().getBytes(); byte[] data = media.isBinary() ? media.getByteData() : media.getStringData().getBytes();
String fileName = m_reportEngine.getName().replace(" ", "_") + "_" + m_reportEngine.getPrintInfo().getName() + "." + media.getFormat(); String fileName = m_reportEngine.getName().replace(" ", "_") + "." + media.getFormat();
attachment.addEntry(fileName, data); attachment.addEntry(fileName, data);
success = attachment.save(); success = attachment.save();
if (success) if (success)