Attached Files | coredirectdebit.diff [^] (3,920 bytes) 2015-10-21 11:40 [Show Content] [Hide Content]diff -ru a/modules/org.openbravo.sepa.iso20022.coredirectdebit.customertobank/referencedata/standard/Core_Direct_Debit_Scheme.xml b/modules/org.openbravo.sepa.iso20022.coredirectdebit.customertobank/referencedata/standard/Core_Direct_Debit_Scheme.xml
--- a/modules/org.openbravo.sepa.iso20022.coredirectdebit.customertobank/referencedata/standard/Core_Direct_Debit_Scheme.xml 2015-10-20 18:30:51.777204000 +0200
+++ b/modules/org.openbravo.sepa.iso20022.coredirectdebit.customertobank/referencedata/standard/Core_Direct_Debit_Scheme.xml 2015-10-21 11:11:24.913622614 +0200
@@ -152,6 +151,13 @@
<value>Y</value>
<remittanceType id="1D120CE3B9D44221B931168CAFD450BE" entity-name="REM_RemittanceType" identifier="SEPA Core Direct Debit Customer-to-Bank (pain.008.001.02)"/>
</REM_RemittanceTypeParam>
+ <REM_RemittanceTypeParam id="1094AAC85B4B486DBC4BE089C761582C" identifier="FILE_EXTENSION - SEPA B2B Direct Debit Customer-to-Bank (pain.008.001.02)">
+ <id>1094AAC85B4B486DBC4BE089C761582C</id>
+ <active>true</active>
+ <name>FILE_EXTENSION</name>
+ <value>XML</value>
+ <remittanceType id="8917662B12CA484F8C16985F006B7047" entity-name="REM_RemittanceType" identifier="SEPA B2B Direct Debit Customer-to-Bank (pain.008.001.02)"/>
+ </REM_RemittanceTypeParam>
<REM_RemittanceTypeParam id="1DF5A9087C284E499F385512F0CF5916" identifier="Use_Nm_ForIdentifiers - SEPA B2B Direct Debit Customer-to-Bank (pain.008.001.03)">
<id>1DF5A9087C284E499F385512F0CF5916</id>
<active>true</active>
@@ -229,6 +235,13 @@
<value>ZZZ</value>
<remittanceType id="F45BFACB7327407FB5904B6327358A59" entity-name="REM_RemittanceType" identifier="SEPA B2B Direct Debit Customer-to-Bank (pain.008.001.03)"/>
</REM_RemittanceTypeParam>
+ <REM_RemittanceTypeParam id="66F10DF7F94E493FBD209F729C923997" identifier="FILE_EXTENSION - SEPA B2B Direct Debit Customer-to-Bank (pain.008.001.03)">
+ <id>66F10DF7F94E493FBD209F729C923997</id>
+ <active>true</active>
+ <name>FILE_EXTENSION</name>
+ <value>XML</value>
+ <remittanceType id="F45BFACB7327407FB5904B6327358A59" entity-name="REM_RemittanceType" identifier="SEPA B2B Direct Debit Customer-to-Bank (pain.008.001.03)"/>
+ </REM_RemittanceTypeParam>
<REM_RemittanceTypeParam id="79347A703FF24B7DA002524B9338FFE9" identifier="Include_InitiatingPartyId - SEPA B2B Direct Debit Customer-to-Bank (pain.008.001.03)">
<id>79347A703FF24B7DA002524B9338FFE9</id>
<active>true</active>
@@ -334,6 +347,20 @@
<value>ZZZ</value>
<remittanceType id="1D120CE3B9D44221B931168CAFD450BE" entity-name="REM_RemittanceType" identifier="SEPA Core Direct Debit Customer-to-Bank (pain.008.001.02)"/>
</REM_RemittanceTypeParam>
+ <REM_RemittanceTypeParam id="EABA177CCDF943F1B471A3E0C0D10405" identifier="FILE_EXTENSION - SEPA Core Direct Debit Customer-to-Bank (pain.008.001.03)">
+ <id>EABA177CCDF943F1B471A3E0C0D10405</id>
+ <active>true</active>
+ <name>FILE_EXTENSION</name>
+ <value>XML</value>
+ <remittanceType id="1E58BE0E6E9A477A9826677E903BB4D5" entity-name="REM_RemittanceType" identifier="SEPA Core Direct Debit Customer-to-Bank (pain.008.001.03)"/>
+ </REM_RemittanceTypeParam>
+ <REM_RemittanceTypeParam id="EC1BAFD3F23A4A72A3E9022E52D301D2" identifier="FILE_EXTENSION - SEPA Core Direct Debit Customer-to-Bank (pain.008.001.02)">
+ <id>EC1BAFD3F23A4A72A3E9022E52D301D2</id>
+ <active>true</active>
+ <name>FILE_EXTENSION</name>
+ <value>XML</value>
+ <remittanceType id="1D120CE3B9D44221B931168CAFD450BE" entity-name="REM_RemittanceType" identifier="SEPA Core Direct Debit Customer-to-Bank (pain.008.001.02)"/>
+ </REM_RemittanceTypeParam>
<REM_RemittanceTypeParam id="E4554BFC24EB47BAA6EF006663C299CE" identifier="Use_AT-02_toGenerateId - SEPA Core Direct Debit Customer-to-Bank (pain.008.001.03)">
<id>E4554BFC24EB47BAA6EF006663C299CE</id>
<active>true</active>
credittransfer.diff [^] (2,391 bytes) 2015-10-21 11:40 [Show Content] [Hide Content]diff -ru ../sepa_original/org.openbravo.sepa.iso20022.credittransfer.customertobank/referencedata/standard/Credit_Transfer_Scheme.xml b/modules/org.openbravo.sepa.iso20022.credittransfer.customertobank/referencedata/standard/Credit_Transfer_Scheme.xml
--- a/modules/org.openbravo.sepa.iso20022.credittransfer.customertobank/referencedata/standard/Credit_Transfer_Scheme.xml 2015-10-20 18:30:38.605203000 +0200
+++ b/modules/org.openbravo.sepa.iso20022.credittransfer.customertobank/referencedata/standard/Credit_Transfer_Scheme.xml 2015-10-21 10:28:01.469604000 +0200
@@ -22,6 +21,13 @@
<javaClassName>org.openbravo.sepa.iso20022.credittransfer.customertobank.pain.x001.x001.x04.report.CreditTransfer</javaClassName>
<postingAllowed>true</postingAllowed>
</REM_RemittanceType>
+ <REM_RemittanceTypeParam id="00942BA8B5AD4033B07C021A6FC220DD" identifier="FILE_EXTENSION - SEPA Credit Transfer Customer-to-Bank (pain.001.001.03)">
+ <id>00942BA8B5AD4033B07C021A6FC220DD</id>
+ <active>true</active>
+ <name>FILE_EXTENSION</name>
+ <value>XML</value>
+ <remittanceType id="B1E7881282B04EE1BAF1C769597EA84D" entity-name="REM_RemittanceType" identifier="SEPA Credit Transfer Customer-to-Bank (pain.001.001.03)"/>
+ </REM_RemittanceTypeParam>
<REM_RemittanceTypeParam id="16632CA8A1CA42D89EC64243E514187C" identifier="Business_Code - SEPA Credit Transfer Customer-to-Bank (pain.001.001.04)">
<id>16632CA8A1CA42D89EC64243E514187C</id>
<active>true</active>
@@ -134,6 +140,13 @@
<value>Y</value>
<remittanceType id="C31197339A33416DB7C41EB3317ABAD6" entity-name="REM_RemittanceType" identifier="SEPA Credit Transfer Customer-to-Bank (pain.001.001.04)"/>
</REM_RemittanceTypeParam>
+ <REM_RemittanceTypeParam id="DE6F6836602F47A2BF0298DDDFD66CCD" identifier="FILE_EXTENSION - SEPA Credit Transfer Customer-to-Bank (pain.001.001.04)">
+ <id>DE6F6836602F47A2BF0298DDDFD66CCD</id>
+ <active>true</active>
+ <name>FILE_EXTENSION</name>
+ <value>XML</value>
+ <remittanceType id="C31197339A33416DB7C41EB3317ABAD6" entity-name="REM_RemittanceType" identifier="SEPA Credit Transfer Customer-to-Bank (pain.001.001.04)"/>
+ </REM_RemittanceTypeParam>
<FIN_PaymentMethod id="AB8901D43FA4488C89B4C2867E66FBFA" identifier="SEPA Credit Transfer Customer-to-Bank">
<id>AB8901D43FA4488C89B4C2867E66FBFA</id>
<active>true</active>
remmitance.diff [^] (4,021 bytes) 2015-10-21 11:40 [Show Content] [Hide Content]diff -ru a/modules/org.openbravo.module.remittance/src/org/openbravo/module/remittance/ad_actionbutton/CreateFile.java b/modules/org.openbravo.module.remittance/src/org/openbravo/module/remittance/ad_actionbutton/CreateFile.java
--- a/modules/org.openbravo.module.remittance/src/org/openbravo/module/remittance/ad_actionbutton/CreateFile.java 2015-10-21 10:45:11.257611000 +0200
+++ b/modules/org.openbravo.module.remittance/src/org/openbravo/module/remittance/ad_actionbutton/CreateFile.java 2015-10-21 10:13:54.261598000 +0200
@@ -45,6 +45,7 @@
import org.openbravo.model.ad.ui.ProcessTrl;
import org.openbravo.module.remittance.Instruction;
import org.openbravo.module.remittance.Remittance;
+import org.openbravo.module.remittance.RemittanceTypeParameter;
import org.openbravo.module.remittance.utility.REM_RemittanceCreateFile;
import org.openbravo.service.db.DalConnectionProvider;
import org.openbravo.xmlEngine.XmlDocument;
@@ -208,7 +209,8 @@
if (createFile != null) {
createFile.init(remittance);
strFile = createFile.generate(remittance);
- String strFileName = "BANK.DAT";
+ String strFileName = getFileName(remittance);
if (createFile.getFilename() != null && !"".equals(createFile.getFilename())) {
strFileName = createFile.getFilename();
}
@@ -223,6 +225,31 @@
return;
}
+ private String getFileName(Remittance remittance) {
+ try {
+ OBContext.setAdminMode(true);
+
+ String fileName = remittance.getDocumentNo() + "_" + remittance.getName();
+ fileName = replaceStrangeCharacters(fileName);
+
+ OBCriteria<RemittanceTypeParameter> obcRemTypeParam = OBDal.getInstance().createCriteria(
+ RemittanceTypeParameter.class);
+ obcRemTypeParam.add(Restrictions.eq(RemittanceTypeParameter.PROPERTY_REMITTANCETYPE,
+ remittance.getRemittanceType()));
+ obcRemTypeParam.add(Restrictions.eq(RemittanceTypeParameter.PROPERTY_NAME, "FILE_EXTENSION"));
+ obcRemTypeParam.setMaxResults(1);
+ if (obcRemTypeParam.list().isEmpty()) {
+ return fileName + ".DAT";
+ } else {
+ return fileName + "." + obcRemTypeParam.list().get(0).getValue().toLowerCase();
+ }
+ } catch (Exception e) {
+ return "BANK.DAT";
+ } finally {
+ OBContext.restorePreviousMode();
+ }
+ }
+
private void printPageFile(HttpServletResponse response, VariablesSecureApp vars,
StringBuffer strFile, String strFileName) throws IOException, ServletException {
response.setContentType("application/rtf");
@@ -258,6 +285,36 @@
return message;
}
+ /**
+ * Returns a string replacing all the strange characters
+ *
+ * @param originalStr
+ * @return
+ */
+ public static String replaceStrangeCharacters(final String originalStr) {
+ String fileName = originalStr;
+ fileName = fileName.replaceAll("[áàäâ]", "a");
+ fileName = fileName.replaceAll("[ÁÀÄÂ]", "A");
+ fileName = fileName.replaceAll("[éèëê]", "e");
+ fileName = fileName.replaceAll("[ÉÈËÊ]", "E");
+ fileName = fileName.replaceAll("[íìïî]", "i");
+ fileName = fileName.replaceAll("[ÍÌÏÎ]", "I");
+ fileName = fileName.replaceAll("[óòöô]", "o");
+ fileName = fileName.replaceAll("[ÓÒÖÔ]", "O");
+ fileName = fileName.replaceAll("[úùüû]", "u");
+ fileName = fileName.replaceAll("[ÚÙÜÛ]", "U");
+ fileName = fileName.replaceAll("[ç]", "c");
+ fileName = fileName.replaceAll("[Ç]", "C");
+ fileName = fileName.replaceAll("[ñ]", "n");
+ fileName = fileName.replaceAll("[Ñ]", "N");
+ fileName = fileName.replace("\\", "/");
+ fileName = fileName.replaceAll("[º]", ".");
+ fileName = fileName.replaceAll("[ª]", ".");
+ fileName = fileName.replaceAll(" ", "_");
+ // fileName = fileName.replaceAll("[^a-zA-Z0-9.]", "");
+ return fileName;
+ }
+
public String getServletInfo() {
return "Servlet for the generation of files for banks";
} // end of getServletInfo() method
|