Skip to content

Commit aab2aa4

Browse files
authored
Merge branch 'apache:trunk' into OFBIZ-9498
2 parents e2f62d9 + 7341e56 commit aab2aa4

File tree

153 files changed

+3020
-2327
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+3020
-2327
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,9 @@ name: "CodeQL"
2626
on:
2727
push:
2828
branches: [ trunk, release* ]
29-
paths:
30-
- '**.java'
31-
- '**.js'
3229
pull_request:
3330
# The branches below must be a subset of the branches above
3431
branches: [ trunk ]
35-
paths:
36-
- '**.java'
37-
- '**.js'
3832
schedule:
3933
- cron: '27 15 * * 1'
4034

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ runtime/catalina/work/*
1818
runtime/tempfiles/*
1919
runtime/indexes/products/
2020
!runtime/tempfiles/README
21-
applications/content/index/
2221
changelog
2322
.classpath
2423
.project

NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Apache OFBiz
2-
Copyright 2001-2021 The Apache Software Foundation
2+
Copyright 2001-2022 The Apache Software Foundation
33

44
This product includes software developed at
55
The Apache Software Foundation (http://www.apache.org/).

README.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ under the License.
2121
The Apache OFBiz Project
2222

2323
image:https://img.shields.io/badge/License-Apache%202.0-blue.svg[link=http://www.apache.org/licenses/LICENSE-2.0]
24-
image:https://img.shields.io/badge/Version-trunk-blue.svg[link=Version]
25-
image:https://github.com/apache/ofbiz-framework/actions/workflows/gradle.yaml/badge.svg?branch=trunk[link=https://github.com/apache/ofbiz-framework/actions/workflows/gradle.yaml/badge.svg?branch=trunk]
24+
image:https://img.shields.io/badge/Version-trunk-blue.svg[link=https://github.com/apache/ofbiz-framework]
25+
image:https://github.com/apache/ofbiz-framework/actions/workflows/gradle.yaml/badge.svg?branch=trunk[link=https://github.com/apache/ofbiz-framework/actions/workflows/gradle.yaml]
26+
image:https://sonarcloud.io/api/project_badges/measure?project=apache_ofbiz-framework&metric=alert_status[link=https://sonarcloud.io/dashboard?id=apache_ofbiz-framework]
2627
image:https://github.com/apache/ofbiz-framework/actions/workflows/codeql-analysis.yml/badge.svg[link=https://github.com/apache/ofbiz-framework/actions/workflows/codeql-analysis.yml]
27-
image:https://qpkb254zxeu.montastic.io/badge[link=https://qpkb254zxeu.montastic.io]
2828

2929
If you are reading this file in AsciiDoc format you may want to see it at
30-
https://ci.apache.org/projects/ofbiz/site/trunk/readme/html5/README.html[HTML] +
30+
https://nightlies.apache.org/ofbiz/trunk/readme/html5/[HTML]
3131
or https://ci.apache.org/projects/ofbiz/site/trunk/readme/pdf/README.pdf[PDF] format
3232

3333
---

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Trunk
1+
Trunk

applications/accounting/config/AccountingUiLabels.xml

Lines changed: 71 additions & 319 deletions
Large diffs are not rendered by default.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Licensed to the Apache Software Foundation (ASF) under one
4+
or more contributor license agreements. See the NOTICE file
5+
distributed with this work for additional information
6+
regarding copyright ownership. The ASF licenses this file
7+
to you under the Apache License, Version 2.0 (the
8+
"License"); you may not use this file except in compliance
9+
with the License. You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing,
14+
software distributed under the License is distributed on an
15+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
KIND, either express or implied. See the License for the
17+
specific language governing permissions and limitations
18+
under the License.
19+
-->
20+
<entity-engine-xml>
21+
<!--
22+
# what should the default of the payment to invoice processing be?
23+
# paymentProcessing by invoice or paymentprocessing by invoiceitem?
24+
# there is still a box on the menu to change this option by the user.
25+
# value Y: applying payments to the invoice as a whole (invoiceItemSeqNr = null) with the option to apply per invoice item
26+
# value N: applying payments to every invoice item with the option to apply to an invoice as a whole
27+
#value YY: do not show the option box to the user and do only invoice processing
28+
#value NN: do not show the option box to the user and do only invoiceitem processing
29+
-->
30+
<SystemProperty systemResourceId="accounting" systemPropertyId="invoiceProcessing"
31+
systemPropertyValue="YY"
32+
description="Options are: Y, N, YY, NN"
33+
/>
34+
35+
<SystemProperty systemResourceId="accounting" systemPropertyId="accounting.fixedasset.autocreate"
36+
systemPropertyValue="Y"
37+
description="Create a fixed asset when an 'asset usage' type product is created. Options: Y, N"/>
38+
39+
<SystemProperty systemResourceId="accounting" systemPropertyId="accounting.payment.application.autocreate"
40+
systemPropertyValue="Y"
41+
description="Create a payment application when a payment is received/sent or invoice is approved (take the oldest not closed one). Options: Y, N"/>
42+
43+
<SystemProperty systemResourceId="accounting" systemPropertyId="accounting.payment.purchaseorder.autocreate"
44+
systemPropertyValue="Y"
45+
description="Create a 'not-paid' payment record if the purchase order is approved. Options: Y, N"/>
46+
47+
<SystemProperty systemResourceId="accounting" systemPropertyId="accounting.payment.salesorder.autocreate"
48+
systemPropertyValue="Y"
49+
description="Create a 'not-paid' payment record if the sales order is completed and no payment exist yet. Options:: Y, N"/>
50+
51+
<!-- <SystemProperty systemResourceId="accounting" systemPropertyId="create.invoice.per.shipment" systemPropertyValue="Y"
52+
description="create invoice per shipment. Options: = Y (Invoice per shipment), N (Invoice per order)"/> -->
53+
</entity-engine-xml>

applications/accounting/ofbiz-component.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ under the License.
2727
<entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel_reports.xml"/>
2828
<entity-resource type="eca" reader-name="main" loader="main" location="entitydef/eecas.xml"/>
2929
<entity-resource type="data" reader-name="seed" loader="main" location="data/AccountingSecurityPermissionSeedData.xml"/>
30+
<entity-resource type="data" reader-name="seed" loader="main" location="data/AccountingSystemPropertyData.xml"/>
3031
<entity-resource type="data" reader-name="seed" loader="main" location="data/AccountingPortletData.xml"/>
3132
<entity-resource type="data" reader-name="seed-initial" loader="main" location="data/AccountingScheduledServiceData.xml"/>
3233

applications/accounting/servicedef/services_admin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ under the License.
8484
<service name="setAcctgCompany" engine="groovy"
8585
location="component://accounting/groovyScripts/admin/AcctgAdminServices.groovy" invoke="setAcctgCompany" auth="true">
8686
<description>Set Accounting Company when select</description>
87-
<permission-service service-name="acctgPrefPermissionCheck" main-action="CREATE"/>
87+
<permission-service service-name="acctgPrefPermissionCheck" main-action="VIEW"/>
8888
<attribute type="String" mode="INOUT" name="organizationPartyId" optional="true"/>
8989
</service>
9090

applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
import org.apache.commons.collections4.CollectionUtils;
3939
import org.apache.commons.csv.CSVFormat;
40+
import org.apache.commons.csv.CSVFormat.Builder;
4041
import org.apache.commons.csv.CSVRecord;
4142
import org.apache.ofbiz.accounting.payment.PaymentGatewayServices;
4243
import org.apache.ofbiz.accounting.payment.PaymentWorker;
@@ -3310,7 +3311,7 @@ public static Map<String, Object> updatePaymentApplicationDefBd(DispatchContext
33103311
errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingNoAmount", locale));
33113312
} else {
33123313
successMessage = UtilProperties.getMessage(RESOURCE,
3313-
"AccountingApplicationSuccess",
3314+
"AccountingPaymentApplicationSuccess",
33143315
UtilMisc.<String, Object>toMap("amountApplied", amountApplied,
33153316
"paymentId", paymentId,
33163317
"isoCode", currencyUomId,
@@ -3672,16 +3673,16 @@ public static Map<String, Object> importInvoice(DispatchContext dctx, Map<String
36723673
String organizationPartyId = (String) context.get("organizationPartyId");
36733674
String encoding = System.getProperty("file.encoding");
36743675
String csvString = Charset.forName(encoding).decode(fileBytes).toString();
3675-
final BufferedReader csvReader = new BufferedReader(new StringReader(csvString));
3676-
CSVFormat fmt = CSVFormat.DEFAULT.withHeader();
3676+
Builder csvFormatBuilder = Builder.create().setHeader();
3677+
CSVFormat fmt = csvFormatBuilder.build();
36773678
List<String> errMsgs = new LinkedList<>();
36783679
List<String> newErrMsgs;
36793680
String lastInvoiceId = null;
36803681
String currentInvoiceId = null;
36813682
String newInvoiceId = null;
36823683
int invoicesCreated = 0;
36833684

3684-
try {
3685+
try (BufferedReader csvReader = new BufferedReader(new StringReader(csvString))) {
36853686
for (final CSVRecord rec : fmt.parse(csvReader)) {
36863687
currentInvoiceId = rec.get("invoiceId");
36873688
if (lastInvoiceId == null || !currentInvoiceId.equals(lastInvoiceId)) {
@@ -3758,11 +3759,18 @@ public static Map<String, Object> importInvoice(DispatchContext dctx, Map<String
37583759
try {
37593760
invoiceResult = dispatcher.runSync("createInvoice", invoice);
37603761
if (ServiceUtil.isError(invoiceResult)) {
3762+
// Eclipse reports here: Resource leak: '<unassigned Closeable value>' is not closed at this location
3763+
// but it's OK. As csvReader is in a try-with-ressource it will be closed anyway
3764+
// I prefer to not put @SuppressWarnings("resource") to the whole method
3765+
// BTW to be consistent Eclipse should also reports the same issue in PartyService (see there)
37613766
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(invoiceResult));
37623767
}
37633768
} catch (GenericServiceException e) {
3764-
csvReader.close();
37653769
Debug.logError(e, MODULE);
3770+
// Eclipse reports here: Resource leak: '<unassigned Closeable value>' is not closed at this location
3771+
// but it's OK. As csvReader is in a try-with-ressource it will be closed anyway
3772+
// I prefer to not put @SuppressWarnings("resource") to the whole method
3773+
// BTW to be consistent Eclipse should also reports the same issue in PartyService (see there)
37663774
return ServiceUtil.returnError(e.getMessage());
37673775
}
37683776
newInvoiceId = (String) invoiceResult.get("invoiceId");
@@ -3824,10 +3832,13 @@ public static Map<String, Object> importInvoice(DispatchContext dctx, Map<String
38243832
try {
38253833
Map<String, Object> result = dispatcher.runSync("createInvoiceItem", invoiceItem);
38263834
if (ServiceUtil.isError(result)) {
3835+
// Eclipse reports here: Resource leak: '<unassigned Closeable value>' is not closed at this location
3836+
// but it's OK. As csvReader is in a try-with-ressource it will be closed anyway
3837+
// I prefer to not put @SuppressWarnings("resource") to the whole method
3838+
// BTW to be consistent Eclipse should also reports the same issue in PartyService (see there)
38273839
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
38283840
}
38293841
} catch (GenericServiceException e) {
3830-
csvReader.close();
38313842
Debug.logError(e, MODULE);
38323843
return ServiceUtil.returnError(e.getMessage());
38333844
}

0 commit comments

Comments
 (0)