From 21a1681c9c7eb9458bf19d7f5ffbaac854b9b60e Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Wed, 17 Apr 2024 00:48:59 +0000 Subject: [PATCH 01/22] fix: upgrade prettier from 3.2.0 to 3.2.5 Snyk has created this PR to upgrade prettier from 3.2.0 to 3.2.5. See this package in npm: https://www.npmjs.com/package/prettier See this project in Snyk: https://app.snyk.io/org/noreply-jcz/project/6f18f5a9-d616-4351-b6a0-903a796d4269?utm_source=github&utm_medium=referral&page=upgrade-pr --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7d4dfe62..e2d1599a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6689,9 +6689,9 @@ "dev": true }, "prettier": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.0.tgz", - "integrity": "sha512-/vBUecTGaPlRVwyZVROVC58bYIScqaoEJzZmzQXXrZOzqn0TwWz0EnOozOlFO/YAImRnb7XsKpTCd3m1SjS2Ww==" + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==" }, "prettier-linter-helpers": { "version": "1.0.0", diff --git a/package.json b/package.json index f5f13a46..0a008cea 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "author": "Openbravo SLU", "license": "SEE LICENSE IN legal/Openbravo_license.txt", "dependencies": { - "prettier": "~3.2.0", + "prettier": "~3.2.5", "eslint-config-prettier": "~9.0.0", "eslint-plugin-prettier": "~5.1.2" }, From 6f901f96e563e71ed2c1516559c9cf3dc9928e92 Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Wed, 17 Apr 2024 00:49:03 +0000 Subject: [PATCH 02/22] fix: upgrade eslint-plugin-prettier from 5.1.2 to 5.1.3 Snyk has created this PR to upgrade eslint-plugin-prettier from 5.1.2 to 5.1.3. See this package in npm: https://www.npmjs.com/package/eslint-plugin-prettier See this project in Snyk: https://app.snyk.io/org/noreply-jcz/project/6f18f5a9-d616-4351-b6a0-903a796d4269?utm_source=github&utm_medium=referral&page=upgrade-pr --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7d4dfe62..9210bdf8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3421,9 +3421,9 @@ } }, "eslint-plugin-prettier": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.1.2.tgz", - "integrity": "sha512-dhlpWc9vOwohcWmClFcA+HjlvUpuyynYs0Rf+L/P6/0iQE6vlHW9l5bkfzN62/Stm9fbq8ku46qzde76T1xlSg==", + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.1.3.tgz", + "integrity": "sha512-C9GCVAs4Eq7ZC/XFQHITLiHJxQngdtraXaM+LoUFoFp/lHNl2Zn8f3WQbe9HvTBBQ9YnKFB0/2Ajdqwo5D1EAw==", "requires": { "prettier-linter-helpers": "^1.0.0", "synckit": "^0.8.6" diff --git a/package.json b/package.json index f5f13a46..0e572a10 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "dependencies": { "prettier": "~3.2.0", "eslint-config-prettier": "~9.0.0", - "eslint-plugin-prettier": "~5.1.2" + "eslint-plugin-prettier": "~5.1.3" }, "devDependencies": { "@babel/plugin-proposal-optional-chaining": "^7.12.7", From af49de1993322a876b506538008704e86b837d58 Mon Sep 17 00:00:00 2001 From: Valeria Garcia Date: Wed, 24 Apr 2024 14:26:38 -0300 Subject: [PATCH 03/22] Feature ETO-298: Add configuration for sonarqube gradle task --- build.gradle | 37 ++++++++++++++++++++++++++++++++++++- gradle.properties.template | 8 ++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index e89786bb..09045c75 100644 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,11 @@ plugins { id 'java' id 'maven-publish' - id "org.sonarqube" version "2.6" + id "org.sonarqube" version "5.0.0.4638" id 'war' id 'idea' id 'groovy' + id 'jacoco' id 'com.etendoerp.gradleplugin' version '1.3.3' id 'org.kordamp.gradle.jandex' version '0.11.0' } @@ -112,12 +113,46 @@ publishing { } } +jacoco { + toolVersion = "0.8.10" +} + +jacocoTestReport { + reports { + xml.required = true + html.required = true + } +} + task exportProjectVersion doLast { ant.propertyfile(file: "version.properties") { entry(key: "version.tag", value: project.version) } } +/** + * Configuration for running static code analysis with SonarQube and generating code quality reports. + */ +sonarqube { + properties { + property "sonar.host.url", "$sonarHostUrl" + property "sonar.login", "$sonarToken" + property "sonar.projectBaseDir", "$rootProject"+"$sonarProjectBaseDir" + property "sonar.projectName", "$sonarProjectName" + property "sonar.projectKey", "$sonarProjectKey" + property "sonar.sourceEncoding", "UTF-8" + property "sonar.sources", "src" + property "sonar.tests", "src-test/src" + property "sonar.java.coveragePlugin", "jacoco" + property "sonar.coverage.jacoco.xmlReportPaths", "../../build/reports/jacoco/test/jacocoTestReport.xml" + property "sonar.branch.name", "$sonarBranchName" + property "sonar.projectVersion", "$sonarVersion" + property "sonar.scm.disabled", "true" + } +} + +tasks['sonarqube'].dependsOn jacocoTestReport + task upgradeCoreVersion { final String RELEASE = 'release' final String HOTFIX = 'hotfix' diff --git a/gradle.properties.template b/gradle.properties.template index dd9ef29a..d7399e94 100644 --- a/gradle.properties.template +++ b/gradle.properties.template @@ -13,3 +13,11 @@ bbdd.user=tad bbdd.password=tad org.gradle.jvmargs=-Xmx2g -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +sonarHostUrl= +sonarToken= +sonarProjectBaseDir= +sonarProjectName= +sonarProjectKey= +sonarBranchName= +sonarVersion= \ No newline at end of file From a98ec0541e8bf64a8221c245649605f7173e4c2d Mon Sep 17 00:00:00 2001 From: AyelenGarcia01 Date: Thu, 16 May 2024 09:14:58 -0300 Subject: [PATCH 04/22] Feature EPL-1469: Change General Ledger ordering Sorting will change if Simple G/L Journal entry records exist --- .../ad_reports/ReportGeneralLedger_data.xsql | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedger_data.xsql b/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedger_data.xsql index 6c2f9b0d..0fdb12b7 100644 --- a/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedger_data.xsql +++ b/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedger_data.xsql @@ -27,7 +27,7 @@ 0 ORDER BY groupbyname, groupbyid, VALUE, NAME, ID, - DATEACCT, FACTACCTTYPE, FACT_ACCT_GROUP_ID, FACT_ACCT_ID, DESCRIPTION, ISDEBIT + DATEACCT, CREATED ASC NULLS FIRST, FACTACCTTYPE, FACT_ACCT_GROUP_ID, FACT_ACCT_ID, DESCRIPTION, ISDEBIT ) C ) B WHERE 1=1 ]]> From ad2822d46895036aef97323c7ca3b64e0498426e Mon Sep 17 00:00:00 2001 From: AyelenGarcia01 Date: Thu, 16 May 2024 11:05:17 -0300 Subject: [PATCH 05/22] Feature EPL-1469: Discard build.gradle --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e3cf93f1..a2a57a89 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,6 +10,7 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 + - run: rm build.gradle - uses: sonarsource/sonarqube-scan-action@master env: SONAR_SCANNER_OPTS: "-Xmx4096m" From 15b91872e0d7b68ed9419bdcb31788582b21ba95 Mon Sep 17 00:00:00 2001 From: Valeria Garcia Date: Fri, 17 May 2024 17:04:36 -0300 Subject: [PATCH 06/22] Feature ETO-326: Fix sonar action for exclude build.gradle --- .github/workflows/build.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a2a57a89..d51bd2af 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,12 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - - run: rm build.gradle + - name: Delete build.gradle (if exists) + run: | + if [ -f build.gradle ]; then + rm build.gradle + echo "'build.gradle' file deleted..." + fi - uses: sonarsource/sonarqube-scan-action@master env: SONAR_SCANNER_OPTS: "-Xmx4096m" @@ -23,4 +28,4 @@ jobs: # - uses: sonarsource/sonarqube-quality-gate-action@master # timeout-minutes: 5 # env: - # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file From 51eaa02149c0383dfec2e0605a86fea2bdce9c20 Mon Sep 17 00:00:00 2001 From: Valeria Garcia Date: Mon, 20 May 2024 09:16:27 -0300 Subject: [PATCH 07/22] Feature ETO-325: Modify Sonarqube and Jacoco properties Add message in build.yml action --- .github/workflows/build.yml | 8 ++++++-- build.gradle | 10 ++++++---- gradle.properties.template | 1 + 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d51bd2af..f1aa7a88 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,10 +1,14 @@ -name: Build +name: Sonar Build on: pull_request: types: [opened, synchronize, reopened] + push: + branches: + - main + - develop jobs: build: - name: Build + name: Sonar Build runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/build.gradle b/build.gradle index a4d3451a..62e161b5 100644 --- a/build.gradle +++ b/build.gradle @@ -118,6 +118,7 @@ jacoco { } jacocoTestReport { + executionData fileTree(dir: "$buildDir/jacoco", include: "**/*.exec") reports { xml.required = true html.required = true @@ -137,17 +138,18 @@ sonarqube { properties { property "sonar.host.url", "$sonarHostUrl" property "sonar.login", "$sonarToken" - property "sonar.projectBaseDir", "$rootProject"+"$sonarProjectBaseDir" + property "sonar.projectBaseDir", "$sonarProjectBaseDir" property "sonar.projectName", "$sonarProjectName" property "sonar.projectKey", "$sonarProjectKey" property "sonar.sourceEncoding", "UTF-8" - property "sonar.sources", "src" + property "sonar.sources", "$sonarSources" property "sonar.tests", "src-test/src" property "sonar.java.coveragePlugin", "jacoco" - property "sonar.coverage.jacoco.xmlReportPaths", "../../build/reports/jacoco/test/jacocoTestReport.xml" - property "sonar.branch.name", "$sonarBranchName" + property "sonar.coverage.jacoco.xmlReportPaths", "$buildDir"+"/reports/jacoco/test/jacocoTestReport.xml" property "sonar.projectVersion", "$sonarVersion" + property "sonar.branch.name", "$sonarBranchName" property "sonar.scm.disabled", "true" + property "sonar.exclusions", "src-gen" } } diff --git a/gradle.properties.template b/gradle.properties.template index d7399e94..39b76b1e 100644 --- a/gradle.properties.template +++ b/gradle.properties.template @@ -19,5 +19,6 @@ sonarToken= sonarProjectBaseDir= sonarProjectName= sonarProjectKey= +sonarSources= sonarBranchName= sonarVersion= \ No newline at end of file From cc86d888167f449fa099ecf49a4c8e2cf095ad69 Mon Sep 17 00:00:00 2001 From: AMAR Date: Tue, 21 May 2024 20:56:41 +0530 Subject: [PATCH 08/22] Issue #306:fix custom accounting for internal consumption EPL-1238 --- .../openbravo/erpCommon/ad_forms/DocInternalConsumption.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/org/openbravo/erpCommon/ad_forms/DocInternalConsumption.java b/src/org/openbravo/erpCommon/ad_forms/DocInternalConsumption.java index e1e8790c..f9d1e5cd 100644 --- a/src/org/openbravo/erpCommon/ad_forms/DocInternalConsumption.java +++ b/src/org/openbravo/erpCommon/ad_forms/DocInternalConsumption.java @@ -158,7 +158,8 @@ public Fact createFact(AcctSchema as, ConnectionProvider conn, Connection con, DocumentType); if (StringUtils.isEmpty(strClassname)) { strClassname = AcctServerData.selectTemplate(conn, as.m_C_AcctSchema_ID, AD_Table_ID); - } else { + } + if (!StringUtils.isEmpty(strClassname)) { try { DocInternalConsumptionTemplate newTemplate = (DocInternalConsumptionTemplate) Class .forName(strClassname) From f58b9f06cd3108e5a1e77d221db517b7bb34528c Mon Sep 17 00:00:00 2001 From: AMAR Date: Wed, 22 May 2024 22:32:36 +0530 Subject: [PATCH 09/22] Issue #306: refactored code EPL-1238 --- .../ad_forms/DocInternalConsumption.java | 196 +++++++++++------- 1 file changed, 118 insertions(+), 78 deletions(-) diff --git a/src/org/openbravo/erpCommon/ad_forms/DocInternalConsumption.java b/src/org/openbravo/erpCommon/ad_forms/DocInternalConsumption.java index f9d1e5cd..0799c929 100644 --- a/src/org/openbravo/erpCommon/ad_forms/DocInternalConsumption.java +++ b/src/org/openbravo/erpCommon/ad_forms/DocInternalConsumption.java @@ -84,7 +84,7 @@ public boolean loadDocumentDetails(FieldProvider[] data, ConnectionProvider conn * @return DocLine Array */ private DocLine[] loadLines(ConnectionProvider conn) { - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); DocLineInternalConsumptionData[] data = null; OBContext.setAdminMode(false); try { @@ -101,15 +101,9 @@ private DocLine[] loadLines(ConnectionProvider conn) { // Get related M_Transaction_ID InternalConsumptionLine intConsLine = OBDal.getInstance() .get(InternalConsumptionLine.class, Line_ID); - if (intConsLine.getMaterialMgmtMaterialTransactionList().size() > 0) { - docLine.setTransaction(intConsLine.getMaterialMgmtMaterialTransactionList().get(0)); - } - DocInternalConsumptionData[] data1 = null; - try { - data1 = DocInternalConsumptionData.selectWarehouse(conn, docLine.m_M_Locator_ID); - } catch (ServletException e) { - log4jDocInternalConsumption.warn(e); - } + updateTransactionForDocLine(intConsLine, docLine); + + DocInternalConsumptionData[] data1 = getInternalConsumptionWarehouse(conn, docLine); if (data1 != null && data1.length > 0) { this.M_Warehouse_ID = data1[0].mWarehouseId; } @@ -126,9 +120,26 @@ private DocLine[] loadLines(ConnectionProvider conn) { return dl; } // loadLines + private DocInternalConsumptionData[] getInternalConsumptionWarehouse(ConnectionProvider conn, + DocLine_Material docLine) { + DocInternalConsumptionData[] data = null; + try { + data = DocInternalConsumptionData.selectWarehouse(conn, docLine.m_M_Locator_ID); + } catch (ServletException e) { + log4jDocInternalConsumption.warn(e); + } + return data; + } + + private void updateTransactionForDocLine(InternalConsumptionLine intConsLine, DocLine_Material docLine) { + if (!intConsLine.getMaterialMgmtMaterialTransactionList().isEmpty()) { + docLine.setTransaction(intConsLine.getMaterialMgmtMaterialTransactionList().get(0)); + } + } + /** * Get Balance - * + * * @return Zero (always balanced) */ @Override @@ -139,101 +150,130 @@ public BigDecimal getBalance() { /** * Create Facts (the accounting logic) for MIC. - * + * *
    *  Internal Consumption
-   *      CoGS            DR      
+   *      CoGS            DR
    *      Inventory               CR
    * 
- * + * * @param as - * account schema + * account schema * @return Fact */ @Override public Fact createFact(AcctSchema as, ConnectionProvider conn, Connection con, VariablesSecureApp vars) throws ServletException { // Select specific definition - String strClassname = AcctServerData.selectTemplateDoc(conn, as.m_C_AcctSchema_ID, - DocumentType); - if (StringUtils.isEmpty(strClassname)) { - strClassname = AcctServerData.selectTemplate(conn, as.m_C_AcctSchema_ID, AD_Table_ID); - } + String strClassname = getTemplateClassname(as, conn); if (!StringUtils.isEmpty(strClassname)) { - try { - DocInternalConsumptionTemplate newTemplate = (DocInternalConsumptionTemplate) Class - .forName(strClassname) - .getDeclaredConstructor() - .newInstance(); - return newTemplate.createFact(this, as, conn, con, vars); - } catch (Exception e) { - log4j.error("Error while creating new instance for DocInternalConsumptionTemplate - " + e); - } + return instantiateTemplateAndCreateFact(strClassname, as, conn, con, vars); } C_Currency_ID = as.getC_Currency_ID(); // create Fact Header Fact fact = new Fact(this, as, Fact.POST_Actual); - String Fact_Acct_Group_ID = SequenceIdData.getUUID(); + String factAcctGroupId = SequenceIdData.getUUID(); // Line pointers FactLine dr = null; FactLine cr = null; log4jDocInternalConsumption.debug("CreateFact - before loop"); - for (int i = 0; i < p_lines.length; i++) { - DocLine_Material line = (DocLine_Material) p_lines[i]; + for (DocLine p_line : p_lines) { + DocLine_Material line = (DocLine_Material) p_line; - Currency costCurrency = FinancialUtils - .getLegalEntityCurrency(OBDal.getInstance().get(Organization.class, line.m_AD_Org_ID)); - if (line.transaction != null && line.transaction.getCurrency() != null) { - costCurrency = line.transaction.getCurrency(); - } - if (line.transaction != null && !line.transaction.isCostCalculated()) { - Map parameters = getNotCalculatedCostParameters(line.transaction); - setMessageResult(conn, STATUS_NotCalculatedCost, "error", parameters); - throw new IllegalStateException(); - } - String costs = line.getProductCosts(DateAcct, as, conn, con); - log4jDocInternalConsumption.debug("CreateFact - before DR - Costs: " + costs); - BigDecimal b_Costs = new BigDecimal(costs); - String strCosts = b_Costs.toPlainString(); - Account cogsAccount = line.getAccount(ProductInfo.ACCTTYPE_P_Cogs, as, conn); - Product product = OBDal.getInstance().get(Product.class, line.m_M_Product_ID); - if (cogsAccount == null) { - org.openbravo.model.financialmgmt.accounting.coa.AcctSchema schema = OBDal.getInstance() - .get(org.openbravo.model.financialmgmt.accounting.coa.AcctSchema.class, - as.m_C_AcctSchema_ID); - log4j.error("No Account COGS for product: " + product.getName() + " in accounting schema: " - + schema.getName()); - } - Account assetAccount = line.getAccount(ProductInfo.ACCTTYPE_P_Asset, as, conn); - if (assetAccount == null) { - org.openbravo.model.financialmgmt.accounting.coa.AcctSchema schema = OBDal.getInstance() - .get(org.openbravo.model.financialmgmt.accounting.coa.AcctSchema.class, - as.m_C_AcctSchema_ID); - log4j.error("No Account Asset for product: " + product.getName() + " in accounting schema: " - + schema.getName()); - } - dr = fact.createLine(line, cogsAccount, costCurrency.getId(), strCosts, "", - Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType, conn); - if (dr != null) { - dr.setM_Locator_ID(line.m_M_Locator_ID); - dr.setLocationFromLocator(line.m_M_Locator_ID, true, conn); // from - dr.setLocationFromBPartner(C_BPartner_Location_ID, false, conn); // to - } - log4jDocInternalConsumption.debug("CreateFact - before CR"); - cr = fact.createLine(line, assetAccount, costCurrency.getId(), "", strCosts, - Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType, conn); - if (cr != null) { - cr.setM_Locator_ID(line.m_M_Locator_ID); - cr.setLocationFromLocator(line.m_M_Locator_ID, true, conn); // from - cr.setLocationFromBPartner(C_BPartner_Location_ID, false, conn); // to - } + Currency costCurrency = determineCostCurrency(line); + validateCostCalculation(line, conn); + + String strCosts = getCostsString(line, as, conn, con); + createFactLines(as, fact, line, costCurrency, strCosts, factAcctGroupId, conn); } log4jDocInternalConsumption.debug("CreateFact - after loop"); SeqNo = "0"; return fact; } // createFact + private String getTemplateClassname(AcctSchema as, ConnectionProvider conn) throws ServletException { + String strClassname = AcctServerData.selectTemplateDoc(conn, as.m_C_AcctSchema_ID, DocumentType); + if (StringUtils.isEmpty(strClassname)) { + strClassname = AcctServerData.selectTemplate(conn, as.m_C_AcctSchema_ID, AD_Table_ID); + } + return strClassname; + } + + private Fact instantiateTemplateAndCreateFact(String strClassname, AcctSchema as, ConnectionProvider conn, + Connection con, VariablesSecureApp vars) throws ServletException { + try { + DocInternalConsumptionTemplate newTemplate = (DocInternalConsumptionTemplate) Class.forName(strClassname) + .getDeclaredConstructor().newInstance(); + return newTemplate.createFact(this, as, conn, con, vars); + } catch (Exception e) { + log4j.error("Error while creating new instance for DocInternalConsumptionTemplate - " + e); + throw new ServletException(e); + } + } + + private Currency determineCostCurrency(DocLine_Material line) { + if (line.transaction != null && line.transaction.getCurrency() != null) { + return line.transaction.getCurrency(); + } + return FinancialUtils.getLegalEntityCurrency( + OBDal.getInstance().get(Organization.class, line.m_AD_Org_ID)); + } + + private void validateCostCalculation(DocLine_Material line, ConnectionProvider conn) { + if (line.transaction != null && !line.transaction.isCostCalculated()) { + Map parameters = getNotCalculatedCostParameters(line.transaction); + setMessageResult(conn, STATUS_NotCalculatedCost, "error", parameters); + throw new IllegalStateException(); + } + } + + private String getCostsString(DocLine_Material line, AcctSchema as, ConnectionProvider conn, + Connection con) { + String costs = line.getProductCosts(DateAcct, as, conn, con); + log4jDocInternalConsumption.debug("CreateFact - before DR - Costs: " + costs); + BigDecimal bCosts = new BigDecimal(costs); + return bCosts.toPlainString(); + } + + private void createFactLines(AcctSchema as, Fact fact, DocLine_Material line, Currency costCurrency, String strCosts, + String factAcctGroupId, ConnectionProvider conn) throws ServletException { + Account cogsAccount = getAccount(line, ProductInfo.ACCTTYPE_P_Cogs, as, conn, "COGS"); + Account assetAccount = getAccount(line, ProductInfo.ACCTTYPE_P_Asset, as, conn, "Asset"); + + FactLine dr = fact.createLine(line, cogsAccount, costCurrency.getId(), strCosts, "", factAcctGroupId, + nextSeqNo(SeqNo), DocumentType, conn); + if (dr != null) { + setFactLineLocations(dr, line, conn); + } + + FactLine cr = fact.createLine(line, assetAccount, costCurrency.getId(), "", strCosts, factAcctGroupId, + nextSeqNo(SeqNo), DocumentType, conn); + if (cr != null) { + setFactLineLocations(cr, line, conn); + } + } + + private Account getAccount(DocLine_Material line, String acctType, AcctSchema as, ConnectionProvider conn, + String accountTypeName) { + Account account = line.getAccount(acctType, as, conn); + if (account == null) { + org.openbravo.model.financialmgmt.accounting.coa.AcctSchema schema = OBDal.getInstance() + .get(org.openbravo.model.financialmgmt.accounting.coa.AcctSchema.class, as.m_C_AcctSchema_ID); + Product product = OBDal.getInstance().get(Product.class, line.m_M_Product_ID); + log4j.error( + "No Account " + accountTypeName + " for product: " + product.getName() + " in accounting schema: " + schema.getName()); + } + return account; + } + + private void setFactLineLocations(FactLine factLine, DocLine_Material line, + ConnectionProvider conn) { + factLine.setM_Locator_ID(line.m_M_Locator_ID); + factLine.setLocationFromLocator(line.m_M_Locator_ID, true, conn); // from + factLine.setLocationFromBPartner(C_BPartner_Location_ID, false, conn); // to + } + /** * Get Document Confirmation * From e656ba76dbd7da1199906a698da841240b4223e3 Mon Sep 17 00:00:00 2001 From: facundomoyano Date: Wed, 22 May 2024 12:02:27 -0300 Subject: [PATCH 10/22] Feature ETO-323: Add git police to workflows --- .github/workflows/auto-reviewer.yml | 19 ++++++++--- .github/workflows/build.yml | 7 +++-- .github/workflows/git-police.yml | 49 +++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/git-police.yml diff --git a/.github/workflows/auto-reviewer.yml b/.github/workflows/auto-reviewer.yml index 6bbbc013..674bb7ba 100644 --- a/.github/workflows/auto-reviewer.yml +++ b/.github/workflows/auto-reviewer.yml @@ -1,15 +1,16 @@ name: Auto Reviewer on: - pull_request: - types: [opened, reopened, synchronize] + workflow_run: + workflows: [Git Police] + types: + - completed jobs: make-review: - if: github.head_ref != 'develop' + if: github.head_ref != 'develop' && github.event.workflow_run.conclusion == 'success' runs-on: ubuntu-latest env: - PULL_REQUEST: ${{ github.event.pull_request.number }} PROJECT: ${{ github.event.repository.owner.login }} REPO_SLUG: ${{ github.event.repository.name }} OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} @@ -20,6 +21,14 @@ jobs: - name: Checkout code uses: actions/checkout@v2 + - name: Fetch pull request number + id: fetch-pr + run: | + PR_NUMBER=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + "https://api.github.com/repos/${{ env.PROJECT }}/${{ env.REPO_SLUG }}/pulls?head=${{ env.PROJECT }}:${{ github.head_ref }}" \ + | jq '.[0].number') + echo "PULL_REQUEST=$PR_NUMBER" >> $GITHUB_ENV + - name: Run Docker container id: run-docker run: | @@ -27,6 +36,7 @@ jobs: echo "-------------------------------------------------------------------------" echo ${{ env.DOCKERHUB_PASSWORD }} | docker login --username "${{ env.DOCKERHUB_USERNAME }}" --password-stdin docker run -d -p 5000:5000 -e REPO_API_TOKEN="${{ env.ETENDOBOT_TOKEN }}" -e PULL_REQUEST=${{ env.PULL_REQUEST }} -e PROJECT=${{ env.PROJECT }} -e REPO_SLUG=${{ env.REPO_SLUG }} -e OPENAI_API_KEY="${{ env.OPENAI_API_KEY }}" etendo/code-reviewer:latest + - name: Make Reviewer API call id: call-api run: | @@ -34,7 +44,6 @@ jobs: response=$(curl -s -o response.txt -w "%{http_code}" -X GET http://localhost:5000/review/github) if [ $response -ne 200 ]; then echo "API call failed with status code $response. This is likely an error related to the PR data, or an internal API error" - echo "Response text:" cat response.txt exit 1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f1aa7a88..02dd03eb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,13 +1,16 @@ name: Sonar Build on: - pull_request: - types: [opened, synchronize, reopened] + workflow_run: + workflows: [Git Police] + types: + - completed push: branches: - main - develop jobs: build: + if: github.event.workflow_run.conclusion == 'success' name: Sonar Build runs-on: ubuntu-latest steps: diff --git a/.github/workflows/git-police.yml b/.github/workflows/git-police.yml new file mode 100644 index 00000000..b8e5cc00 --- /dev/null +++ b/.github/workflows/git-police.yml @@ -0,0 +1,49 @@ +name: Git Police + +on: + pull_request: + types: [opened, reopened, synchronize] + +jobs: + git-police: + name: Git Police + if: github.head_ref != 'develop' + runs-on: ubuntu-latest + env: + PR_ID: ${{ github.event.pull_request.number }} + REPO_NAME: ${{ github.event.repository.name }} + ETENDOBOT_TOKEN: ${{ secrets.ETENDOBOT_TOKEN }} + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Run Docker container + id: run-docker + run: | + printenv + echo "-------------------------------------------------------------------------" + echo ${{ env.DOCKERHUB_PASSWORD }} | docker login --username "${{ env.DOCKERHUB_USERNAME }}" --password-stdin + docker run -d -p 5000:5000 -e REPO_TOKEN="${{ env.ETENDOBOT_TOKEN }}" -e PR_ID=${{ env.PR_ID }} -e REPO_NAME=${{ env.REPO_NAME }} etendo/gitpolice:latest + - name: Git Police API call + id: call-api + run: | + sleep 10s + response=$(curl -s -o response.txt -w "%{http_code}" -X GET http://localhost:5000/api/github) + if [ $response -ne 200 ]; then + echo "API call failed with status code $response. This is likely an error related to the PR data, or an internal API error" + + echo "Response text:" + cat response.txt + exit 1 + fi + if ! grep -q "Valid branch name and correct destination" response.txt; then + echo "Git Police check failed: response does not contain 'Valid branch name and correct destination'" + echo "Full response:" + cat response.txt + exit 1 + fi + echo "API call successful with status code $response" + echo "Response text:" + cat response.txt From 74cb4ad3fcd06b5f1ca193d47fb3d13a7b1e1909 Mon Sep 17 00:00:00 2001 From: facundomoyano Date: Wed, 29 May 2024 12:25:41 -0300 Subject: [PATCH 11/22] Feature ETO-323: fix sonar workflow --- .github/workflows/build.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 02dd03eb..f1aa7a88 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,16 +1,13 @@ name: Sonar Build on: - workflow_run: - workflows: [Git Police] - types: - - completed + pull_request: + types: [opened, synchronize, reopened] push: branches: - main - develop jobs: build: - if: github.event.workflow_run.conclusion == 'success' name: Sonar Build runs-on: ubuntu-latest steps: From 5dc89f5641b45d6c65fea98568834c03a2ff1770 Mon Sep 17 00:00:00 2001 From: Matias Bernal Date: Tue, 28 May 2024 14:41:35 -0300 Subject: [PATCH 12/22] Issue #314: Changed AddPaymentActionHandler to allow throws exceptions EPL-1320: Changed AddPaymentActionHandler java class to allow throws exeptions when a trigger throws an exeption --- .../AddPaymentActionHandler.java | 36 +++++-------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/modules_core/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddPaymentActionHandler.java b/modules_core/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddPaymentActionHandler.java index f71bf5d8..ed70a491 100644 --- a/modules_core/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddPaymentActionHandler.java +++ b/modules_core/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddPaymentActionHandler.java @@ -198,7 +198,7 @@ private void massiveMessageHandler(ActionResult result, List regist } private void callPaymentProcess(ActionResult actionResult, JSONObject content, - String paymentId, boolean isWebService) throws JSONException { + String paymentId, boolean isWebService) throws Exception { // process payments JSONObject resultProcess = oldProcessPaymentHandler(getRequestParameters(), content, paymentId, isWebService); JSONObject resultMessage = resultProcess.has(MESSAGE) ? resultProcess.getJSONObject(MESSAGE) : new JSONObject(); @@ -228,12 +228,12 @@ private void callPaymentProcess(ActionResult actionResult, JSONObject content, } protected JSONObject oldProcessPaymentHandler(Map parameters, JSONObject content, String paymentId, - boolean isWebService) { + boolean isWebService) throws Exception { JSONObject jsonResponse = new JSONObject(); - OBContext.setAdminMode(true); boolean openedFromMenu = false; String comingFrom = null; try { + OBContext.setAdminMode(true); if (isWebService) { FIN_Payment payment = OBDal.getInstance().get(FIN_Payment.class, paymentId); if (payment.isProcessed()) { @@ -328,17 +328,8 @@ protected JSONObject oldProcessPaymentHandler(Map parameters, JS // Load existing lines to be deleted. pdToRemove = OBDao.getIDListFromOBObject(payment.getFINPaymentDetailList()); } else { - try { payment = createNewPayment(jsonParams, isReceipt, org, businessPartner, paymentDate, currency, exchangeRate, convertedAmount, strActualPayment); - } catch (OBException e) { - JSONObject errorMessage = new JSONObject(); - errorMessage.put(SEVERITY, ERROR); - errorMessage.put(TEXT, e.getMessage()); - jsonResponse.put(RETRY_EXECUTION, openedFromMenu); - jsonResponse.put(MESSAGE, errorMessage); - return jsonResponse; - } } payment.setAmount(new BigDecimal(strActualPayment)); FIN_AddPayment.setFinancialTransactionAmountAndRate(vars, payment, exchangeRate, @@ -384,21 +375,6 @@ protected JSONObject oldProcessPaymentHandler(Map parameters, JS return resultPost; } } - } catch (Exception e) { - log.error("Exception handling the new payment", e); - - try { - jsonResponse = new JSONObject(); - Throwable ex = DbUtility.getUnderlyingSQLException(e); - String message = OBMessageUtils.translateError(ex.getMessage()).getMessage(); - JSONObject errorMessage = new JSONObject(); - errorMessage.put(SEVERITY, ERROR); - errorMessage.put(TEXT, message); - jsonResponse.put(RETRY_EXECUTION, openedFromMenu); - jsonResponse.put(MESSAGE, errorMessage); - - } catch (Exception ignore) { - } } finally { OBContext.restorePreviousMode(); } @@ -468,13 +444,17 @@ private FIN_Payment createNewPayment(JSONObject jsonParams, boolean isReceipt, O strPaymentDocumentNo = FIN_Utility.getDocumentNo(documentType, FIN_PAYMENT); } - OBContext.setAdminMode(false); try { + OBContext.setAdminMode(false); FIN_Payment payment = (new AdvPaymentMngtDao()).getNewPayment(isReceipt, org, documentType, strPaymentDocumentNo, bPartner, paymentMethod, finAccount, strPaymentAmount, paymentDate, strReferenceNo, currency, conversionRate, convertedAmt); OBDal.getInstance().getConnection(true).commit(); return payment; + } catch (Exception e) { + final Throwable ex = DbUtility.getUnderlyingSQLException(e.getCause() != null ? e.getCause() : e); + final String message = OBMessageUtils.translateError(ex.getMessage()).getMessage(); + throw new OBException(message); } finally { OBContext.restorePreviousMode(); } From c9fa537f02ba2921eaafa04f1c343772fa1f852c Mon Sep 17 00:00:00 2001 From: Valeria Garcia Date: Thu, 30 May 2024 21:03:22 -0300 Subject: [PATCH 13/22] Issue #414: Set resources test dir for 'modules' and 'modules_core' EPL-1530: Add mockito dependency --- pipelines/unittests/Jenkinsfile | 2 +- tests.gradle | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pipelines/unittests/Jenkinsfile b/pipelines/unittests/Jenkinsfile index 58e6b6a3..a0ce430a 100644 --- a/pipelines/unittests/Jenkinsfile +++ b/pipelines/unittests/Jenkinsfile @@ -18,7 +18,7 @@ pipeline { GITHUB_TOKEN = credentials('github-read-package-token') LANG = 'en_US.UTF-8' - ACCESS_TOKEN = credentials('access_token') + ACCESS_TOKEN = credentials('access_token_github') EMAIL_ADDRESS = credentials('email_builds') URL_REPO = 'https://github.com/etendosoftware/etendo_core' diff --git a/tests.gradle b/tests.gradle index 02244a8c..43af1961 100644 --- a/tests.gradle +++ b/tests.gradle @@ -16,6 +16,7 @@ dependencies { testImplementation 'org.spockframework:spock-core' testImplementation 'org.spockframework:spock-junit4' testImplementation 'junit:junit:4.13.1' + testImplementation 'org.mockito:mockito-core:3.2.4' testImplementation( "com.athaydes:spock-reports:2.0-groovy-2.5" ) { transitive = false // this avoids affecting your version of Groovy/Spock } @@ -47,6 +48,7 @@ sourceSets{ if(file('modules').exists() && file('modules').isDirectory()){ file('modules').eachDir { sourceSets.test.java.srcDirs += it.toString()+"/src-test/src" + sourceSets.test.resources.srcDirs += it.toString()+"/src-test/resources" sourceSets.test.java.outputDir = file("src-test/build/classes") sourceSets.test.groovy.srcDirs += it.toString()+"/src-test/test/groovy" sourceSets.test.groovy.outputDir = file("src-test/build/classes") @@ -55,12 +57,11 @@ if(file('modules').exists() && file('modules').isDirectory()){ if(file('modules_core').exists() && file('modules_core').isDirectory()){ file('modules_core').eachDir { sourceSets.test.java.srcDirs += it.toString()+"/src-test" + sourceSets.test.resources.srcDirs += it.toString()+"/src-test/resources" sourceSets.test.java.outputDir = file("src-test/build/classes") } } -test.dependsOn('ant.compile.test') - task depsTest { doLast { configurations.compileClasspath.getFiles().each { file -> From c2f0b445f94a87368cdb230687b37e5b5852bcf8 Mon Sep 17 00:00:00 2001 From: Valeria Garcia Date: Fri, 31 May 2024 12:44:48 -0300 Subject: [PATCH 14/22] Hotfix ETO-346: Change access_token for update commit status Change build name --- pipelines/unittests/Jenkinsfile | 2 +- pipelines/unittests/build-update.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pipelines/unittests/Jenkinsfile b/pipelines/unittests/Jenkinsfile index 58e6b6a3..a0ce430a 100644 --- a/pipelines/unittests/Jenkinsfile +++ b/pipelines/unittests/Jenkinsfile @@ -18,7 +18,7 @@ pipeline { GITHUB_TOKEN = credentials('github-read-package-token') LANG = 'en_US.UTF-8' - ACCESS_TOKEN = credentials('access_token') + ACCESS_TOKEN = credentials('access_token_github') EMAIL_ADDRESS = credentials('email_builds') URL_REPO = 'https://github.com/etendosoftware/etendo_core' diff --git a/pipelines/unittests/build-update.sh b/pipelines/unittests/build-update.sh index e2d85c27..bafce613 100755 --- a/pipelines/unittests/build-update.sh +++ b/pipelines/unittests/build-update.sh @@ -9,7 +9,7 @@ DESCRIPTION=$3 TARGET_URL="$6" ACCESS_TOKEN=$4 GIT_STATUS_URL="https://$ACCESS_TOKEN:x-oauth-basic@$URI/repos/$OWNER/$REPO_SLUG/statuses/${REVISION}" -TEMPLATE='{"state":"%s", "target_url":"%s", "description":"%s", "context":"build/job"}' +TEMPLATE='{"state":"%s", "target_url":"%s", "description":"%s", "context":"Etendo Core Unit Tests"}' PAYLOAD=$(printf "$TEMPLATE" "$STATUS" "$TARGET_URL" "$DESCRIPTION") echo $PAYLOAD From b72de7aafe24d1c96cd8016c4dd517105f827c6d Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 31 May 2024 21:34:33 +0200 Subject: [PATCH 15/22] :zap: Update version to 24.1.7 --- build.gradle | 4 ++-- .../src-db/database/sourcedata/AD_MODULE.xml | 6 +++--- src-db/database/sourcedata/AD_MODULE.xml | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index d7671b5e..035ee057 100644 --- a/build.gradle +++ b/build.gradle @@ -35,9 +35,9 @@ dependencies { } -final String CURRENT_VERSION = "24.1.6" +final String CURRENT_VERSION = "24.1.7" final String NEXT_RELEASE = "24.2.0" -final String NEXT_HOTFIX = "24.1.7" +final String NEXT_HOTFIX = "24.1.8" final String DEV_URL = "https://repo.futit.cloud/repository/maven-snapshots/" final String PROD_URL = uri("https://maven.pkg.github.com/etendosoftware/etendo_core/") diff --git a/modules_core/org.openbravo.v3/src-db/database/sourcedata/AD_MODULE.xml b/modules_core/org.openbravo.v3/src-db/database/sourcedata/AD_MODULE.xml index 7301fb50..cf0c3639 100644 --- a/modules_core/org.openbravo.v3/src-db/database/sourcedata/AD_MODULE.xml +++ b/modules_core/org.openbravo.v3/src-db/database/sourcedata/AD_MODULE.xml @@ -6,7 +6,7 @@ - + @@ -20,8 +20,8 @@ - - + + diff --git a/src-db/database/sourcedata/AD_MODULE.xml b/src-db/database/sourcedata/AD_MODULE.xml index 83fb885a..ec0ab37f 100644 --- a/src-db/database/sourcedata/AD_MODULE.xml +++ b/src-db/database/sourcedata/AD_MODULE.xml @@ -6,7 +6,7 @@ - + @@ -21,9 +21,9 @@ You may obtain a copy of the License at support@etendo.software or in the legal - + - + From 3d6c07263ad91c6c49baba5d6b077edd9b13d558 Mon Sep 17 00:00:00 2001 From: Matias Bernal Date: Fri, 14 Jun 2024 12:55:22 -0300 Subject: [PATCH 16/22] Issue #270: Fix JS function to prevent abnormally callouts execution. EPL-530: Remove blur in combobox item to prevent set changes on this and abnormally execution of callouts --- .../web/org.openbravo.client.application/js/form/ob-view-form.js | 1 - 1 file changed, 1 deletion(-) diff --git a/modules_core/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js b/modules_core/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js index 6e0bed67..8007754e 100644 --- a/modules_core/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js +++ b/modules_core/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js @@ -279,7 +279,6 @@ OB.ViewFormProperties = { // showing focused style in multiple fields if (this.getFocusItem()) { this.getFocusItem().hasFocus = false; - this.getFocusItem().elementBlur(); } this.setFocusItem(null); From 937c3abd9891258e4ed5123daa94a93590f95f04 Mon Sep 17 00:00:00 2001 From: admin Date: Sat, 15 Jun 2024 01:57:08 +0200 Subject: [PATCH 17/22] :zap: Update version to 24.1.8 --- build.gradle | 4 ++-- .../src-db/database/sourcedata/AD_MODULE.xml | 6 +++--- src-db/database/sourcedata/AD_MODULE.xml | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index 035ee057..e38bf038 100644 --- a/build.gradle +++ b/build.gradle @@ -35,9 +35,9 @@ dependencies { } -final String CURRENT_VERSION = "24.1.7" +final String CURRENT_VERSION = "24.1.8" final String NEXT_RELEASE = "24.2.0" -final String NEXT_HOTFIX = "24.1.8" +final String NEXT_HOTFIX = "24.1.9" final String DEV_URL = "https://repo.futit.cloud/repository/maven-snapshots/" final String PROD_URL = uri("https://maven.pkg.github.com/etendosoftware/etendo_core/") diff --git a/modules_core/org.openbravo.v3/src-db/database/sourcedata/AD_MODULE.xml b/modules_core/org.openbravo.v3/src-db/database/sourcedata/AD_MODULE.xml index cf0c3639..d4213d6c 100644 --- a/modules_core/org.openbravo.v3/src-db/database/sourcedata/AD_MODULE.xml +++ b/modules_core/org.openbravo.v3/src-db/database/sourcedata/AD_MODULE.xml @@ -6,7 +6,7 @@ - + @@ -20,8 +20,8 @@ - - + + diff --git a/src-db/database/sourcedata/AD_MODULE.xml b/src-db/database/sourcedata/AD_MODULE.xml index ec0ab37f..4d1dc96e 100644 --- a/src-db/database/sourcedata/AD_MODULE.xml +++ b/src-db/database/sourcedata/AD_MODULE.xml @@ -6,7 +6,7 @@ - + @@ -21,9 +21,9 @@ You may obtain a copy of the License at support@etendo.software or in the legal - + - + From cd26fed0a90f16aa92547ba519cbaa2f045ff04e Mon Sep 17 00:00:00 2001 From: Roman Magnoli Date: Tue, 25 Jun 2024 12:21:11 -0300 Subject: [PATCH 18/22] Issue #418: Change the parameter name on the URL EPL-1535: The URL parameter name was changed in order to match with the parameter name itself. --- .../web/com.smf.securewebservices/doc/doc.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules_core/com.smf.securewebservices/web/com.smf.securewebservices/doc/doc.yaml b/modules_core/com.smf.securewebservices/web/com.smf.securewebservices/doc/doc.yaml index 6b57940f..7f874835 100644 --- a/modules_core/com.smf.securewebservices/web/com.smf.securewebservices/doc/doc.yaml +++ b/modules_core/com.smf.securewebservices/web/com.smf.securewebservices/doc/doc.yaml @@ -98,7 +98,7 @@ paths: $ref: "#/components/schemas/LogResp" 401: description: No auth. - /sws/com.smf.securewebservices.obRest/{modelName}: + /sws/com.smf.securewebservices.obRest/{_entityName}: get: summary: List records security: @@ -229,7 +229,7 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" - /sws/com.smf.securewebservices.obRest/{modelName}/{recordID}: + /sws/com.smf.securewebservices.obRest/{_entityName}/{recordID}: get: summary: Get a record by ID security: From 4220a8797ccefe01413a00daa1b83dc200f13584 Mon Sep 17 00:00:00 2001 From: Roman Magnoli Date: Wed, 26 Jun 2024 11:55:49 -0300 Subject: [PATCH 19/22] Issue #418: Fix 'distinct' parameter to avoid NPE EPL-1535: Add a 'lowerCase' for the parameter in order to find the desired property. --- .../smf/securewebservices/service/SecureJsonDataService.java | 4 ++-- .../web/com.smf.securewebservices/doc/doc.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules_core/com.smf.securewebservices/src/com/smf/securewebservices/service/SecureJsonDataService.java b/modules_core/com.smf.securewebservices/src/com/smf/securewebservices/service/SecureJsonDataService.java index 116af830..5ab7babc 100644 --- a/modules_core/com.smf.securewebservices/src/com/smf/securewebservices/service/SecureJsonDataService.java +++ b/modules_core/com.smf.securewebservices/src/com/smf/securewebservices/service/SecureJsonDataService.java @@ -390,7 +390,7 @@ private DataEntityQueryService createSetQueryService(Map paramet // this is the main entity of a 'contains' (used in FK drop down lists), it will create also // info for subentity - if ("true".equals(parameters.get(JsonConstants.SHOW_FK_DROPDOWN_UNFILTERED_PARAMETER))) { + if (StringUtils.equals("true", parameters.get(JsonConstants.SHOW_FK_DROPDOWN_UNFILTERED_PARAMETER))) { // Do not filter out the rows of the referenced tables if // they are not referenced from the referencing tables // Showing the records unfiltered improves the performance if the referenced table has just @@ -435,7 +435,7 @@ private DataEntityQueryService createSetQueryService(Map paramet removeWhereParameter(parameters); } else { - final String distinctPropertyPath = parameters.get(JsonConstants.DISTINCT_PARAMETER); + final String distinctPropertyPath = StringUtils.lowerCase(parameters.get(JsonConstants.DISTINCT_PARAMETER)); final Property distinctProperty = DalUtil.getPropertyFromPath( ModelProvider.getInstance().getEntity(entityName), distinctPropertyPath); final Entity distinctEntity = distinctProperty.getTargetEntity(); diff --git a/modules_core/com.smf.securewebservices/web/com.smf.securewebservices/doc/doc.yaml b/modules_core/com.smf.securewebservices/web/com.smf.securewebservices/doc/doc.yaml index 7f874835..35d89906 100644 --- a/modules_core/com.smf.securewebservices/web/com.smf.securewebservices/doc/doc.yaml +++ b/modules_core/com.smf.securewebservices/web/com.smf.securewebservices/doc/doc.yaml @@ -132,10 +132,10 @@ paths: - name: distinct in: query required: false - description: Only filters by entities. Returns the specified entity from the model. + description: Specifies that only unique values will be returned of the described entity. schema: type: string - example: Organization + example: organization - name: identifiers in: query required: false From a4eeb92ec9354e7812a2d4babc480591199ddd88 Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 28 Jun 2024 19:54:50 +0200 Subject: [PATCH 20/22] :zap: Update version to 24.2.0 --- build.gradle | 6 +++--- .../src-db/database/sourcedata/AD_MODULE.xml | 6 +++--- src-db/database/sourcedata/AD_MODULE.xml | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index e38bf038..b253a746 100644 --- a/build.gradle +++ b/build.gradle @@ -35,9 +35,9 @@ dependencies { } -final String CURRENT_VERSION = "24.1.8" -final String NEXT_RELEASE = "24.2.0" -final String NEXT_HOTFIX = "24.1.9" +final String CURRENT_VERSION = "24.2.0" +final String NEXT_RELEASE = "24.3.0" +final String NEXT_HOTFIX = "24.2.1" final String DEV_URL = "https://repo.futit.cloud/repository/maven-snapshots/" final String PROD_URL = uri("https://maven.pkg.github.com/etendosoftware/etendo_core/") diff --git a/modules_core/org.openbravo.v3/src-db/database/sourcedata/AD_MODULE.xml b/modules_core/org.openbravo.v3/src-db/database/sourcedata/AD_MODULE.xml index d4213d6c..8f9ac4fb 100644 --- a/modules_core/org.openbravo.v3/src-db/database/sourcedata/AD_MODULE.xml +++ b/modules_core/org.openbravo.v3/src-db/database/sourcedata/AD_MODULE.xml @@ -6,7 +6,7 @@ - + @@ -20,8 +20,8 @@ - - + + diff --git a/src-db/database/sourcedata/AD_MODULE.xml b/src-db/database/sourcedata/AD_MODULE.xml index 4d1dc96e..3b10f358 100644 --- a/src-db/database/sourcedata/AD_MODULE.xml +++ b/src-db/database/sourcedata/AD_MODULE.xml @@ -6,7 +6,7 @@ - + @@ -21,9 +21,9 @@ You may obtain a copy of the License at support@etendo.software or in the legal - + - + From 94eb0ddab58656d790ced1c9c5f3f744af055ff4 Mon Sep 17 00:00:00 2001 From: Matias Bernal Date: Wed, 3 Jul 2024 15:04:42 -0300 Subject: [PATCH 21/22] Issue #397: Fixed aliases in HQL query of DJOBS_CreateFromOrders. EPL-1505: Fixed projection aliases in HQL query of DJOBS_CreateFromOrders table to allow added new fields on query projections. --- .../src-db/database/sourcedata/AD_TABLE.xml | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/modules_core/com.smf.jobs.defaults/src-db/database/sourcedata/AD_TABLE.xml b/modules_core/com.smf.jobs.defaults/src-db/database/sourcedata/AD_TABLE.xml index 759d28f2..c3ee7eda 100644 --- a/modules_core/com.smf.jobs.defaults/src-db/database/sourcedata/AD_TABLE.xml +++ b/modules_core/com.smf.jobs.defaults/src-db/database/sourcedata/AD_TABLE.xml @@ -24,9 +24,9 @@ ic.salesOrder.id, o.name as adorgname, ic.documentType as cdoctypename, -ic.documentNo, +ic.documentNo as documentNo, bp.name as cbpartnername, -ic.orderDate, +ic.orderDate as orderDate, case when @linesIncludeTaxes@ = 'Y' then ic.amountlinesgross else ic.amountlines end as amountlines, case when ic.term = 'N' @@ -36,7 +36,7 @@ case else case when @linesIncludeTaxes@ = 'Y' then ic.notinvoicedlinesgross else ic.notinvoicedlines end end as notinvoicedlines, -ic.term AS TermName, +ic.term as TermName, case when ic.term = 'N' then 0.0 @@ -55,14 +55,14 @@ case then 0.0 else ic.pendinglines end as pendinglines, -ic.orderedQuantity, -ic.deliveredQuantity, -((case when @linesIncludeTaxes@ = 'Y' then ic.amountlinesgross else ic.amountlines end)-(case when @linesIncludeTaxes@ = 'Y' then ic.notinvoicedlinesgross else ic.notinvoicedlines end)) AS linesinvoiced, +ic.orderedQuantity as orderedQuantity, +ic.deliveredQuantity as deliveredQuantity, +((case when @linesIncludeTaxes@ = 'Y' then ic.amountlinesgross else ic.amountlines end)-(case when @linesIncludeTaxes@ = 'Y' then ic.notinvoicedlinesgross else ic.notinvoicedlines end)) as linesinvoiced, ic.amountlinesgross as totalgross, -ic.creationDate, -ic.createdBy, -ic.updated, -ic.updatedBy +ic.creationDate as creationDate, +ic.createdBy as createdBy, +ic.updated as updated, +ic.updatedBy as updatedBy from InvoiceCandidateV ic join ic.salesOrder ord From 61464f2eb0995fc135f6f5f3537549fb93e215c7 Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 5 Jul 2024 21:48:34 +0200 Subject: [PATCH 22/22] :zap: Update version to 24.2.1 --- build.gradle | 4 ++-- .../src-db/database/sourcedata/AD_MODULE.xml | 6 +++--- src-db/database/sourcedata/AD_MODULE.xml | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index b253a746..c2deba66 100644 --- a/build.gradle +++ b/build.gradle @@ -35,9 +35,9 @@ dependencies { } -final String CURRENT_VERSION = "24.2.0" +final String CURRENT_VERSION = "24.2.1" final String NEXT_RELEASE = "24.3.0" -final String NEXT_HOTFIX = "24.2.1" +final String NEXT_HOTFIX = "24.2.2" final String DEV_URL = "https://repo.futit.cloud/repository/maven-snapshots/" final String PROD_URL = uri("https://maven.pkg.github.com/etendosoftware/etendo_core/") diff --git a/modules_core/org.openbravo.v3/src-db/database/sourcedata/AD_MODULE.xml b/modules_core/org.openbravo.v3/src-db/database/sourcedata/AD_MODULE.xml index 8f9ac4fb..eb228976 100644 --- a/modules_core/org.openbravo.v3/src-db/database/sourcedata/AD_MODULE.xml +++ b/modules_core/org.openbravo.v3/src-db/database/sourcedata/AD_MODULE.xml @@ -6,7 +6,7 @@ - + @@ -20,8 +20,8 @@ - - + + diff --git a/src-db/database/sourcedata/AD_MODULE.xml b/src-db/database/sourcedata/AD_MODULE.xml index 3b10f358..5fd0b333 100644 --- a/src-db/database/sourcedata/AD_MODULE.xml +++ b/src-db/database/sourcedata/AD_MODULE.xml @@ -6,7 +6,7 @@ - + @@ -21,9 +21,9 @@ You may obtain a copy of the License at support@etendo.software or in the legal - + - +