Author SHA1 Message Date
Jacques Le Roux 00896e73bc Fixed: Announce 17.12.09 EOL (OFBIZ-12479)
Includes:
[SECURITY] CVE-2021-44228: Apache Log4j2 (OFBIZ-12449)
[SECURITY] CVE-2021-45105: Apache Log4j2 (OFBIZ-12470)
[SECURITY] Update TIka because of Apache Log4j2 vulnerability (OFBIZ-12474)
[SECURITY] CVE-2021-44832: Apache Log4j2 (OFBIZ-12475)
2022-01-06 14:19:06 +01:00
Jacques Le Roux fb6b508d56 Improved: Migrate Ofbiz bb 0.8 config to 3.2 (OFBIZ-12456)
Comment out the XMLRPC tests. This alone should allow Buildbot 3.2 to run the
integration tests.

Conflict handled by hand
2021-12-16 08:07:08 +01:00
Mathieu Lirzin bdf94f31a1 Fixed: All local XML schema files are now present in classpath, Backport form trunk
(OFBIZ-11132) (OFBIZ-12437)

Previously there was some warnings about missing “.xsd” files that
‘UtilXml#resolveEntity’ failed to find in classpath.  This has been
fixed by declaring all “dtd” directories inside components as resources.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1862346 13f79535-47bb-0310-9956-ffa450edef68
2021-12-12 15:40:17 +01:00
Wiebke Pätzold c5d262aeab Fixed: Builds fail due to unauthorized access to
repo.spring.io/plugins-release (OFBIZ-12351)

Replaces repository syndication by rometools
2021-12-06 11:45:06 +01:00
Jacques Le Roux 208d44e0a3 Fixed: Builds fail due to unauthorized access to repo.spring.io/plugins-release (OFBIZ-12351)
The old demo crashed. I guess this should be OK, let's try...
2021-12-06 09:54:09 +01:00
rohitkouandRohit Koushal e3691d1b21 Fixed: CVE-2021-37608 vulnerability bypass (OFBIZ-12307) (#352)
Fixed the Additional image uploading issue which got somehow missed in service addAdditionalViewForProduct.

Co-authored-by: Rohit Koushal <rohit.koushal39@gmail.com>
2021-11-23 10:40:26 +01:00
Jacques Le Roux dfb702cd9c Fixed: In LookupProduct some categories don't show, only blank lines (OFBIZ-12368)
For now only description is shown. OOTB some categories have no description
We can easily fix that by showing more info. I suggest to add categoryName and
productCategoryId. That should be enough. There are then no blank lines since
productCategoryId always show.

This is anyway customisable by users
2021-11-09 10:05:38 +01:00
Jacques Le Roux 39db98a535 Fixed: RAINBOWSTONE_SAPHIR does not show right on old demo.
I'm unable to test that locally because I get an error with com.sun.syndication
even when using jcenter and 0.9.0. It works on demo I guess because ASF is
authorised.

Anyway, manually turning to Flat Grey on demo works, so here a patch to do that.
2021-11-09 07:53:43 +01:00
Jacques Le Roux 2aca1121ee Fixed: [SECURITY] CVE-2021-42340 Apache Tomcat DoS (OFBIZ-12337)
Upgrades to Apache Tomcat 9.0.54
2021-10-14 19:31:08 +02:00
Jacques Le Roux 7de28070a3 Improved: post-auth Remote Code Execution Vulnerability (OFBIZ-12332)
Prevents an useless inevitable warning by commenting out
RequestWrapper::getParameterNames and with it all the unused methods in
RequestWrapper class

Also better comments CacheFilter::doFilter by giving its real and only goal:
<<to prevent a post-auth security issue described in OFBIZ-12332>>
2021-10-11 09:44:45 +02:00
Jacques Le Roux c859c6f636 Fixed: post-auth Remote Code Execution Vulnerability (OFBIZ-12332)
When I removed service-permission-tests, I forgot to remove associated
load-data-service-permission-tests :/
2021-10-10 17:28:29 +02:00
Jacques Le Roux d960b2b0ca Improved: Refactor methods signature to reduce the number of params they use (OFBIZ-12335)
Fixes a typo about filterConfiguration in CacheFilter.java
2021-10-10 13:36:30 +02:00
Jacques Le Roux 1c93a26ccc Fixed: post-auth Remote Code Execution Vulnerability (OFBIZ-12332)
Removes service-permission-tests accidentally added while handling conflicts by
hand
2021-10-10 13:25:24 +02:00
Jacques Le Roux 006ce17647 Fixed: post-auth Remote Code Execution Vulnerability (OFBIZ-12332)
In previous commit, in CacheFilter::doFilter, I checked "xmlrpc"  when it was
actually "/control/xmlrpc"
2021-10-10 12:19:35 +02:00
Jacques Le Roux b6257b720b Fixed: post-auth Remote Code Execution Vulnerability (OFBIZ-12332)
This definitely solves all issues by introducing a CacheFilter and
RequestWrapper classes inspired by several works found on the Net.
Also moves the change introduced before in ContextFilter to CacheFilter.

The basic problem is that you only can use once
ServletRequest::getInputStream or the ServletRequest::getReader
Also not both, even once, ie they can be seen as same from this POV.

The integration tests all pass.

Also replace the checked String "</serializable>" by "</serializable" as, like
reported by Jie Zhu, the former could be bypassed by using "</serializable >"

Thanks: Jie Zhu for report

# Conflicts handled by hand
  CacheFilter.java
  RequestWrapper.java
2021-10-10 08:14:57 +02:00
Jacques Le Roux fb49563744 Fixed: post-auth Remote Code Execution Vulnerability (OFBIZ-12332)
This definitely solves all issues by introducing a CacheFilter and
RequestWrapper classes inspired by several works found on the Net.
Also moves the change introduced before in ContextFilter to CacheFilter.

The basic problem is that you only can use once
ServletRequest::getInputStream or the ServletRequest::getReader
Also not both, even once, ie they can be seen as same from this POV.

The integration tests all pass.

Also replace the checked String "</serializable>" by "</serializable" as, like
reported by Jie Zhu, the former could be bypassed by using "</serializable >"

Thanks: Jie Zhu for report

Conflicts: ContextFilter.java handled by hand
2021-10-09 20:00:50 +02:00
Jacques Le Roux 7db83d6a53 Improved: post-auth Remote Code Execution Vulnerability (OFBIZ-12332)
Temporarily comments out XMLRPC tests.

I'll work on a definitive solution ASAP

Conflicts handled by hand: framework/service/testdef/servicetests.xml
2021-10-09 08:01:46 +02:00
Jacques Le Roux 8e8ef4c9dc Fixed: post-auth Remote Code Execution Vulnerability (OFBIZ-12332)
Fixes the "eternal" (for R17 and R18 ;) bug about MODULE (trunk) vs module
2021-10-08 19:35:00 +02:00
Jacques Le Roux 15c209a475 Fixed: post-auth Remote Code Execution Vulnerability (OFBIZ-12332)
As reported by Jie Zhu:
<<The latest version of the OFBiz framework (17.12.08) is affected by an
XMLRPC Remote Code Execution Vulnerability.
This vulnerability is caused by incomplete patch repair of cve-2020-9496.>>

Actually this is not an OFBiz bug (so not related to CVE-2020-9496)
but an old XMLRPC bug (Archiva was(/is?)) also affected:
https://nvd.nist.gov/vuln/detail/CVE-2016-5003

Unfortunately XMLRPC is no longer maintained, so it's OFBiz responsibility to
fix this bug.

As the code that secures serialisation in OFBiz is not reached by this bug, the
solution is to secure it at the ContextFilter class level (ie before it reaches
secured serialisation in OFBiz source).

Thanks: Jie Zhu for report and help.
2021-10-08 19:15:21 +02:00
Jacques Le Roux c79321c479 Fixed: Edit record in product promotion, "Promotion Last Modified Date" is invalid, but don't notice to user (OFBIZ-12046)
As Lalit reported it's not really a bug. But an annoying service transformation
of updateProductPromo to entity-auto (I checked using R15.12). Note that
createProductPromo is not affected

I'm not sure other update services using entity-auto are not affected

Thanks: Do Nhu Vy for report, Lalit Dashora  for initial analysis
2021-10-02 13:58:36 +02:00
Gil Portenseigne d02386d2d1 Improved: Create a deny list to reject webshell tokens (OFBIZ-12324)
Improve readability using stream api
Fix deniedWebShellTokens property where some blank space where removed
and '// python' comment was inlined.
2021-09-22 15:08:41 +02:00
Jacques Le Roux 364f4264b0 Improved: Create a deny list to reject webshell tokens (OFBIZ-12324)
Extracts the list of words used in SecuredUpload::isValidText in a
deniedWebShellTokens property in security.properties
2021-09-20 18:15:16 +02:00
Jacques Le Roux 72e2eacef8 Fixed: Groovy Program sandbox bypass (OFBIZ-12305)
This much increases the current security by creating SecuredUpload::isValidText
and call it from ProgramExport.groovy

This said I agree with thiscodecc that a better solution would be to use a
Groovy sandbox, and not only in ProgramExport.groovy.

I had a quick glance at a such solution. Unfortunately as Cédric Champeau reports
at https://melix.github.io/blog/2015/03/sandboxing.html and unlike thiscodecc
suggest there are no "mature solutions on the market".

Nevertheless I'll have a deeper look at an OFBiz specific Groovy sandbox
solution.

Somehow related: I'll also soon extract the list of words used in
SecuredUpload::isValidText in a deniedWebShellWords property in security.properties

Thanks: thiscodecc for report

Conflicts handled by hand
  framework/webtools/groovyScripts/entity/ProgramExport.groovy
2021-09-17 18:49:27 +02:00
Jacques Le Roux 0a49e0addd Fixed: CVE-2021-37608 vulnerability bypass (OFBIZ-12307)
Fixes a number of issues I spotted while working on OFBIZ-12305 in relation with
OFBIZ-12055

The last change I made for OFBIZ-12305 was incomplete, the files could not be
checked by SecuredUpload because they did not exist! This concerns
ImageManagementServices, DataServices, FrameImage and ProductServices classes.
I used Files::createTempFile to fix that.

Also fixes a bug in SecuredUpload where I reversed the check on
fileToCheck.length in Windows case. I also added a comment, Windows 10 now
allows more length (need an OS parameter change though)

Finally, creates public SecuredUpload::isValidText to be used in OFBIZ-12305

Conflicts handled by hand
  DataServices.java
2021-09-17 11:42:06 +02:00
Jacques Le Roux 95ec51ecd1 Fixed: Found a new XXE (XML External Entity Injection) vulnerability in EntityImport (OFBIZ-12304)
Fixes a typo issue
2021-09-13 10:11:02 +02:00
Jacques Le Roux 123f30eb6b Fixed: Found a new XXE (XML External Entity Injection) vulnerability in EntityImport (OFBIZ-12304)
The XXE vulnerability can read arbitrary files on the server.

Thanks: thiscodecc for reporting this security issue (post-auth)
2021-09-13 08:44:43 +02:00
Jacques Le Roux a28316b70d Fixed: Found a new XXE (XML External Entity Injection) vulnerability in EntityImport (OFBIZ-12304)
The XXE vulnerability can read arbitrary files on the server.

Thanks: thiscodecc for reporting this security issue (post-auth)
2021-09-13 08:16:49 +02:00
Jacques Le Roux 7e00617828 Fixed: Found a new XXE (XML External Entity Injection) vulnerability in ArtifactInfo (OFBIZ-12306)
The XXE vulnerability can read arbitrary files on the server.

Thanks: thiscodecc for reporting this security issue (post-auth)
2021-09-13 08:16:47 +02:00
Jacques Le Roux 1b907b06e8 Fixed: CVE-2021-37608 vulnerability bypass (OFBIZ-12307)
Safer completing solution as recommended by weinull orz <weinull@outlook.com>
Previous commit was OK, but better be safe than sorry ;)

Also forgot to commit the DENIEDFILEEXTENSIONS checkstyle change last time

Thanks: weinull orz for the the right suggestion (done 2021-08-13)
2021-09-03 17:18:11 +02:00
Jacques Le Roux dfd71bf7dd Fixed: CVE-2021-37608 vulnerability bypass (OFBIZ-12307)
The fix I did is two folds:
filters extensions (thanks to Zhujie's suggestion of a list of extensions to ban)
deletes bad files at the right place (thanks to thiscodecc's report)

Thanks: thiscodecc for the security report
2021-09-03 13:48:55 +02:00
Jacques Le Roux 3e5d0b73a8 Documented: Changes the link to issue tracker (Jira) to simplify things related to security 2021-09-01 09:55:51 +02:00
Jacques Le Roux 2b17c50ce7 Fixed: SecuredUpload::isValidTextFile wrong check with uppercase (OFBIZ-12301)
In SecuredUpload::isValidTextFile a wrong check is done

Thanks: Zhujie from Ping'an Technology
2021-08-10 13:04:09 +02:00
Nicolas Malin 6271d220b6 Fixed: IndexOutOfBoundsException on Entity Import (OFBIZ-12273)
Backport e4919d16ca from trunk

Removes the localhost (and 127.0.0.1) OOTB.
Allows to use it through a "multi-property" (list) in security.properties.

Conflict handled by hand in security.properties
2021-07-29 17:58:55 +02:00
Jacques Le Roux 8d49af4005 Fixed: Wrong uploaded file checked in Image Management (OFBIZ-12297)
When I secured the uploads with OFBIZ-12080 I made a mistake and checked the
wrong uploaded file in Image Management.
2021-07-29 17:25:41 +02:00
Nicolas Malin 2f5b8d33e3 Fixed: UserLoginHistory failed the store operation with large password (OFBIZ-12287)
Backport 2aa68dc4de from trunk

When you have a user with long password (greater than 256 characters) present in OFBiz and you try to log with, OFBiz return a long error message with sensitive information due to exceeding value size to store on the field UserLoginHistory.passwordUsed.

To solve this we don't return any information on the genericValue that failed and analyze the field passwordUsed to escape the case where the password set to login is create than the database field capacity.

Thanks to Daniel Elkabes <daniel.elkabes@whitesourcesoftware.com> and Hagai Wechsler <hagai.wechsler@whitesourcesoftware.com> from white source software to raise the problem.
2021-07-28 14:42:09 +02:00
Jacques Le Roux 326e0f12a4 Improved: Adds missing ASL2 headers in Rainbow Stone less files 2021-07-27 17:02:41 +02:00
dshunter107 2dda5b7095 Update services_ledger.xml (#315) 2021-07-27 13:06:25 +02:00
Jacques Le Roux 7c3a03c16d Fixed: bug on button from catalog to party associated (OFBIZ-12289)
Problem when trying to access Party linked to Catalog.
When you click on a user associated with a catalog, the framework sends you to
party manager, but it's the currently logged in user that shows up in the
party manager, not the party that you want to see.

To reproduce, just go in the Catalog app, then on Catalogs, add a user to a
catalog, and try to access it via the button.

It comes from the fact that the parameter sent to the party manager via the
link doesn't have the right syntax.

Thanks: Gaetan Chaboussie
2021-07-23 12:56:20 +02:00
Jacques Le Roux d890ebaedc Fixed: Static initialization vectors for encryption (OFBIZ-12281)
(after discussing this on security@ofbiz.apache.org, it was decided to open a
Jira issue for that)

I've noticed that OFBiz Framework sometimes uses static initialization vectors
(IV) while creating a cipher:

https://s.apache.org/vhlbj
https://s.apache.org/nyndk

IVs should be unique and ideally unpredictable to avoid producing the same
ciphertexts for the same plaintexts.

The issues can be fixed with something like the following:

byte[] rawIV = new byte[8];
SecureRandom random = new SecureRandom();
random.nextBytes(rawIV).
IvParameterSpec iv = new IvParameterSpec(rawIV);

jleroux: this prepends the IV in order to decrypt the plaintexts. It's similar
to what has been done for the DesCrypt class. But contrary to the DesCrypt class
I did not test.

Thanks: Artem Smotrakov

Conflicts handled by hand (a lot)
ValueLinkApi.java
2021-07-23 09:29:37 +02:00
Jacques Le Roux 5a069a9991 Fixed: Static initialization vectors for encryption (OFBIZ-12281)
(after discussing this on security@ofbiz.apache.org, it was decided to open a
Jira issue for that)

I've noticed that OFBiz Framework sometimes uses static initialization vectors
(IV) while creating a cipher:

https://s.apache.org/vhlbj
https://s.apache.org/nyndk

IVs should be unique and ideally unpredictable to avoid producing the same
ciphertexts for the same plaintexts.

The issues can be fixed with something like the following:

byte[] rawIV = new byte[8];
SecureRandom random = new SecureRandom();
random.nextBytes(rawIV).
IvParameterSpec iv = new IvParameterSpec(rawIV);

jleroux: we prepend the IV in order to decrypt the plaintexts. I'll do
something similar in ValueLinkApi class ASAP

Thanks: Artem Smotrakov

Conflicts handled by hand:
framework/base/src/main/java/org/apache/ofbiz/base/crypto/DesCrypt.java
2021-07-21 11:11:54 +02:00
Jacques Le Roux 2b15c0302c Fixed: Add http to https redirect rule for ofbiz.apache.org (OFBIZ-10590)
This prevented to run the stable demo
2021-07-20 07:35:11 +02:00
Jacques Le Roux 2e88059bfc Fixed: Upgrades Tomcat from 9.0.43 to 9.0.48 (OFBIZ-12280)
Due to CVEs-2021-30037/30639/30640
2021-07-12 18:52:08 +02:00
Jacques Le Roux 123d9ed67f Fixed: Add TASK_STATUS to `status' field options in EditCalEvent form (OFBIZ-12271)
As WorkEffort entities with type as `Task' and a non-empty `Estimated Start Date'
will be included in calendar page, so TASK_STATUS should be added to EditCalEvent,
to make task status be correctly displayed and updated.

1. Go to page: https://demo-trunk.ofbiz.apache.org/workeffort/control/EditWorkEffort
2. Create a WorkEffort with Type as Task, Status as [Task] Accepted,
   and select Now for Estimated Start Date
3. Go to page: https://demo-trunk.ofbiz.apache.org/workeffort/control/calendar
4. Selected newly added task entry in calender, to show the edit form

In step 4, task status will be shown as In Planning, instead of Accepted.

Thanks: Xin Wang
2021-07-10 12:37:05 +02:00
Jacques Le Roux 0bfd33a274 Fixed: SeoConfigUtil does not maintain char-replace order (OFBIZ-12259)
Thanks: Ingo Wolfmayr for your contribution
2021-06-22 18:28:23 +02:00
Jacques Le Roux e1e7c2a4d3 Fixed: Update PDFBox to 2.0.24 because of CVE-2021-31811 & CVE-2021-31812 (OFBIZ-12256)
CVE-2021-31811: A carefully crafted PDF file can trigger an OutOfMemory-Exception
while loading the file. This issue affects Apache PDFBox version 2.0.23 and prior 2.0.x versions.

CVE-2021-31812: a carefully crafted PDF file can trigger an infinite loop while
loading the file. This issue affects Apache PDFBox version 2.0.23 and prior 2.0.x versions.
2021-06-13 09:16:16 +02:00
Jacques Le Roux f0ee921873 Fixed: Unexpected decoding of url encoded textarea data after submission (OFBIZ-12249)
When trying to add a note to WorkEffort entity, I found that URL encoded
characters are unescaped, which is not expected.

e.g.:
1. Go to page: https://demo-trunk.ofbiz.apache.org/workeffort/control/EditWorkEffortNotes?workEffortId=TASK01
2. Add a note with content: https://example.com/a%20link
3. After submission, it will turned to be: https://example.com/a link

Thanks: Xin Wang for report and exchanges until solution I provided

Conflicts:
  UtilHttp.java:
      removes unused OOTB checkURLforSpiders for simplification
      removes number of cases in setResponseBrowserDefaultSecurityHeaders
      not present in R17
2021-06-09 12:39:37 +02:00
Jacques Le Roux 725c8543e0 Fixed: XSS vulnerability for ListWorkEfforts form (OFBIZ-12254)
If `sanitizer.enable` is turned off, `ListWorkEfforts` form will be vulnerable
to XSS attack, because of incomplete escaping.

Steps to reproduce:

1. Turn off `sanitizer.enable` in owasp.properties
2. Create a WorkEffort entity with name as `<script>alert(1)</script>`
3. Go to page: http://localhost:8080/workeffort/control/FindWorkEffort
4. Search for "Work Effort Name" which contains "script"

Thanks: Xin Wang
2021-06-09 12:28:40 +02:00
Jacques Le Roux 858cd36e90 Fixed: Show WorkEffort names in FindWorkEffort page (OFBIZ-12253)
In FindWorkEffort page, "Work Effort Name" can be specified as search
option, but the result table do not show it.

It would be nice if WorkEffort names can be displayed. Actually,
'workEffortName' has already been added to the description of hyperlink
in 'workEffortId' field, but 'workEffortName' is not presented in
'fieldList', so names are failed to be shown.

Thanks: Xin Wang
2021-06-06 11:52:43 +02:00
Jacques Le Roux 3742e034a7 Fixed: Failed to update work effort child (OFBIZ-12250)
When trying to update child work effort, a SQL error is reported:
Column 'WORK_EFFORT_ID' cannot accept a NULL value.

Steps to reproduce:

1. Open : workeffort/control/ChildWorkEfforts?workEffortId=TASK01&trail=TASK01
2. Select a child work effort
3. Modify the name and click "Save"

related to OFBIZ-753, workEffortId is also duplicated in edit form, If I
comment out workEffortId field of EditWorkEffortAndAssoc, it works properly.

Thanks: Xin Wang for report and Scott for initial workaround in OFBIZ-753
2021-06-05 18:06:56 +02:00
Priya Sharma 14e581ff35 [Fixed] Possibly currency display bug in 'Find Invoices' (OFBIZ-12177) (#302)
- Since the method InvoiceWorker.getInvoiceTotal takes care of the conversion, it is redundant to convert it again on the screen, which results in mismatch of the currency and the amount.

Thanks: Suraj, Jacques, Rajadurai for the review and Andrei Stan for reporting.
2021-05-31 19:03:56 +05:30
wpaetzold 4fd4cfc05a Implemented: Missing service for updateFacilityLocationGeoPoint (#296)
(OFBIZ-12242)

Thanks: Wiebke
2021-05-19 10:04:53 +02:00
Jacques Le Roux 69ce0dffc8 Fixed: Plugin not showing in menu due to permission (OFBIZ-12233)
When creating a plugin via gradle :
./gradlew createPlugin -PpluginId=plugin-test -PpluginResourceName=PluginTest
-PwebappName=plugin-test -PbasePermission=PLUGIN_TEST

and loading all the required data and permissions, the plugin doesn't appear
in the menu.

It comes from the ComponentConfig.java file, L1229, when the permissions gets
trimmed and modified. I tried removing it locally and it fixed the problem.

Thanks: Gaetan Chaboussie
2021-05-17 12:01:09 +02:00
Jacques Le Roux 2c7a414cc2 Fixed: Error page shown when clicking on a product Id in the purchase order page (OFBIZ-12229)
There is no "basePrice" resulting from calculatePurchasePrice service calling but
a simple "price".

This was put in with d04f777 commit and OFBIZ-11955

Thanks: Woyce Batkins for report
2021-05-01 19:10:35 +02:00
Jacques Le Roux 717bd4ba43 Fixed: Secure the uploads (OFBIZ-12080)
Reopened after report of a bug (only on *nix systems) by Shrilesh Korgaonkar.
This fixes the issue

Thanks: Shrilesh Korgaonkar
2021-04-16 09:24:52 +02:00
Jacques Le Roux 564b605d55 Improved: Replace Bintray by a new place to upload the Gradle Wrapper (OFBIZ-12192)
The checksum part was missing in Windows init-gradle-wrapper.ps1 script

I have noticed 2 points:
1. We should use SHA256, not SHA1
2. The unix-like shell script in OFBiz misses checksum verification in case
shasum command is not installed. In other words, if I launch the script it would
fail with "shasum not found, the downloaded files could not be verified".
However, the file will be kept there, so the user could launch unverified jar.

Last point was reported by Vladimir Sitnikov at LEGAL-288
2021-04-10 14:10:43 +02:00
Jacques Le Roux 2ce14c8fe1 Fixed: Service calls of "createPartyContactMech" now include the needed contactMechTypeId (OFBIZ-12175) (#292)
Accidentally removed PartyServices::createRoleType
2021-04-08 13:47:47 +02:00
wpaetzold 7af07c808b Fixed: Error while deleting a Facility because of an existing (#291)
FacilityLocationGeoPoint (OFBIZ-12222)

Adds a service to delete a FacilityLocationGeoPoint
2021-04-08 11:53:12 +02:00
bjugl f089d59389 Fixed: Service calls of "createPartyContactMech" now include the needed contactMechTypeId (OFBIZ-12175) (#292)
This was broken by OFBIZ-8358 where, as well explained at OFBIZ-12175,
"createPartyContactMech Service has been changed to expect an OUT
contactMechTypeId paramter and the call on this end has not been modified."

jleroux: I fixed lines too long
File PartyServices.java
Error Description	Line
La ligne excède 150 caractères (trouvé 178).	2621
La ligne excède 150 caractères (trouvé 178).	2638
La ligne excède 150 caractères (trouvé 191).	2655

Conflicts handled by hand
2021-04-08 11:40:42 +02:00
bjugl 8ef5896077 Fixed: Service calls of "createPartyContactMech" now include the needed contactMechTypeId (OFBIZ-12175) (#292)
This was broken by OFBIZ-8358 where, as well explained at OFBIZ-12175,
"createPartyContactMech Service has been changed to expect an
OUT contactMechTypeId paramter and the call on this end has not been modified."

Conflicts handled by hand in PartyServices.java
I let the changes coming from trunk, too much to revert by hand
2021-04-08 11:28:47 +02:00
Jacques Le Roux 57183eea13 Improved: Improve ObjectInputStream denyList (OFBIZ-12221)
In SafeObjectInputStream.properties
  Renames listOfSafeObjectsForInputStream to allowList and fixes it
  Introduces a denyList

Adapts SafeObjectInputStream class to new denyList

Conflicts handled by hand
  framework/base/config/SafeObjectInputStream.properties
  framework/base/src/main/java/org/apache/ofbiz/base/util/SafeObjectInputStream.java
2021-04-07 09:19:20 +02:00
Jacques Le Roux 27adfed9f0 Improved: Improve ObjectInputStream denyList (OFBIZ-12221)
Prevents generics markup in string type names.

Conflict handled by hand
  framework/base/src/main/java/org/apache/ofbiz/base/util/SafeObjectInputStream.java
2021-04-05 17:05:32 +02:00
Jacques Le Roux 02cd3b33b0 Fixed: updates Tika because of CVE-2021-2865 2021-03-30 17:20:34 +02:00
Jacques Le Roux 1a5bca9190 Improved: Improve UtilObject class (OFBIZ-12216)
This removes the inoffensive but annoying message in log (which does not show in
trunk, see https://github.com/apache/ofbiz-framework/commit/27c9180/

Not the same as in trunk, simply handling with exception Rather than returning
null, also shorten java.rmi.server to java.rmi to block more cases
2021-03-30 12:38:36 +02:00
Aditya Sharma d75ef8212d Fixed: Form to add an employee position doesn't function properly when invoked from Humanres tree (OFBIZ-11684)
Replaced logic to ajaxify the response from EditEmplPosition with navigating user to EditEmplPosition page.
When we are getting the entire page and updating it into the DOM, it would be better if we navigate user to the page.
Issue with the current approach is current page and the EditEmplPosition page both have GlobalActions decorator all the js files in GlobalActions are loaded twice. Either we should ajaxify a section of page or we should navigate user to the EditEmplPosition page.

Thanks Pierre Smits for reporting the issue and Sebastian Berg, Michael Brohl, & Jacques Le Roux for the discussion and efforts
2021-03-30 10:59:19 +05:30
Jacques Le Roux 703a32b41f Improved: Comment out the SOAP and HTTP engines (OFBIZ-12212)
The SOAP and HTTP engines are open doors to security issues.
At https://markmail.org/message/pgtjyh23bazq4s2w I proposed to comment them out
as we did for RMI in the past.
Of cause it must be clearly documented how to use them if needed.

Here is the email content:

    After the recent fix for the CVE-2021-26295[1] we discussed with the security
    team about the opportunity need to comment out the SOAP and HTTP engines
    like we did in the past for RMI[2], this obviously for security reason.

    [1] OFBIZ-12167 "Adds a blacklist (to be
    renamed soon to denylist) in Java serialisation (CVE-2021-26295)"
    [2] OFBIZ-6942 "Comment out RMI related
    code because of the Java deserialization issue [CVE-2016-2170] "

I just put a small comment in webtools controller, it should be enough.

The tests pass
2021-03-29 13:19:49 +02:00
Jacques Le Roux 9510fc9389 Fixed: addImageForProduct fails (OFBIZ-12211)
The addImageForProduct  process is not directly uploading a file but renames it
before.So there is a hyphen, and possibly a pair or parenthesis in case of
duplicate files, added to the file name.

In this commit I have also added the possibility to use underscores and spaces
in the original filename
2021-03-29 11:09:08 +02:00
Jacques Le Roux 7fb8780c97 Fixed: Invalid Currency symbol in income statement csv export (OFBIZ-12108)
1. Navigate to URL: accounting/control/IncomeStatement?organizationPartyId=Company
2. In income statement section click on export as csv button.
3. The exported csv has correct balance but with invalid currency symbol.
4. On screen USD $ symbol is shown and in csv some other currency symbol is shown.

Thanks: Lalit Dashora for report, Praveen Sharma for the fix
2021-03-28 13:31:47 +02:00
Suraj Khurana 921db68bde Fixed: ChangeReason was not being set on OrderStatus when orderItem was marked cancelled with reason.
(OFBIZ-12210)
Thanks Lalit Dashora for reporting the issue and providing the patch.
2021-03-27 16:29:30 +05:30
Jacques Le Roux 6b1d71d91a Fixed: Secure the uploads (OFBIZ-12080)
Fixes an issue reported by 赖涵 <1044309102@qq.com>: "Any file upload and delete
in latest Apache OFBiz"

It was a simple syntax error on my side
2021-03-26 19:15:10 +01:00
Jacques Le Roux c4c3012916 Improved: Secure the uploads (OFBIZ-12080)
Improves the error message for the file name part
2021-03-24 19:12:03 +01:00
Jacques Le Roux ac1595b304 Improved: Update Freemaker to 2.3.31 in R17 and R18 (OFBIZ-12196)
That's for (low) security reason. There are no bugs in R17 and R18 but after
reading about FREEMARKER-124 at
https://freemarker.apache.org/docs/versions_2_3_30.html
I believe we should update update Freemaker to 2.3.31 in R17 and R18
2021-03-22 11:08:54 +01:00
Jacques Le Roux 15bb640a83 Fixed: Upgrade Apache PDFBox to 2.0.23 because of CVE-2021-27807 and CVE-2021-27906 (OFBIZ-12205)
Currently we don't declare any dependency on PDFBox. I guess because it's used
as a 3rd party by another lib. Fortunately it's easily done.
2021-03-21 16:38:52 +01:00
Jacques Le Roux 7933fef9f2 Fixed: EditFinAccountReconciliations does not work (OFBIZ-12198)
Like for createGlReconciliation at OFBIZ-10675 it must be that this has never
been tested nor used by anybody. In relation with OFBIZ-10675, took me hours to
understand that it was only missing an INOUT instead of a simple IN :/
2021-03-18 10:23:55 +01:00
Jacques Le Roux 5b0b80f795 Fixed: createGlReconciliation throws an error (OFBIZ-10675)
https://demo-trunk.ofbiz.apache.org/accounting/control/createGlReconciliation
When entering an amount and submitting the data an error is thrown.

jleroux:
EditFinAccountReconciliation form extends EditGlReconciliation. There
glReconciliationId and reconciledBalance fields are already present.
So adding them in EditFinAccountReconciliation  is wrong. On the other hand the
display of reconciledBalance is better in EditFinAccountReconciliation.
So I moved it there.

Thanks: Pierre Smits for report and Mohammed Rehan Khan for initial patch
2021-03-18 10:23:54 +01:00
Jacques Le Roux 5560130451 Fixed: createGlReconciliation throws an error (OFBIZ-10675)
See accounting/control/EditFinAccountReconciliations?finAccountId=ABN_CHECKING

Removes the unwanted condition to include duplicate reconciledBalance filed
which was the cause of the issue.

Thanks: Pierre Smits for report, Mohammed Rehan Khan for the fix
2021-03-18 10:23:52 +01:00
Pawan Verma af5d61b051 Fixed: Bug preventing proper explosion of BOM containing virtual nodes (OFBIZ-12191)
Thanks: Nameet for report and fix and Jacopo for test.
2021-03-15 13:38:58 +05:30
Pawan Verma 2cf6476a79 Fixed: Error in deleting Financial Account (OFBIZ-12153)
1. Navigate to URL: accounting/control/FindFinAccount
2. Click on Find button. List of fin account will be displayed.
3. Click on delete button near available balance column.

Thanks: Lalit Dashora for report, Sourabh Jain for the initial fix, Jacques for the test.
2021-03-15 13:12:15 +05:30
Jacques Le Roux 4138bf2a34 Fixed: Replace Bintray by a new place to upload the Gradle Wrapper (OFBIZ-12192)
Updates the documentation for Windows and Gradle wrapper download, needs
Powershell
2021-03-14 09:50:06 +01:00
Jacques Le Roux 44cb8dd327 Fixed: Replace Bintray by a new place to upload the Gradle Wrapper (OFBIZ-12192)
Updates init-gradle-wrapper.bat
  to exit if Gradle wrapper already exists
  to start PowerShell (>=7) in admin mode, this to be able to use Set-ItemProperty

Updates init-gradle-wrapper.ps1
 to removes exit if Gradle wrapper already exists
 to create the gradle/wrapper dir if necessary
 to handle the ConstrainedLanguage mode if necessary
2021-03-13 23:13:40 +01:00
Michael Brohl 9c0c43365f Fixed: Replace Bintray by a new place to upload the Gradle Wrapper
(OFBIZ-12192)

Changed Windows powershell script to use the proper Gradle wrapper
version. Removed the properties and batch file download.
2021-03-13 09:16:03 +01:00
Michael Brohl 58f2b14ee8 Fixed: Replace Bintray by a new place to upload the Gradle Wrapper
(OFBIZ-12192)

Changed script to use the proper Gradle wrapper version. Changed the
download url from Bintray to Gradle GitHub repository and removed the
backup link.
2021-03-13 09:14:05 +01:00
Michael Brohl 20e1e1fae7 Improved: Upgrade Gradle to version 4.5.1 for the jcenter to
mavenCentral migration (OFBIZ-12171)
2021-03-13 08:49:41 +01:00
Jacques Le Roux c32abb81d2 Fixed: Use Labels in themes names (OFBIZ-9863)
Fixes wrong C/P done with r1865370
2021-03-12 11:20:40 +01:00
Jacques Le Roux 9dd2a255e9 Fixed: webtools/control/threadList no longer works on trunk (only) (OFBIZ-12195)
It works if we downgrade Freemarker to 2.3.28 as in R18 and even using 2.3.29,
not 2.3.30.

Handles things at the Groovy level, ie put in context, rather than creating
in Freemarker template.

It's backported, even if it's not a pb but in trunk, because it's a (low)
security issue.
2021-03-12 08:59:32 +01:00
Jacques Le Roux 69f00cff78 Revert "Fixed: Error in deleting Financial Account (OFBIZ-12153)"
This reverts commit 2876adf26c.
2021-03-05 06:20:03 +01:00
Jacques Le Roux d93f7ce590 Fixed: When creating blog or forums, it failed to save (OFBIZ-10426)
Create a blog or forum and click save button, it will popup with error message.
The reason is because the mapKey passed from front end cannot be handled by the
service. The solution is not to pass the mapKey to the service.

Steps:

1) navigate to content/control/blogContent?blogContentId=BLOGROOTBIGAL

2) create a new article  content/control/EditBlogArticle?blogContentId=BLOGROOTBIGAL

Thanks: Jason Hao for report and Aman Mishra for the fix
2021-03-02 19:50:09 +01:00
Jacques Le Roux 7756b11421 Fixed: Upgrade Tomcat from 9.0.41 to 9.0.43 (OFBIZ-12165)
Fixes 2 security issues:

CVE-2021-25122 h2c request mix-up
Severity: Important

CVE-2021-25329 Incomplete fix for CVE-2020-9484 (RCE via session persistence)
Severity: Low
2021-03-01 23:21:36 +01:00
Jacques Le Roux 2876adf26c Fixed: Error in deleting Financial Account (OFBIZ-12153)
1. Navigate to URL: accounting/control/FindFinAccount
2. Click on Find button. List of fin account will be displayed.
3. Click on delete button near available balance column.

Thanks: Lalit Dashora for report, Sourabh Jain for the fix
2021-03-01 14:33:27 +01:00
Jacques Le Roux b5cdcd9efc Fixed: fixes testUpdatePartyCreditCard found by Buildbot
Changes all expireDate to 02/2100.
I'll not know if OFBiz will still be alive then, hope you will

All done by hand
2021-02-28 20:17:42 +01:00
Jacques Le Roux 78f09e61ad Fixed: Overlapped labels in Accounting transaction pdf export (OFBIZ-12110)
1. Navigate to URL: accounting/control/FindAcctgTrans
2. Click on search button and then click on export as pdf button
3. Validate the export pdf file, here labels are overlapped in pdf header.

Thanks: Lalit Dashora for report and enehlauri on GH with PR-281 for the fix
2021-02-28 11:34:27 +01:00
Michael Brohl ec4bff76a0 Improved: Switch from jCenter to mavenCentral to handle the jCenter
shutdown (OFBIZ-12171)
2021-02-27 14:43:54 +01:00
Michael Brohl d6c6330b39 Improved: Upgrades Gradle due to the jCenter to mavenCentral migration
(OFBIZ-12171)
2021-02-27 14:43:54 +01:00
Michael Brohl 2b8f4f8b64 Fixed: Corrects wrong API use for Collections and Arrays
edu.emory.mathcs.backport.java.util.* instead of java.util.*
which was spotted during the jCenter to mavenCentral migration.
2021-02-27 14:43:54 +01:00
Jacques Le Roux 392f18f913 Improved: Enlarge the "more-app" menu in Rainbow Stome theme (OFBIZ-12181)
Enlarges #more-app in rainbowstone-main-theme.less from 40 to 200px
2021-02-26 10:31:22 +01:00
Jacques Le Roux 1cf9d9110b Fixed: Error while running MRP (OFBIZ-12187)
I tried running MRP for Sales Forecast option and it returned the following error.

Error running the initMrpEvents service: Service [initMrpEvents] target threw
an unexpected exception (java.sql.Timestamp cannot be cast to java.sql.Date)

Thanks: Nameet Jain

Conflict handled by hand
2021-02-23 13:02:11 +01:00
Jacques Le Roux b06521c356 Fixed: fixes wrong wiki URLs 2021-02-22 11:44:17 +01:00
Jacques Le Roux 26a2be1392 Fixed: Wrong heading on creating quote under order component (OFBIZ-11221)
Steps to re-generate :

1. Login with the username and password.
2. Go to order component order.
3. Click on Quotes
4. Click on new quotes

Error: Edit quote is shown on the place of New quote.
Actual: New quote should be shown on the place of edit quote on UI.

Thanks: jai kumar raghuwanshi for report, Pradyum Dharwa  for 1st patch,
Ratnesh Upadhyay for better suggestion and Ankit Joshi for the patch
2021-02-20 13:29:21 +01:00
Jacques Le Roux a0b2f55b40 Fixed: Bypass Java GString to String conversion in ObjectType::simpleTypeOrObjectConvert (OFBIZ-12182)
Follows https://markmail.org/message/azn7e4g2rbpo7tvj

Conflicts handled by hand
 framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java
2021-02-19 09:38:50 +01:00
Wiebke Pätzold 7add713a10 Fixed: Financial account transaction (OFBIZ-10308)
Fixes the direction of some accounting transactions.

Thanks Ingo Wolfmayr for the patch
2021-02-15 19:50:21 +01:00
Michael Brohl 315bdea44b Fixed: Unable to add product (of ASSET_USAGE type) in order
(OFBIZ-10791)

The patch was manually applied due to conflicts/renamed ressources.

Thanks Priya Sharma for providing the patch.
2021-02-15 18:23:03 +01:00
Jacques Le Roux a1e495de19 Fixed: issue put in with r1160964 (9 years, 5 months ago)
Fixes a syntax issue spotted while testing FreeMarker 2.3.31
2021-02-13 18:08:33 +01:00
Jacques Le Roux 4a26aecbf5 Fixed: Use from-field pattern instead of value=${***} pattern in 'set' element (OFBIZ-9607)
Fixes a syntax issue spotted while testing FreeMarker 2.3.31
2021-02-13 18:08:32 +01:00
Suraj Khurana a5e96763e4 Fixed: ViewQuoteProfit shows fields in wrong order.
(OFBIZ-11680)
Thanks Pierre for reporting and Lalit Dashora for providing the patch.
2021-02-12 11:12:17 +05:30
Jacques Le Roux 00200bfaca Fixed: Adds a blacklist (to be renamed soon to denylist) in Java serialisation (OFBIZ-12167)
Adds an example based on RMI which is known to be a problem
2021-02-09 09:59:17 +01:00
Jacques Le Roux bbc63bc470 Fixed: Ampersand in Party not displayed correctly (OFBIZ-12140)
In the reported case, ModelFormField::getDescription double HTML encodes the
description when both the entity and the description contain an ampersand.

A solution is to test if the description is already HTML encoded before encoding
it again. If HTML encoded then only String encodes it.

BTW I'm not sure it's useful but it's harmless, the same solution can be applied
to OFBIZ-12026 and similarly in renderableFtlFormElementsBuilder::encode. I'll
do as improvements...

Thanks: Andrew Waters for report and help in analysis
2021-01-23 17:50:03 +01:00
Jacques Le Roux e1d57fba00 Fixed: Creating a new Customer create a wrong record in CommunicationEvent (OFBIZ-12142)
In https://markmail.org/message/pf3d3qyjfucicbj7 I initially answered:
In demo data 13 parties use <<infoString="ofbiztest@example.com">> as in
<ContactMech contactMechId="FRA01" contactMechTypeId="EMAIL_ADDRESS" infoString="ofbiztest@example.com"/>
This one is loaded last. Rather
<ContactMech contactMechId="Company" contactMechTypeId="EMAIL_ADDRESS" infoString="ofbiztest@example.com"/>
which is the 1st one, should be loaded last.

A better solution is to use "ofbizsupport@example.com" in EmailServices.xml

Indeed, fortunately the Company party also uses this infoString and using it in
EmailServices.xml does not affect the integration test and should not affect
other parts of the (only) demo data

Thanks: Emad Radwan for opiniated report :) and Pritam Kute for issue analysis
2021-01-18 20:14:44 +01:00
Deepak Dixit 24d9328cdf Fix: Corrected the tika-parsers dependency version, also remove redundant entry for tika-core. This should fix the build failure (OFBIZ-12100) (#248)
Thanks Alexander Tzvetanov for reporting the issue
2020-12-31 15:59:28 +05:30
Jacques Le Roux 2d15771d56 Fixed: partymgr fails to upload image (OFBIZ-12101)
This is a bug due to OFBIZ-12080, fileToCheck is the complete name of the file
with path not the filename

Thanks: Wai for report
2020-12-26 09:08:04 +01:00
Jacques Le Roux d13264b584 Improved: Remove hardcoded product category on CategoryWorker.getCatalogTopCategory (OFBIZ-12078)
When you call the java function
org.apache.ofbiz.product.category.CategoryWorker.getCatalogTopCategory()
the catalog returned if the system failed found it is hardcoded and don't use an
existing property : catalog->top.category.default

Thanks: Nicolas

Conflicts handled by hand:
applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java
2020-12-25 17:04:59 +01:00
Jacques Le Roux aa4791f120 Fixed: Unique form names for promo actions (OFBIZ-12082)
Creating a promo with multiple rules and actions results in an exception.

It's reproducible by creating a promo with 1 rule and more than 1 Action and
specifying different products for each Action. When creating the second Action
and trying to specify another product to included the ajax request LookupProduct
will fail because it included both product ids in its xhr request.

Thanks: Danny Trunk
2020-12-25 16:18:37 +01:00
Jacques Le Roux e87747dcb9 Fixed: Issue in creating promotion action (OFBIZ-11168)
The issue reported there was fixed with OFBIZ-11058.

But there was still an issue in logI reported in a comment.

The problem was that
<#assign productPromoActionCurEnum = productPromoAction.getRelatedOne("ActionEnumeration", true)>
was used in 2 places where it should not have been because it returned a null
value that can't be handled by OFBiz.

Better use
<#assign productPromoActionCustomMethod = productPromoAction.getRelatedOne("CustomMethod", true)>
and
productPromoAction.getRelatedOne("ActionEnumeration", true))??

The repercussion was that the description was not used but the Id and the log
was showing an error.

Conflicts handled by hand:
applications/product/template/promo/EditProductPromoRules.ftl
2020-12-25 16:12:24 +01:00
Jacques Le Roux 3982f8d526 Fixed: Make ruleName field in PriceForms.xml#AddPriceRules safe (OFBIZ-12098)
I noticed an issue due to entity-auto. Unlike with a standard service you can't
protect fields using allow-html="safe" except by overriding fields. So in case
this must be done one by one...

An example is ruleName field in PriceForms.xml#AddPriceRules with
createProductPriceRule and updateProductPriceRule services

This fixes this only case...
Also removes trailing blanks and only that (by IDE setting)

Conflicts handled by hand
applications/product/servicedef/services_pricepromo.xml
2020-12-20 11:07:27 +01:00
Jacques Le Roux 540f5c80cd Fixed: Post-auth XSS vulnerability at catalog/control/EditProductPromo (OFBIZ-12096)
Prevents issues with integration tests

Conflicts handled by hand:
framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java
2020-12-19 20:45:40 +01:00
Jacques Le Roux 637e02978c Fixed: Post-auth XSS vulnerability at catalog/control/EditProductPromo (OFBIZ-12096)
We missed to unescape EcmaScript encoded strings in
UtilCoded::checkStringForHtmlSafe, ie in all form fields using allow-html="safe"

Thanks: 牛治 <niu.zhi@zte.com.cn> for report

Conflicts handled by hand => no functional changes in code (ude to IDE setting)
framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java
2020-12-19 18:20:45 +01:00
Jacques Le Roux 363e0be770 Fixed: Secure the uploads (OFBIZ-12080)
According to https://s.apache.org/rpzog, adds few, maybe redundant, Java
API/methods found in webshell, or alike, source code
2020-12-14 19:01:31 +01:00
Jacques Le Roux ba6470b9ea Fixed: Secure the uploads (OFBIZ-12080)
Follows OWASP advice on file names:

All the control characters and Unicode ones should be removed from the filenames
and their extensions without any exception. Also, the special characters such as
“;”, “:”, “>”, “<”, “/” ,”\”, additional “.”, “*”, “%”, “$”, and so on should be
discarded as well.

If it is applicable and there is no need to have Unicode characters, it is
highly recommended to only accept Alpha-Numeric characters and only 1 dot as an
input for the file name and the extension; in which the file name and also the
extension should not be empty at all
(regular expression: [a-zA-Z0-9]{1,200}.[a-zA-Z0-9]{1,10}).

So if someone needs other chars in uploaded filenames a change will be needed
2020-12-14 16:52:00 +01:00
Jacques Le Roux 00d875251c Fixed: Secure the uploads (OFBIZ-12080)
Prevents too long filenames as recommended by OWASP.

Based on https://security.stackexchange.com/questions/46484/denial-of-service-when-uploading-a-file#answer-46495
I decided to not limit sizes of files. Anyway we know it's only post-auth...
2020-12-14 12:48:49 +01:00
Jacques Le Roux 71ff63a043 Improved: Gradle logging hygiene (OFBIZ-12085)
Some times ago, we were forced to stop and quickly restart the demos because of
the Gradle daemons logging taking all the place; though we don't use Gradle
daemons in demos. Weird isn't ?

The reason is that by default org.gradle.logging.level=lifecycle is verbose.
Anyway, all org.gradle.logging.level are verbose. I mean they also duplicate
OFBiz information, have a look into your own Gradle daemon dir!

And that even if you don't use daemons, as we do for demos. Because Gradle
always uses at least 1 daemon to run.

So I was looking for a solution to not uselessly clutter the VM disk demos and
stumbled upon <<Gradle logging hygiene - Issue #2688>> - gradle/gradle (github.com)

This uses Evgeny Naumenko's solution at
https://discuss.gradle.org/t/gradle-daemon-produces-a-lot-of-logs/9905

I backport because it's needed by demos

# Conflicts:
#	build.gradle

# Conflicts:
#	build.gradle
2020-12-11 18:01:29 +01:00
Jacques Le Roux ce2f66b720 Fixed: Hyperlink title under form widget doesn't support character encoding for special characters (OFBIZ-12026)
When we use any title with special characters for hyperlink tag, it shows broken
string on UI, eg:
<hyperlink description="${uiLabelMap.CommonImportExport}"  target="ImportExport">
should render a button with the title "Import/Export. But it shows as
Import&#x2f;Export

jleroux: I have noticed that the same happens with special French characters.
So it's a general issue.
The title (description in code) is HTML encoded and that does not work for
special characters. I simply used a string encoder.

Thanks: Pradeep Choudhary for report, Sourabh Jain for a possible but not
general solution at OFBIZ-12023, ie using target-type="plain"
2020-12-11 13:43:15 +01:00
Jacques Le Roux aaed04d7c8 Fixed: Label issue on List Companies page (OFBIZ-12023)
Navigate to URL: 'accounting/control/ListCompanies'
Under the companies list, the 2nd column has button for account
The System is not showing proper label in French.

This issue is occurring due to the hyperlink title is not supporting character
encoding for special characters. Please track progress under OFBIZ-12026.
2020-12-08 09:39:30 +01:00
Jacques Le Roux 13001ee048 Fixed: Secure the uploads (OFBIZ-12080)
module should be MODULE in SecuredUpload class

Improves: add adio adn video to supported file formats in security.properties

# Conflicts handled by hand
#	framework/security/config/security.properties
2020-12-07 19:46:11 +01:00
Jacques Le Roux e50ad56bb9 Improved: Adds the HTML <input> accept Attribute in form widgets and Freemaker templates (OFBIZ-12049)
As explained at
https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept
this is only an help for the users (ie not a security feature), but an
appreciable one easy to implement.

Here we start with website/WebSiteCMSContent.ftl
Also add some missing file extensions
2020-12-07 18:34:45 +01:00
Jacques Le Roux 7ff8fb814e Fixed: Secure the uploads (OFBIZ-12080)
Handles audio and video formats supported by Tika.

Adds few new audio and video formats in seed data.

AFAIK there are no ways to embed a webshell in an audio or video file. So I did
not sophisticate the validation, just rely on Tika.

I have also fixed bugs in SecuredUpload: in isValidSvgFile and
isValidImageIncludingSvgFile
2020-12-07 15:11:21 +01:00
Jacques Le Roux dc57528fd4 Fixed: Secure the uploads (OFBIZ-12080)
Improves the labels names and format comment in LayoutEvents.java

I backport to ease later works...
2020-12-06 11:18:26 +01:00
Jacques Le Roux 57c15f615d Fixed: Secure the uploads (OFBIZ-12080)
Replaces RESOURCE by resource, doh!
2020-12-06 11:11:07 +01:00
Jacques Le Roux 9d3631e278 Fixed: Secure the uploads (OFBIZ-12080)
validateUploadedFile() fixes another case reported in August by Harshit

Conflicts handled by hand
applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java
2020-12-06 10:20:21 +01:00
Jacques Le Roux 983f4b95ae Fixed: Secure the uploads (OFBIZ-12080)
org.apache.xmlgraphics:batik:1.13 does not include batik-svg-dom it's in
batik:batik-svg-dom:1.6-1.

It's also in org.eclipse.birt.runtime:viewservlets:4.5.0 that's why it worked
only with plugins
2020-12-02 10:04:05 +01:00
Jacques Le Roux f741bb2277 Fixed: Secure the uploads (OFBIZ-12080)
2020/08/10 the OFBiz security team received a security report by Harshit Shukla
<harshit.shukz@gmail.com>, roughly it was (quoting part of it to simplify):

<<I have identified a Remote Code Execution (RCE) Vulnerability. The reason
behind this RCE is lack of file extension check at
catalog/control/UploadCategoryImage?productCategoryId=CATALOG1_BEST_SELL&pload_file_type=category>>

Using this post-auth RCE in OFBiz demos, Harshit was able to get some AWS
credentials by uploading a webshell (based on [0]).
By security, it was then decided by the Infra and OFBiz security teams to shut
down the demos.

After discussing the elements reported with Mark J Cox (VP of ASF security team)
we in common decided that no CVE was necessary.

# Conflicts handled by hand in R18:
#	applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java
#	applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java
#	applications/product/groovyScripts/catalog/category/EditCategory.groovy
#	applications/product/groovyScripts/catalog/config/EditProductConfigItemContent.groovy
#	applications/product/groovyScripts/catalog/imagemanagement/ImageUpload.groovy
#	applications/product/groovyScripts/catalog/imagemanagement/SetDefaultImage.groovy
#	applications/product/groovyScripts/catalog/product/EditProductContent.groovy
#	applications/product/src/main/java/org/apache/ofbiz/product/image/ScaleImage.java
#	applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/FrameImage.java
#	applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java
#	applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java
#	build.gradle
#	framework/base/src/main/java/org/apache/ofbiz/base/util/FileUtil.java
#	framework/base/src/main/java/org/apache/ofbiz/base/util/HttpRequestFileUpload.java
#	framework/base/src/main/java/org/apache/ofbiz/base/util/template/FreeMarkerWorker.java
#	framework/security/config/security.properties

# Conflicts handled by hand in R17:
#	applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java
#	applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java
#	applications/datamodel/data/seed/ContentSeedData.xml
#	build.gradle
#	framework/base/src/main/java/org/apache/ofbiz/base/util/HttpRequestFileUpload.java
2020-12-01 10:14:48 +01:00
Jacques Le Roux f6176dba99 Fixed: Label issue on List Companies page (OFBIZ-12023)
Navigate to URL: 'accounting/control/ListCompanies'
Under the companies list, the last column has button for import export.
The System is not showing proper label.

This issue is occurring due to the hyperlink title is not supporting character
encoding for special characters. Please track progress under OFBIZ-12026.

Thanks: Lalit Dashora for report, sourabh jain for patch, Daniel Watford for test
2020-11-30 12:03:17 +01:00
Girish Vasmatkar 2a30d57118 Fixed: Discouraged use of variable to store command with paramaters because of wordsplitting issue
and instead used complete command for wget .(OFBIZ-12066)
2020-11-30 16:26:41 +05:30
Saurabh Dixit 91de16a55c Fixed: Single product tile is displayed on one row in product search. (OFBIZ-12045) (#245)
Cause: Wrong use of bootstrap grid classes.
Fix: Used row class as a parent to col-* class while rendering the products.
2020-11-30 11:40:43 +01:00
Jacques Le Roux e1cfe58828 Fixed: Edit button(s) are shown for shipments received or shipped (OFBIZ-11788)
When a shipment has been received (purchase) or shipped (sales), the shipment
process should be concluded. And thus the shipment should not be editable anymore.

Thanks: Pierre Smits for report, Ankit Joshi for patch
2020-11-29 20:43:10 +01:00
Girish Vasmatkar cc8ee48154 Fixed: Used correct syntax to conctenate bash variable and string such that wgent command runs properly.(OFBIZ-12066) 2020-11-28 15:05:26 +05:30
Deepak Dixit 1f965ca30d Improved: Update IND Geo data as per 2020-11-24 notification (#243)
- Deletion of Union territory IN-DD, IN-DN;
- Addition of Union territory IN-DH;
- Correction of spelling for IN-AR, IN-BR, IN-CH, IN-CT, IN-DH, IN-GJ, IN-HP, IN-HR, IN-JH, IN-JK, IN-KA, IN-LA, IN-MH, IN-ML, IN-NL, IN-RJ, IN-TG, IN-TN, IN-UT;
2020-11-28 12:43:34 +05:30
Jacques Le Roux 9b45ab7aff Reverted: Replace java.io.File::renameTo by java.nio.file.Files::move (OFBIZ-12063)
This reverts commit 1be480b68c.

Actually the problem was due to another WIP where 2 streams were not closed
2020-11-27 11:53:30 +01:00
Jacques Le Roux 7400899b58 Reverted: Replace java.io.File::renameTo by java.nio.file.Files::move (OFBIZ-12063)
This reverts commit 2c86f9a8c0.

Actually the problem was due to another WIP where 2 streams were not closed
2020-11-27 11:51:25 +01:00
Jacques Le Roux ce0b8903ea Fixed: Replace java.io.File::renameTo by java.nio.file.Files::move (OFBIZ-12063)
On Windows in EditProductContent.groovy neither file.renameTo(), Files.move()
nor FileUtils.moveFile works. Copy and delete works.
2020-11-27 10:23:39 +01:00
Jacques Le Roux f6450a01c5 Fixed: Replace java.io.File::renameTo by java.nio.file.Files::move (OFBIZ-12063)
This is a bug because the behaviour is not assured on Windows for instance. So
it's impossible to correctly develop and test.

As explained at
https://docs.oracle.com/javase/8/docs/api/java/io/File.html#renameTo-java.io.File-

<<Many aspects of the behavior of this method are inherently platform-dependent:
The rename operation might not be able to move a file from one filesystem to
another, it might not be atomic, and it might not succeed if a file with the
destination abstract pathname already exists. The return value should always be
checked to make sure that the rename operation was successful.
Note that the Files class defines the move method to move or rename a file in a
platform independent manner.>>

So the expression
  file.renameTo(file1)
used in 5 Application Product Groovy scripts can be easily replaced by
  Path source = file.toPath()
  Files.move(source, source.resolveSibling(filenameToUse))
that is working on all platforms as explained at
https://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html#
move-java.nio.file.Path-java.nio.file.Path-java.nio.file.CopyOption...-
2020-11-24 18:40:47 +01:00
Jacques Le Roux 008246bf7b Fixed: .sh missing in <<Unix-like OS: ./gradle/init-gradle-wrapper>>
My bad :/

Thanks: Tuck Seng Phoon
2020-11-20 17:39:13 +01:00
Jacques Le Roux 28a6d4391a Fixed: Prevent arbitary file write using webtools/control/EntitySQLProcessor. (OFBIZ-12057)
Shuibo Ye <shuiboye@gmail.com> reported a possible arbitary file write using
webtools/control/EntitySQLProcessor.

    In the "SQL Command" part, I create a table and insert some strings and
    export the table to a file one sentence at a time.
    PoC: CREATE TABLE "test" (string VARCHAR(80))
    INSERT INTO "test" (string) VALUES ('<%= system.getProperty("user.dir") %>')
    call SYSCS_UTIL.SYSCS_EXPORT_TABLE(null,'test','.\framework\webtools\webapp\webtools\default.jsp',null,'*',null)

    After executing the three sentences,I successfully write the file and its url
    is https://localhost:8443/webtools/default.jsp.

I fixed it preventing execution on SYSCS_UTIL.SYSCS_EXPORT_TABLE and JSP, more
could be added if necessary
2020-11-16 14:09:16 +01:00
Jacques Le Roux 6bf785654a Improved: Prevent possible post-auth RCE from webtools/control/ProgramExport (OFBIZ-12055)
This was reported to the security team by Shuibo Ye <shuiboye@gmail.com>.
We did not create a CVE because it's a post-auth "vulnerability"

Thanks: Shuibo Ye
2020-11-14 11:57:15 +01:00
Jacques Le Roux 4925d81d07 Fixed: Handle special characters like single quote in Freemarker template (prevent encoding) (OFBIZ-12029)
A such case was reported by Amit Gadaley at
https://markmail.org/message/ybyjkngdiwrywut6
The solution is to use StringUtil.wrapString() to prevent encoding.
2020-11-10 11:10:57 +01:00
Jacques Le Roux 6dc266996e Fixed: NotSerializableException using uploadPartyContentFile service (OFBIZ-12050)
This error appears after trying to upload a file to party content:

2020-11-06 07:48:22,488 |jsse-nio-8443-exec-7 |RequestHandler                |I|
Sending redirect to:
[https://localhost:8443/partymgr/control/viewprofile?partyId=admin].
2020-11-06 07:48:29,288 |jsse-nio-8443-exec-7 |UtilObject                    |E|
null
java.io.NotSerializableException: org.apache.commons.fileupload.disk.DiskFileItem

# Conflicts handled by hand
#	framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java
#	framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java
2020-11-06 11:23:27 +01:00
Jacques Le Roux 69828b37ad Fixed: Sorting of lists generates undesired results (OFBIZ-8302)
For this issue (OFBIZ-8302) I reverted the point 1 of
http://svn.apache.org/viewvc?view=revision&revision=1759555

As reported by Alvaro Munoz from GH security team it's not sufficient:
<<the second part of the fix was not effective, since the attacker can close the
raw string context with a double quote and write a new attribute or even close
the macro tag and write arbitrary FreeMarker code.>>

So this removes the 2nd part and add better solution to fix the OFBIZ-8302 issue
The solution is to encode only the QueryString and to handle it correctly in
UtilHttp::getParameterMap. I must say it was not a sinecure!

# Conflicts:
#	framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java
#	framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java
2020-10-31 20:01:35 +01:00
Jacques Le Roux 8640250331 Fixed: variant product selection trashes image (OFBIZ-12019)
The variant products' images are being saved in the variable IMG encoded as urls,
thus selecting the variant triggers an image override with an unsuitable file name.

Thanks: Alex Bodnaru
2020-10-06 15:20:15 +02:00
holivier 726ebe8493 fixed: svg files not removed on clean (OFBIZ-11976)
Backport build.gradle correction from OFBIZ-12035, correction in generateAllPluginsDocumentation to put copy of OFBiz-Logo in doFirst to avoid it's run during gradle Configure project
2020-10-02 19:00:18 +02:00
holivier 85db312077 Improvement: Error messages when generating HTML and PDF file from AsciiDoc files (OFBIZ-11893)
minor correction, title level
2020-10-02 18:05:28 +02:00
holivier 744fa72316 Improvement: Error messages when generating HTML and PDF file from AsciiDoc files (OFBIZ-11893)
remove sy-impersonation.adoc because impersonation is not implemented in 17.12
2020-10-02 18:04:39 +02:00
Suraj Khurana f1e8ea734f Fixed: Incorrect data issue for InvoiceItemTypeMap and ReturnItemTypeMap.
(OFBIZ-11971)
As we have returnItemTypeId as RET_MISC_ADJ, same should be used in ReturnItemTypeMap and corresponding InvoiceItemTypeMap.
Thanks Amit Gadaley for reporting and providing the patch.
2020-09-26 18:26:00 +05:30
Jacques Le Roux faadf5a622 Improved: fixes the executionpolicy for last update of Windows 10
Thanks: Georg Potthast for report on user ML
2020-09-26 09:56:27 +02:00
Jacques Le Roux a353cda8b6 Fixed: Error while decoding url parameters with percent character (OFBIZ-12014)
This has been already fixed (an clearly explained) in OFBIZ-10275 and broken
again in OFBIZ-11822

Thanks: Pradeep Choudhary
2020-09-14 11:19:24 +02:00
Jacques Le Roux 8622a761e0 Fixed: display/selection of unit of measure is broken (OFBIZ-11955)
Improve code for UOM dropdown of products like WG-9943

Thanks: Alex

Conflicts handled by hand in ProductDetail.ftl
2020-09-11 11:04:39 +02:00
Akash Jain 4de58fc206 Fixed: Display/functionality improvement in findParty of OOTB regarding classification group (OFBIZ-10302)
Thanks, Rajesh Kumar Mallah for report.
2020-09-01 15:40:36 +05:30
Jacques Le Roux 26075f06a8 Fixed: display/selection of unit of measure is broken (OFBIZ-11955)
Fixes UOM dropdown for products like WG-9943

Thanks: Alex
2020-08-31 10:45:36 +02:00
Jacques Le Roux f83be8652e Fixed: display/selection of unit of measure is broken
(OFBIZ-11955)

This fixes in in order component

Thanks: Alex

Conflict handled by hand in ProductSummary.ftl
2020-08-30 14:11:41 +02:00
Jacques Le Roux 8390abb855 Documented: warns users about demo credentials in production 2020-08-29 10:09:26 +02:00
Akash Jain fddc3ac8c1 Fixed: Default value flags not working for configurable and variant products at the time of order entry (OFBIZ-10532)
Thanks, Deepak Nigam for report.
2020-08-27 18:20:14 +05:30
Jacques Le Roux dcfa5495ad Improved: removes a nonsense word left during a C/P 2020-08-27 09:31:00 +02:00
Jacques Le Roux 3cfed4c657 Fixed: MessagingException in sendShipmentScheduledNotification service (OFBIZ-11984)
This MessagingException issue is with sendFrom, please refer the the code blocks from minilang and groovy versions below,

<!-- find email address for currently logged in user, set as sendFrom -->
<entity-and entity-name="PartyAndContactMech" list="curUserPartyAndContactMechs">
    <field-map field-name="partyId" from-field="userLogin.partyId"/>
    <field-map field-name="contactMechTypeId" value="EMAIL_ADDRESS"/>
</entity-and>

<first-from-list list="curUserPartyAndContactMechs" entry="curUserPartyAndContactMech"/>
<string-append field="sendEmailMap.sendFrom" string="${curUserPartyAndContactMech.infoString}" prefix=","/>

There should not be a prefix, there is always only 1 sender
sendOrderDeliveryScheduleNotification was also affected

Thanks: Mridul Pathak for analyse
2020-08-26 19:53:08 +02:00
Jacques Le Roux 977d2afb0f Improved: svg files not removed on clean (OFBIZ-11976)
After removing the temporary diles in generateAllPluginsDocumentation
this removes them also in generatePluginDocumentation.

Despite that they still appear after simply running gradlew ofbiz (without any
change), I mean:
ofbiz-framework\plugins\birt\src\docs\asciidoc\images\OFBiz-Logo.svg
ofbiz-framework\plugins\ebay\src\docs\asciidoc\images\OFBiz-Logo.svg
ofbiz-framework\plugins\ldap\src\docs\asciidoc\images\OFBiz-Logo.svg
ofbiz-framework\plugins\myportal\src\docs\asciidoc\images\OFBiz-Logo.svg
ofbiz-framework\plugins\projectmgr\src\docs\asciidoc\images\OFBiz-Logo.svg
ofbiz-framework\plugins\solr\src\docs\asciidoc\images\OFBiz-Logo.svg

I have no ideas why :/
2020-08-25 15:06:10 +02:00
Jacques Le Roux 31a3a75938 Fixed: svg files not removed on clean (OFBIZ-11976)
Files like birt/src/docs/asciidoc/images/OFBiz-Logo.svg, in many plugins,
don't get removed on clean.

I simply missed to clean them in pluginAsciidoc Gradle task (OFBIZ-10677)

Thanks: Alex Bodnaru for report
2020-08-23 17:42:52 +02:00
Jacques Le Roux 5ebc88d213 Fixed: Bug in order manager main page when using Arab language (OFBIZ-9687)
It seems that we are getting the issue due to the special character "/" which is
present in OrderManager Uilabel.
I just changed the OrderManager Uilabel value from Buy / Sell Order Manager to
Order Manager and removed the special character "/".

Thanks: Mohammed Rehan Khan
2020-08-22 18:13:37 +02:00
Jacques Le Roux b9b22a56c7 Improved: Add a title to Javadoc overview (OFBIZ-11950)
We can add a global version heading using the Gradle title Javadoc option:
https://docs.gradle.org/current/dsl/org.gradle.api.tasks.javadoc.Javadoc.html

Relates to https://markmail.org/message/t3svau3udlwaa7mq
2020-08-12 15:50:57 +02:00
Akash Jain 09a4b32ec2 Fixed: View Image button on order view page fails to render the image (OFBIZ-11734)
Thanks, Arpit Mor for reporting.
2020-08-04 16:05:44 +05:30
Jacques Le Roux 9a0bda00f8 Fixed: Server-Side Template Injection using Static (OFBIZ-11871)
Thanks to Alvaro's explanations, the problem was in MacroFormRenderer where, for
lookups, we retrieve _LAST_VIEW_NAME_ as a parameter without encoding it.

Got hard conflicts, all done by hand.

Thanks: Alvaro for advice
2020-08-03 10:43:56 +02:00
Jacques Le Roux 9058351d1f Improved: changes content of VERSION file added during INFRA-19443 2020-07-29 11:49:15 +02:00
Jacques Le Roux 084eb85c0b Improved: removes VERSION file added during INFRA-19443 2020-07-29 11:35:52 +02:00
Jacques Le Roux 95d3aadcb5 Fixed: Inconsistent String Comparisons (OFBIZ-9254) & Uploading image to data resource (OFBIZ-10834)
Changes made in startsWith and indexOf methods in ContentManagementServices
for OFBIZ-9254  where wrong (reversed). Fortunately only place where this happened.

I added a comment to make clear why we have 2 empty else if

I'll backport later, conflicts to handle by hand...

Thanks: Ankush Upadhyay for spotting the bug

Conflicts handled by hand
2020-07-27 14:47:30 +02:00
Jacques Le Roux 8dc864ff71 Fixed: Unable to create event in SFA component (OFBIZ-9901)
The tests failed because CAL_OWNER instead of CONTACT was necessary

Handled by hand, cherry-pick was impossible
2020-07-25 19:24:50 +02:00
Jacques Le Roux 1662e5b42e Fixed: One page checkout is broken because of ordermgr::getAssociatedStateList (OFBIZ-11838)
On orderview screen at the ordermgr, when a user tries to change the status of
the order, in OrderInfo.ftl, we are calling "changeOrderStatus" request as

<@ofbizUrl>changeOrderStatus/orderview</@ofbizUrl>

Hence when the request is done, it is rewriting URL to
https://localhost:8443/ordermgr/control/changeOrderStatus/orderview.

When js functions running in the backend like "getAssociatedStateList" are
called, they are getting the wrong URL to send a request to. This was causing
the issue.

For now, there are two different fixes that can handle both problems which are
mentioned in OFBIZ-2562 and OFBIZ-11838.

1.
  To change the request mapping for "changeOrderStatus" and add request-redirect
  to "orderview" screen. Change the actions in the forms in OrderInfo.ftl to
  call "changeOrderStatus" request only and then remove code in
  "getAssociatedStateList" js function to rewrite URL.

2.
  To add .length to the existing URL rewrite code written in
  "getAssociatedStateList" js function as

if (jQuery('#orderViewed').length) {
    requestToSend = "/ordermgr/control/getAssociatedStateList"
}

Thanks: Pritam Kute!

I picked the 2nd solution
2020-07-25 19:21:38 +02:00
Aditya Sharma ca62bd6cef Fixed: Unable to create event in SFA component (OFBIZ-9901)
When creating event for the party other than the loggedin user, the party should be in CAL_OWNER role to be added to event. Added appropriate check in service along with the error message.
Thanks Rubia Elza Joshep for reporting the issue and Aditi Patidar for providing the patch
2020-07-25 19:05:58 +05:30
Jacques Le Roux c0b11bdfad Improved: Adds missing jGrowl map file (OFBIZ-11892)
Picked from
https://cdnjs.cloudflare.com/ajax/libs/jquery-jgrowl/1.4.6/jquery.jgrowl.map

Thanks to Alex Bodnaru

Conflicts: added jquery.jgrowl.map by hand
2020-07-23 09:14:27 +02:00
Aditya Sharma bf0c628dfb Fixed: pre push failures due to absence of checkstyle plugin (OFBIZ-11304)
We have added a Gradle plugin com.github.jakemarsden.git-hooks which install pre push hook on developer machine, but due to limitations of checkstyle plugin with the Gradle version of release 17.12 these changes cannot be backported. Once the hook is installed it is difficult to remove the hook when branch changes. With the absence of checkstyle plugin, the hook fails when pushing code. To avoid such failures added a dummy task with the same name.
2020-07-22 19:02:10 +05:30
Jacques Le Roux b0b4ba4d56 Improved: Reflected XSS in content component (OFBIZ-11840)
Fixes a Reflected XSS vulnerability in content component

Harshit Shukla reported it to the OFBiz security team:
https://demo-stable.ofbiz.apache.org/content/control/stream?contentId="><svg/onload=alert(0)>

It's a post-auth vulnerability so we did not ask for a CVE.

Thanks: Harshit Shukla harshit.shukz@gmail.com
2020-07-18 12:09:46 +02:00
Jacques Le Roux 346ddf229e Improved: Hard coded label in ProductUomDropDownOnly (OFBIZ-11891)
The select label is not receiving translations.

There are more related issues, but this is independent.

Thanks: Alex Bodnaru
2020-07-16 14:36:12 +02:00
Jacques Le Roux 4c8141e07a Fixed: wrong image name in css. missing map file (OFBIZ-11881)
The 'background-image:url("/d.png")' thing has already been fixed with
OFBIZ-10895 but wrongly backported it seems.

Thanks: Alex Bodnaru for report
2020-07-15 21:08:16 +02:00
Jacques Le Roux c248af0c55 Improved: adds links to the HTML and PDF versions on the web site 2020-07-12 11:52:58 +02:00
Jacques Le Roux b7b7cad1a2 Fixed: MODULE is not module :/ (backporting is never easy!) 2020-07-11 11:20:28 +02:00
Jacques Le Roux 76beb10627 Improved: Put the AsciiDoc files in main repo under the web site (OFBIZ-11879)
We have AsciiDoc files in main repo and it would be better to have them also in
HTML format under the web site: https://ci.apache.org/projects/ofbiz/site

For that a new generateReadmeFiles is needed and new "readme" locations under
each of https://ci.apache.org/projects/ofbiz/site "sub-dirs".
We can create those from Buildbot like we did with INFRA-20311
2020-07-11 09:54:32 +02:00
Jacques Le Roux 0e3b1c7a49 Improved: better message for host-headers-allowed
Adds an explanation about what to do when using own domain.

Some users don't look into the log so it's better to set also the exception
message in order for them to have it right at 1st glance.
2020-07-11 09:54:18 +02:00
Jacques Le Roux ba15f2ec77 Improved: Adds information to install without the demo data 2020-07-08 10:34:28 +02:00
Jacques Le Roux 6622277585 Fixed: DatabaseUtil::getColumnInfo does not retrieve PK due to connection-locks (OFBIZ-11312)
I wrongly removed a line when backporting by hand
2020-07-04 11:52:19 +02:00
Jacques Le Roux 791be06575 Improved: Removes a deprecated comment (work is done) 2020-07-04 11:15:14 +02:00
Jacques Le Roux 4b8ee87aef Improved: Cannot find the declaration of element 'web-app' in version 3.0 files. (OFBIZ-6993)
I missed to backport changes web.xml (was OK in plugins)
2020-07-04 10:30:49 +02:00
Michael Brohl accca2d388 Fixed: Added missing AJP connector property introduced for Tomcat 9.0.31
(OFBIZ-11848)
2020-07-03 17:35:06 +02:00
Suraj Khurana cb228cd11f Fixed: Console warnings related to OrderHeader caching.
(OFBIZ-11858)
Thanks Praveen Sharma for the patch and Jacques for review.
2020-07-02 11:10:44 +05:30
Michael Brohl 0eeaee6a25 Fixed: Upgrades Tomcat to 9.0.36 due to CVE-2020-11996 (OFBIZ-11848) 2020-06-28 12:46:47 +02:00
Pawan Verma f6353957e2 Fixed: EntityQuery queryCount is throwing error with distinct method (OFBIZ-11294)
Added missing support for selectFields in queryCount and all the subsequent methods.

Thanks: Deepak Dixit for the review.
2020-06-28 01:43:44 +05:30
Jacques Le Roux 4a71a959a6 Fixed: With Rainbow theme, a scrollbar appears at bottom where it's not needed
(OFBIZ-10174)

With Rainbow theme, even in large screens, a scrollbar appears at bottom where
it's useless.

The CSS which is adding a border-right on the application bar is adding extra
1px width causing this issue. Attached the patch to remove extra width for the
same.

Changes made by hand
2020-06-27 16:19:41 +02:00
Jacques Le Roux b09fa66ed3 Fixed: IDOR vulnerability in the order processing feature in ecommerce component (OFBIZ-11836)
Fixes a bug when there are no problem viewing the order, my bad
2020-06-27 10:47:06 +02:00
Jacques Le Roux 8120f75b21 Fixed: IDOR vulnerability in the order processing feature in ecommerce component (OFBIZ-11836)
https://demo-stable.ofbiz.apache.org/ecommerce/control/order.pdf?orderId=WSCO10000

In the above URL, the parameter 'orderId' has the value 'WSCO10000' and after
incrementing the value to 'WSCO10001' or 'WSCO10002' will download the receipt
of other orders which have been placed by other users.

All the available order receipts can be downloaded by running an automated tool
(Burp Intruder) on the parameter 'orderId=WSCOXXXXX'

I have successfully tested this by using 2 different accounts: DemoCustomer and
DemoCustomer2

An attacker can download order receipts of other users and this could lead to
information disclosure.

The only real solution to this issue is to implement access control. The user
needs to be authorized for the requested information before the server provides
it.

Thanks: Harshit Shukla [mailto:harshit.shukz@gmail.com]reported this IDOR
vulnerability to the OFBiz security team, and we thank him for that.
2020-06-26 09:29:57 +02:00
Jacques Le Roux 4079b54ece Fixed: getEntityRefData service has a weird issue (OFBIZ-11401)
It's reproductible on trunk demo though only visible in log, UI shows no issue

R17 and R18 are also affected, R16 is OK.

Ankush: This stacktrace should be coming for all entities where
default-resource-name is defined on entity definition but no property exist in
defined resource for key EntityDescription.entityname and FieldDescription.field.

As we want to have these entity labels as much as possible, we can simply print
warning about the missing entity descriptions and field descriptions for
readability purpose instead of printing huge exceptions stacktrace.

Thanks: Ankush Upadhyay and Pierre Smits for the help

Handled by hand (swallowing exceptions is lazy and bad :p)
2020-06-18 17:51:36 +02:00
Jacques Le Roux a603349b55 Fixed: Double encoded urls are not being decoded (OFBIZ-11822)
This was broken by OFBIZ-10275

Thanks: Alex Bodnaru
2020-06-15 13:31:42 +02:00
Aditya Sharma 685b7c3d82 Fixed: Check embedded Javascript libs vulnerabilities using retire.js
(OFBIZ-11752)

Upgraded jQuery to 3.5.2 and jQuery migrate to 3.3.0 to vulnerabilities of medium severity
Regex in its jQuery.htmlPrefilter sometimes may introduce XSS; https://blog.jquery.com/2020/04/10/jquery-3-5-0-released/
2020-06-15 13:21:43 +05:30
Jacques Le Roux e47e0142a0 Improved: no functional change
Adds missing ASL2 licenses

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1860259 13f79535-47bb-0310-9956-ffa450edef68
2020-06-09 17:47:49 +02:00
Jacques Le Roux 7a46ad7a4c Improved: Removes plugins as a submodule (OFBIZ-8459)
This was wrongly put in with several commits done for OFBIZ-8459 where plugins
https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=b39c179
https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=3a4d22
https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=bda6192
2020-06-09 16:12:08 +02:00
Jacques Le Roux abad801b0c Fixed: plugins in common-theme/webapp/common/js is not monitored by git (OFBIZ-11745)
In .gitignore in root ofbiz directory there is plugins/

so all directory plugins are ignored

if the line is replace by /plugins/ only root directory plugins is ignored

Thanks: Olivier

Conflict handled by hand
2020-06-09 14:55:01 +02:00
Suraj Khurana f914203956 Fixed: Unnecessary iterations and setting inventory for all productFacilities in setLastInventoryCount.
(OFBIZ-11796)

Instead of updating all product facilities records on one inventory item change, we should be changing only specific product facility record for that the inventory item belongs to. Thanks Jacques, Pierre, Pawan and Arun for the review.
2020-06-08 18:02:33 +05:30
Pawan Verma 079e909f21 Fixed: startup-service does not work without runtime-data-id(OFBIZ-11668) 2020-06-02 17:26:14 +05:30
Pawan Verma 260c0bb36b Fixed: Overview of shipments shows links to edit shipment it should point to viewshipment(OFBIZ-11787)
Thanks: Pierre for your contribution.
2020-06-02 17:16:22 +05:30
Pawan Verma 5414813438 Fixed: UI issue in payment lookup(OFBIZ-9476)
Thanks: Pallavi for report and patch and pierre from the review.
2020-06-02 16:38:18 +05:30
Pawan Verma f45c3ce988 Fixed: ViewShipment in facility does not show phone details(OFBIZ-11785)
Thanks, Pierre for the report.
2020-06-02 15:35:34 +05:30
Jacques Le Roux 7252dbf4e3 Improved: adds pull_request_template.md (OFBIZ-11722)
Forgot to commit the replacement
2020-05-31 08:51:26 +02:00
Aditya Sharma aec541efe1 Fixed: RequestHandlerException due missing controller entries
(OFBIZ-9478)
Fixed missing Lookup controller entries for the following pages:
1. LookupBudget for Employment Applications page of party
2. LookupDataResource for Content page of facility
3. LookupFixedAsset for Inventory Items Details page of facility

Thank you Pallavi Goyal for reporting the issue and Humera Khan for providing the patch
2020-05-31 09:57:07 +05:30
Pawan Verma 38a4202d91 Fixed: Corrected package path for UtilDateTime.(OFBIZ-6408) 2020-05-30 23:09:18 +05:30
Pawan Verma 482df0ba5e Fixed: Adding a group order generates an error(OFBIZ-6408)
The error is caused by an invalid expression, the two boolean evaluations should reside in the same groovy scriptlet.

Thanks, Pierre for report, Scott for the solution and Adrian, Jacques, Rahul for the review.
2020-05-30 15:38:12 +05:30
Pawan Verma 673fddf72b Fixed: productServiceOrder-test issue, it has been introduced after we fixed InventoryItemStatus is not updated to INV_PROMISED status(OFBIZ-8459)
Thanks, Jacques for the report.
2020-05-28 20:00:22 +05:30
Pawan Verma 16b8a789af Revert "Fixed: productServiceOrder-test issue, it has been introduced after we fixed InventoryItemStatus is not updated to INV_PROMISED status(OFBIZ-8459)"
This reverts commit 78e1ee1795.
2020-05-28 19:54:32 +05:30
Pawan Verma 78e1ee1795 Fixed: productServiceOrder-test issue, it has been introduced after we fixed InventoryItemStatus is not updated to INV_PROMISED status(OFBIZ-8459)
Thanks, Jacques for the report.
2020-05-28 19:46:51 +05:30
Pawan Verma e375286c74 Fixed: InventoryItemStatus is not updated to INV_PROMISED status while creating sales order for serialized product(OFBIZ-8459)
Thanks, Vaibhav for the report and patch and Pranay for the review.
2020-05-28 17:34:23 +05:30
Jacques Le Roux 17f4d36ec1 Documented: Create a simple INSTALL file with minimum installation information and redirection to more documentation
(OFBIZ-11691)

Following https://markmail.org/message/xi2bcvnmpdfvfgk2 discussion on dev ML
here is the file I suggest. If we are OK we can backport it to the supported
release branches. Of course I'm open to modifications...

Thanks for their answers: Deepak Nigam, Michael Brohl, Pierre Smits and
Taher Alkhateeb
2020-05-25 18:20:53 +02:00
Aditya Sharma cbeffa91f0 Fixed: paginateOrderList does not find orders on next page specific to FindOrders.ftl
(OFBIZ-11356)
Adding the missing showAll flag in the paginateOrder form because of which the orders were not shown while submitting the next button.
Thanks Michael Brohl for reporting the issue and Ankit Joshi for providing the patch
2020-05-23 16:23:40 +05:30
Jacques Le Roux d708d9afcb Fixed: Apache OFBiz unsafe deserialization of XMLRPC arguments (CVE-2020-9496)
(OFBIZ-11716)

Because the 2 xmlrpc related requets in webtools (xmlrpc and ping) are not using
authentication they are vulnerable to unsafe deserialization.

thanks: Alvaro Munoz <pwntester@github.com> from the GitHub Security Lab team
2020-05-19 15:59:39 +02:00
Pawan Verma d913366851 Fixed: Issue with redirect queryParameters when the user is logged out
(OFBIZ-11714)

In OFBIZ-10539, We missed removing the line which was adding parameters into the map as Ritesh suggested a good way to handle parameters. I've removed that redundant line of code and attaching a patch for the same.
2020-05-19 17:24:23 +05:30
Jacques Le Roux c7a5b22e0e Improved: Prevent FreeMarker Template Injection (SSTI)
(OFBIZ-11709)

This commit does 2 things:

Send a correct commit comment (kind of amendment, w/o push force)
Previous code compiled but SAFER_RESOLVER is not a class but a field, better KISS

Real change:
Better style with line not too long:
2020-05-18 22:50:28 +02:00
Jacques Le Roux 78cb314066 Improved:
Implemented:
Documented:
Completed:
Reverted:
Fixed:

(OFBIZ-)
Explanation
Thanks:
2020-05-18 15:26:15 +02:00
Jacques Le Roux c502a978a0 Improved: Prevent FreeMarker Template Injection (SSTI)
(OFBIZ-11709)

Fixes all the conflicts previously handled by hand (no merge was possible)
2020-05-18 13:48:31 +02:00
Jacques Le Roux babd23282e Improved: Prevent FreeMarker Template Injection (SSTI)
(OFBIZ-11709)

Some people may want to use another TemplateClassResolver than SAFER_RESOLVER
This creates a new templateClassResolver security property and uses it in
FreeMarkerWorker::makeConfiguration by default

Conflicts all handled by hand (no merge possible)
2020-05-18 13:35:02 +02:00
Jacques Le Roux dc60f6fdb3 Fixed: Prevent FreeMarker Template Injection (SSTI)
(OFBIZ-11709)

Since Freemarker 2.3.17 a known solution to these issues is to register a
TemplateClassResolver in Freemarker configuration in order to limit which
TemplateModels can be instantiated in the templates. The predefined resolver
SAFER_RESOLVER doesn't allow to instantiate the Execute class[4].

So the solution is to add the line
    newConfig.setNewBuiltinClassResolver(TemplateClassResolver.SAFER_RESOLVER);
in FreeMarkerWorker.java
2020-05-16 20:56:54 +02:00
Pawan Verma 6b04468f45 Fixed: Theme files loading taking longer time
(OFBIZ-11665)

Thanks: Pierre and Jacques for the review.
2020-05-10 14:19:03 +05:30
Pierre Smits 039d51062c Fixed: ListParty doesn't show middleName
(OFBIZ-11681)

Fixes a logic error
2020-05-09 16:10:00 +02:00
Pawan Verma 454230e613 Fixed: Promised Datetime & Current Promised Date values not getting updated in OISGIR Entity
(OFBIZ-10538)

Thanks: Deepak, Taher, Ravi, Amit, Suraj for the contribution.
2020-05-06 11:53:40 +05:30
Pawan Verma 4cd701023c Fixed: Issue with opening a page via bookmark when the user is logged out
(OFBIZ-10539)

Thanks: Ritesh Kumar for report and the patch and Girish for the review.
2020-05-05 14:58:58 +05:30
Pawan Verma 95a65c3dd2 Fixed: Creating custom Time Period does not show in party time period
(OFBIZ-10904)

Thanks, Pierre and Jacques for your contribution.
2020-05-04 15:21:47 +05:30
Jacques Le Roux 41737adca3 Improved: enough of stash issues, adds upload to runtime/.gitignore 2020-05-02 12:49:49 +02:00
Jacques Le Roux 27c91802fc Improved: Improve ObjectInputStream class
(OFBIZ-10837)

While working on OFBIZ-11633 I crossed an issue in R18 (not in trunk) where
objects from org.apache.commons.fileupload (namely DiskFileItem and
FileItemHeadersImpl) are not serializable.

While at it I decided to handle at the SafeObjectInputStream level
the "fileItems" case I already crossed with, OFBIZ-11534, in RequestHandler

It has an inconvenient in R18 (not in trunk) where ObjectInputStream can't
handle a null class (of course) and so return a benign exception in log (only).

I believe it's better to handle these specific cases at the lower possible
level in all supported branches.
2020-05-02 12:42:45 +02:00
Jacques Le Roux 45535e34cb Fixed: PartyProfileContent.js does not work
(OFBIZ-11633)
When you upload a content from the party profile page you don't see a progress
bar. The PartyProfileContent.js is loaded but for some reason is unused or wrong

Mohammad Kathawala mentionned that it was removed with OFBIZ-9299
It was also broken with OFBIZ-11402

Thanks: Mohammad for the track

Conflicts handled by hand
 applications/party/template/party/profileblocks/Content.ftl
 framework/common/groovyScripts/CommonServices.groovy
2020-05-02 12:42:12 +02:00
Suraj Khurana 972401bb9d Fixed: Incorrect value in entity-auto invoke for removeProductFeatureDataResource.
(OFBIZ-11614)

It was may be a typo introduced in rev 1728261, fifty months ago.
2020-04-30 17:04:33 +05:30
Pawan Verma 5eadb77a88 Incorrect column alias in EntitySQLProcessor for sql query working with mysql
(OFBIZ-11573)

More details: Method getColumnLabel returns the designated column's suggested title for use in printouts and displays. Method getColumnName returns the designated column's name.

Thanks: Suraj and Jacques for the review.
2020-04-28 10:57:56 +05:30
Pawan Verma 520cc35935 Fixed: Create Exchange Order button on Return screen is distorted
(OFBIZ-11144)

Thanks: Devanshu for the report, Suraj and Jacques for the review.
2020-04-28 10:14:27 +05:30
Jacques Le Roux 0e20d16cfd Fixed: Compound-widget not works with condition
(OFBIZ-11606)

Fixes "<**:condition" not well managed and generating an error

Changes all the getNodeName() by getLocalName() in the ModelX****Condition.java

Thanks: Olivier
2020-04-27 17:45:28 +02:00
Jacques Le Roux 6189bd8ddd Fixed: Compound-widget not works with condition
(OFBIZ-11606)

rootElement is not correct for a compound file, it's necessary to do a
UtilXml.firstChildElement(rootElement, "forms"); to be correct.
It's done for screen, form but not for grid !

So correction is now added the correct read of rootElement.

jleroux: completely backported by hand

Thanks: Olivier
2020-04-27 15:08:40 +02:00
Deepak Dixit 8a4a68e9f9 Fixed: Used the jdk 8 compatible version for gradle-svntools-plugin
(OFBIZ-11601)
build.grale using latest.release of gradle-svntools-plugin, and gradle-svntools-plugin release its latest release on 19th with jdk11 compatible. So this is causing build failure
2020-04-20 11:37:27 +05:30
Jacques Le Roux 4b43b0c639 Fixed: Error removing an uploaded party content
(OFBIZ-11597)

When you try to remove an uploaded party content you get this error:

ControlServlet                |E| Error in request handler:
org.apache.ofbiz.webapp.control.RequestHandlerException:
Unknown request [removePartyContent/viewprofile];
this request does not exist or cannot be called directly.

While at it I also fixed the similar case for payment methods
2020-04-17 17:33:24 +02:00
Jacques Le Roux 9f5ebc48fd Fixed: Error in uploading very large files, ie >2MB
(OFBIZ-11534)

This was not supposed to be committed, actually (wrong) part of OFBIZ-11597

Fixed: Error in uploading very large files, ie >2MB

(OFBIZ-11534)

There is an issue in uploading large files, I am able to upload files up to 2 GB
successfully but getting an error when trying to upload a file larger than 2GB.

Example -
1. Go to party profile -
https://demo-trunk.ofbiz.apache.org/partymgr/control/viewprofile?partyId=admin
2. Try to create a party content with a file larger than 2 GB
3. Error on console

jleroux:
For a 2GB+ file you need to set Xmx to more than the double of the file size,
eg: gradlew ofbiz -PjvmArgs="-Xms1024M -Xmx5048M"

You then get another small issue (only in log) when redirecting to send the
partyId parameter.

This is because, DiskFileItem is a temporary Object with a null value contained
in "fileItems" attribute. It can't be detected by UtilMisc::makeMapSerializable
and that makes "fileItems" not serializable. So it must be removed from
reqAttrMap.

Thanks: Chandan Khandelwal for report, Michael for suggesting a very large file
to upload
2020-04-16 16:16:14 +02:00
Jacques Le Roux 9530d4b441 Documented: Adds the CSRF defense documentation (missed the add last time) 2020-04-15 19:44:03 +02:00
Jacques Le Roux 242e62d6f3 Documented: Adds the CSRF defense documentation 2020-04-15 19:44:01 +02:00
Jacques Le Roux 1e8ffb4906 Improved: Adds the download-the-gradle-wrapper section 2020-04-07 15:29:55 +02:00
Jacques Le Roux b14516202d Improved: Removes deprecated README.md file 2020-04-07 12:24:40 +02:00
Ulrich Heidfeld 5b5029312a Improved: Decodes AjaxAutocompleteOptions return value
(OFBIZ-11475)
2020-04-05 14:01:16 +02:00
Jacques Le Roux 42ad34f0b6 Fixed: removes a wrong import due to CSRF token backport trying 2020-04-05 12:02:06 +02:00
Jacques Le Roux 793628bb15 Fixed: Prevent Host Header Injection (CVE-2019-12425)
(OFBIZ-11583)

Conflicts handled by hand
  framework/security/config/security.properties
  framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java
2020-04-05 11:40:48 +02:00
Jacques Le Roux 84e102a6a1 Revert "Merge branch 'JacquesLeRoux-POC-for-CSRF-Token-OFBIZ-11306' into trunk"
This reverts commit 27e57522b1.
2020-04-05 10:05:16 +02:00
Jacques Le Roux 27e57522b1 Merge branch 'JacquesLeRoux-POC-for-CSRF-Token-OFBIZ-11306' into trunk
Because of GitHub message on PR56:
This branch cannot be rebased due to conflicts

Much Conflicts, but that should be OK
2020-04-04 18:41:14 +02:00
Jacques Le Roux cf936d6c5e Fixed: The createTaskContent request does not work
(OFBIZ-11246)

It seems that same request can not be parsed multiple times if it has multi part
object in it as the parse method remove it after that.

Found one stackoverflow link around the same:

https://stackoverflow.com/questions/13881272/
servletfileuploadparserequestrequest-returns-an-empty-list

I believe that all places/uploads using this workflow should resulting the same
issue.

One possible solution I could think of without going with new approach is to set
list of file Items into the request attribute and use it if parse method remove
it and unable to retrieve on 2nd call.

Thanks: Ankush Upadhyay for the analysis and initial patch. I only slightly
modified it.
2020-03-27 11:09:36 +01:00
Jacques Le Roux 7e03082d92 Improved: Improve Web Content Caching
(OFBIZ-11477)

According to OWASP OFBiz Web Content Caching is weak:

Independently of the cache policy defined by the web application, if caching web
application contents is allowed, the session IDs must never be cached, so it is
highly recommended to use the Cache-Control: no-cache="Set-Cookie, Set-Cookie2"
directive, to allow web clients to cache everything except the session ID

I though noticed that Set-Cookie2 is deprecated for a long time now. And we new
browsers policies it to often updated. So no need to use Set-Cookie2.
2020-03-27 10:11:53 +01:00
Jacques Le Roux 1617226897 Fixed: Ensure that the SameSite attribute is set to 'strict' for all cookies.
(OFBIZ-11470)

It's better to allow users to change from strict to lax, at least for all
cookies. Some could want to change it by cookie type. I let the exercise for
them :)
See:https://blog.mozilla.org/security/2018/04/24/same-site-cookies-in-firefox-60

Conflicts handled by hand
	framework/security/config/security.properties
2020-03-21 11:59:46 +01:00
Jacques Le Roux bb26cc1c62 Improved: no functional change
Adds "Content-Security-Policy" frame-ancestors="self" in ErrorPage.ftl
Because this page is used as a HTTP 500 error it's more susceptible to
clickjacking

Quoting OWASP ZAP:
This problem still applies to error-type pages (401, 403, 500, etc.), as these
pages are still often affected by injection problems, in which case it is still
possible that browsers may interpret pages differently from their actual content
type.

I tried to work on other file types that were also reported but it's complicated
adn I believe it's not worth it
2020-03-20 20:21:27 +01:00
Jacques Le Roux 09270a1c34 Fixed: Ensure that the SameSite attribute is set to 'strict' for all cookies.
(OFBIZ-11470)

Forgot to add UtilHttp::SameSiteFilter
2020-03-20 18:05:39 +01:00
Jacques Le Roux 82ef7a5871 Fixed: Ensure that the SameSite attribute is set to 'strict' for all cookies.
(OFBIZ-11470)

As reported by OWASP ZAP:
A cookie has been set without the SameSite attribute, which means that the
cookie can be sent as a result of a 'cross-site' request. The SameSite attribute
is an effective counter measure to cross-site request forgery, cross-site script
inclusion, and timing attacks.

The solution was not obvious in OFBiz for 2 reasons:

1. There is no HttpServletResponse::setHeader. So we need to use a filter
  (SameSiteFilter) and even that is not enough because of 2:
2. To prevent session fixation we force Tomcat to generates a new jsessionId,
ultimately put in cookie, in LoginWorker::login. So we need to add a call to
SameSiteFilter::addSameSiteCookieAttribute in
UtilHttp::setResponseBrowserDefaultSecurityHeaders.
2020-03-20 17:52:21 +01:00
Jacques Le Roux a16271e5c3 Improved: no functional change
Follows the "How to apply the Apache License to your work" section at
https://www.apache.org/licenses/LICENSE-2.0

Removes the references to products only used in plugins
2020-03-14 12:36:49 +01:00
Dennis Balkir 0c7be39acb Fixed: Potential Nullpointer in ErrorPage.ftl
(OFBIZ-11448)

Inserted nullcheck for request-attribute
2020-03-10 16:04:52 +01:00
Daniel Watford 0355006c62 Improved: Add 2020 version of Incoterms
(OFBIZ-11437)

Alter the parent type and descriptions of existing Incoterm TermTypes to
indicate the version of Incoterms they relate to.

Added new Incoterm TermTypes and descriptions correspoding to the
Incoterms 2020 set.

Conflicts handled by hand:
	applications/datamodel/data/seed/PartySeedData.xml
	applications/party/config/PartyEntityLabels.xml
2020-03-06 08:48:13 +01:00
Jacques Le Roux b571234062 Fixed: createMissingCategoryAndProductAltUrls service misses a transaction
(OFBIZ-11441)

Not sure why it had use-transaction="false", makes no sens to me, too old to
check, not a big deal I guess
2020-03-05 10:17:10 +01:00
Jacques Le Roux 3d9b551d65 Merge pull request #42 from danwatford/ofbiz-11437-2020-incoterms-improvement
OFBIZ-11437: Improved: Added 2020 version of Incoterms
(cherry picked from commit 7a34e9cda8)
2020-03-04 15:10:23 +01:00
530 changed files with 6108 additions and 3861 deletions
+11
View File
@@ -0,0 +1,11 @@
Improved:
Implemented:
Documented:
Completed:
Reverted:
Fixed:
(OFBIZ-)
Explanation
Thanks:
+1 -1
View File
@@ -2,7 +2,7 @@ bin/
build/
applications/*/build
framework/*/build
plugins/
/plugins/
runtime/git-rebase/*
runtime/SvnInfo.ftl
runtime/GitInfo.ftl
+67
View File
@@ -0,0 +1,67 @@
Welcome to Apache OFBiz! A powerful top level Apache software project. OFBiz
is an Enterprise Resource Planning (ERP) System written in Java and houses a
large set of libraries, entities, services and features to run all aspects of
your business.
== System requirements
The only requirement to run OFBiz is to have the Java Development Kit (JDK)
version 8 installed on your system (not just the JRE, but the full JDK) which
you can download from the below link. Make sure of setting the $JAVA_HOME
environment variable.
https://adoptopenjdk.net/[JDK download]
== Quick start
To quickly install and fire-up OFBiz, please follow the below instructions from
the command line at the OFBiz top level directory (folder).
=== Download the Gradle wrapper:
MS Windows: init-gradle-wrapper
Unix-like OS: ./gradle/init-gradle-wrapper
=== Prepare OFBiz:
==== Clean system and load the complete OFBiz data
_______________________________________________________________________________
Note: Depending on your Internet connection speed it might take a long time
for this step to complete if you are using OFBiz for the first time as it needs
to download all dependencies. So please be patient!
_______________________________________________________________________________
MS Windows: gradlew cleanAll loadAll
Unix-like OS: ./gradlew cleanAll loadAll
=====Note:
As the later step, to install without the demo data follow:
(beware this is for development or production, not trying)
Windows: gradlew cleanAll "ofbiz --load-data readers=seed,seed-initial" loadAdminUserLogin -PuserLoginId=admin
Unix-like OS: ./gradlew cleanAll "ofbiz --load-data readers=seed,seed-initial" loadAdminUserLogin -PuserLoginId=admin
The OFBiz install will be empty, there will be no chart of accounts, no transactions, no products, no customers and no suppliers.
You can't log to the E-Commerce Store. You will get: "A Product Store has not been defined for this ecommerce site. A Product Store can be created using the ofbizsetup wizard."
=== Start OFBiz:
MS Windows: gradlew ofbiz
Unix-like OS: ./gradlew ofbiz
_______________________________________________________________________________
Note: Ignore the % progress indicator because this task does not end as long
as OFBiz is running.
_______________________________________________________________________________
=== Visit OFBiz through your browser:
https://localhost:8443/webtools
== Going further
To complete your installation and use OFBiz please read README.adoc
You may prefer to read this AsciiDoc file in HTML format.
For that simply follow:
https://asciidoctor.org/docs/convert-documents/#converting-a-document-to-html
+11 -53
View File
@@ -186,24 +186,19 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2001-2008 The Apache Software Foundation
Copyright [yyyy] [name of copyright owner]
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================
@@ -219,42 +214,5 @@ For details, see themes/common/webapp/common/js/plugins/date/timezones.
=========================================================================
This product bundles "Date Format 1.2.3", which is available
under the "MIT" license.
under the "MIT" license.
For details, see themes/common/webapp/common/js/plugins/date/date.format-1.2.3*
=========================================================================
This product bundles "jQuery" and "jQuery" plugins and extensions, which are available
under the "MIT" license. For details, see:
themes/common/webapp/common/js/jquery
plugins/webpos/webapp/webpos/images/js/jquery.hotkeys-0.7.9.min.js
plugins/webpos/webapp/webpos/images/js/WebPosHotkeys.js
=========================================================================
This product bundles files from the "Birt" technology platform (www.eclipse.org/birt/)
which are available under the "Eclipse Public License - v 1.0".
For details, see plugins/birt/webapp/birt/webcontent/birt/
=========================================================================
This product bundles "Webhelp for DocBook", which is available
under the "MIT" License. For details, see plugins/cmssite/template/docbook/webhelp/
=========================================================================
This product bundles "DocBook XSL Stylesheets 1.77.1", which is available
under the "MIT" license.
For details, see plugins/cmssite/template/docbook/
=========================================================================
This product bundles "Openlayers", which is available
under the "FreeBSD" license.
For details, see themes/common/webapp/images/OpenLayers-2.13.1-modified-for-CSP-.js
=========================================================================
This product bundles "Bootstrap", which is available
under the "MIT" license.
For details, see:
plugins/ecommerce/webapp/ecommerce/js
plugins/ecommerce/webapp/ecommerce/css
+36 -16
View File
@@ -19,6 +19,12 @@ under the License.
[[apache-ofbiz]]
= Apache OFBiz®
If you are reading this file in AsciiDoc format you may want to see it in
https://ci.apache.org/projects/ofbiz/site/stable/readme/html5/README.html[HTML]
or https://ci.apache.org/projects/ofbiz/site/stable/readme/pdf/README.pdf[PDF] format
---
Welcome to *Apache OFBiz*! A powerful top level Apache software project. OFBiz
is an Enterprise Resource Planning (ERP) System written in Java and houses a
large set of libraries, entities, services and features to run all aspects of
@@ -53,14 +59,17 @@ ________________________________________________________________________________
[[system-requirements]]
== System requirements
The only requirement to run OFBiz is to have the Java Development Kit (JDK)
version 8 installed on your system (not just the JRE, but the full JDK) which
you can download from the below link. Make sure of setting the $JAVA_HOME
environment variable.
The only requirements to run OFBiz is
* to have the Java Development Kit (JDK) version 8 installed on your system
(not just the JRE, but the full JDK) that you can download from the below link.
Make sure of setting the $JAVA_HOME environment variable. +
https://adoptopenjdk.net/[JDK download], https://medium.com/@javachampions/java-is-still-free-2-0-0-6b9aa8d6d244[To know more about the JDK]
* If on Windows, a Powershell version >= 7.1.3 installed that you can download from the below link. +
https://github.com/PowerShell/PowerShell[Powershell]
https://adoptopenjdk.net/[JDK download]
https://medium.com/@javachampions/java-is-still-free-2-0-0-6b9aa8d6d244[To know more about the JDK]
[[quick-start]]
// tag::quickstart[]
@@ -69,6 +78,13 @@ https://medium.com/@javachampions/java-is-still-free-2-0-0-6b9aa8d6d244[To know
To quickly install and fire-up OFBiz, please follow the below instructions from
the command line at the OFBiz top level directory (folder).
[[download-the-gradle-wrapper]]
=== Download the Gradle wrapper:
MS Windows: `init-gradle-wrapper`
Unix-like OS: `./gradle/init-gradle-wrapper.sh`
[[prepare-ofbiz]]
=== Prepare OFBiz:
@@ -113,13 +129,18 @@ In case of problems visit our link:#further-reading[Further reading section].
[[security]]
== Security
If you find a security issue, please report it to: security @ ofbiz.apache.org.
* If you find a pre-auth security issue, please report it to: security @ ofbiz.apache.org.
Once proper mitigations to the security issues are complete the OFBiz team will
disclose this information to the public mailing list.
* If you find a post-auth security issue, please https://s.apache.org/dsj2p[create a bug in our issue tracker (Jira)] .
You can find more information about security in OFBiz at
https://cwiki.apache.org/confluence/display/OFBIZ/Keeping+OFBiz+secure[Keeping
OFBiz secure]
https://cwiki.apache.org/confluence/display/OFBIZ/Keeping+OFBiz+secure[Keeping OFBiz secure]
[CAUTION]
In production never use the credentials contained in demo data. Not only the admin credentials, but all of them.
[[build-system-syntax]]
== Build system syntax
@@ -261,8 +282,7 @@ operating system kill command. Use this command to force OFBiz termination if
the --shutdown command does not work. Usually this is needed when in the middle
of data loading or testing in OFBiz.
Warning: Be careful in using this command as force termination might lead to
inconsistent state / data
Warning: Be careful in using this command as force termination might lead to inconsistent state / data
`gradlew terminateOfbiz`
@@ -373,7 +393,7 @@ Example:
Beware that copying this command in Microsoft Word will automatically transform
the double dash in en dashes (Unicode 0x2013: –) Other cases not related to Word
were also reported.So when this command does not work check that you are using
dash! text
dash!
[[load-all-ofbiz-data]]
==== Load all OFBiz data
@@ -381,13 +401,13 @@ dash! text
Loads all data sets; meant for initial loading of generic OFBiz data. Can be
applied for development, testing, demonstration, etc. purposes. Be aware that
executing this task can result in your data being overwritten in your database
of choice. Use with caution in production environments.
of choice.
`gradlew loadAll`
`gradlew loadAll` OR `gradlew "ofbiz --load-data"`
OR
[CAUTION]
Use with caution in production environments.
`gradlew "ofbiz --load-data"`
[[load-seed-data]]
==== Load seed data
-760
View File
@@ -1,760 +0,0 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
Apache OFBiz®
=============
Welcome to __Apache OFBiz__! A powerful top level Apache software project.
OFBiz is an Enterprise Resource Planning (ERP) System written in Java and
houses a large set of libraries, entities, services and features to run
all aspects of your business.
For more details about OFBiz please visit the OFBiz Documentation page:
[OFBiz documentation](http://ofbiz.apache.org/documentation.html)
[OFBiz License](http://www.apache.org/licenses/LICENSE-2.0)
>_Note_: If you want to use Eclipse, read the "Setup eclipse project for OFBiz"
section to set it up.
>_Note_: If you want to use an external database like MySQL or PostgreSQL, read
the "Setup an external database" section to set it up.
>_Note_: If you want to run OFBiz without an internet connection, read the
"Running gradle tasks without an internet connection" section.
>_Note_: The directory structure and repositories have changed. For more
information read the "Repository and directory structure" section.
System requirements
-------------------
The only requirement to run OFBiz is to have the Java Development Kit (JDK)
version 8 installed on your system (not just the JRE, but the full JDK) which
you can download from the below link. Make sure of setting the $JAVA_HOME
environment variable.
[JDK download](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
Quick start
-----------
To quickly install and fire-up OFBiz, please follow the below instructions
from the command line at the OFBiz top level directory (folder)
In case of problems visit our [Further reading section](#further-reading)
### Prepare OFBiz:
>_Note_: Depending on your Internet connection speed it might take a long
time for this step to complete if you are using OFBiz for the first time
as it needs to download all dependencies. So please be patient!
MS Windows:
`gradlew cleanAll loadAll`
Unix-like OS:
`./gradlew cleanAll loadAll`
### Start OFBiz:
MS Windows:
`gradlew ofbiz`
Unix-like OS:
`./gradlew ofbiz`
>_Note_: Ignore the % progress indicator because this task does not end as
long as OFBiz is running.
### Visit OFBiz through your browser:
[Order Back Office](https://localhost:8443/ordermgr)
[Accounting Back Office](https://localhost:8443/accounting)
[Administrator interface](https://localhost:8443/webtools)
You can log in with the user __admin__ and password __ofbiz__.
Security
--------
If you find a security issue, please report it to: security @ ofbiz.apache.org.
Once proper mitigations to the security issues are complete the OFBiz team will
disclose this information to the public mailing list.
You can find more information about security in OFBiz at
[Keeping OFBiz secure](https://cwiki.apache.org/confluence/display/OFBIZ/Keeping+OFBiz+secure)
* * * * * * * * * * * *
Build system syntax
-------------------
All build tasks are executed using the __Gradle__ build system which
is embedded in OFBiz. To execute build tasks go to OFBiz top-level
directory (folder) and execute tasks from there.
### Operating System Syntax
The syntax for tasks differ slightly between windows and Unix-like systems
- __Windows__: `gradlew <tasks-in-here>`
- __Unix-like__: `./gradlew <tasks-in-here>`
For the rest of this document, we will use the windows syntax, if you are on
a Unix-like system, you need to add the `./` to gradlew
### Types of tasks in Gradle
There are two types of tasks designed for OFBiz in Gradle:
- __Standard tasks__: To execute general standard Gradle tasks
- __OFBiz server tasks__: To execute OFBiz startup commands. These
tasks start with one of the following words:
- __ofbiz__ : standard server commands
- __ofbizDebug__ : server commands running in remote debug mode
- __ofbizBackground__ ; server commands running in a background forked process
Tips:
- OFBiz __server commands__ require __"quoting"__ the
commands. For example: `gradlew "ofbiz --help"`
- Shortcuts to task names can be used by writing the
first letter of every word in a task name. However, you
cannot use the shortcut form for OFBiz server tasks.
Example: `gradlew loadAdminUserLogin -PuserLoginId=myadmin` = `gradlew lAUL -PuserLoginId=myadmin`
- Dependent tasks can be skipped with the -x switch.
Example: `gradlew build -x test` does not run the tests within the build.
#### Example standard tasks
`gradlew build`
`gradlew cleanAll loadAll testIntegration`
#### Example OFBiz server tasks
`gradlew "ofbiz --help"`
`gradlew "ofbizDebug --test"`
`gradlew "ofbizBackground --start --portoffset 10000"`
`gradlew "ofbiz --shutdown --portoffset 10000"`
`gradlew ofbiz` (default is --start)
#### Example mixed tasks (standard and OFBiz server)
`gradlew cleanAll loadAll "ofbiz --start --portoffset 10000"`
* * * * * * * * * * * *
Quick reference
---------------
You can use the below common list of tasks as a quick reference
for controlling the system. This document uses the windows task
syntax, if you are on a Unix-like system, you need to add the
`./` to gradlew i.e. `./gradlew`
* * * * * * * * * * * *
### Help tasks
#### List OFBiz server commands
List all available commands to control the OFBiz server
`gradlew "ofbiz --help"`
#### List build tasks
List all available tasks from the build system
`gradlew tasks`
#### List build projects
List all available projects in the build system
`gradlew projects`
#### Gradle build system help
Show usage and options for the Gradle build system
`gradlew --help`
* * * * * * * * * * * *
### Server command tasks
#### Start OFBiz
`gradlew "ofbiz --start"`
start is the default server task so this also works:
`gradlew ofbiz`
#### Shutdown OFBiz
`gradlew "ofbiz --shutdown"`
#### Get OFBiz status
`gradlew "ofbiz --status"`
#### Force OFBiz shutdown
Terminate all running OFBiz server instances by calling
the appropriate operating system kill command. Use this
command to force OFBiz termination if the --shutdown
command does not work. Usually this is needed when in the
middle of data loading or testing in OFBiz.
Warning: Be careful in using this command as force termination
might lead to inconsistent state / data
`gradlew terminateOfbiz`
#### Start OFBiz in remote debug mode
Starts OFBiz in remote debug mode and waits for debugger
or IDEs to connect on port __5005__
`gradlew "ofbizDebug --start"`
OR
`gradlew ofbizDebug`
#### Start OFBiz on a different port
Start OFBiz of the network port offsetted by the range
provided in the argument to --portoffset
`gradlew "ofbiz --start --portoffset 10000"`
#### Start OFBiz in the background
Start OFBiz in the background by forking it to a new
process and redirecting the output to __runtime/logs/console.log__
`gradlew "ofbizBackground --start"`
OR
`gradlew ofbizBackground`
You can also offset the port, for example:
`gradlew "ofbizBackground --start --portoffset 10000"`
#### Passing JVM runtime options to OFBiz
You can pass JVM runtime options by specifying the project property `-PjvmArgs`.
`gradlew ofbiz -PjvmArgs="-Xms1024M -Xmx2048M" -Dsome.parameter=hello`
If you do not specify `jvmArgs`, a default of `-Xms128M -Xmx1024M` is set.
* * * * * * * * * * * *
### Data loading tasks
OFBiz contains the following data reader types:
- __seed__: OFBiz and External Seed Data - to be maintained along with source and
updated whenever a system deployment is updated
- __seed-initial__: OFBiz and External Seed Data - to be maintained along with
source like other seed data, but only loaded initially and not updated
when a system is updated except manually reviewing each line
- __demo__: OFBiz Only Demo Data
- __ext__: External General Data (custom)
- __ext-test__: External Test Data (custom)
- __ext-demo__: External Demo Data (custom)
- __tenant__: Data to load into the master tenants database "ofbiztenant". This
data is required to identify where a tenant's database is located. For more
information you can review the relevant
[tenant documentation](https://cwiki.apache.org/confluence/display/OFBIZ/Multitenancy+support)
Available options for the --load-data server command are the following:
- **readers=[name]**: only load data from certain readers separated by comma.
e.g. seed,seed-initial,ext
- **file=[path]**: load a single file from location or several files separated
by commas. e.g. /my/file/1,/my/file/2
- **dir=[path]**: load all data files found in directory
- **component=[name]**: only load data from a specific component. e.g. base
- **delegator=[name]**: use the defined delegator. Default is "default". If the
value passed is **"all-tenants"** then OFBiz will load the data for all defined
tenants in the system.
- **group=[name]**: override the entity group (org.apache.ofbiz).
e.g. com.example.something
- **timeout=[millis]**: timeout in milliseconds
- **create-pks**: create primary keys
- **drop-pks**: drop primary keys
- **create-constraints**: create indexes and foreign keys after loading
- **drop-constraints**: drop indexes and foreign keys before loading
- **create-fks**: create dummy (placeholder) foreign keys
- **maintain-txs**: maintain timestamps in data file
- **try-inserts**: use mostly inserts
- **repair-columns**: repair column sizes
(default is true w/ drop-constraints)
- **continue-on-failure**: By default OFBiz will fail and stop if it is unable
to load any of the files it is attempting to load. By passing this property
OFBiz will ignore failures and continue loading all files
#### Load specific OFBiz data
you can choose which data readers to pass in the following syntax:
`gradlew "ofbiz --load-data readers=<readers-here-comma-separated>"`
Example:
`gradlew "ofbiz --load-data readers=seed,seed-initial,ext,ext-demo"`
<span style="color:red">
Beware that copying this command in Microsoft Word will automatically transform the double dash in en dashes (Unicode 0x2013: –)
Other cases not related to Word were also reported.So when this command does not work check that you are using dash!
text</span>
#### Load all OFBiz data
Loads all data sets; meant for initial loading of generic OFBiz data.
Can be applied for development, testing, demonstration, etc. purposes.
Be aware that executing this task can result in your data being overwritten
in your database of choice. Use with caution in production environments.
`gradlew loadAll`
OR
`gradlew "ofbiz --load-data"`
#### Load seed data
Load ONLY the seed data (not seed-initial, demo, ext* or anything else);
meant for use after an update of the code to reload the seed data
as it is generally maintained along with the code and needs to be
in sync for operation
`gradlew "ofbiz --load-data readers=seed"`
#### load ext data
Load seed, seed-initial and ext data; meant for manual/generic
testing, development, or going into production with a derived
system based on stock OFBiz where the ext data basically
replaces the demo data
`gradlew "ofbiz --load-data readers=seed,seed-initial,ext"`
#### load ext test data
Load seed, seed-initial, ext and ext-test data; meant for
automated testing with a derived system based on stock OFBiz
`gradlew "ofbiz --load-data readers=seed,seed-initial,ext,ext-test"`
#### load data from an entity file
Load data from an XML file holding entity data.
`gradlew "ofbiz --load-data file=foo/bar/FileNameHere.xml"`
#### create a new tenant
Create a new tenant in your environment, create the delegator, load
initial data with admin-user and password (needs multitenant=Y in
general.properties). The following project parameters are passed:
- tenantId: mandatory
- tenantName: optional, default is value of tenantId
- domainName: optional, default is org.apache.ofbiz
- tenantReaders: optional, default value is seed,seed-initial,demo
- dbPlatform: optional, D(Derby), M(MySQL), O(Oracle), P(PostgreSQL) (default D)
- dbIp: optional, ip address of the database
- dbUser: optional, username of the database
- dbPassword: optional, password of the database
`gradlew createTenant -PtenantId=mytenant`
`gradlew createTenant -PtenantId=mytenant -PtenantName="My Name" -PdomainName=com.example -PtenantReaders=seed,seed-initial,ext -PdbPlatform=M -PdbIp=127.0.0.1 -PdbUser=mydbuser -PdbPassword=mydbpass`
If run successfully, the system creates a new tenant having:
- delegator: default#${tenandId} (e.g. default#mytenant)
- admin user: ${tenantId}-admin (e.g. mytenant-admin)
- admin user password: ofbiz
#### load data for a specific tenant
Load data for one specific tenant in a multitenant environment. Note
that you must set multitenant=Y in general.properties and the
following project parameters are passed:
- tenantId (mandatory)
- tenantReaders (optional)
- tenantComponent (optional)
`gradlew loadTenant -PtenantId=mytenant`
`gradlew loadTenant -PtenantId=mytenant -PtenantReaders=seed,seed-initial,demo -PtenantComponent=base`
* * * * * * * * * * * *
### Testing tasks
#### Execute all unit tests
`gradlew test`
#### Execute all integration tests
`gradlew testIntegration`
OR
`gradlew 'ofbiz --test'`
#### Execute integration tests with a different log level
It is possible to start integration tests with a log level different from the
default one. The log levels allowed are listed below from most verbose to
least verbose:
- always
- verbose
- timing
- info
- important
- warning
- error
- fatal
`gradlew "ofbiz --test loglevel=fatal"`
#### Execute an integration test case
run a test case, in this example the component is "entity" and the case
name is "entity-tests"
`gradlew "ofbiz --test component=entity --test suitename=entitytests --test case=entity-query-tests"`
#### Execute an integration test case in debug mode with verbose log
listens on port __5005__
`gradlew "ofbizDebug --test component=entity --test loglevel=verbose"`
#### Execute an integration test suite
`gradlew "ofbiz --test component=entity --test suitename=entitytests"`
#### Execute an integration test suite in debug mode
listens on port __5005__
`gradlew "ofbizDebug --test component=entity --test suitename=entitytests"`
* * * * * * * * * * * *
### Miscellaneous tasks
#### Run all tests on a clean system
`gradlew cleanAll loadAll testIntegration`
#### Clean all generated artifacts
`gradlew cleanAll`
#### Refresh the generated artifacts
`gradlew clean build`
#### Create an admin user account
Create an admin user with login name MyUserName and default password
with value "ofbiz". Upon first login OFBiz will request changing the
default password
`gradlew loadAdminUserLogin -PuserLoginId=MyUserName`
#### Compile Java using Xlint output
Xlint prints output of all warnings detected by the compiler
`gradlew -PXlint build`
#### Run OWASP tool to identify dependency vulnerabilities (CVEs)
The below command activates a gradle plugin (OWASP) and Identifies
and reports known vulnerabilities (CVEs) in OFBiz library dependencies.
The task takes time to complete, and once done, a report will be generated in
$OFBIZ_HOME/build/reports/dependency-check-report.html
`gradlew -PenableOwasp dependencyCheckAnalyze`
#### Setup eclipse project for OFBiz
Setting up OFBiz on eclipse is done by simply running the below command
and then importing the project to eclipse. This command will generate
the necessary __.classpath__ and __.project__ files for eclipse and it
will also make the source code for external libraries available in
eclipse (i.e. you can view source through Ctrl + Click)
The first time you run this command it will take a long time to execute
because it will download source packages available for project
dependencies.
`gradlew eclipse`
* * * * * * * * * * *
OFBiz plugin system
-------------------
OFBiz provides an extension mechanism through plugins. Plugins are standard
OFBiz components that reside in the plugins directory. Plugins can be
added manually or fetched from a maven repository. The standard tasks for
managing plugins are listed below.
>_Note_: OFBiz plugin versions follow [Semantic Versioning 2.0.0](http://semver.org/)
### Pull (download and install) a plugin automatically
Download a plugin with all its dependencies (plugins) and install them one-by-one
starting with the dependencies and ending with the plugin itself.
`gradlew pullPlugin -PdependencyId="org.apache.ofbiz.plugin:myplugin:0.1.0"`
If the plugin resides in a custom maven repository (not jcenter or localhost) then
you can use specify the repository using below command:
`gradlew pullPlugin -PrepoUrl="http://www.example.com/custom-maven" -PdependencyId="org.apache.ofbiz.plugin:myplugin:0.1.0"`
If you need username and password to access the custom repository:
`gradlew pullPlugin -PrepoUrl="http://www.example.com/custom-maven" -PrepoUser=myuser -PrepoPassword=mypassword -PdependencyId="org.apache.ofbiz.plugin:myplugin:0.1.0"`
### Pull an official plugin from source control
Download an official plugin from source control (currently subversion) and place
it in the plugins directory. In addition, this task also executes the "install"
task if it is defined for the plugin being downloaded.
This task is mostly useful when working on the trunk branch
as it pulls in the latest version of a plugin.
`gradlew pullPluginSource -PpluginId=ecommerce`
>_Note_: This plugin will have its own .svn directory placed inside the plugin directory.
### Pull all official plugins from source control
Download all officially supported plugins from source control (currently subversion)
and place them inclusive of their ".svn" directory in /plugins. WARNING! This task
deletes the /plugins directory and replaces it with the official plugins.
`gradlew pullAllPluginsSource`
This task makes it easy to download and develop officially supported plugins. It is
mostly used by developers or individuals working on the trunk branch. We do not
recommend using this task on releases of OFBiz, instead consider using the "pullPlugin"
task to get the correct version of a plugin compatible with your release.
>_Note_: All the plugins will share a .svn directory placed in the plugins directory.
### Install a plugin
If you have a plugin called mycustomplugin and want to install it in OFBiz follow the
below instructions:
- Extract the plugin if it is compressed
- Place the extracted directory into /plugins
- Run the below command
`gradlew installPlugin -PpluginId=myplugin`
The above commands executes the task "install" in the plugin's build.gradle
file if it exists
### Uninstall a plugin
If you have an existing plugin called mycustomplugin and you wish to uninstall
run the below command
`gradlew uninstallPlugin -PpluginId=myplugin`
The above command executes the task "uninstall" in the plugin's build.gradle
file if it exists
### Remove a plugin
Calls __uninstallPlugin__ on an existing plugin and then delete it from the file-system
`gradlew removePlugin -PpluginId=myplugin`
### Create a new plugin
Create a new plugin. The following project parameters are passed:
- pluginId: mandatory
- pluginResourceName: optional, default is the Capitalized value of pluginId
- webappName: optional, default is the value of pluginId
- basePermission: optional, default is the UPPERCASE value of pluginId
`gradlew createPlugin -PpluginId=myplugin`
`gradlew createPlugin -PpluginId=myplugin -PpluginResourceName=MyPlugin -PwebappName=mypluginweb -PbasePermission=MYSECURITY`
The above command creates a new plugin in /plugins/myplugin
### Push a plugin to a repository
This task publishes an OFBiz plugin into a maven package and then uploads it to
a maven repository. Currently, pushing is limited to localhost maven repository
(work in progress). To push a plugin the following parameters are passed:
- pluginId: mandatory
- groupId: optional, defaults to org.apache.ofbiz.plugin
- pluginVersion: optional, defaults to 0.1.0-SNAPSHOT
- pluginDescription: optional, defaults to "Publication of OFBiz plugin ${pluginId}"
`gradlew pushPlugin -PpluginId=myplugin`
`gradlew pushPlugin -PpluginId=mycompany -PpluginGroup=com.mycompany.ofbiz.plugin -PpluginVersion=1.2.3 -PpluginDescription="Introduce special functionality X"`
* * * * * * * * * * * *
Miscellaneous Documentation
---------------------------
### Further reading
* [Known issues](https://cwiki.apache.org/confluence/display/OFBIZ/FAQ+-+Tips+-+Tricks+-+Cookbook+-+HowTo#FAQ-Tips-Tricks-Cookbook-HowTo-Knownissues "Known issues")
### Repository and directory structure
OFBiz is split into two repositories:
- **ofbiz-framework**: Contains the core framework and main applications in
the system like accounting, party, order, etc
- **ofbiz-plugins**: Renamed from "special-purpose" and contains optional
components that are officially supported by the community
Furthermore, the hot-deploy directory is removed as the plugins directory works
as a replacement for both "special-purpose" and "hot-deploy".
If you need to load the components in the plugins directory in a specific order
place a component-load.xml file in the plugins directory listing the order.
To check out a plugin from source control use the **pullPluginSource** Gradle task.
To check out all plugins from source control use the **pullAllPluginsSource**.
**Beware** this deletes a previously existing plugins directory.
### Running gradle tasks without an internet connection
OFBiz must run with an internet connection the **first time** it is prepared on
the system because it needs to download all the required dependencies.
After preparing OFBiz the first time correctly, it is possible to run OFBiz
without an internet connection by using the `--offline` command line switch
which tells Gradle to fetch its dependencies from the cache.
If any dependencies are missing from the cache and you pass `--offline` switch
then the build execution will fail.
### Setup an external database like MySQL, PostgreSQL, etc
To setup an external database instead of the default embedded Apache Derby, you
will need to follow the following instructions:
1. Find the JDBC driver suitable for your database using one of the following
options:
* Search for the JDBC driver in [jcenter](https://bintray.com/bintray/jcenter)
and place it in build.gradle dependencies e.g.
`runtime 'mysql:mysql-connector-java:5.1.36'`
OR
* Download the JDBC driver jar and place it in $OFBIZ_HOME/lib or the lib
sub-directory of any component
2. Modify the entityengine.xml file located in $OFBIZ_HOME/framework/entity/config
to switch the default database to the one you selected. For more details you
can read the relevant section in the
[technical setup guide](https://cwiki.apache.org/confluence/display/OFBIZ/Apache+OFBiz+Technical+Production+Setup+Guide)
### Setup gradle tab-completion on Unix-like systems:
To get tab completion (auto complete gradle commands by pressing tab)
you can download the script from the below link and place it in the
appropriate location for your system.
[Gradle tab completion](https://edub.me/gradle-completion-bash)
For example, on debian based systems, you can use the following command:
`sudo curl -L -s https://edub.me/gradle-completion-bash -o /etc/bash_completion.d/gradle-tab-completion.bash`
* * * * * * * * * * * *
Crypto notice
-------------
This distribution includes cryptographic software. The country in
which you currently reside may have restrictions on the import,
possession, use, and/or re-export to another country, of
encryption software. BEFORE using any encryption software, please
check your country's laws, regulations and policies concerning the
import, possession, or use, and re-export of encryption software, to
see if this is permitted. See <http://www.wassenaar.org/> for more
information.
The U.S. Government Department of Commerce, Bureau of Industry and
Security (BIS), has classified this software as Export Commodity
Control Number (ECCN) 5D002.C.1, which includes information security
software using or performing cryptographic functions with asymmetric
algorithms. The form and manner of this Apache Software Foundation
distribution makes it eligible for export under the License Exception
ENC Technology Software Unrestricted (TSU) exception (see the BIS
Export Administration Regulations, Section 740.13) for both object
code and source code.
The following provides more details on the included cryptographic
software:
- Various classes in OFBiz, including DesCrypt, HashCrypt, and
BlowFishCrypt use libraries from the Sun Java JDK API including
java.security.* and javax.crypto.* (the JCE, Java Cryptography
Extensions API)
- Other classes such as HttpClient and various related ones use
the JSSE (Java Secure Sockets Extension) API
+1 -1
View File
@@ -1 +1 @@
17.12.01
17.12
@@ -18,7 +18,7 @@
specific language governing permissions and limitations
under the License.
-->
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
<property key="AcctgTransType.description.AMORTIZATION">
<value xml:lang="ar">الإطفاء</value>
<value xml:lang="de">Amortisation</value>
@@ -18,7 +18,7 @@
specific language governing permissions and limitations
under the License.
-->
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
<property key="AccountingCheckAccountCannotBeUpdated">
<value xml:lang="en">ERROR: Could not update Check Account.</value>
</property>
@@ -18,7 +18,7 @@
specific language governing permissions and limitations
under the License.
-->
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
<property key="AccountingAccount">
<value xml:lang="ar">حساب</value>
<value xml:lang="cs">Účet</value>
@@ -33,7 +33,7 @@ under the License.
organizationPartyId="Company" ownerPartyId="Company" postToGlAccountId="231000" isRefundable="Y" replenishLevel="0.00" actualBalance="0.00" availableBalance="0.00"/>
<FinAccountStatus finAccountId="AMEX_01" statusId="FNACT_ACTIVE" statusDate="2009-04-01 00:00:01.000"/>
<PaymentMethod paymentMethodId="AMEX_01" paymentMethodTypeId="CREDIT_CARD" partyId="Company" description="AmEx 0005" glAccountId="231000" finAccountId="AMEX_01" fromDate="2009-04-01 00:00:00.000"/>
<CreditCard paymentMethodId="AMEX_01" cardType="CCT_AMERICANEXPRESS" cardNumber="378282246310005" expireDate="02/2020" companyNameOnCard="Your Company Name"
<CreditCard paymentMethodId="AMEX_01" cardType="CCT_AMERICANEXPRESS" cardNumber="378282246310005" expireDate="02/2120" companyNameOnCard="Your Company Name"
titleOnCard="" firstNameOnCard="Smart" middleNameOnCard="" lastNameOnCard="Guy" suffixOnCard="" contactMechId="9000"/>
<PaymentMethod paymentMethodId="PETTY_CASH" paymentMethodTypeId="CASH" partyId="Company" description="Petty Cash" glAccountId="110000" fromDate="2009-04-01 00:00:00.000"/>
+1 -1
View File
@@ -19,7 +19,7 @@
-->
<entity-eca xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/entity-eca.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/entity-eca.xsd">
<!-- To maintain FinAccount.actualBalance and FinAccount.availableBalance -->
<eca entity="FinAccountTrans" operation="create-store" event="return">
@@ -19,7 +19,7 @@ under the License.
-->
<entitymodel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/entitymodel.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/entitymodel.xsd">
<!-- ========================================================= -->
<!-- ======================== Defaults ======================= -->
<!-- ========================================================= -->
@@ -78,8 +78,8 @@ under the License.
<!-- TODO: somehow determine if this is an order placed against the account or some other type of withdrawal -->
<!-- TODO: handle order placed against (paid for with) the account -->
<set field="quickCreateAcctgTransAndEntries.debitGlAccountId" from-field="glAccountId"/>
<set field="quickCreateAcctgTransAndEntries.creditGlAccountId" from-field="parameters.glAccountId"/>
<set field="quickCreateAcctgTransAndEntries.debitGlAccountId" from-field="parameters.glAccountId"/>
<set field="quickCreateAcctgTransAndEntries.creditGlAccountId" from-field="glAccountId"/>
<set field="quickCreateAcctgTransAndEntries.acctgTransTypeId" value="PAYMENT_ACCTG_TRANS"/>
</then>
</else-if>
@@ -89,6 +89,12 @@ under the License.
<!-- if positive will go to one account for write-off, if negative will go to another account for a fee -->
<!-- these will reverse depending on positive/negative amount -->
<if-compare field="finAccountTrans.amount" operator="less" value="0">
<calculate field="quickCreateAcctgTransAndEntries.amount" decimal-scale="${ledgerDecimals}" rounding-mode="${roundingMode}">
<calcop operator="multiply">
<calcop operator="get" field="quickCreateAcctgTransAndEntries.amount"/>
<number value="-1"/>
</calcop>
</calculate>
<set field="quickCreateAcctgTransAndEntries.debitGlAccountId" from-field="parameters.glAccountId"/>
<set field="quickCreateAcctgTransAndEntries.creditGlAccountId" from-field="glAccountId"/>
<set field="quickCreateAcctgTransAndEntries.acctgTransTypeId" value="OUTGOING_PAYMENT"/>
@@ -70,7 +70,8 @@ under the License.
<field-map field-name="finAccountId" value="1002"/>
</entity-one>
<assert>
<if-empty field="finAccount"/>
<not><if-empty field="finAccount"/></not>
<not><if-empty field="finAccount.thruDate"/></not>
</assert>
<check-errors/>
</simple-method>
+1 -1
View File
@@ -20,7 +20,7 @@ under the License.
<ofbiz-component name="accounting"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-component.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/ofbiz-component.xsd">
<resource-loader name="main" type="component"/>
<classpath type="dir" location="config"/>
@@ -19,7 +19,7 @@ under the License.
-->
<service-group xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/service-group.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/service-group.xsd">
<group name="createCreditCardAndAddress" send-mode="all">
<invoke name="createPostalAddress" mode="sync" result-to-context="true"/>
+1 -1
View File
@@ -19,7 +19,7 @@ under the License.
-->
<service-eca xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/service-eca.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/service-eca.xsd">
<eca service="createPaymentApplication" event="commit">
<condition field-name="invoiceId" operator="is-not-empty"/>
@@ -19,7 +19,7 @@ under the License.
-->
<service-eca xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/service-eca.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/service-eca.xsd">
<!-- On cancelling invoice reverse its Accounting Transactions -->
<eca service="cancelInvoice" event="invoke">
@@ -19,7 +19,7 @@ under the License.
-->
<service-eca xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/service-eca.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/service-eca.xsd">
<!-- this eca automatically posts the accounting transactions to GL -->
<eca service="createAcctgTransAndEntries" event="commit">
@@ -19,7 +19,7 @@ under the License.
-->
<service-eca xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/service-eca.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/service-eca.xsd">
<!-- these SECAs are for automatically creating accounting transactions based on business transactions.
They should normally be "sync" SECAs so that they happen as soon
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Accounting Services - Miscellaneous</description>
<vendor>OFBiz</vendor>
<version>1.0</version>
@@ -18,7 +18,7 @@ specific language governing permissions and limitations
under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Accounting Services: Agreements </description>
<vendor>OFBiz</vendor>
<version>1.0</version>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Accounting Services</description>
<vendor>OFBiz</vendor>
<version>1.0</version>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Accounting Services</description>
<vendor>OFBiz</vendor>
<version>1.0</version>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Accounting Services: Budget</description>
<vendor>Apache OFBiz</vendor>
<version>1.0</version>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Clear Commerce Services</description>
<vendor>OFBiz</vendor>
<version>1.0</version>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Cost Services</description>
<vendor>OFBiz</vendor>
<version>1.0</version>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Accounting Services</description>
<vendor>OFBiz</vendor>
<version>1.0</version>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Accounting Services: Financial Account</description>
<vendor>OFBiz</vendor>
<version>1.0</version>
@@ -48,7 +48,7 @@ under the License.
<attribute name="replenishPaymentId" type="String" mode="OUT" optional="true"/>
<attribute name="replenishLevel" type="BigDecimal" mode="OUT" optional="true"/>
</service>
<service name="deleteFinAccount" default-entity-name="FinAccount" engine="entity-auto" invoke="delete">
<service name="deleteFinAccount" default-entity-name="FinAccount" engine="entity-auto" invoke="expire">
<description>Delete a Financial Account</description>
<auto-attributes mode="IN" optional="false" include="pk"/>
</service>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Accounting Services: Fixed Asset </description>
<vendor>OFBiz</vendor>
<version>1.0</version>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Accounting Services</description>
<vendor>OFBiz</vendor>
<version>1.0</version>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Accounting Services</description>
<vendor>OFBiz</vendor>
<version>1.0</version>
@@ -556,7 +556,7 @@ under the License.
<attribute name="customTimePeriodId" mode="IN" type="String"/>
<attribute name="previousTimePeriod" mode="OUT" type="Map" optional="true"/>
</service>
<service name="getAcctgTransEntriesAndTransTotal" engine="simple" invoke="getAcctgTransEntriesAndTransTotal"
<service name="getAcctgTransEntriesAndTransTotal" engine="simple" invoke="getAcctgTransEntriesAndTransTotal"
location="component://accounting/minilang/ledger/AcctgTransServices.xml" auth="true">
<description>Given AcctgTransAndEntire and Calculate acctg trans total for specific time period.</description>
<attribute name="customTimePeriodStartDate" mode="IN" type="Timestamp"/>
@@ -581,7 +581,7 @@ under the License.
<attribute name="debitCreditDifference" type="BigDecimal" mode="OUT"/>
</service>
<service name="revertAcctgTransOnCancelInvoice" engine="simple"
<service name="revertAcctgTransOnCancelInvoice" engine="simple"
location="component://accounting/minilang/ledger/AcctgTransServices.xml" invoke="revertAcctgTransOnCancelInvoice" auth="true">
<description>Reverting Accounting Transaction And Entries on Canceling an Invoice</description>
<attribute name="invoiceId" mode="IN" type="String" optional="false"/>
@@ -589,7 +589,7 @@ under the License.
<service name="revertAcctgTransOnRemovePaymentApplications" engine="simple"
location="component://accounting/minilang/ledger/AcctgTransServices.xml" invoke="revertAcctgTransOnRemovePaymentApplications" auth="true">
<description>Create Reverse Accounting Transaction and Entries on removing PaymentApplication records.</description>
<attribute name="paymentApplicationId" mode="IN" type="String" optional="false"/>
<attribute name="paymentApplicationId" mode="IN" type="String" optional="false"/>
</service>
<service name="createGlAccountCategory" engine="entity-auto" default-entity-name="GlAccountCategory" invoke="create" auth="true">
@@ -656,7 +656,7 @@ under the License.
<attribute name="oldStatusId" type="String" mode="OUT" optional="true"/>
</service>
<service name="createUpdateCostCenter" engine="java" auth="true" invoke="createUpdateCostCenter"
<service name="createUpdateCostCenter" engine="java" auth="true" invoke="createUpdateCostCenter"
location="org.apache.ofbiz.accounting.ledger.GeneralLedgerServices">
<description>Create Update CostCenters</description>
<attribute name="glAccountId" mode="IN" type="String"/>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>OrbitalGateway Services</description>
<vendor></vendor>
<version>1.0</version>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Accounting Services</description>
<vendor>OFBiz</vendor>
<version>1.0</version>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Accounting Payment Gateway Config Services</description>
<vendor>OFBiz</vendor>
<version>1.0</version>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Accounting Services</description>
<vendor>OFBiz</vendor>
<version>1.0</version>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>PayPal Services</description>
<service name="payPalSetExpressCheckout" engine="java"
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Accounting Services</description>
<vendor>OFBiz</vendor>
<version>1.0</version>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Accounting Permission Services</description>
<vendor>OFBiz</vendor>
<version>1.0</version>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Accounting Services: Rate and related services</description>
<vendor>OFBiz</vendor>
<version>1.0</version>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Accounting Services</description>
<vendor>OFBiz</vendor>
<version>1.0</version>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Accounting Services</description>
<vendor>OFBiz</vendor>
<version>1.0</version>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Accounting Services</description>
<vendor>OFBiz</vendor>
<version>1.0</version>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Accounting Services: TaxAuthority and related </description>
<vendor>OFBiz</vendor>
<version>1.0</version>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Accounting Services</description>
<vendor>OFBiz</vendor>
<version>1.0</version>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Accounting Services</description>
<vendor>OFBiz</vendor>
<version>1.0</version>
@@ -23,6 +23,7 @@ import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.KeyFactory;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
@@ -59,7 +60,9 @@ import javax.crypto.spec.DHPrivateKeySpec;
import javax.crypto.spec.DHPublicKeySpec;
import javax.crypto.spec.IvParameterSpec;
import org.apache.commons.codec.binary.Base64;
import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.GeneralException;
import org.apache.ofbiz.base.util.HttpClient;
import org.apache.ofbiz.base.util.HttpClientException;
import org.apache.ofbiz.base.util.StringUtil;
@@ -154,14 +157,23 @@ public class ValueLinkApi {
* @return Hex String of the encrypted pin (EAN) for transmission to ValueLink
*/
public String encryptPin(String pin) {
byte[] rawIv = new byte[8];
SecureRandom random = new SecureRandom();
random.nextBytes(rawIv);
IvParameterSpec iv = new IvParameterSpec(rawIv);
// get the Cipher
Cipher mwkCipher = this.getCipher(this.getMwkKey(), Cipher.ENCRYPT_MODE);
Cipher mwkCipher = null;
try {
mwkCipher = getCipher(this.getMwkKey(), Cipher.ENCRYPT_MODE, iv);
} catch (GeneralException e1) {
Debug.logError(e1, module);
}
// pin to bytes
byte[] pinBytes = pin.getBytes(StandardCharsets.UTF_8);
// 7 bytes of random data
byte[] random = this.getRandomBytes(7);
byte[] randomBytes = this.getRandomBytes(7);
// pin checksum
byte[] checkSum = this.getPinCheckSum(pinBytes);
@@ -169,8 +181,8 @@ public class ValueLinkApi {
// put all together
byte[] eanBlock = new byte[16];
int i;
for (i = 0; i < random.length; i++) {
eanBlock[i] = random[i];
for (i = 0; i < randomBytes.length; i++) {
eanBlock[i] = randomBytes[i];
}
eanBlock[7] = checkSum[0];
for (i = 0; i < pinBytes.length; i++) {
@@ -200,11 +212,26 @@ public class ValueLinkApi {
/**
* Decrypt an encrypted pin using the configured keys
* @param pin Hex String of the encrypted pin (EAN)
* @return Plain text String of the pin
* @return Plain text String of the pin @
*/
public String decryptPin(String pin) {
// get the Cipher
Cipher mwkCipher = this.getCipher(this.getMwkKey(), Cipher.DECRYPT_MODE);
// separate prefix with IV from the rest of encrypted data
byte[] encryptedPayload = Base64.decodeBase64(pin.getBytes());
byte[] iv = new byte[8];
byte[] encryptedBytes = new byte[encryptedPayload.length - iv.length];
// populate iv with bytes:
System.arraycopy(encryptedPayload, 0, iv, 0, iv.length);
// populate encryptedBytes with bytes:
System.arraycopy(encryptedPayload, iv.length, encryptedBytes, 0, encryptedBytes.length);
Cipher mwkCipher = null;
try {
mwkCipher = getCipher(getMwkKey(), Cipher.ENCRYPT_MODE, new IvParameterSpec(iv));
} catch (GeneralException e1) {
Debug.logError(e1, module);
}
// decrypt pin
String decryptedPinString = null;
@@ -271,7 +298,7 @@ public class ValueLinkApi {
}
/**
* Output the creation of public/private keys + KEK to the console for manual database update
* Output the creation of public/private keys + KEK to the console for manual database update @
*/
public StringBuffer outputKeyCreation(boolean kekOnly, String kekTest) {
return this.outputKeyCreation(0, kekOnly, kekTest);
@@ -340,8 +367,18 @@ public class ValueLinkApi {
byte[] loadKekBytes = loadedKek.getEncoded();
// test the KEK
Cipher cipher = this.getCipher(this.getKekKey(), Cipher.ENCRYPT_MODE);
byte[] kekTestB = { 0, 0, 0, 0, 0, 0, 0, 0 };
byte[] rawIv = new byte[8];
SecureRandom secRandom = new SecureRandom();
secRandom.nextBytes(rawIv);
IvParameterSpec iv = new IvParameterSpec(rawIv);
Cipher cipher = null;
try {
cipher = getCipher(this.getKekKey(), Cipher.ENCRYPT_MODE, iv);
} catch (GeneralException e1) {
Debug.logError(e1, module);
}
byte[] kekTestB = {0, 0, 0, 0, 0, 0, 0, 0 };
byte[] kekTestC = new byte[0];
if (kekTest != null) {
kekTestB = StringUtil.fromHexString(kekTest);
@@ -496,7 +533,7 @@ public class ValueLinkApi {
/**
* Generate a new MWK
* @return Hex String of the new encrypted MWK ready for transmission to ValueLink
* @return Hex String of the new encrypted MWK ready for transmission to ValueLink @
*/
public byte[] generateMwk() {
KeyGenerator keyGen = null;
@@ -535,7 +572,7 @@ public class ValueLinkApi {
/**
* Generate a new MWK
* @param desBytes byte array of the DES key (24 bytes)
* @return Hex String of the new encrypted MWK ready for transmission to ValueLink
* @return Hex String of the new encrypted MWK ready for transmission to ValueLink @
*/
public byte[] generateMwk(byte[] desBytes) {
if (debug) {
@@ -570,7 +607,7 @@ public class ValueLinkApi {
/**
* Generate a new MWK
* @param mwkdes3 pre-generated DES3 SecretKey
* @return Hex String of the new encrypted MWK ready for transmission to ValueLink
* @return Hex String of the new encrypted MWK ready for transmission to ValueLink @
*/
public byte[] generateMwk(SecretKey mwkdes3) {
// zeros for checksum
@@ -581,9 +618,18 @@ public class ValueLinkApi {
Random ran = new SecureRandom();
ran.nextBytes(random);
byte[] rawIv = new byte[8];
SecureRandom secRandom = new SecureRandom();
secRandom.nextBytes(rawIv);
IvParameterSpec iv = new IvParameterSpec(rawIv);
// open a cipher using the new mwk
Cipher cipher = this.getCipher(mwkdes3, Cipher.ENCRYPT_MODE);
Cipher cipher = null;
try {
cipher = getCipher(mwkdes3, Cipher.ENCRYPT_MODE, iv);
} catch (GeneralException e1) {
Debug.logError(e1, module);
}
// make the checksum - encrypted 8 bytes of 0's
byte[] encryptedZeros = new byte[0];
@@ -617,7 +663,12 @@ public class ValueLinkApi {
* @return encrypted byte array
*/
public byte[] encryptViaKek(byte[] content) {
return cryptoViaKek(content, Cipher.ENCRYPT_MODE);
try {
return cryptoViaKek(content, Cipher.ENCRYPT_MODE);
} catch (GeneralException e1) {
Debug.logError(e1, module);
}
return null;
}
/**
@@ -626,7 +677,12 @@ public class ValueLinkApi {
* @return decrypted byte array
*/
public byte[] decryptViaKek(byte[] content) {
return cryptoViaKek(content, Cipher.DECRYPT_MODE);
try {
return cryptoViaKek(content, Cipher.DECRYPT_MODE);
} catch (GeneralException e1) {
Debug.logError(e1, module);
}
return null;
}
/**
@@ -772,46 +828,50 @@ public class ValueLinkApi {
return dhParamSpec;
}
// actual kek encryption/decryption code
protected byte[] cryptoViaKek(byte[] content, int mode) {
/**
* actual kek encryption/decryption code
* @throws GeneralException
*/
protected byte[] cryptoViaKek(byte[] content, int mode) throws GeneralException {
// open a cipher using the kek for transport
Cipher cipher = this.getCipher(this.getKekKey(), mode);
byte[] dec = new byte[0];
byte[] rawIv = new byte[8];
SecureRandom random = new SecureRandom();
random.nextBytes(rawIv);
IvParameterSpec iv = new IvParameterSpec(rawIv);
// Create the Cipher - DESede/CBC/PKCS5Padding
byte[] encBytes = null;
Cipher cipher = getCipher(getKekKey(), mode, iv);
try {
dec = cipher.doFinal(content);
} catch (IllegalStateException e) {
Debug.logError(e, module);
} catch (IllegalBlockSizeException e) {
Debug.logError(e, module);
} catch (BadPaddingException e) {
encBytes = cipher.doFinal(content);
} catch (IllegalStateException | BadPaddingException | IllegalBlockSizeException e) {
Debug.logError(e, module);
}
return dec;
// Prepend iv as a prefix to use it during decryption
byte[] combinedPayload = new byte[rawIv.length + encBytes.length];
// populate payload with prefix iv and encrypted data
System.arraycopy(iv, 0, combinedPayload, 0, rawIv.length);
System.arraycopy(cipher, 0, combinedPayload, 8, encBytes.length);
return encBytes;
}
// return a cipher for a key - DESede/CBC/NoPadding IV = 0
protected Cipher getCipher(SecretKey key, int mode) {
byte[] zeros = { 0, 0, 0, 0, 0, 0, 0, 0 };
IvParameterSpec iv = new IvParameterSpec(zeros);
// return a cipher for a key - DESede/CBC/NoPadding with random IV
protected static Cipher getCipher(Key key, int mode, IvParameterSpec iv) throws GeneralException {
// create the Cipher - DESede/CBC/NoPadding
Cipher mwkCipher = null;
Cipher cipher = null;
try {
mwkCipher = Cipher.getInstance("DESede/CBC/NoPadding");
} catch (NoSuchAlgorithmException e) {
Debug.logError(e, module);
return null;
} catch (NoSuchPaddingException e) {
Debug.logError(e, module);
cipher = Cipher.getInstance("DESede/CBC/NoPadding");
} catch (NoSuchAlgorithmException | NoSuchPaddingException e) {
throw new GeneralException(e);
}
try {
mwkCipher.init(mode, key, iv);
} catch (InvalidKeyException e) {
Debug.logError(e, "Invalid key", module);
} catch (InvalidAlgorithmParameterException e) {
Debug.logError(e, module);
cipher.init(mode, key, iv);
} catch (InvalidKeyException | InvalidAlgorithmParameterException e) {
throw new GeneralException(e);
}
return mwkCipher;
return cipher;
}
protected byte[] getPinCheckSum(byte[] pinBytes) {
@@ -298,6 +298,11 @@ under the License.
<input type="text" size='14' name='fromDate' />
<span class="label">${uiLabelMap.CommonThruDate}</span>
<input type="text" size='14' name='thruDate' />
<span class="label">${uiLabelMap.FormFieldTitle_isClosed}:</span>
<select name="isClosed">
<option value="N">${uiLabelMap.CommonN}</option>
<option value="Y">${uiLabelMap.CommonY}</option>
</select>
<input type="submit" value="${uiLabelMap.CommonAdd}" />
</div>
</form>
@@ -20,7 +20,7 @@
<test-suite suite-name="accountingtests"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/test-suite.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/test-suite.xsd">
<test-case case-name="accounting-tests-data-load">
<entity-xml action="load" entity-xml-url="component://accounting/testdef/data/AccountingTestsData.xml"/>
@@ -20,7 +20,7 @@
<test-suite suite-name="fixedassettests"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/test-suite.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/test-suite.xsd">
<test-case case-name="fixedasset-tests">
<simple-method-test location="component://accounting/minilang/test/FixedAssetTests.xml"/>
@@ -20,7 +20,7 @@
<test-suite suite-name="invoicetests"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/test-suite.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/test-suite.xsd">
<test-case case-name="auto-invoice-tests">
<simple-method-test location="component://accounting/minilang/test/AutoInvoiceTests.xml"/>
@@ -20,7 +20,7 @@
<test-suite suite-name="paymentappltests"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/test-suite.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/test-suite.xsd">
<test-case case-name="application-tests-data-load">
<entity-xml action="load" entity-xml-url="component://accounting/testdef/data/PaymentApplicationTestsData.xml"/>
@@ -20,7 +20,7 @@
<test-suite suite-name="paymenttests"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/test-suite.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/test-suite.xsd">
<test-case case-name="auto-payment-tests">
<simple-method-test location="component://accounting/minilang/test/AutoPaymentTests.xml"/>
@@ -20,7 +20,7 @@
<test-suite suite-name="ratetests"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/test-suite.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/test-suite.xsd">
<test-case case-name="rate-tests-data-load">
<entity-xml action="load" entity-xml-url="component://accounting/testdef/data/RateTestsData.xml"/>
</test-case>
@@ -19,7 +19,7 @@ specific language governing permissions and limitations
under the License.
-->
<web-app version="3.0">
<web-app version="4.0" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd">
<display-name>Apache OFBiz - Accounting Manager</display-name>
<description>Accounting Manager Module of the Apache OFBiz Project</description>
@@ -62,6 +62,11 @@ under the License.
<filter-name>ContextFilter</filter-name>
<filter-class>org.apache.ofbiz.webapp.control.ContextFilter</filter-class>
</filter>
<filter>
<display-name>SameSiteFilter</display-name>
<filter-name>SameSiteFilter</filter-name>
<filter-class>org.apache.ofbiz.webapp.control.SameSiteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ControlFilter</filter-name>
<url-pattern>/*</url-pattern>
@@ -70,6 +75,10 @@ under the License.
<filter-name>ContextFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>SameSiteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener><listener-class>org.apache.ofbiz.webapp.control.ControlEventListener</listener-class></listener>
<listener><listener-class>org.apache.ofbiz.webapp.control.LoginEventListener</listener-class></listener>
@@ -15,7 +15,7 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<web-app version="3.0">
<web-app version="4.0" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd">
<display-name>Apache OFBiz - Account Payable</display-name>
<description>Accounting Payable Module of the Apache OFBiz Project</description>
@@ -58,6 +58,11 @@ under the License.
<filter-name>ContextFilter</filter-name>
<filter-class>org.apache.ofbiz.webapp.control.ContextFilter</filter-class>
</filter>
<filter>
<display-name>SameSiteFilter</display-name>
<filter-name>SameSiteFilter</filter-name>
<filter-class>org.apache.ofbiz.webapp.control.SameSiteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ControlFilter</filter-name>
<url-pattern>/*</url-pattern>
@@ -66,6 +71,10 @@ under the License.
<filter-name>ContextFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>SameSiteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener><listener-class>org.apache.ofbiz.webapp.control.ControlEventListener</listener-class></listener>
<listener><listener-class>org.apache.ofbiz.webapp.control.LoginEventListener</listener-class></listener>
<!-- NOTE: not all app servers support mounting implementations of the HttpSessionActivationListener interface -->
@@ -19,7 +19,7 @@ specific language governing permissions and limitations
under the License.
-->
<web-app version="3.0">
<web-app version="4.0" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd">
<display-name>Apache OFBiz - Account Receivable</display-name>
<description>Accounting Receivable Module of the Apache OFBiz Project</description>
@@ -62,6 +62,11 @@ under the License.
<filter-name>ContextFilter</filter-name>
<filter-class>org.apache.ofbiz.webapp.control.ContextFilter</filter-class>
</filter>
<filter>
<display-name>SameSiteFilter</display-name>
<filter-name>SameSiteFilter</filter-name>
<filter-class>org.apache.ofbiz.webapp.control.SameSiteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ControlFilter</filter-name>
<url-pattern>/*</url-pattern>
@@ -70,6 +75,10 @@ under the License.
<filter-name>ContextFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>SameSiteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener><listener-class>org.apache.ofbiz.webapp.control.ControlEventListener</listener-class></listener>
<listener><listener-class>org.apache.ofbiz.webapp.control.LoginEventListener</listener-class></listener>
@@ -165,7 +165,7 @@ under the License.
<field name="submitButton" title="${uiLabelMap.CommonFind}" widget-style="smallSubmit"><submit button-type="button"/></field>
</form>
<form name="ListPayment" list-name="listIt" title="" paginate-target="LookupPayment"
<form name="ListPayment" list-name="listIt" title="" type="list" paginate-target="LookupPayment"
odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
<actions>
<service service-name="performFind" result-map="result" result-map-list="listIt">
@@ -18,7 +18,7 @@ specific language governing permissions and limitations
under the License.
-->
<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://ofbiz.apache.org/Widget-Form" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form http://ofbiz.apache.org/dtds/widget-form.xsd">
<form name="FindFinAccounts" type="single" target="FindFinAccount"
@@ -73,7 +73,7 @@ under the License.
<parameter param-name="partyId" from-field="ownerPartyId"/>
</hyperlink>
</field>
<field name="deleteLink" title=" " widget-style="buttontext">
<field name="deleteLink" title=" " widget-style="buttontext" use-when="thruDate==null">
<hyperlink description="${uiLabelMap.CommonDelete}" target="deleteFinAccount" also-hidden="false">
<parameter param-name="finAccountId"/>
</hyperlink>
@@ -336,7 +336,7 @@ under the License.
<field name="glReconciliationId" position="2">
<drop-down allow-empty="true">
<option key="_NA_" description="${uiLabelMap.CommonNotAssigned}"/>
<list-options list-name="glReconciliations" key-name="glReconciliationId"
<list-options list-name="glReconciliations" key-name="glReconciliationId"
description="${glReconciliationName}[[${glReconciliationId}] [${reconciledDate}] [${reconciledBalance}]]"/>
</drop-down>
</field>
@@ -346,17 +346,17 @@ under the License.
<field name="thruEntryDate" position="2"><date-time/></field>
<field name="searchButton" widget-style="smallSubmit"><submit button-type="button"/></field>
</form>
<form name="FindBankReconciliationFinAcctTrans" target="BankReconciliation"
<form name="FindBankReconciliationFinAcctTrans" target="BankReconciliation"
extends="FindFinAccountTransactions">
<field name="statusId" title="${uiLabelMap.CommonStatus}"><display-entity entity-name="StatusItem"/></field>
<field name="glReconciliationId" position="2">
<drop-down>
<list-options list-name="glReconciliations" key-name="glReconciliationId"
<list-options list-name="glReconciliations" key-name="glReconciliationId"
description="${glReconciliationName}[[${glReconciliationId}] [${reconciledDate}] [${reconciledBalance}]]"/>
</drop-down>
</field>
</form>
<form name="EditDepositPayment" extends="EditPayment"
<form name="EditDepositPayment" extends="EditPayment"
extends-resource="component://accounting/widget/PaymentForms.xml" target="createDepositPayment">
<actions>
<entity-one entity-name="FinAccount" value-field="finAccount"/>
@@ -400,12 +400,8 @@ under the License.
</actions>
<alt-target use-when="glReconciliationId != null" target="updateFinAccountGlReconciliation"/>
<field name="finAccountId"><hidden value="${finAccountId}"/></field>
<field name="glReconciliationId" use-when="glReconciliationId == null"><ignored/></field>
<field name="glReconciliationId" use-when="glReconciliationId != null"><display/></field>
<field name="glAccountId"><hidden value="${finAccount.postToGlAccountId}"/></field>
<field name="organizationPartyId"><lookup target-form-name="LookupPartyName"/></field>
<field name="reconciledBalance" use-when="${reconciledBalance == null}"><hidden/></field>
<field name="reconciledBalance" use-when="&quot;GLREC_RECONCILED&quot;.equals(&quot;${glReconciliation.statusId}&quot;)"><display type="currency" currency="${defaultOrganizationPartyCurrencyUomId}"/></field>
<field name="reconciledDate" title="${uiLabelMap.AccountingReconciliationDate}"><date-time/></field>
<field name="createButton" use-when="glReconciliationId == null" widget-style="smallSubmit">
<submit button-type="button"/>
+3 -3
View File
@@ -18,7 +18,7 @@ specific language governing permissions and limitations
under the License.
-->
<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://ofbiz.apache.org/Widget-Form" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form http://ofbiz.apache.org/dtds/widget-form.xsd">
<form name="FindAcctgTrans" target="FindAcctgTrans" type="single" title="" default-map-name="journal"
@@ -763,7 +763,7 @@ under the License.
<field name="description"><textarea/></field>
<field name="createButton" widget-style="smallSubmit"><submit button-type="button"/></field>
<sort-order>
<sort-field name="organizationPartyId"/>
<sort-field name="organizationPartyId"/>
<sort-field name="acctgTransTypeId"/>
<sort-field name="glFiscalTypeId"/>
<sort-field name="glJournalId"/>
@@ -861,7 +861,7 @@ under the License.
</field>
<field name="reconciledDate"><date-time/></field>
<field name="organizationPartyId"><display/></field>
<field name="reconciledBalance"><display/></field>
<field name="reconciledBalance" use-when="&quot;GLREC_RECONCILED&quot;.equals(&quot;${glReconciliation.statusId}&quot;)"><display type="currency" currency="${defaultOrganizationPartyCurrencyUomId}"/></field>
<field name="openingBalance" use-when="${groovy:'GLREC_RECONCILED'.equals(glReconciliation?.statusId)}"><display/></field>
<field use-when="glReconciliationId!=null" name="updateButton" title="${uiLabelMap.CommonUpdate}" widget-style="buttontext" ><submit button-type="text-link"/></field>
</form>
@@ -18,7 +18,7 @@ specific language governing permissions and limitations
under the License.
-->
<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://ofbiz.apache.org/Widget-Form" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form http://ofbiz.apache.org/dtds/widget-form.xsd">
<form name="ListCompanies" type="list" title="Internal Organizations" list-name="parties"
@@ -370,7 +370,7 @@ under the License.
</field>
<field name="errorGlJournalId" tooltip="${groovy: import org.apache.ofbiz.base.util.UtilProperties;
if((partyAcctgPreference==null&amp;&amp;aggregatedPartyAcctgPreference!= null&amp;&amp;aggregatedPartyAcctgPreference.get('errorGlJournalId')!=null) ||
(partyAcctgPreference!=null&amp;&amp;partyAcctgPreference.get('errorGlJournalId')==null&amp;&amp;aggregatedPartyAcctgPreference!= null&amp;&amp;aggregatedPartyAcctgPreference.get('errorGlJournalId')!=null))return
(partyAcctgPreference!=null&amp;&amp;partyAcctgPreference.get('errorGlJournalId')==null&amp;&amp;aggregatedPartyAcctgPreference!= null&amp;&amp;aggregatedPartyAcctgPreference.get('errorGlJournalId')!=null))return
(UtilProperties.getMessage('AccountingUiLabels', 'AccountingInheritedValue', locale))}">
<drop-down allow-empty="true">
<entity-options entity-name="GlJournal" key-field-name="glJournalId" description="${glJournalName} [${glJournalId}]">
@@ -1103,7 +1103,7 @@ under the License.
<field name="glAccountClassId"><display-entity entity-name="GlAccountClass" key-field-name="glAccountClassId"/></field>
<field name="glResourceTypeId"><display-entity entity-name="GlResourceType" key-field-name="glResourceTypeId"/></field>
<field name="glXbrlClassId"><display-entity entity-name="GlXbrlClass" key-field-name="glXbrlClassId"/></field>
<field name="parentGlAccountId"><display-entity entity-name="GlAccount" key-field-name="glAccountId" description="${parentGlAccountId}"/></field>
<field name="parentGlAccountId"><display-entity entity-name="GlAccount" key-field-name="glAccountId" description="${parentGlAccountId}"/></field>
<field name="accountCode" ><display-entity entity-name="GlAccount" key-field-name="glAccountId" description="${accountCode}"/></field>
<field name="accountName" ><display-entity entity-name="GlAccount" key-field-name="glAccountId" description="${accountName}"/></field>
<field name="description"><display description="${description}"/></field>
@@ -69,10 +69,8 @@ under the License.
<field-map field-name="compareDate" from-field="invoiceDate"/>
<field-map field-name="lastNameFirst" value="Y"/>
</service>
<set field="amountToApply" value="${groovy:org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(delegator,invoiceId)
.multiply(org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceCurrencyConversionRate(delegator,invoiceId))}"/>
<set field="total" value="${groovy:org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotal(delegator,invoiceId)
.multiply(org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceCurrencyConversionRate(delegator,invoiceId))}"/>
<set field="amountToApply" value="${groovy:org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(delegator,invoiceId)}"/>
<set field="total" value="${groovy:org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotal(delegator,invoiceId)}"/>
</row-actions>
<field name="invoiceId" widget-style="buttontext" sort-field="true">
@@ -891,6 +891,11 @@ under the License.
<set field="fromDate" from-field="parameters.fromDate" type="Timestamp"/>
<set field="thruDate" from-field="parameters.thruDate" type="Timestamp"/>
<set field="glFiscalTypeId" from-field="parameters.glFiscalTypeId" default-value="ACTUAL"/>
<service service-name="getPartyAccountingPreferences" result-map="result">
<field-map field-name="organizationPartyId" value="${groovy:parameters.get('ApplicationDecorator|organizationPartyId')}"/>
</service>
<set field="partyAcctgPreference" from-field="result.partyAccountingPreference"/>
<set field="currencyUomId" from-field="partyAcctgPreference.baseCurrencyUomId"/>
<script location="component://accounting/groovyScripts/reports/IncomeStatement.groovy"/>
</actions>
<widgets>
@@ -18,7 +18,7 @@
specific language governing permissions and limitations
under the License.
-->
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
<property key="CommonExtCreatePublicMessage">
<value xml:lang="de">Erzeuge öffentliche Nachricht</value>
<value xml:lang="en">Create Public Message</value>
@@ -18,7 +18,7 @@
specific language governing permissions and limitations
under the License.
-->
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
<property key="PageTitleEditProductCategory">
<value xml:lang="en">Edit Product Category</value>
<value xml:lang="fr">Edition de la catégorie produit</value>
@@ -19,7 +19,7 @@ under the License.
-->
<entitymodel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/entitymodel.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/entitymodel.xsd">
<title>Entity of an Apache OFBiz Component</title>
<description>None</description>
<version>1.0</version>
+1 -1
View File
@@ -20,7 +20,7 @@ under the License.
<ofbiz-component name="commonext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-component.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/ofbiz-component.xsd">
<resource-loader name="main" type="component"/>
<classpath type="dir" location="config"/>
+1 -1
View File
@@ -19,6 +19,6 @@ under the License.
-->
<service-eca xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/service-eca.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/service-eca.xsd">
</service-eca>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Commonext Component Services</description>
<vendor>OFBiz</vendor>
<version>1.0</version>
@@ -19,7 +19,7 @@
under the License.
-->
<web-app version="3.0">
<web-app version="4.0" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd">
<display-name>Apache OFBiz - Setup Manager</display-name>
<description>Setup Manager Module of the Apache OFBiz Project</description>
@@ -57,6 +57,11 @@
<filter-name>ContextFilter</filter-name>
<filter-class>org.apache.ofbiz.webapp.control.ContextFilter</filter-class>
</filter>
<filter>
<display-name>SameSiteFilter</display-name>
<filter-name>SameSiteFilter</filter-name>
<filter-class>org.apache.ofbiz.webapp.control.SameSiteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ControlFilter</filter-name>
<url-pattern>/*</url-pattern>
@@ -65,6 +70,10 @@
<filter-name>ContextFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>SameSiteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener><listener-class>org.apache.ofbiz.webapp.control.ControlEventListener</listener-class></listener>
<listener><listener-class>org.apache.ofbiz.webapp.control.LoginEventListener</listener-class></listener>
@@ -17,7 +17,7 @@
-->
<web-app version="3.0">
<web-app version="4.0" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd">
<display-name>Empty placeholder</display-name>
<description>Empty placeholder, see http://svn.apache.org/viewvc?view=revision&amp;revision=1612202 </description>
</web-app>
@@ -81,7 +81,7 @@ function setKeyAsParameter(event, ui) {
function getAssociatedStateList(countryId, stateId, errorId, divId) {
var countryGeoId = jQuery("#" + countryId).val();
var requestToSend = "getAssociatedStateList";
if (jQuery('#orderViewed')) {
if (jQuery('#orderViewed').length) {
requestToSend = "/ordermgr/control/getAssociatedStateList"
}
jQuery.ajax({
+1 -1
View File
@@ -19,7 +19,7 @@ under the License.
-->
<component-loader xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/component-loader.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/component-loader.xsd">
<load-component component-location="datamodel"/>
<load-component component-location="party"/>
<load-component component-location="securityext"/>
@@ -17,7 +17,7 @@
specific language governing permissions and limitations
under the License.
-->
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
<property key="CharacterSet.description.ISO-8859-1">
<value xml:lang="en">ISO-8859-1</value>
<value xml:lang="es">ISO-8859-1 Inglés</value>
@@ -18,7 +18,7 @@
specific language governing permissions and limitations
under the License.
-->
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
<property key="contentevents.error_getting_content_list">
<value xml:lang="en">Error getting the content list to index: ${gee}.</value>
<value xml:lang="ja">コンテンツリストの取得時にエラー。索引: ${gee}.</value>
@@ -18,7 +18,7 @@
specific language governing permissions and limitations
under the License.
-->
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
<property key="CannotFindCmsform">
<value xml:lang="de">Die CMS Form kann nicht gefunden werden!</value>
<value xml:lang="en">Cannot find the cmsform!</value>
+1 -1
View File
@@ -19,7 +19,7 @@ under the License.
-->
<entity-eca xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/entity-eca.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/entity-eca.xsd">
<!-- If the text in the database has changed for the data resource, we need to clear out anything depending on this cached value -->
<eca entity="ElectronicText" operation="store-remove" event="return">
@@ -101,7 +101,6 @@
<if-not-empty field="parameters.summaryData">
<!-- create the summary data -->
<set field="createSummary.dataResourceTypeId" value="ELECTRONIC_TEXT"/>
<set field="createSummary.contentPurposeTypeId" value="ARTICLE"/>
<set field="createSummary.dataTemplateTypeId" value="NONE"/>
<set field="createSummary.mapKey" value="SUMMARY"/>
<set field="createSummary.ownerContentId" from-field="ownerContentId"/>
@@ -771,83 +771,6 @@
<field-to-result field="contentId"/>
</simple-method>
<simple-method method-name="getSubContentWithPermCheck" short-description="Get sub content and perform permission check on each record">
<set field="filterByDate" from-field="parameters.filterByDate" default-value="true" type="Boolean"/>
<set field="useCache" from-field="parameters.useCache" default-value="true" type="Boolean"/>
<entity-condition entity-name="ContentAssocViewTo" list="viewList" filter-by-date="${filterByDate}" use-cache="${useCache}">
<condition-list combine="and">
<condition-expr field-name="contentIdStart" from-field="parameters.contentId"/>
<condition-expr field-name="caContentAssocTypeId" from-field="parameters.contentAssocTypeId" ignore-if-empty="true"/>
<condition-expr field-name="caMapKey" from-field="parameters.mapKey" ignore-if-empty="true"/>
</condition-list>
</entity-condition>
<iterate list="viewList" entry="view">
<set field="hasPermission" value="true" type="Boolean"/>
<if>
<condition>
<and>
<not>
<if-empty field="parameters.mainAction"/>
</not>
<not>
<if-empty field="parameters.userLogin"/>
</not>
</and>
</condition>
<then>
<set field="inMap.contentId" from-field="parameters.contentId"/>
<set field="inMap.mainAction" from-field="parameters.mainAction"/>
<set field="inMap.userLogin" from-field="parameters.userLogin"/>
<set field="inMap.contentOperationId" from-field="parameters.contentOperationId" default-value="CONTENT_CREATE"/>
<call-service service-name="genericContentPermission" in-map-name="inMap" include-user-login="true">
<result-to-field result-name="hasPermission"/>
</call-service>
</then>
</if>
<if-compare field="hasPermission" operator="equals" value="true" type="Boolean">
<set field="contentViewList[]" from-field="view"/>
</if-compare>
</iterate>
<field-to-result field="contentViewList" result-name="subContentList"/>
</simple-method>
<simple-method method-name="getSubSubContentWithPermCheck" short-description="Get sub content and perform permission check on each record">
<set-service-fields service-name="getSubContentWithPermCheck" map="parameters" to-map="inMap"/>
<call-service service-name="getSubContentWithPermCheck" in-map-name="inMap">
<result-to-field result-name="subContentList"/>
</call-service>
<iterate list="subContentList" entry="view">
<entity-condition list="viewList" entity-name="ContentAssocViewTo" filter-by-date="true" use-cache="${useCache}">
<condition-list combine="and">
<condition-expr field-name="contentIdStart" from-field="view.caContentIdTo"/>
<condition-expr field-name="caContentAssocTypeId" from-field="parameters.subContentAssocTypeId" ignore-if-empty="true"/>
<condition-expr field-name="caMapKey" from-field="parameters.subMapKey" ignore-if-empty="true"/>
</condition-list>
</entity-condition>
<clear-field field="view2"/>
<first-from-list list="viewList" entry="view2"/>
<clear-field field="map"/>
<set field="map.contentIdFrom" from-field="view.contentId"/>
<set field="map.dataResourceIdFrom" from-field="view.dataResourceId"/>
<set field="map.contentId" from-field="view2.contentId"/>
<set field="map.contentName" from-field="view2.contentName"/>
<set field="map.description" from-field="view2.description"/>
<entity-one entity-name="ElectronicText" value-field="electronicText">
<field-map field-name="dataResourceId" from-field="view2.dataResourceId"/>
</entity-one>
<set field="map.textData" from-field="electronicText.textData"/>
<set field="contentViewList[]" from-field="map"/>
</iterate>
<field-to-result field="subContentList" result-name="subContentList"/>
<field-to-result field="contentViewList" result-name="subSubContentList"/>
</simple-method>
<simple-method method-name="forceIndexContentKeywords" short-description="induce all the keywords of a content">
<entity-one entity-name="Content" value-field="content"/>
<call-class-method class-name="org.apache.ofbiz.content.content.ContentKeywordIndex" method-name="forceIndexKeywords">
+1 -1
View File
@@ -20,7 +20,7 @@ under the License.
<ofbiz-component name="content"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-component.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/ofbiz-component.xsd">
<resource-loader name="main" type="component"/>
<classpath type="dir" location="config"/>
<classpath type="dir" location="dtd"/>
+1 -1
View File
@@ -19,7 +19,7 @@ under the License.
-->
<service-mca xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/service-mca.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/service-mca.xsd">
<mca mail-rule-name="processIncomingEmail">
<action service="storeIncomingEmail" mode="sync"/>
+1 -1
View File
@@ -19,7 +19,7 @@ under the License.
-->
<service-eca xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/service-eca.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/service-eca.xsd">
<eca service="createFile" event="in-validate">
<condition field-name="dataResource" operator="is-empty"/>
<action service="createDataResource" mode="sync"/>
+1 -28
View File
@@ -19,7 +19,7 @@
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Content Component Services</description>
<vendor>OFBiz</vendor>
@@ -40,33 +40,6 @@
<attribute mode="OUT" name="resultData" optional="true" type="java.util.Map"/>
</service>
<service name="getSubContentWithPermCheck" engine="simple" auth="true"
location="component://content/minilang/content/ContentServices.xml" invoke="getSubContentWithPermCheck">
<description>Get Content and resource information</description>
<permission-service service-name="genericContentPermission" main-action="VIEW"/>
<attribute mode="IN" name="contentId" optional="false" type="String">
<type-validate>
<fail-property resource="ContentErrorUiLabels" property="ContentRequiredFieldMissingContentId"/>
</type-validate>
</attribute>
<attribute mode="IN" name="contentAssocTypeId" optional="true" type="String"/>
<attribute mode="IN" name="mapKey" optional="true" type="String"/>
<attribute mode="IN" name="mainAction" optional="true" type="String"/>
<attribute mode="IN" name="contentOperationId" optional="true" type="String"/>
<attribute mode="IN" name="useCache" optional="true" type="Boolean"/>
<attribute mode="IN" name="filterByDate" optional="true" type="Boolean"/>
<attribute mode="OUT" name="subContentList" optional="true" type="java.util.List"/>
</service>
<service name="getSubSubContentWithPermCheck" engine="simple" auth="true"
location="component://content/minilang/content/ContentServices.xml" invoke="getSubSubContentWithPermCheck">
<description>Get Content associated with Content</description>
<implements service="getSubContentWithPermCheck"/>
<attribute mode="IN" name="subContentAssocTypeId" optional="true" type="String"/>
<attribute mode="IN" name="subMapKey" optional="true" type="String"/>
<attribute mode="OUT" name="subSubContentList" optional="true" type="java.util.List"/>
</service>
<service name="getContentAndDataResource" engine="simple" default-entity-name="Content" auth="true"
location="component://content/minilang/content/ContentServices.xml" invoke="getContentAndDataResource">
<description>Get Content and resource information</description>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Content Component Services</description>
<vendor>OFBiz</vendor>
@@ -18,7 +18,7 @@
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Content Component Content Services</description>
<vendor>OFBiz</vendor>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Content Component Services</description>
<vendor>OFBiz</vendor>
@@ -18,7 +18,7 @@
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Content Component Data Services</description>
<vendor>OFBiz</vendor>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Content Component Document Services</description>
<vendor>OFBiz</vendor>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Content Component Output Services</description>
<vendor>OFBiz</vendor>
@@ -19,7 +19,7 @@ under the License.
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Content Component Services</description>
<vendor>OFBiz</vendor>
@@ -18,7 +18,7 @@
-->
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Content Component WebSite Services</description>
<vendor>OFBiz</vendor>
@@ -18,6 +18,8 @@
*******************************************************************************/
package org.apache.ofbiz.content;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.nio.ByteBuffer;
import java.sql.Timestamp;
@@ -29,6 +31,7 @@ import java.util.Locale;
import java.util.Map;
import java.util.Set;
import org.apache.commons.imaging.ImageReadException;
import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.StringUtil;
import org.apache.ofbiz.base.util.UtilDateTime;
@@ -260,7 +263,7 @@ public class ContentManagementServices {
}
// Do update and create permission checks on Content if warranted.
context.put("skipPermissionCheck", null); // Force check here
context.put("skipPermissionCheck", null); // Force check here
boolean contentExists = true;
if (Debug.infoOn()) {
Debug.logInfo("in persist... contentTypeId:" + contentTypeId + " dataResourceTypeId:" + dataResourceTypeId + " contentId:" + contentId + " dataResourceId:" + dataResourceId, module);
@@ -271,7 +274,9 @@ public class ContentManagementServices {
} else {
try {
GenericValue val = EntityQuery.use(delegator).from("Content").where("contentId", contentId).queryOne();
if (val == null) contentExists = false;
if (val == null) {
dataResourceExists = false;
}
} catch (GenericEntityException e) {
return ServiceUtil.returnError(e.toString());
}
@@ -403,9 +408,8 @@ public class ContentManagementServices {
}
/**
Service for update publish sites with a ContentRole that will tie them to the passed
in party.
*/
* Service for update publish sites with a ContentRole that will tie them to the passed in party.
*/
public static Map<String, Object> updateSiteRoles(DispatchContext dctx, Map<String, ? extends Object> context) {
LocalDispatcher dispatcher = dctx.getDispatcher();
Delegator delegator = dctx.getDelegator();
@@ -461,7 +465,7 @@ public class ContentManagementServices {
String errMsg = ServiceUtil.getErrorMessage(permResults);
if (UtilValidate.isNotEmpty(errMsg)) {
return ServiceUtil.returnError(errMsg);
}
}
} catch (GenericServiceException e) {
Debug.logError(e, e.toString(), module);
return ServiceUtil.returnError(e.toString());
@@ -529,17 +533,24 @@ public class ContentManagementServices {
return result;
}
public static Map<String, Object> persistDataResourceAndDataMethod(DispatchContext dctx, Map<String, ? extends Object> rcontext) throws GenericServiceException, GenericEntityException, Exception {
Delegator delegator = dctx.getDelegator();
LocalDispatcher dispatcher = dctx.getDispatcher();
Map<String, Object> context = UtilMisc.makeMapWritable(rcontext);
Map<String, Object> result = new HashMap<String, Object>();
Map<String, Object> newDrContext = new HashMap<String, Object>();
GenericValue dataResource = delegator.makeValue("DataResource");
dataResource.setPKFields(context);
dataResource.setNonPKFields(context);
dataResource.setAllFields(context, false, "dr", null);
context.putAll(dataResource);
public static Map<String, Object> persistDataResourceAndDataMethod(DispatchContext dctx, Map<String, ? extends Object> rcontext)
throws GenericServiceException, GenericEntityException {
Delegator delegator = dctx.getDelegator();
LocalDispatcher dispatcher = dctx.getDispatcher();
Map<String, Object> context = UtilMisc.makeMapWritable(rcontext);
String errorMessage = validateUploadedFile(dctx, context);
if (errorMessage != null) {
return ServiceUtil.returnError(errorMessage);
}
Map<String, Object> result = new HashMap<>();
Map<String, Object> newDrContext = new HashMap<>();
GenericValue dataResource = delegator.makeValue("DataResource");
dataResource.setPKFields(context);
dataResource.setNonPKFields(context);
dataResource.setAllFields(context, false, "dr", null);
context.putAll(dataResource);
GenericValue electronicText = delegator.makeValue("ElectronicText");
electronicText.setPKFields(context);
@@ -583,100 +594,102 @@ public class ContentManagementServices {
newDrContext.put("mimeTypeId", mimeTypeId);
}
if (!dataResourceExists) { // Create
Map<String, Object> thisResult = dispatcher.runSync("createDataResource", newDrContext);
String errorMsg = ServiceUtil.getErrorMessage(thisResult);
if (UtilValidate.isNotEmpty(errorMsg)) {
throw(new Exception(errorMsg));
}
dataResourceId = (String)thisResult.get("dataResourceId");
if (Debug.infoOn()) {
Debug.logInfo("in persist... dataResourceId(0):" + dataResourceId, module);
}
dataResource = (GenericValue)thisResult.get("dataResource");
Map<String, Object> fileContext = new HashMap<String, Object>();
fileContext.put("userLogin", userLogin);
if ("IMAGE_OBJECT".equals(dataResourceTypeId)) {
if (imageDataBytes != null) {
fileContext.put("dataResourceId", dataResourceId);
fileContext.put("imageData", imageDataBytes);
thisResult = dispatcher.runSync("createImage", fileContext);
errorMsg = ServiceUtil.getErrorMessage(thisResult);
if (UtilValidate.isNotEmpty(errorMsg)) {
return ServiceUtil.returnError(errorMsg);
}
}
} else if ("SHORT_TEXT".equals(dataResourceTypeId)) {
} else if ("SURVEY".startsWith(dataResourceTypeId)) {
} else if ("_FILE".indexOf(dataResourceTypeId) >=0) {
Map<String, Object> uploadImage = new HashMap<String, Object>();
uploadImage.put("userLogin", userLogin);
uploadImage.put("dataResourceId", dataResourceId);
uploadImage.put("dataResourceTypeId", dataResourceTypeId);
uploadImage.put("rootDir", context.get("objectInfo"));
uploadImage.put("uploadedFile", imageDataBytes);
uploadImage.put("_uploadedFile_fileName", (String) context.get("_imageData_fileName"));
uploadImage.put("_uploadedFile_contentType", (String) context.get("_imageData_contentType"));
dispatcher.runSync("attachUploadToDataResource", uploadImage);
} else {
// assume ELECTRONIC_TEXT
if (UtilValidate.isNotEmpty(textData)) {
fileContext.put("dataResourceId", dataResourceId);
fileContext.put("textData", textData);
thisResult = dispatcher.runSync("createElectronicText", fileContext);
errorMsg = ServiceUtil.getErrorMessage(thisResult);
if (UtilValidate.isNotEmpty(errorMsg)) {
return ServiceUtil.returnError(errorMsg);
}
}
}
} else { // Update
Map<String, Object> thisResult = dispatcher.runSync("updateDataResource", newDrContext);
String errorMsg = ServiceUtil.getErrorMessage(thisResult);
if (UtilValidate.isNotEmpty(errorMsg)) {
return ServiceUtil.returnError(errorMsg);
}
Map<String, Object> fileContext = new HashMap<String, Object>();
fileContext.put("userLogin", userLogin);
String forceElectronicText = (String)context.get("forceElectronicText");
if ("IMAGE_OBJECT".equals(dataResourceTypeId)) {
if (imageDataBytes != null || "true".equalsIgnoreCase(forceElectronicText)) {
fileContext.put("dataResourceId", dataResourceId);
fileContext.put("imageData", imageDataBytes);
thisResult = dispatcher.runSync("updateImage", fileContext);
errorMsg = ServiceUtil.getErrorMessage(thisResult);
if (UtilValidate.isNotEmpty(errorMsg)) {
return ServiceUtil.returnError(errorMsg);
}
}
} else if ("SHORT_TEXT".equals(dataResourceTypeId)) {
} else if ("SURVEY".startsWith(dataResourceTypeId)) {
} else if ("_FILE".indexOf(dataResourceTypeId) >=0) {
Map<String, Object> uploadImage = new HashMap<String, Object>();
uploadImage.put("userLogin", userLogin);
uploadImage.put("dataResourceId", dataResourceId);
uploadImage.put("dataResourceTypeId", dataResourceTypeId);
uploadImage.put("rootDir", context.get("objectInfo"));
uploadImage.put("uploadedFile", imageDataBytes);
uploadImage.put("_uploadedFile_fileName", (String) context.get("_imageData_fileName"));
uploadImage.put("_uploadedFile_contentType", (String) context.get("_imageData_contentType"));
dispatcher.runSync("attachUploadToDataResource", uploadImage);
} else {
if (UtilValidate.isNotEmpty(textData) || "true".equalsIgnoreCase(forceElectronicText)) {
fileContext.put("dataResourceId", dataResourceId);
fileContext.put("textData", textData);
thisResult = dispatcher.runSync("updateElectronicText", fileContext);
errorMsg = ServiceUtil.getErrorMessage(thisResult);
if (UtilValidate.isNotEmpty(errorMsg)) {
return ServiceUtil.returnError(errorMsg);
}
}
}
}
result.put("dataResourceId", dataResourceId);
result.put("drDataResourceId", dataResourceId);
context.put("dataResourceId", dataResourceId);
return result;
if (!dataResourceExists) { // Create
Map<String, Object> thisResult = dispatcher.runSync("createDataResource", newDrContext);
if (ServiceUtil.isError(thisResult)) {
throw (new GenericServiceException(ServiceUtil.getErrorMessage(thisResult)));
}
dataResourceId = (String) thisResult.get("dataResourceId");
if (Debug.infoOn()) {
Debug.logInfo("in persist... dataResourceId(0):" + dataResourceId, module);
}
dataResource = (GenericValue) thisResult.get("dataResource");
Map<String, Object> fileContext = new HashMap<>();
fileContext.put("userLogin", userLogin);
if ("IMAGE_OBJECT".equals(dataResourceTypeId)) {
if (imageDataBytes != null) {
fileContext.put("dataResourceId", dataResourceId);
fileContext.put("imageData", imageDataBytes);
thisResult = dispatcher.runSync("createImage", fileContext);
if (ServiceUtil.isError(thisResult)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult));
}
}
// We don't want SHORT_TEXT and SURVEY to be caught by the last else if, hence the 2 empty else if
} else if ("SHORT_TEXT".equals(dataResourceTypeId)) {
} else if (dataResourceTypeId.startsWith("SURVEY")) {
} else if (dataResourceTypeId.indexOf("_FILE") >= 0) {
Map<String, Object> uploadImage = new HashMap<>();
uploadImage.put("userLogin", userLogin);
uploadImage.put("dataResourceId", dataResourceId);
uploadImage.put("dataResourceTypeId", dataResourceTypeId);
uploadImage.put("rootDir", context.get("objectInfo"));
uploadImage.put("uploadedFile", imageDataBytes);
uploadImage.put("_uploadedFile_fileName", context.get("_imageData_fileName"));
uploadImage.put("_uploadedFile_contentType", context.get("_imageData_contentType"));
thisResult = dispatcher.runSync("attachUploadToDataResource", uploadImage);
if (ServiceUtil.isError(thisResult)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult));
}
} else {
// assume ELECTRONIC_TEXT
if (UtilValidate.isNotEmpty(textData)) {
fileContext.put("dataResourceId", dataResourceId);
fileContext.put("textData", textData);
thisResult = dispatcher.runSync("createElectronicText", fileContext);
if (ServiceUtil.isError(thisResult)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult));
}
}
}
} else { // Update
Map<String, Object> thisResult = dispatcher.runSync("updateDataResource", newDrContext);
if (ServiceUtil.isError(thisResult)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult));
}
Map<String, Object> fileContext = new HashMap<>();
fileContext.put("userLogin", userLogin);
String forceElectronicText = (String) context.get("forceElectronicText");
if ("IMAGE_OBJECT".equals(dataResourceTypeId)) {
if (imageDataBytes != null || "true".equalsIgnoreCase(forceElectronicText)) {
fileContext.put("dataResourceId", dataResourceId);
fileContext.put("imageData", imageDataBytes);
thisResult = dispatcher.runSync("updateImage", fileContext);
if (ServiceUtil.isError(thisResult)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult));
}
}
// We don't want SHORT_TEXT and SURVEY to be caught by the last else if, hence the 2 empty else if
} else if ("SHORT_TEXT".equals(dataResourceTypeId)) {
} else if (dataResourceTypeId.startsWith("SURVEY")) {
} else if (dataResourceTypeId.indexOf("_FILE") >= 0) {
Map<String, Object> uploadImage = new HashMap<>();
uploadImage.put("userLogin", userLogin);
uploadImage.put("dataResourceId", dataResourceId);
uploadImage.put("dataResourceTypeId", dataResourceTypeId);
uploadImage.put("rootDir", context.get("objectInfo"));
uploadImage.put("uploadedFile", imageDataBytes);
uploadImage.put("_uploadedFile_fileName", context.get("_imageData_fileName"));
uploadImage.put("_uploadedFile_contentType", context.get("_imageData_contentType"));
thisResult = dispatcher.runSync("attachUploadToDataResource", uploadImage);
if (ServiceUtil.isError(thisResult)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult));
}
} else {
if (UtilValidate.isNotEmpty(textData) || "true".equalsIgnoreCase(forceElectronicText)) {
fileContext.put("dataResourceId", dataResourceId);
fileContext.put("textData", textData);
thisResult = dispatcher.runSync("updateElectronicText", fileContext);
if (ServiceUtil.isError(thisResult)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult));
}
}
}
}
result.put("dataResourceId", dataResourceId);
result.put("drDataResourceId", dataResourceId);
context.put("dataResourceId", dataResourceId);
return result;
}
public static void addRoleToUser(Delegator delegator, LocalDispatcher dispatcher, Map<String, Object> serviceContext) throws GenericServiceException, GenericEntityException {
@@ -735,7 +748,7 @@ public class ContentManagementServices {
} else {
if (fromDate != null) {
// for now, will assume that any error is due to non-existence - ignore
//return ServiceUtil.returnError(e.toString());
// return ServiceUtil.returnError(e.toString());
try {
Debug.logInfo("updateSiteRoles, serviceContext(2):" + serviceContext, module);
Map<String, Object> newContext = new HashMap<String, Object>();
@@ -960,7 +973,6 @@ public class ContentManagementServices {
return result;
}
/**
* This service changes the contentTypeId of the current content and its children depending on the pageMode.
* if pageMode == "outline" then if the contentTypeId of children is not "OUTLINE_NODE" or "PAGE_NODE"
@@ -1430,7 +1442,7 @@ public class ContentManagementServices {
}
orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne();
if (orderHeader == null) {
String msg = UtilProperties.getMessage(resource, "ContentNoOrderHeaderFound", UtilMisc.toMap("orderId", orderId), locale);
String msg = UtilProperties.getMessage(resource, "ContentNoOrderHeaderFound", UtilMisc.toMap("orderId", orderId), locale);
return ServiceUtil.returnError(msg);
}
Timestamp orderCreatedDate = (Timestamp) orderHeader.get("orderDate");
@@ -1490,7 +1502,9 @@ public class ContentManagementServices {
}
return result;
}
public static Map<String, Object> followNodeChildrenMethod(GenericValue content, LocalDispatcher dispatcher, String serviceName, Map<String, Object> context) throws GenericEntityException, GenericServiceException {
public static Map<String, Object> followNodeChildrenMethod(GenericValue content, LocalDispatcher dispatcher, String serviceName,
Map<String, Object> context) throws GenericEntityException, GenericServiceException {
Map<String, Object> result = null;
String contentId = content.getString("contentId");
List<String> contentAssocTypeIdList = UtilGenerics.checkList(context.get("contentAssocTypeIdList"));
@@ -1584,4 +1598,25 @@ public class ContentManagementServices {
return result;
}
private static String validateUploadedFile(DispatchContext dctx, Map<String, ? extends Object> context) {
Delegator delegator = dctx.getDelegator();
Locale locale = (Locale) context.get("locale");
String objectInfo = (String) context.get("objectInfo");
String errorMessage = null;
if (!UtilValidate.isEmpty(objectInfo)) {
File file = new File(objectInfo);
if (file.isFile()) {
try {
if (!org.apache.ofbiz.security.SecuredUpload.isValidFile(objectInfo, "All", delegator)) {
errorMessage = UtilProperties.getMessage("SecurityUiLabels", "SupportedFileFormatsIncludingSvg", locale);
}
} catch (ImageReadException | IOException e) {
errorMessage = UtilProperties.getMessage(resource, "ContentUnableToOpenFileForWriting", UtilMisc.toMap("fileName",
objectInfo), locale);
}
}
}
return errorMessage;
}
}
@@ -39,12 +39,12 @@ import org.apache.ofbiz.service.DispatchContext;
import org.apache.ofbiz.service.LocalDispatcher;
import org.apache.ofbiz.service.ServiceUtil;
import com.sun.syndication.feed.synd.SyndContent;
import com.sun.syndication.feed.synd.SyndContentImpl;
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndEntryImpl;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.feed.synd.SyndFeedImpl;
import com.rometools.rome.feed.synd.SyndContent;
import com.rometools.rome.feed.synd.SyndContentImpl;
import com.rometools.rome.feed.synd.SyndEntry;
import com.rometools.rome.feed.synd.SyndEntryImpl;
import com.rometools.rome.feed.synd.SyndFeed;
import com.rometools.rome.feed.synd.SyndFeedImpl;
/**
* BlogRssServices
@@ -79,6 +79,13 @@ public class DataEvents {
// get the permission service required for streaming data; default is always the genericContentPermission
String permissionService = EntityUtilProperties.getPropertyValue("content", "stream.permission.service", "genericContentPermission", delegator);
// This is counterintuitive but it works, for OFBIZ-11840
// It could be improved by checking for possible events associated with svg
// As listed at https://portswigger.net/web-security/cross-site-scripting/cheat-sheet
if (contentId.contains("<svg")) {
return "success";
}
// get the content record
GenericValue content;
try {
@@ -27,16 +27,21 @@ import java.io.RandomAccessFile;
import java.io.StringWriter;
import java.io.Writer;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.sql.Timestamp;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import org.apache.commons.imaging.ImageReadException;
import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.GeneralException;
import org.apache.ofbiz.base.util.UtilDateTime;
import org.apache.ofbiz.base.util.UtilGenerics;
import org.apache.ofbiz.base.util.UtilIO;
import org.apache.ofbiz.base.util.UtilMisc;
import org.apache.ofbiz.base.util.UtilProperties;
import org.apache.ofbiz.base.util.UtilValidate;
@@ -49,15 +54,14 @@ import org.apache.ofbiz.service.GenericServiceException;
import org.apache.ofbiz.service.ModelService;
import org.apache.ofbiz.service.ServiceUtil;
import edu.emory.mathcs.backport.java.util.Arrays;
/**
* DataServices Class
*/
public class DataServices {
public static final String module = DataServices.class.getName();
public static final String resource = "ContentUiLabels";
private static final String MODULE = DataServices.class.getName();
private static final String RESOURCE = "ContentUiLabels";
public static Map<String, Object> clearAssociatedRenderCache(DispatchContext dctx, Map<String, Object> context) {
Delegator delegator = dctx.getDelegator();
@@ -66,8 +70,9 @@ public class DataServices {
try {
DataResourceWorker.clearAssociatedRenderCache(delegator, dataResourceId);
} catch (GeneralException e) {
Debug.logError(e, "Unable to clear associated render cache with dataResourceId=" + dataResourceId, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentClearAssociatedRenderCacheError", UtilMisc.toMap("dataResourceId", dataResourceId), locale));
Debug.logError(e, "Unable to clear associated render cache with dataResourceId=" + dataResourceId, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentClearAssociatedRenderCacheError",
UtilMisc.toMap("dataResourceId", dataResourceId), locale));
}
return ServiceUtil.returnSuccess();
}
@@ -128,7 +133,7 @@ public class DataServices {
dataResourceId = delegator.getNextSeqId("DataResource");
}
if (Debug.infoOn()) {
Debug.logInfo("in createDataResourceMethod, dataResourceId:" + dataResourceId, module);
Debug.logInfo("in createDataResourceMethod, dataResourceId:" + dataResourceId, MODULE);
}
GenericValue dataResource = delegator.makeValue("DataResource", UtilMisc.toMap("dataResourceId", dataResourceId));
dataResource.setNonPKFields(context);
@@ -139,9 +144,10 @@ public class DataServices {
// get first statusId for content out of the statusItem table if not provided
if (UtilValidate.isEmpty(dataResource.get("statusId"))) {
try {
GenericValue statusItem = EntityQuery.use(delegator).from("StatusItem").where("statusTypeId", "CONTENT_STATUS").orderBy("sequenceId").queryFirst();
GenericValue statusItem = EntityQuery.use(delegator).from("StatusItem").where("statusTypeId", "CONTENT_STATUS")
.orderBy("sequenceId").queryFirst();
if (statusItem != null) {
dataResource.put("statusId", statusItem.get("statusId"));
dataResource.put("statusId", statusItem.get("statusId"));
}
} catch (GenericEntityException e) {
return ServiceUtil.returnError(e.getMessage());
@@ -172,7 +178,8 @@ public class DataServices {
String dataResourceId = (String) context.get("dataResourceId");
String textData = (String) context.get("textData");
if (UtilValidate.isNotEmpty(textData)) {
GenericValue electronicText = delegator.makeValue("ElectronicText", UtilMisc.toMap("dataResourceId", dataResourceId, "textData", textData));
GenericValue electronicText = delegator.makeValue("ElectronicText",
UtilMisc.toMap("dataResourceId", dataResourceId, "textData", textData));
try {
electronicText.create();
} catch (GenericEntityException e) {
@@ -196,7 +203,7 @@ public class DataServices {
}
public static Map<String, Object> createFileMethod(DispatchContext dctx, Map<String, ? extends Object> context) {
//GenericValue dataResource = (GenericValue) context.get("dataResource");
Delegator delegator = dctx.getDelegator();
String dataResourceTypeId = (String) context.get("dataResourceTypeId");
String objectInfo = (String) context.get("objectInfo");
ByteBuffer binData = (ByteBuffer) context.get("binData");
@@ -209,18 +216,19 @@ public class DataServices {
// extended validation for binary/character data
if (UtilValidate.isNotEmpty(textData) && binData != null) {
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentCannotProcessBothCharacterAndBinaryFile", locale));
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentCannotProcessBothCharacterAndBinaryFile", locale));
}
// obtain a reference to the file
File file = null;
if (UtilValidate.isEmpty(objectInfo)) {
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentUnableObtainReferenceToFile", UtilMisc.toMap("objectInfo", ""), locale));
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentUnableObtainReferenceToFile",
UtilMisc.toMap("objectInfo", ""), locale));
}
if (UtilValidate.isEmpty(dataResourceTypeId) || "LOCAL_FILE".equals(dataResourceTypeId) || "LOCAL_FILE_BIN".equals(dataResourceTypeId)) {
file = new File(objectInfo);
if (!file.isAbsolute()) {
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentLocalFileDoesNotPointToAbsoluteLocation", locale));
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentLocalFileDoesNotPointToAbsoluteLocation", locale));
}
} else if ("OFBIZ_FILE".equals(dataResourceTypeId) || "OFBIZ_FILE_BIN".equals(dataResourceTypeId)) {
prefix = System.getProperty("ofbiz.home");
@@ -231,7 +239,7 @@ public class DataServices {
} else if ("CONTEXT_FILE".equals(dataResourceTypeId) || "CONTEXT_FILE_BIN".equals(dataResourceTypeId)) {
prefix = (String) context.get("rootDir");
if (UtilValidate.isEmpty(prefix)) {
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentCannotFindContextFileWithEmptyContextRoot", locale));
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentCannotFindContextFileWithEmptyContextRoot", locale));
}
if (objectInfo.indexOf('/') != 0 && prefix.lastIndexOf('/') != (prefix.length() - 1)) {
sep = "/";
@@ -239,33 +247,49 @@ public class DataServices {
file = new File(prefix + sep + objectInfo);
}
if (file == null) {
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentUnableObtainReferenceToFile", UtilMisc.toMap("objectInfo", objectInfo), locale));
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentUnableObtainReferenceToFile",
UtilMisc.toMap("objectInfo", objectInfo), locale));
}
// write the data to the file
if (UtilValidate.isNotEmpty(textData)) {
try (
OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(file), UtilIO.getUtf8());
) {
try (OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8);) {
out.write(textData);
} catch (IOException e) {
Debug.logWarning(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentUnableWriteCharacterDataToFile", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale));
if (!org.apache.ofbiz.security.SecuredUpload.isValidFile(file.getAbsolutePath(), "Text", delegator)) {
String errorMessage = UtilProperties.getMessage("SecurityUiLabels", "SupportedTextFileFormats", locale);
return ServiceUtil.returnError(errorMessage);
}
} catch (IOException | ImageReadException e) {
Debug.logWarning(e, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentUnableWriteCharacterDataToFile",
UtilMisc.toMap("fileName", file.getAbsolutePath()), locale));
}
} else if (binData != null) {
try {
// Check if a webshell is not uploaded
Path tempFile = Files.createTempFile(null, null);
Files.write(tempFile, binData.array(), StandardOpenOption.APPEND);
if (!org.apache.ofbiz.security.SecuredUpload.isValidFile(tempFile.toString(), "All", delegator)) {
String errorMessage = UtilProperties.getMessage("SecurityUiLabels", "SupportedFileFormatsIncludingSvg", locale);
return ServiceUtil.returnError(errorMessage);
}
Files.delete(tempFile);
RandomAccessFile out = new RandomAccessFile(file, "rw");
out.write(binData.array());
out.close();
} catch (FileNotFoundException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentUnableToOpenFileForWriting", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale));
} catch (FileNotFoundException | ImageReadException e) {
Debug.logError(e, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentUnableToOpenFileForWriting",
UtilMisc.toMap("fileName", file.getAbsolutePath()), locale));
} catch (IOException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentUnableWriteBinaryDataToFile", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale));
Debug.logError(e, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentUnableWriteBinaryDataToFile",
UtilMisc.toMap("fileName", file.getAbsolutePath()), locale));
}
} else {
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentNoContentFilePassed", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale));
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentNoContentFilePassed",
UtilMisc.toMap("fileName", file.getAbsolutePath()), locale));
}
Map<String, Object> result = ServiceUtil.returnSuccess();
@@ -313,8 +337,9 @@ public class DataServices {
try {
dataResource = EntityQuery.use(delegator).from("DataResource").where("dataResourceId", dataResourceId).queryOne();
} catch (GenericEntityException e) {
Debug.logWarning(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentDataResourceNotFound", UtilMisc.toMap("parameters.dataResourceId", dataResourceId), locale));
Debug.logWarning(e, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentDataResourceNotFound",
UtilMisc.toMap("parameters.dataResourceId", dataResourceId), locale));
}
dataResource.setNonPKFields(context);
@@ -324,7 +349,7 @@ public class DataServices {
try {
dataResource.store();
} catch (GenericEntityException e) {
Debug.logError(e, module);
Debug.logError(e, MODULE);
return ServiceUtil.returnError(e.getMessage());
}
@@ -341,8 +366,8 @@ public class DataServices {
}
/**
* Because sometimes a DataResource will exist, but no ElectronicText has been created,
* this method will create an ElectronicText if it does not exist.
* Because sometimes a DataResource will exist, but no ElectronicText has been created, this method will create an
* ElectronicText if it does not exist.
* @param dctx the dispatch context
* @param context the context
* @return update the ElectronicText
@@ -357,12 +382,12 @@ public class DataServices {
String contentId = (String) context.get("contentId");
result.put("contentId", contentId);
if (UtilValidate.isEmpty(dataResourceId)) {
Debug.logError("dataResourceId is null.", module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentDataResourceIsNull", locale));
Debug.logError("dataResourceId is null.", MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentDataResourceIsNull", locale));
}
String textData = (String) context.get("textData");
if (Debug.verboseOn()) {
Debug.logVerbose("in updateElectronicText, textData:" + textData, module);
Debug.logVerbose("in updateElectronicText, textData:" + textData, MODULE);
}
try {
electronicText = EntityQuery.use(delegator).from("ElectronicText").where("dataResourceId", dataResourceId).queryOne();
@@ -376,8 +401,8 @@ public class DataServices {
electronicText.create();
}
} catch (GenericEntityException e) {
Debug.logWarning(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentElectronicTextNotFound", locale) + " " + e.getMessage());
Debug.logWarning(e, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentElectronicTextNotFound", locale) + " " + e.getMessage());
}
return result;
@@ -397,6 +422,7 @@ public class DataServices {
}
public static Map<String, Object> updateFileMethod(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException {
Delegator delegator = dctx.getDelegator();
Map<String, Object> result = new HashMap<>();
Locale locale = (Locale) context.get("locale");
String dataResourceTypeId = (String) context.get("dataResourceTypeId");
@@ -433,44 +459,59 @@ public class DataServices {
// write the data to the file
if (UtilValidate.isNotEmpty(textData)) {
try (
OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(file),UtilIO.getUtf8());
) {
try (OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8);) {
out.write(textData);
} catch (IOException e) {
Debug.logWarning(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentUnableWriteCharacterDataToFile", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale));
if (!org.apache.ofbiz.security.SecuredUpload.isValidFile(file.getAbsolutePath(), "Text", delegator)) {
String errorMessage = UtilProperties.getMessage("SecurityUiLabels", "SupportedTextFileFormats", locale);
return ServiceUtil.returnError(errorMessage);
}
} catch (IOException | ImageReadException e) {
Debug.logWarning(e, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentUnableWriteCharacterDataToFile",
UtilMisc.toMap("fileName", file.getAbsolutePath()), locale));
}
} else if (binData != null) {
try {
// Check if a webshell is not uploaded
Path tempFile = Files.createTempFile(null, null);
Files.write(tempFile, binData.array(), StandardOpenOption.APPEND);
if (!org.apache.ofbiz.security.SecuredUpload.isValidFile(tempFile.toString(), "Image", delegator)) {
String errorMessage = UtilProperties.getMessage("SecurityUiLabels", "SupportedFileFormatsIncludingSvg", locale);
return ServiceUtil.returnError(errorMessage);
}
Files.delete(tempFile);
RandomAccessFile out = new RandomAccessFile(file, "rw");
out.setLength(binData.array().length);
out.write(binData.array());
out.close();
} catch (FileNotFoundException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentUnableToOpenFileForWriting", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale));
} catch (FileNotFoundException | ImageReadException e) {
Debug.logError(e, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentUnableToOpenFileForWriting",
UtilMisc.toMap("fileName", file.getAbsolutePath()), locale));
} catch (IOException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentUnableWriteBinaryDataToFile", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale));
Debug.logError(e, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentUnableWriteBinaryDataToFile",
UtilMisc.toMap("fileName", file.getAbsolutePath()), locale));
}
} else {
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentNoContentFilePassed", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale));
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentNoContentFilePassed",
UtilMisc.toMap("fileName", file.getAbsolutePath()), locale));
}
} catch (IOException e) {
Debug.logWarning(e, module);
Debug.logWarning(e, MODULE);
throw new GenericServiceException(e.getMessage());
}
return result;
}
public static Map<String, Object> renderDataResourceAsText(DispatchContext dctx, Map<String, ? extends Object> context) throws GeneralException, IOException {
public static Map<String, Object> renderDataResourceAsText(DispatchContext dctx, Map<String, ? extends Object> context)
throws GeneralException, IOException {
Map<String, Object> results = new HashMap<>();
//LocalDispatcher dispatcher = dctx.getDispatcher();
Writer out = (Writer) context.get("outWriter");
Map<String, Object> templateContext = UtilGenerics.checkMap(context.get("templateContext"));
Map<String, Object> templateContext = UtilGenerics.cast(context.get("templateContext"));
//GenericValue userLogin = (GenericValue) context.get("userLogin");
String dataResourceId = (String) context.get("dataResourceId");
if (templateContext != null && UtilValidate.isEmpty(dataResourceId)) {
@@ -493,7 +534,7 @@ public class DataServices {
out.write(outWriter.toString());
results.put("textData", outWriter.toString());
} catch (IOException e) {
Debug.logError(e, "Error rendering sub-content text", module);
Debug.logError(e, "Error rendering sub-content text", MODULE);
return ServiceUtil.returnError(e.toString());
}
return results;
@@ -512,14 +553,15 @@ public class DataServices {
Delegator delegator = dctx.getDelegator();
//Locale locale = (Locale) context.get("locale");
String dataResourceId = (String) context.get("dataResourceId");
ByteBuffer byteBuffer = (ByteBuffer)context.get("imageData");
ByteBuffer byteBuffer = (ByteBuffer) context.get("imageData");
if (byteBuffer != null) {
byte[] imageBytes = byteBuffer.array();
try {
GenericValue imageDataResource = EntityQuery.use(delegator).from("ImageDataResource").where("dataResourceId", dataResourceId).queryOne();
GenericValue imageDataResource = EntityQuery.use(delegator).from("ImageDataResource")
.where("dataResourceId", dataResourceId).queryOne();
if (Debug.infoOn()) {
Debug.logInfo("imageDataResource(U):" + imageDataResource, module);
Debug.logInfo("imageBytes(U):" + Arrays.toString(imageBytes), module);
Debug.logInfo("imageDataResource(U):" + imageDataResource, MODULE);
Debug.logInfo("imageBytes(U):" + Arrays.toString(imageBytes), MODULE);
}
if (imageDataResource == null) {
return createImageMethod(dctx, context);
@@ -545,14 +587,14 @@ public class DataServices {
Map<String, Object> result = new HashMap<>();
Delegator delegator = dctx.getDelegator();
String dataResourceId = (String) context.get("dataResourceId");
ByteBuffer byteBuffer = (ByteBuffer)context.get("imageData");
ByteBuffer byteBuffer = (ByteBuffer) context.get("imageData");
if (byteBuffer != null) {
byte[] imageBytes = byteBuffer.array();
try {
GenericValue imageDataResource = delegator.makeValue("ImageDataResource", UtilMisc.toMap("dataResourceId", dataResourceId));
imageDataResource.setBytes("imageData", imageBytes);
if (Debug.infoOn()) {
Debug.logInfo("imageDataResource(C):" + imageDataResource, module);
Debug.logInfo("imageDataResource(C):" + imageDataResource, MODULE);
}
imageDataResource.create();
} catch (GenericEntityException e) {
@@ -576,39 +618,45 @@ public class DataServices {
return result;
}
public static Map<String, Object> createBinaryFileMethod(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException {
public static Map<String, Object> createBinaryFileMethod(DispatchContext dctx, Map<String, ? extends Object> context)
throws GenericServiceException {
Delegator delegator = dctx.getDelegator();
Map<String, Object> result = new HashMap<>();
GenericValue dataResource = (GenericValue) context.get("dataResource");
String dataResourceTypeId = (String) dataResource.get("dataResourceTypeId");
String objectInfo = (String) dataResource.get("objectInfo");
byte [] imageData = (byte []) context.get("imageData");
String rootDir = (String)context.get("rootDir");
byte[] imageData = (byte[]) context.get("imageData");
String rootDir = (String) context.get("rootDir");
Locale locale = (Locale) context.get("locale");
File file = null;
if (Debug.infoOn()) {
Debug.logInfo("in createBinaryFileMethod, dataResourceTypeId:" + dataResourceTypeId, module);
Debug.logInfo("in createBinaryFileMethod, objectInfo:" + objectInfo, module);
Debug.logInfo("in createBinaryFileMethod, rootDir:" + rootDir, module);
Debug.logInfo("in createBinaryFileMethod, dataResourceTypeId:" + dataResourceTypeId, MODULE);
Debug.logInfo("in createBinaryFileMethod, objectInfo:" + objectInfo, MODULE);
Debug.logInfo("in createBinaryFileMethod, rootDir:" + rootDir, MODULE);
}
try {
file = DataResourceWorker.getContentFile(dataResourceTypeId, objectInfo, rootDir);
} catch (FileNotFoundException | GeneralException e) {
Debug.logWarning(e, module);
Debug.logWarning(e, MODULE);
throw new GenericServiceException(e.getMessage());
}
if (Debug.infoOn()) {
Debug.logInfo("in createBinaryFileMethod, file:" + file, module);
Debug.logInfo("in createBinaryFileMethod, imageData:" + imageData.length, module);
Debug.logInfo("in createBinaryFileMethod, file:" + file, MODULE);
Debug.logInfo("in createBinaryFileMethod, imageData:" + imageData.length, MODULE);
}
if (imageData != null && imageData.length > 0) {
try (
FileOutputStream out = new FileOutputStream(file);
) {
try (FileOutputStream out = new FileOutputStream(file);) {
out.write(imageData);
if (Debug.infoOn()) {
Debug.logInfo("in createBinaryFileMethod, length:" + file.length(), module);
// Check if a webshell is not uploaded
if (!org.apache.ofbiz.security.SecuredUpload.isValidFile(file.getAbsolutePath(), "All", delegator)) {
String errorMessage = UtilProperties.getMessage("SecurityUiLabels", "SupportedFileFormatsIncludingSvg", locale);
return ServiceUtil.returnError(errorMessage);
}
} catch (IOException e) {
Debug.logWarning(e, module);
if (Debug.infoOn()) {
Debug.logInfo("in createBinaryFileMethod, length:" + file.length(), MODULE);
}
} catch (IOException | ImageReadException e) {
Debug.logWarning(e, MODULE);
throw new GenericServiceException(e.getMessage());
}
}
@@ -629,43 +677,46 @@ public class DataServices {
return result;
}
public static Map<String, Object> updateBinaryFileMethod(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException {
public static Map<String, Object> updateBinaryFileMethod(DispatchContext dctx, Map<String, ? extends Object> context)
throws GenericServiceException {
Delegator delegator = dctx.getDelegator();
Map<String, Object> result = new HashMap<>();
GenericValue dataResource = (GenericValue) context.get("dataResource");
String dataResourceTypeId = (String) dataResource.get("dataResourceTypeId");
String objectInfo = (String) dataResource.get("objectInfo");
byte [] imageData = (byte []) context.get("imageData");
String rootDir = (String)context.get("rootDir");
byte[] imageData = (byte[]) context.get("imageData");
String rootDir = (String) context.get("rootDir");
Locale locale = (Locale) context.get("locale");
File file = null;
if (Debug.infoOn()) {
Debug.logInfo("in updateBinaryFileMethod, dataResourceTypeId:" + dataResourceTypeId, module);
Debug.logInfo("in updateBinaryFileMethod, objectInfo:" + objectInfo, module);
Debug.logInfo("in updateBinaryFileMethod, rootDir:" + rootDir, module);
Debug.logInfo("in updateBinaryFileMethod, dataResourceTypeId:" + dataResourceTypeId, MODULE);
Debug.logInfo("in updateBinaryFileMethod, objectInfo:" + objectInfo, MODULE);
Debug.logInfo("in updateBinaryFileMethod, rootDir:" + rootDir, MODULE);
}
try {
file = DataResourceWorker.getContentFile(dataResourceTypeId, objectInfo, rootDir);
} catch (FileNotFoundException e) {
Debug.logWarning(e, module);
} catch (FileNotFoundException | GeneralException e) {
Debug.logWarning(e, MODULE);
throw new GenericServiceException(e.getMessage());
} catch (GeneralException e2) {
Debug.logWarning(e2, module);
throw new GenericServiceException(e2.getMessage());
}
if (Debug.infoOn()) {
Debug.logInfo("in updateBinaryFileMethod, file:" + file, module);
Debug.logInfo("in updateBinaryFileMethod, imageData:" + Arrays.toString(imageData), module);
Debug.logInfo("in updateBinaryFileMethod, file:" + file, MODULE);
Debug.logInfo("in updateBinaryFileMethod, imageData:" + Arrays.toString(imageData), MODULE);
}
if (imageData != null && imageData.length > 0) {
try (
FileOutputStream out = new FileOutputStream(file);
){
try (FileOutputStream out = new FileOutputStream(file);) {
out.write(imageData);
if (Debug.infoOn()) {
Debug.logInfo("in updateBinaryFileMethod, length:" + file.length(), module);
// Check if a webshell is not uploaded
if (!org.apache.ofbiz.security.SecuredUpload.isValidFile(file.getAbsolutePath(), "All", delegator)) {
String errorMessage = UtilProperties.getMessage("SecurityUiLabels", "SupportedFileFormatsIncludingSvg", locale);
return ServiceUtil.returnError(errorMessage);
}
out.close();
} catch (IOException e) {
Debug.logWarning(e, module);
if (Debug.infoOn()) {
Debug.logInfo("in updateBinaryFileMethod, length:" + file.length(), MODULE);
}
} catch (IOException | ImageReadException e) {
Debug.logWarning(e, MODULE);
throw new GenericServiceException(e.getMessage());
}
}
@@ -131,8 +131,7 @@ public class LayoutEvents {
}
GenericValue dataResource = EntityQuery.use(delegator).from("DataResource").where("dataResourceId", dataResourceId).queryOne();
// Use objectInfo field to store the name of the file, since there is no
// place in ImageDataResource for it.
// Use objectInfo field to store the name of the file, since there is no place in ImageDataResource for it.
if (dataResource != null) {
dataResource.set("objectInfo", imageFileName);
dataResource.set("mimeTypeId", mimeTypeId);
@@ -35,6 +35,7 @@ import org.apache.ofbiz.base.util.UtilGenerics;
import org.apache.ofbiz.base.util.UtilHttp;
import org.apache.ofbiz.base.util.UtilMisc;
import org.apache.ofbiz.base.util.UtilProperties;
import org.apache.ofbiz.base.util.UtilValidate;
import org.apache.ofbiz.service.ServiceUtil;
/**
@@ -66,6 +67,9 @@ public final class LayoutWorker {
return ServiceUtil.returnError(e4.getMessage());
}
if(lst.size() == 0 && UtilValidate.isNotEmpty(request.getAttribute("fileItems"))) {
lst = UtilGenerics.cast(request.getAttribute("fileItems"));
}
if (lst.size() == 0) {
String errMsg = UtilProperties.getMessage(err_resource,
"layoutEvents.no_files_uploaded", locale);
@@ -333,7 +333,18 @@
<td class="label">${uiLabelMap.CommonUpload}</td>
<td>
<input type="hidden" name="isUploadObject" value="Y"/>
<input type="file" name="uploadedFile" size="30"/>
<#if dataResourceTypeId == 'IMAGE_OBJECT'>
<input type="file" name="uploadedFile" size="30" accept=".png,.gif,.jpg,.jpeg,.tiff,.tif"/>
</#if>
<#if dataResourceTypeId == 'VIDEO_OBJECT'>
<input type="file" name="uploadedFile" size="30" accept=".mpeg,.mpg,.mp4,.m4v,.mov,.qt,.asf,.avi,.asx,.asf,.flv,.wvx,.wm,.wmv,.wmx,.avi"/>
</#if>
<#if dataResourceTypeId == 'AUDIO_OBJECT'>
<input type="file" name="uploadedFile" size="30" accept=".mp3,.ogg,.vorbis,.flac,.wav"/>
</#if>
<#if dataResourceTypeId == 'OTHER_OBJECT' || dataResourceTypeId == 'LOCAL_FILE' || dataResourceTypeId == 'OFBIZ_FILE' >
<input type="file" name="uploadedFile" size="30"/>
</#if>
</td>
</tr>
<#elseif (dataResourceTypeId == 'URL_RESOURCE')>
@@ -354,9 +365,9 @@
<tr>
<td colspan="2">
<div id="editorcontainer" class="nocolumns">
<textarea name="textData" id="cmseditor" style="margin: 0; width: 100%; border: 1px solid black;">
<textarea name="textData" id="cmseditor" style="margin: 0; width: 100%; border: 1px solid black;">
<#if (dataText?has_content)>
${StringUtil.wrapString(dataText.textData!)}
${StringUtil.wrapString(dataText.textData!)}
</#if>
</textarea>
</div>
@@ -370,4 +381,4 @@
</tr>
</table>
</form>
</#if>
</#if>
@@ -19,7 +19,7 @@ specific language governing permissions and limitations
under the License.
-->
<web-app version="3.0">
<web-app version="4.0" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd">
<display-name>Apache OFBiz - Content Manager</display-name>
<description>Content Manager Module of the Apache OFBiz Project</description>
@@ -62,6 +62,11 @@ under the License.
<filter-name>ContextFilter</filter-name>
<filter-class>org.apache.ofbiz.webapp.control.ContextFilter</filter-class>
</filter>
<filter>
<display-name>SameSiteFilter</display-name>
<filter-name>SameSiteFilter</filter-name>
<filter-class>org.apache.ofbiz.webapp.control.SameSiteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ControlFilter</filter-name>
<url-pattern>/*</url-pattern>
@@ -70,6 +75,10 @@ under the License.
<filter-name>ContextFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>SameSiteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener><listener-class>org.apache.ofbiz.webapp.control.ControlEventListener</listener-class></listener>
<listener><listener-class>org.apache.ofbiz.webapp.control.LoginEventListener</listener-class></listener>

Some files were not shown because too many files have changed in this diff Show More