Author SHA1 Message Date
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
166 changed files with 3667 additions and 1732 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
+17 -10
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
@@ -74,7 +80,7 @@ the command line at the OFBiz top level directory (folder).
MS Windows: `init-gradle-wrapper`
Unix-like OS: `./gradle/init-gradle-wrapper`
Unix-like OS: `./gradle/init-gradle-wrapper.sh`
[[prepare-ofbiz]]
=== Prepare OFBiz:
@@ -125,8 +131,10 @@ 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
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
@@ -268,8 +276,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`
@@ -380,7 +387,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
@@ -388,13 +395,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
+1 -1
View File
@@ -1 +1 @@
17.12.01
17.12
@@ -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>
@@ -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>
@@ -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>
@@ -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>
@@ -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="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>
@@ -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>
@@ -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({
@@ -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;
}
}
@@ -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 {
@@ -32,6 +32,7 @@ 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;
@@ -196,7 +197,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");
@@ -248,7 +249,11 @@ public class DataServices {
OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(file), UtilIO.getUtf8());
) {
out.write(textData);
} catch (IOException e) {
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));
}
@@ -257,7 +262,13 @@ public class DataServices {
RandomAccessFile out = new RandomAccessFile(file, "rw");
out.write(binData.array());
out.close();
} catch (FileNotFoundException e) {
// 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 (FileNotFoundException | ImageReadException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentUnableToOpenFileForWriting", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale));
} catch (IOException e) {
@@ -397,6 +408,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");
@@ -437,7 +449,11 @@ public class DataServices {
OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(file),UtilIO.getUtf8());
) {
out.write(textData);
} catch (IOException e) {
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));
}
@@ -447,7 +463,12 @@ public class DataServices {
out.setLength(binData.array().length);
out.write(binData.array());
out.close();
} catch (FileNotFoundException e) {
// 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 (FileNotFoundException | ImageReadException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentUnableToOpenFileForWriting", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale));
} catch (IOException e) {
@@ -577,12 +598,14 @@ public class DataServices {
}
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");
Locale locale = (Locale) context.get("locale");
File file = null;
if (Debug.infoOn()) {
Debug.logInfo("in createBinaryFileMethod, dataResourceTypeId:" + dataResourceTypeId, module);
@@ -604,10 +627,15 @@ public class DataServices {
FileOutputStream out = new FileOutputStream(file);
) {
out.write(imageData);
// 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);
}
if (Debug.infoOn()) {
Debug.logInfo("in createBinaryFileMethod, length:" + file.length(), module);
}
} catch (IOException e) {
} catch (IOException | ImageReadException e) {
Debug.logWarning(e, module);
throw new GenericServiceException(e.getMessage());
}
@@ -630,12 +658,14 @@ public class DataServices {
}
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");
Locale locale = (Locale) context.get("locale");
File file = null;
if (Debug.infoOn()) {
Debug.logInfo("in updateBinaryFileMethod, dataResourceTypeId:" + dataResourceTypeId, module);
@@ -660,11 +690,16 @@ public class DataServices {
FileOutputStream out = new FileOutputStream(file);
){
out.write(imageData);
// 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);
}
if (Debug.infoOn()) {
Debug.logInfo("in updateBinaryFileMethod, length:" + file.length(), module);
}
out.close();
} catch (IOException e) {
} 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);
@@ -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>
@@ -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>Apache OFBiz - Content Empty placeholder</display-name>
<description>Empty placeholder, see http://svn.apache.org/viewvc?view=revision&amp;revision=1658621 </description>
</web-app>
@@ -597,7 +597,7 @@ under the License.
<InvoiceItemTypeMap invoiceTypeId="CUST_RTN_INVOICE" invoiceItemMapKey="RET_REPLACE_ADJ" invoiceItemTypeId="CRT_REPLACE_ADJ"/>
<InvoiceItemTypeMap invoiceTypeId="CUST_RTN_INVOICE" invoiceItemMapKey="RET_DISCOUNT_ADJ" invoiceItemTypeId="CRT_DISCOUNT_ADJ"/>
<InvoiceItemTypeMap invoiceTypeId="CUST_RTN_INVOICE" invoiceItemMapKey="RET_FEE_ADJ" invoiceItemTypeId="CRT_FEE_ADJ"/>
<InvoiceItemTypeMap invoiceTypeId="CUST_RTN_INVOICE" invoiceItemMapKey="RET_MISC_CHARGE_ADJ" invoiceItemTypeId="CRT_MISC_ADJ"/>
<InvoiceItemTypeMap invoiceTypeId="CUST_RTN_INVOICE" invoiceItemMapKey="RET_MISC_ADJ" invoiceItemTypeId="CRT_MISC_ADJ"/>
<InvoiceItemTypeMap invoiceTypeId="CUST_RTN_INVOICE" invoiceItemMapKey="RET_SALES_TAX_ADJ" invoiceItemTypeId="CRT_SALES_TAX_ADJ"/>
<InvoiceItemTypeMap invoiceTypeId="CUST_RTN_INVOICE" invoiceItemMapKey="RET_VAT_TAX_ADJ" invoiceItemTypeId="CRT_VAT_TAX_ADJ"/>
<InvoiceItemTypeMap invoiceTypeId="CUST_RTN_INVOICE" invoiceItemMapKey="RET_VAT_PC_ADJ" invoiceItemTypeId="CRT_VAT_PC_ADJ"/>
@@ -617,7 +617,7 @@ under the License.
<InvoiceItemTypeMap invoiceTypeId="PURC_RTN_INVOICE" invoiceItemMapKey="RET_REPLACE_ADJ" invoiceItemTypeId="SRT_REPLACE_ADJ"/>
<InvoiceItemTypeMap invoiceTypeId="PURC_RTN_INVOICE" invoiceItemMapKey="RET_DISCOUNT_ADJ" invoiceItemTypeId="SRT_DISCOUNT_ADJ"/>
<InvoiceItemTypeMap invoiceTypeId="PURC_RTN_INVOICE" invoiceItemMapKey="RET_FEE_ADJ" invoiceItemTypeId="SRT_FEE_ADJ"/>
<InvoiceItemTypeMap invoiceTypeId="PURC_RTN_INVOICE" invoiceItemMapKey="RET_MISC_CHARGE_ADJ" invoiceItemTypeId="SRT_MISC_ADJ"/>
<InvoiceItemTypeMap invoiceTypeId="PURC_RTN_INVOICE" invoiceItemMapKey="RET_MISC_ADJ" invoiceItemTypeId="SRT_MISC_ADJ"/>
<InvoiceItemTypeMap invoiceTypeId="PURC_RTN_INVOICE" invoiceItemMapKey="RET_SALES_TAX_ADJ" invoiceItemTypeId="SRT_SALES_TAX_ADJ"/>
<InvoiceItemTypeMap invoiceTypeId="PURC_RTN_INVOICE" invoiceItemMapKey="RET_VAT_TAX_ADJ" invoiceItemTypeId="SRT_VAT_TAX_ADJ"/>
<InvoiceItemTypeMap invoiceTypeId="PURC_RTN_INVOICE" invoiceItemMapKey="RET_VAT_PC_ADJ" invoiceItemTypeId="SRT_VAT_PC_ADJ"/>
@@ -405,9 +405,15 @@ under the License.
<!-- audio mime types -->
<MimeType mimeTypeId="audio/basic" description="Basic Audio"/>
<MimeType mimeTypeId="audio/mpeg" description="MPEG Audio"/>
<MimeType mimeTypeId="audio/mpeg" description="MP3 Audio"/>
<MimeType mimeTypeId="audio/mp4" description="MP4 Audio"/>
<MimeType mimeTypeId="audio/x-ms-wax" description="WAX Audio"/>
<MimeType mimeTypeId="audio/x-ms-wma" description="WMA Audio"/>
<MimeType mimeTypeId="audio/wav" description="WAV Audio"/>
<MimeType mimeTypeId="audio/ogg" description="OGG Audio"/>
<MimeType mimeTypeId="audio/x-ogg" description="OGG Audio"/>
<MimeType mimeTypeId="audio/vorbis" description="Vorbis Audio"/>
<MimeType mimeTypeId="audio/x-flac" description="FLAC Audio"/>
<MimeType mimeTypeId="audio/flac" description="FLAC Audio"/>
<!-- image mime types -->
<MimeType mimeTypeId="image/jpeg" description="JPEG/JPG Image"/>
@@ -415,6 +421,8 @@ under the License.
<MimeType mimeTypeId="image/gif" description="GIF Image"/>
<MimeType mimeTypeId="image/tiff" description="TIFF Image"/>
<MimeType mimeTypeId="image/png" description="PNG Image"/>
<MimeType mimeTypeId="image/svg+xml" description="Image SVG"/>
<!-- message mime types -->
<MimeType mimeTypeId="message/external-body" description="External Body Message"/>
@@ -462,6 +470,7 @@ under the License.
<MimeType mimeTypeId="video/x-ms-wm" description="WM Video"/>
<MimeType mimeTypeId="video/x-ms-wmv" description="WMV Video"/>
<MimeType mimeTypeId="video/x-ms-wmx" description="WMX Video"/>
<MimeType mimeTypeId="video/3gpp" description="3GP Mobile Video"/>
<FileExtension fileExtensionId="asf" mimeTypeId="video/x-ms-asf"/>
<FileExtension fileExtensionId="asx" mimeTypeId="video/x-ms-asf"/>
@@ -473,6 +482,7 @@ under the License.
<FileExtension fileExtensionId="tif" mimeTypeId="image/tiff"/>
<FileExtension fileExtensionId="tiff" mimeTypeId="image/tiff"/>
<FileExtension fileExtensionId="gif" mimeTypeId="image/gif"/>
<FileExtension fileExtensionId="svg" mimeTypeId="image/svg+xml"/>
<FileExtension fileExtensionId="png" mimeTypeId="image/png"/>
<FileExtension fileExtensionId="mp4" mimeTypeId="video/mp4"/>
<FileExtension fileExtensionId="m4v" mimeTypeId="video/mp4"/>
@@ -497,6 +507,16 @@ under the License.
<FileExtension fileExtensionId="wmx" mimeTypeId="video/x-ms-wmx"/>
<FileExtension fileExtensionId="zip" mimeTypeId="application/zip"/>
<FileExtension fileExtensionId="vcf" mimeTypeId="text/x-vcard"/>
<FileExtension fileExtensionId="wav" mimeTypeId="audio/wav"/>
<FileExtension fileExtensionId="mpeg" mimeTypeId="audio/mpeg"/>
<FileExtension fileExtensionId="mp3" mimeTypeId="audio/mpeg"/>
<FileExtension fileExtensionId="mp4" mimeTypeId="audio/mpeg"/>
<FileExtension fileExtensionId="ogg" mimeTypeId="audio/ogg"/>
<FileExtension fileExtensionId="flac" mimeTypeId="audio/flac"/>
<FileExtension fileExtensionId="vorbis" mimeTypeId="audio/ogg"/>
<FileExtension fileExtensionId="dflt" mimeTypeId="application/octet-stream"/>
<FileExtension fileExtensionId="3gp" mimeTypeId="video/3gpp"/>
<!-- Registered MIME Types:
MEDIA TYPES
@@ -317,7 +317,7 @@ under the License.
<ReturnItemTypeMap returnHeaderTypeId="CUSTOMER_RETURN" returnItemMapKey="REPLACE_ADJUSTMENT" returnItemTypeId="RET_REPLACE_ADJ"/>
<ReturnItemTypeMap returnHeaderTypeId="CUSTOMER_RETURN" returnItemMapKey="DISCOUNT_ADJUSTMENT" returnItemTypeId="RET_DISCOUNT_ADJ"/>
<ReturnItemTypeMap returnHeaderTypeId="CUSTOMER_RETURN" returnItemMapKey="FEE" returnItemTypeId="RET_FEE_ADJ"/>
<ReturnItemTypeMap returnHeaderTypeId="CUSTOMER_RETURN" returnItemMapKey="MISCELLANEOUS_CHARGE" returnItemTypeId="RET_MISC_CHARGE_ADJ"/>
<ReturnItemTypeMap returnHeaderTypeId="CUSTOMER_RETURN" returnItemMapKey="MISCELLANEOUS_CHARGE" returnItemTypeId="RET_MISC_ADJ"/>
<ReturnItemTypeMap returnHeaderTypeId="CUSTOMER_RETURN" returnItemMapKey="SALES_TAX" returnItemTypeId="RET_SALES_TAX_ADJ"/>
<ReturnItemTypeMap returnHeaderTypeId="CUSTOMER_RETURN" returnItemMapKey="VAT_TAX" returnItemTypeId="RET_VAT_TAX_ADJ"/>
<ReturnItemTypeMap returnHeaderTypeId="CUSTOMER_RETURN" returnItemMapKey="VAT_PRICE_CORRECT" returnItemTypeId="RET_VAT_PC_ADJ"/>
@@ -341,7 +341,7 @@ under the License.
<ReturnItemTypeMap returnHeaderTypeId="VENDOR_RETURN" returnItemMapKey="REPLACE_ADJUSTMENT" returnItemTypeId="RET_REPLACE_ADJ"/>
<ReturnItemTypeMap returnHeaderTypeId="VENDOR_RETURN" returnItemMapKey="DISCOUNT_ADJUSTMENT" returnItemTypeId="RET_DISCOUNT_ADJ"/>
<ReturnItemTypeMap returnHeaderTypeId="VENDOR_RETURN" returnItemMapKey="FEE" returnItemTypeId="RET_FEE_ADJ"/>
<ReturnItemTypeMap returnHeaderTypeId="VENDOR_RETURN" returnItemMapKey="MISCELLANEOUS_CHARGE" returnItemTypeId="RET_MISC_CHARGE_ADJ"/>
<ReturnItemTypeMap returnHeaderTypeId="VENDOR_RETURN" returnItemMapKey="MISCELLANEOUS_CHARGE" returnItemTypeId="RET_MISC_ADJ"/>
<ReturnItemTypeMap returnHeaderTypeId="VENDOR_RETURN" returnItemMapKey="SALES_TAX" returnItemTypeId="RET_SALES_TAX_ADJ"/>
<ReturnItemTypeMap returnHeaderTypeId="VENDOR_RETURN" returnItemMapKey="VAT_TAX" returnItemTypeId="RET_VAT_TAX_ADJ"/>
<ReturnItemTypeMap returnHeaderTypeId="VENDOR_RETURN" returnItemMapKey="VAT_PRICE_CORRECT" returnItemTypeId="RET_VAT_PC_ADJ"/>
@@ -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 - HumanRes Manager</display-name>
<description>HumanRes Manager Module of the Apache OFBiz Project</description>
@@ -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 - Manufacturing Manager</display-name>
<description>Manufacturing Manager Module by TAU Informatica srl</description>
@@ -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 - Marketing Manager</display-name>
<description>Marketing Manager Module of the Apache OFBiz Project</description>
@@ -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 - SFA Manager</display-name>
<description>SFA Manager Module of the Apache OFBiz Project</description>
+1 -1
View File
@@ -5872,7 +5872,7 @@
<value xml:lang="zh-TW">預訂</value>
</property>
<property key="OrderManager">
<value xml:lang="ar">مدير أمر البيع\الشراء</value>
<value xml:lang="ar">مدير أمر</value>
<value xml:lang="de">Auftragsverwaltung Anwendung</value>
<value xml:lang="en">Order Manager</value>
<value xml:lang="es">Gestión de pedidos</value>
@@ -102,6 +102,9 @@ if (inlineProduct) {
featureTypes = [:]
featureOrder = []
variantInfoJS = new StringBuffer()
variantInfoJS.append("<script language=\"JavaScript\" type=\"text/javascript\">\n jQuery(document).ready(function(jQuery) {\n")
// make the productContentWrapper
productContentWrapper = new ProductContentWrapper(inlineProduct, request)
context.productContentWrapper = productContentWrapper
@@ -284,7 +287,9 @@ if (inlineProduct) {
variantPriceMap = runService('calculateProductPrice', priceContext)
}
amt.append(" if (sku == \"" + variant.productId + "\") return \"" + (variant.requireAmount ?: "N") + "\"; ")
variantInfoJS.append(" variantReqAmounts['" + variant.productId + "'] = '" + (variant.requireAmount ?: "N") + "';\n")
variantPriceJS.append(" if (sku == \"" + variant.productId + "\") return \"" + numberFormat.format(variantPriceMap.basePrice) + "\"; ")
variantInfoJS.append(" variantPrices['" + variant.productId + "'] = '" + numberFormat.format(variantPriceMap.basePrice) + "';\n")
}
amt.append(" } ")
variantPriceJS.append(" } ")
@@ -298,4 +303,6 @@ if (inlineProduct) {
}
}
}
variantInfoJS.append(" });\n</script>\n")
context.variantInfoJavaScript = variantInfoJS
}
@@ -106,6 +106,9 @@ if (product) {
featureTypes = [:]
featureOrder = []
variantInfoJS = new StringBuffer()
variantInfoJS.append("<script language=\"JavaScript\" type=\"text/javascript\">\n jQuery(document).ready(function(jQuery) {\n")
// set this as a last viewed
LAST_VIEWED_TO_KEEP = 10 // modify this to change the number of last viewed to keep
lastViewedProducts = session.getAttribute("lastViewedProducts")
@@ -346,8 +349,10 @@ if (product) {
contentWrapper = new ProductContentWrapper(imageMap[key], request)
// initial image paths
detailImage = contentWrapper.get("DETAIL_IMAGE_URL", "url") ?: productContentWrapper.get("DETAIL_IMAGE_URL", "url")
largeImage = contentWrapper.get("LARGE_IMAGE_URL", "url") ?: productContentWrapper.get("LARGE_IMAGE_URL", "url")
detailImage = contentWrapper.getProductContentAsText(product, "DETAIL_IMAGE_URL", request, "string")
?: productContentWrapper.get("DETAIL_IMAGE_URL", "string")
largeImage = contentWrapper.getProductContentAsText(product, "LARGE_IMAGE_URL", request, "string")
?: productContentWrapper.get("LARGE_IMAGE_URL", "string")
// full image URLs
detailImageUrl = null
@@ -440,8 +445,10 @@ if (product) {
variantPriceMap = runService('calculatePurchasePrice', priceContext)
}
amt.append(" if (sku == \"" + variant.productId + "\") return \"" + (variant.requireAmount ?: "N") + "\"; ")
variantInfoJS.append(" variantReqAmounts['" + variant.productId + "'] = '" + (variant.requireAmount ?: "N") + "';\n")
if (variantPriceMap && variantPriceMap.basePrice) {
variantPriceJS.append(" if (sku == \"" + variant.productId + "\") return \"" + UtilFormatOut.formatCurrency(variantPriceMap.basePrice, currencyUomId, locale, 10) + "\"; ")
variantInfoJS.append(" variantPrices['" + variant.productId + "'] = '" + UtilFormatOut.formatCurrency(variantPriceMap.basePrice, currencyUomId, locale, 10) + "';\n")
}
// make a list of virtual variants sku with requireAmount
@@ -481,9 +488,11 @@ if (product) {
}
variantPriceList.add(virtualPriceMap)
variantPriceJS.append(" if (sku == \"" + virtual.productId + "\") return \"" + UtilFormatOut.formatCurrency(variantPriceMap.basePrice, currencyUomId, locale, 10) + "\"; ")
variantInfoJS.append(" variantPrices['" + virtual.productId + "'] = '" + UtilFormatOut.formatCurrency(variantPriceMap.basePrice, currencyUomId, locale, 10) + "';\n")
} else {
virtualPriceMap = runService('calculatePurchasePrice', priceContext)
variantPriceJS.append(" if (sku == \"" + virtual.productId + "\") return \"" + UtilFormatOut.formatCurrency(variantPriceMap.price, currencyUomId, locale, 10) + "\"; ")
variantInfoJS.append(" variantPrices['" + virtual.productId + "'] = '" + UtilFormatOut.formatCurrency(variantPriceMap.price, currencyUomId, locale, 10) + "';\n")
}
}
@@ -537,9 +546,11 @@ if (product) {
// Get the minimum quantity for variants if MINIMUM_ORDER_PRICE is set for variants.
virtualVariantPriceList.add(virtualPriceMap)
variantPriceJS.append(" if (sku == \"" + virtual.productId + "\") return \"" + UtilFormatOut.formatCurrency(virtualPriceMap.basePrice, currencyUomId, locale, 10) + "\"; ")
variantInfoJS.append(" variantPrices['" + virtual.productId + "'] = '" + UtilFormatOut.formatCurrency(virtualPriceMap.basePrice, currencyUomId, locale, 10) + "';\n")
} else {
virtualPriceMap = runService('calculatePurchasePrice', priceContext)
variantPriceJS.append(" if (sku == \"" + virtual.productId + "\") return \"" + UtilFormatOut.formatCurrency(virtualPriceMap.price, currencyUomId, locale, 10) + "\"; ")
variantInfoJS.append(" variantPrices['" + virtual.productId + "'] = '" + UtilFormatOut.formatCurrency(virtualPriceMap.price, currencyUomId, locale, 10) + "';\n")
}
}
variantPriceJS.append(" } ")
@@ -552,6 +563,9 @@ if (product) {
}
}
}
variantInfoJS.append(" variantPrices['" + product.productId + "'] = '" + UtilFormatOut.formatCurrency(priceMap.basePrice, currencyUomId, locale, 10) + "';\n")
variantInfoJS.append(" });\n</script>\n")
context.variantInfoJavaScript = variantInfoJS
availableInventory = 0.0
@@ -97,8 +97,12 @@ if (product) {
categoryId = null
reviews = null
if (product) {
numberFormat = NumberFormat.getCurrencyInstance(locale)
categoryId = parameters.category_id ?: request.getAttribute("productCategoryId")
variantInfoJS = new StringBuffer()
variantInfoJS.append("<script language=\"JavaScript\" type=\"text/javascript\">\n jQuery(document).ready(function(jQuery) {\n")
// get the product price
if (cart.isSalesOrder()) {
// sales order: run the "calculateProductPrice" service
@@ -167,7 +171,6 @@ if (product) {
}
}
variantPriceList = []
numberFormat = NumberFormat.getCurrencyInstance(locale)
if(virtualVariants){
amt = new StringBuffer()
@@ -194,6 +197,7 @@ if (product) {
basePrice = UtilProperties.getResourceBundleMap("CommonUiLabels", locale).get("CommonNA")
}
variantPriceJS.append(" if (sku == \"" + virtual.productId + "\") return \"" + basePrice + "\"; ")
variantInfoJS.append(" variantPrices['" + virtual.productId + "'] = '" + basePrice + "';\n")
}
variantPriceJS.append(" } ")
@@ -204,6 +208,10 @@ if (product) {
context.virtualJavaScript = jsBuf
}
}
variantInfoJS.append(" variantPrices['" + product.productId + "'] = '" + numberFormat.format(priceMap.basePrice) + "';\n")
variantInfoJS.append(" });\n</script>\n")
context.variantInfoJavaScript = variantInfoJS
context.mainProducts = mainProducts
}
@@ -59,7 +59,7 @@ orderAdjustments = null
comments = null
if (orderId) {
orderHeader = from('OrderHeader').where('orderId', orderId).cache(false).queryFirst()
orderHeader = from('OrderHeader').where('orderId', orderId).queryOne()
comments = select("orderItemSeqId", "changeComments", "changeDatetime", "changeUserLogin").from("OrderItemChange").where(UtilMisc.toList(EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderId))).orderBy("-changeDatetime").queryList()
}
@@ -21,6 +21,9 @@ import org.apache.ofbiz.order.order.OrderContentWrapper
orderHeader = context.orderHeader
// can anybody view an anonymous order? this is set in the screen widget and should only be turned on by an email confirmation screen
allowAnonymousView = context.allowAnonymousView
// if orderHeader is null in OrderView.groovy then it is not null but void here!
if (orderHeader) {
// set hasPermission, must always exist if the orderHeader != null
@@ -44,9 +47,28 @@ if (orderHeader) {
hasPermission = true
}
}
// This is related with OFBIZ-11836 "IDOR vulnerability in the order processing feature"
if (parameters.localDispatcherName.equals("ecommerce")) {
List errMsgList = []
if (orderHeader.createdBy.equals(person.partyId)
|| ("anonymous".equals(orderHeader.createdBy) && "Y".equals(allowAnonymousView))) {
hasPermission = true
canViewInternalDetails = true
} else {
hasPermission = false
canViewInternalDetails = false
errMsgList.add("It's not an error : you are not allowed to view this!")
showErrorMsg = "Y"
request.setAttribute("_ERROR_MESSAGE_LIST_", errMsgList)
context.showErrorMsg = showErrorMsg
}
}
context.hasPermission = hasPermission
context.canViewInternalDetails = canViewInternalDetails
orderContentWrapper = OrderContentWrapper.makeOrderContentWrapper(orderHeader, request)
context.orderContentWrapper = orderContentWrapper
}
@@ -88,7 +88,7 @@ under the License.
<set field="curUserPcmFindMap.contactMechTypeId" value="EMAIL_ADDRESS"/>
<find-by-and entity-name="PartyAndContactMech" map="curUserPcmFindMap" list="curUserPartyAndContactMechs"/>
<first-from-list list="curUserPartyAndContactMechs" entry="curUserPartyAndContactMech"/>
<string-append field="sendEmailMap.sendFrom" string="${curUserPartyAndContactMech.infoString}" prefix=","/>
<string-append field="sendEmailMap.sendFrom" string="${curUserPartyAndContactMech.infoString}"/>
<!-- find email addresses of all parties in SHIPMENT_CLERK roleTypeId, set as sendTo -->
<set value="SHIPMENT_CLERK" field="shipmentClerkFindMap.roleTypeId"/>
@@ -763,6 +763,18 @@ under the License.
<set-service-fields service-name="createOrderContactMech" map="inputMap" to-map="removeOrderContactMechMap"/>
<call-service service-name="removeOrderContactMech" in-map-name="removeOrderContactMechMap" include-user-login="true"/>
</if-empty>
<!-- Update promisedDateTime & currentPromisedDate in OrderItemShipGrpInvRes entity-->
<set field="itemShipGrpInvResLookupMap.orderId" from="parameters.orderId"/>
<set field="itemShipGrpInvResLookupMap.shipGroupSeqId" from="parameters.shipGroupSeqId"/>
<find-by-and entity-name="OrderItemShipGrpInvRes" map="itemShipGrpInvResLookupMap" list="itemShipGrpInvResList"/>
<if-not-empty field="itemShipGrpInvResList">
<iterate list="itemShipGrpInvResList" entry="orderItemShipGrpInvRes">
<set field="orderItemShipGrpInvRes.promisedDatetime" from="parameters.shipByDate"/>
<set field="orderItemShipGrpInvRes.currentPromisedDate" from="parameters.shipByDate"/>
<store-value value-field="orderItemShipGrpInvRes"/>
</iterate>
</if-not-empty>
</simple-method>
<simple-method method-name="getOrderItemShipGroupEstimatedShipDate" short-description="Compute and return the OrderItemShipGroup estimated ship date based on the associated items.">
@@ -1033,6 +1033,7 @@ public class OrderServices {
delegator.storeAll(toBeStored);
List<String> resErrorMessages = new LinkedList<>();
GenericValue permUserLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne();
// add a product service to inventory
if (UtilValidate.isNotEmpty(orderItems)) {
@@ -1066,14 +1067,13 @@ public class OrderServices {
Map<String, Object> ripCtx = new HashMap<>();
if (UtilValidate.isNotEmpty(inventoryFacilityId) && UtilValidate.isNotEmpty(productId) && orderItem.getBigDecimal("quantity").compareTo(BigDecimal.ZERO) > 0) {
// do something tricky here: run as the "system" user
GenericValue permUserLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne();
ripCtx.put("productId", productId);
ripCtx.put("facilityId", inventoryFacilityId);
ripCtx.put("inventoryItemTypeId", "SERIALIZED_INV_ITEM");
ripCtx.put("statusId","INV_AVAILABLE");
ripCtx.put("quantityAccepted", orderItem.getBigDecimal("quantity"));
ripCtx.put("quantityRejected", 0.0);
// do something tricky here: run as the "system" user
ripCtx.put("userLogin", permUserLogin);
try {
Map<String, Object> ripResult = dispatcher.runSync("receiveInventoryProduct", ripCtx);
@@ -1093,7 +1093,7 @@ public class OrderServices {
// START inventory reservation
try {
reserveInventory(delegator, dispatcher, userLogin, locale, orderItemShipGroupInfo, dropShipGroupIds, itemValuesBySeqId,
reserveInventory(delegator, dispatcher, permUserLogin, locale, orderItemShipGroupInfo, dropShipGroupIds, itemValuesBySeqId,
orderTypeId, productStoreId, resErrorMessages);
} catch (GeneralException e) {
return ServiceUtil.returnError(e.getMessage());
@@ -185,7 +185,7 @@ function submitForm(form, mode, value) {
</#if>
<#-- end code to display a small image of the product -->
<a href="<@ofbizUrl>product?product_id=${cartLine.getProductId()}</@ofbizUrl>" class="buttontext">${cartLine.getProductId()} -
${cartLine.getName(dispatcher)!}</a> : ${cartLine.getDescription(dispatcher)!}
${StringUtil.wrapString(cartLine.getName(dispatcher))!}</a> : ${StringUtil.wrapString(cartLine.getDescription(dispatcher))!}
<#-- display the registered ship groups and quantity -->
<#assign itemShipGroups = cart.getShipGroups(cartLine)>
@@ -205,7 +205,7 @@ function submitForm(form, mode, value) {
<#else>
<#-- this is a non-product item -->
<b>${cartLine.getItemTypeDescription()!}</b> : ${cartLine.getName(dispatcher)!}
<b>${StringUtil.wrapString(cartLine.getItemTypeDescription())!}</b> : ${StringUtil.wrapString(cartLine.getName(dispatcher))!}
</#if>
</div>
@@ -60,12 +60,12 @@ under the License.
<td>
<#if cartLine.getProductId()??>
<#if cartLine.getParentProductId()??>
<a href="<@ofbizCatalogAltUrl productId=cartLine.getParentProductId()/>" class="linktext">${cartLine.getName(dispatcher)}</a>
<a href="<@ofbizCatalogAltUrl productId=cartLine.getParentProductId()/>" class="linktext">${StringUtil.wrapString(cartLine.getName(dispatcher))}</a>
<#else>
<a href="<@ofbizCatalogAltUrl productId=cartLine.getProductId()/>" class="linktext">${cartLine.getName(dispatcher)}</a>
<a href="<@ofbizCatalogAltUrl productId=cartLine.getProductId()/>" class="linktext">${StringUtil.wrapString(cartLine.getName(dispatcher))}</a>
</#if>
<#else>
<strong>${cartLine.getItemTypeDescription()!}</strong>
<strong>${StringUtil.wrapString(cartLine.getItemTypeDescription())!}</strong>
</#if>
</td>
<td><@ofbizCurrency amount=cartLine.getDisplayItemSubTotal() isoCode=shoppingCart.getCurrency()/></td>
@@ -80,8 +80,8 @@ under the License.
<#if cartLine.getProductId()??>
<#-- product item -->
<a href="<@ofbizUrl>product?product_id=${cartLine.getProductId()}</@ofbizUrl>" class="buttontext">${cartLine.getProductId()}</a> -
<input size="60" type="text" name="description_${cartLineIndex}" value="${cartLine.getName(dispatcher)?default("")}"/><br />
<i>${cartLine.getDescription(dispatcher)!}</i>
<input size="60" type="text" name="description_${cartLineIndex}" value="${StringUtil.wrapString(cartLine.getName(dispatcher))?default("")}"/><br />
<i>${StringUtil.wrapString(cartLine.getDescription(dispatcher))!}</i>
<#if shoppingCart.getOrderType() != "PURCHASE_ORDER">
<#-- only applies to sales orders, not purchase orders -->
<#-- if inventory is not required check to see if it is out of stock and needs to have a message shown about that... -->
@@ -93,7 +93,7 @@ under the License.
</#if>
<#else>
<#-- this is a non-product item -->
<b>${cartLine.getItemTypeDescription()!}</b> : ${cartLine.getName(dispatcher)!}
<b>${StringUtil.wrapString(StringUtil.wrapString(cartLine.getItemTypeDescription()))!}</b> : ${StringUtil.wrapString(cartLine.getName(dispatcher))!}
</#if>
<#-- display the item's features -->
<#assign features = "">
@@ -132,7 +132,7 @@ under the License.
</#if>
<#if cartLine.getItemComment()?has_content>
<tr><td><div>${uiLabelMap.CommonComment} : </div></td>
<td><div><input size="60" type="text" name="comment_${cartLineIndex}" value="${cartLine.getItemComment()?default("")}"/><br /></div></td>
<td><div><input size="60" type="text" name="comment_${cartLineIndex}" value="${StringUtil.wrapString(cartLine.getItemComment())?default("")}"/><br /></div></td>
</tr>
</#if>
<#if cartLine.getDesiredDeliveryDate()?has_content>
@@ -60,7 +60,7 @@ under the License.
</#macro>
<@paginationControls/>
<div class="productsummary-container">
<div class="productsummary-container row">
<#list productIds as productId> <#-- note that there is no boundary range because that is being done before the list is put in the content -->
${setRequestAttribute("optProductId", productId)}
${setRequestAttribute("listIndex", productId_index)}
@@ -17,57 +17,31 @@ specific language governing permissions and limitations
under the License.
-->
<#-- variable setup -->
<#assign price = priceMap!/>
<#assign price = priceMap! />
<#-- end variable setup -->
<#-- virtual product javascript -->
${virtualJavaScript!}
<script language="JavaScript" type="text/javascript">
${virtualVariantJavaScript!}
<script type="application/javascript">
<!--
var detailImageUrl = null;
function setAddProductId(name) {
document.addform.add_product_id.value = name;
if (document.addform.quantity == null) return;
if (name == '' || name == 'NULL' || isVirtual(name) == true) {
document.addform.quantity.disabled = true;
var elem = document.getElementById('product_id_display');
var txt = document.createTextNode('');
if(elem.hasChildNodes()) {
elem.replaceChild(txt, elem.firstChild);
} else {
elem.appendChild(txt);
}
} else {
document.addform.quantity.disabled = false;
var elem = document.getElementById('product_id_display');
var txt = document.createTextNode(name);
if(elem.hasChildNodes()) {
elem.replaceChild(txt, elem.firstChild);
} else {
elem.appendChild(txt);
}
function setAddProductId2(sku, with_bak) {
document.addform.add_product_id.value = sku;
var disable = (sku == '' || sku == 'NULL' || isVirtual(sku) == true);
if (document.addform.quantity != null) {
document.addform.quantity.disabled = disable;
}
var txt = disable ? '' : sku;
$('#product_id_display').text(txt);
if (with_bak) {
document.addform.product_id_bak.value = txt;
}
}
function setVariantPrice(sku) {
if (sku == '' || sku == 'NULL' || isVirtual(sku) == true) {
var elem = document.getElementById('variant_price_display');
var txt = document.createTextNode('');
if(elem.hasChildNodes()) {
elem.replaceChild(txt, elem.firstChild);
} else {
elem.appendChild(txt);
}
}
else {
var elem = document.getElementById('variant_price_display');
var price = getVariantPrice(sku);
var txt = document.createTextNode(price);
if(elem.hasChildNodes()) {
elem.replaceChild(txt, elem.firstChild);
} else {
elem.appendChild(txt);
}
}
function setVariantPrice2(sku) {
var disable = (sku == '' || sku == 'NULL' || isVirtual(sku) == true);
var txt = disable ? '' : getVariantPrice2(sku);
$('#variant_price_display').text(txt || '');
}
function isVirtual(product) {
var isVirtual = false;
@@ -159,11 +133,15 @@ ${virtualJavaScript!}
} else {
var Variable1 = eval("list" + OPT[(currentFeatureIndex+1)] + selectedValue + "()");
}
// reset uom select
$('#product_uom').text('');
// set the product ID to NULL to trigger the alerts
setAddProductId('NULL');
setAddProductId2('NULL');
// set the variant price to NULL
setVariantPrice('NULL');
setVariantPrice2('NULL');
} else {
// this is the final selection -- locate the selected index of the last selection
var indexSelected = document.forms["addform"].elements[name].selectedIndex;
@@ -175,13 +153,13 @@ ${virtualJavaScript!}
ajaxUpdateArea("product_uom", "<@ofbizUrl>ProductUomDropDownOnly</@ofbizUrl>", "productId=" + sku);
// set the product ID
setAddProductId(sku);
setAddProductId2(sku, true);
// set the variant price
setVariantPrice(sku);
setVariantPrice2(sku);
// check for amount box
toggleAmt(checkAmtReq(sku));
toggleAmt(checkAmtReq2(sku));
}
}
@@ -208,7 +186,7 @@ ${virtualJavaScript!}
}
function showAlert(msg) {
showErrorAlert("${uiLabelMap.CommonErrorMessage2}",msg);
showErrorAlert("${uiLabelMap.CommonErrorMessage2}", msg);
}
function additemSubmit(){
@@ -266,21 +244,11 @@ ${virtualJavaScript!}
block2.style.display = "none";
}
</#if>
function displayProductVirtualVariantId(variantId) {
document.addform.product_id.value = variantId;
var elem = document.getElementById('product_id_display');
var txt = document.createTextNode(variantId);
if(elem.hasChildNodes()) {
elem.replaceChild(txt, elem.firstChild);
} else {
elem.appendChild(txt);
}
setVariantPrice(variantId);
}
//-->
</script>
${screens.render("component://order/widget/ordermgr/OrderEntryCatalogScreens.xml#productvariantjs")}
${variantInfoJavaScript!}
<div id="productdetail">
<table border="0" cellpadding="2" cellspacing="0" width="100%">
@@ -321,9 +289,9 @@ ${virtualJavaScript!}
<#if sizeProductFeatureAndAppls?has_content>
<div>
<#if (sizeProductFeatureAndAppls?size == 1)>
Size:
${uiLabelMap.OrderSizeAvailableSingle}:
<#else>
Sizes Available:
${uiLabelMap.OrderSizeAvailableMultiple}:
</#if>
<#list sizeProductFeatureAndAppls as sizeProductFeatureAndAppl>
${sizeProductFeatureAndAppl.description?default(sizeProductFeatureAndAppl.abbrev?default(sizeProductFeatureAndAppl.productFeatureId))}<#if sizeProductFeatureAndAppl_has_next>,</#if>
@@ -435,9 +403,11 @@ ${virtualJavaScript!}
<form method="post" action="<@ofbizUrl>additem<#if requestAttributes._CURRENT_VIEW_??>/${requestAttributes._CURRENT_VIEW_}</#if></@ofbizUrl>" name="addform" style="margin: 0;">
<#if requestAttributes.paramMap?has_content>
<input type="hidden" name="itemComment" value="${requestAttributes.paramMap.itemComment!}" />
<input type="hidden" name="useAsDefaultComment" value="${requestAttributes.paramMap.useAsDefaultComment!}" />
<input type="hidden" name="shipBeforeDate" value="${requestAttributes.paramMap.shipBeforeDate!}" />
<input type="hidden" name="shipAfterDate" value="${requestAttributes.paramMap.shipAfterDate!}" />
<input type="hidden" name="itemDesiredDeliveryDate" value="${requestAttributes.paramMap.itemDesiredDeliveryDate!}" />
<input type="hidden" name="useAsDefaultDesiredDeliveryDate" value="${requestAttributes.paramMap.useAsDefaultDesiredDeliveryDate!}" />
</#if>
<#assign inStock = true>
<#-- Variant Selection -->
@@ -479,13 +449,14 @@ ${virtualJavaScript!}
</select>
</div>
</#list>
<span id="product_uom"></span>
<span id="product_uom"></span><br/>
<input type="hidden" name="product_id_bak" value=""/>
<div class="variant-price" style="display: inline-block;">
<strong><span id="product_id_display" class="product_id_display"> </span></strong>
<strong><span id="variant_price_display" class="variant_price_display"> </span></strong>
</div>
<input type="hidden" name="product_id" value="${product.productId}"/>
<input type="hidden" name="add_product_id" value="NULL"/>
<div>
<b><span id="product_id_display"> </span></b>
<b><div id="variant_price_display"> </div></b>
</div>
<#else>
<input type="hidden" name="product_id" value="${product.productId}"/>
<input type="hidden" name="add_product_id" value="NULL"/>
@@ -496,6 +467,19 @@ ${virtualJavaScript!}
<#else>
<input type="hidden" name="product_id" value="${product.productId}"/>
<input type="hidden" name="add_product_id" value="${product.productId}"/>
<#if mainProducts?has_content>
<select name="productVariantId" class="form-control" onchange="javascript:variantUomSelection(this);">
<option value="">${uiLabelMap.CommonSelect} ${uiLabelMap.ProductUnitOfMeasure}</option>
<#list mainProducts as mainProduct>
<option value="${mainProduct.productId}">${mainProduct.uomDesc} : ${mainProduct.piecesIncluded}</option>
</#list>
</select><br/>
<input type="hidden" name="product_id_bak" value="${product.productId}"/>
<div class="variant-price" style="display: inline-block;">
<strong><span class="product_id_display"> </span></strong>
<strong><span class="variant_price_display"> </span></strong>
</div>
</#if>
<#if productStoreId??>
<#assign isStoreInventoryNotAvailable = !(Static["org.apache.ofbiz.product.store.ProductStoreWorker"].isStoreInventoryAvailable(request, product, 1.0?double))>
<#assign isStoreInventoryRequired = Static["org.apache.ofbiz.product.store.ProductStoreWorker"].isStoreInventoryRequired(request, product)>
@@ -538,7 +522,7 @@ ${virtualJavaScript!}
<td nowrap="nowrap" align="right">Number of persons</td>
<td><input type="text" size="4" name="reservPersons" value="2"/></td>
</#if>
<td nowrap="nowrap" align="right">Quantity</td>
<td nowrap="nowrap" align="right">${uiLabelMap.CommonQuantity}</td>
<td><input type="text" size="5" name="quantity" value="1"/></td>
</tr>
</table>
@@ -51,6 +51,8 @@ ${virtualJavaScript!}
}
//-->
</script>
${screens.render("component://order/widget/ordermgr/OrderEntryCatalogScreens.xml#productvariantjs")}
${variantInfoJavaScript!}
<#if product??>
<#-- variable setup -->
<#if "Y" == backendPath?default("N")>
@@ -94,6 +96,8 @@ ${virtualJavaScript!}
</table>
</div>
<script type="text/javascript">
/*
jQuery(document).ready(function(jQuery) {
jQuery("#${productInfoLinkId}").attr('title', jQuery("#${productDetailId}").remove().html());
jQuery("#${productInfoLinkId}").tooltip({
content: function(){
@@ -102,6 +106,8 @@ ${virtualJavaScript!}
tooltipClass: "popup",
track: true
});
});
*/
</script>
<div class="productbuy">
<#-- check to see if introductionDate hasn't passed yet -->
@@ -133,15 +139,16 @@ ${virtualJavaScript!}
<a href="javascript:document.the${requestAttributes.formNamePrefix!}${requestAttributes.listIndex!}form.submit()" class="buttontext">${uiLabelMap.OrderAddToCart}</a>
<#if mainProducts?has_content>
<input type="hidden" name="product_id" value=""/>
<select name="productVariantId" onchange="javascript:displayProductVirtualId(this.value, '${product.productId}', this.form);">
<option value="">Select Unit Of Measure</option>
<select name="productVariantId" onchange="javascript:variantUomSelection(this);" style="width: 100%;">
<option value="">${uiLabelMap.CommonSelect} ${uiLabelMap.ProductUnitOfMeasure}</option>
<#list mainProducts as mainProduct>
<option value="${mainProduct.productId}">${mainProduct.uomDesc} : ${mainProduct.piecesIncluded}</option>
</#list>
</select>
<div style="display: inline-block;">
<strong><span id="product_id_display"> </span></strong>
<strong><span id="variant_price_display"> </span></strong>
<input type="hidden" name="product_id_bak" value="${product.productId}"/>
<div class="variant-price" style="display: inline-block;">
<strong><span class="product_id_display"> </span></strong>
<strong><span class="variant_price_display"> </span></strong>
</div>
</#if>
</form>
@@ -17,8 +17,8 @@ specific language governing permissions and limitations
under the License.
-->
<#if product?? && mainProducts??>
<select name="parentProductId" onchange="javascript:displayProductVirtualVariantId(this.value);">
<option value="">Select Unit Of Measure</option>
<select name="parentProductId" onchange="javascript:variantUomSelection(this);">
<option value="">${uiLabelMap.CommonSelect} ${uiLabelMap.ProductUnitOfMeasure}</option>
<#list mainProducts as mainProduct>
<option value="${mainProduct.productId}">${mainProduct.uomDesc} : ${mainProduct.piecesIncluded}</option>
</#list>
@@ -0,0 +1,69 @@
<#--
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.
-->
<script language="JavaScript" type="text/javascript">
if (typeof(checkAmtReq2) == 'undefined') {
var variantReqAmounts = {};
function checkAmtReq2(sku) {
return variantReqAmounts[sku];
}
var variantPrices = {};
function getVariantPrice2(sku) {
return variantPrices[sku];
}
function variantUomSelection (select) {
var $select = $(select);
var form = $select.closest('form');
var variantId = $select.val();
$("[name='product_id']", form).val(variantId);
if (!variantId) {
variantId = $("[name='product_id_bak']", form).val() || '';
}
$('.product_id_display', form).text(variantId);
var price = getVariantPrice2(variantId);
$('.variant_price_display', form).text(price || '');
// var price_div = $('.variant-price', form);
// if (price) {
// price_div.css('display', 'inline-block');
// }
// else {
// price_div.hide();
// }
}
jQuery(document).ready(function(jQuery) {
jQuery('.popup_link').each(
function(index) {
var $this = jQuery(this);
var popup = $('.popup', $this.closest('.productsummary'));
$this.attr('title', popup.remove().html());
$this.tooltip({
content: function(){
return this.getAttribute("title");
},
tooltipClass: "popup",
track: true
});
});
});
}
</script>
@@ -65,7 +65,6 @@ under the License.
</tr>
<#list orderItemList as orderItem>
<#if orderItem.productId??> <#-- a null product may come from a quote -->
<#assign orderItemContentWrapper = Static["org.apache.ofbiz.order.order.OrderContentWrapper"].makeOrderContentWrapper(orderItem, request)>
<tr><td colspan="8"><hr /></td></tr>
<tr>
<#assign orderItemType = orderItem.getRelatedOne("OrderItemType", false)!>
@@ -106,9 +105,6 @@ under the License.
<div>
<a href="/catalog/control/EditProduct?productId=${productId}" class="buttontext" target="_blank">${uiLabelMap.ProductCatalog}</a>
<a href="/ecommerce/control/product?product_id=${productId}" class="buttontext" target="_blank">${uiLabelMap.OrderEcommerce}</a>
<#if orderItemContentWrapper.get("IMAGE_URL", "url")?has_content>
<a href="<@ofbizUrl>viewimage?orderId=${orderId}&amp;orderItemSeqId=${orderItem.orderItemSeqId}&amp;orderContentTypeId=IMAGE_URL</@ofbizUrl>" target="_orderImage" class="buttontext">${uiLabelMap.OrderViewImage}</a>
</#if>
</div>
</#if>
</td>
@@ -556,6 +556,7 @@ document.lookuporder.orderId.focus();
<input type="hidden" name="viewSize"/>
<input type="hidden" name="viewIndex"/>
<input type="hidden" name="hideFields"/>
<input type="hidden" name="showAll" value="Y"/>
<#if paramIdList?? && paramIdList?has_content>
<#list paramIdList as paramIds>
<#assign paramId = paramIds.split("=")/>
@@ -45,7 +45,6 @@ under the License.
<#else>
<#assign itemClass = "2">
<#list orderItemList as orderItem>
<#assign orderItemContentWrapper = Static["org.apache.ofbiz.order.order.OrderContentWrapper"].makeOrderContentWrapper(orderItem, request)>
<#assign orderItemShipGrpInvResList = orderReadHelper.getOrderItemShipGrpInvResList(orderItem)>
<#if "SALES_ORDER" == orderHeader.orderTypeId><#assign pickedQty = orderReadHelper.getItemPickedQuantityBd(orderItem)></#if>
<tr<#if "1" == itemClass> class="alternate-row"</#if>>
@@ -89,10 +88,6 @@ under the License.
</#if>
<a href="/catalog/control/EditProduct?productId=${productId}${StringUtil.wrapString(externalKeyParam)}" class="buttontext" target="_blank">${uiLabelMap.ProductCatalog}</a>
<a href="/ecommerce/control/product?product_id=${productId}" class="buttontext" target="_blank">${uiLabelMap.OrderEcommerce}</a>
<#if orderItemContentWrapper.get("IMAGE_URL", "url")?has_content>
<a href="<@ofbizUrl>viewimage?orderId=${orderId}&amp;orderItemSeqId=${orderItem.orderItemSeqId}&amp;orderContentTypeId=IMAGE_URL</@ofbizUrl>"
target="_orderImage" class="buttontext">${uiLabelMap.OrderViewImage}</a>
</#if>
</div>
</td>
</#if>
@@ -41,7 +41,7 @@ under the License.
<#if returnItems?has_content>
<#assign orderId = (Static["org.apache.ofbiz.entity.util.EntityUtil"].getFirst(returnItems)).getString("orderId")/>
<#assign partyId = "${(returnHeader.fromPartyId)!}"/>
<a href="<@ofbizUrl>setOrderCurrencyAgreementShipDates?partyId=${partyId!}&amp;originOrderId=${orderId!}</@ofbizUrl>" class="buttontext">${uiLabelMap.OrderCreateExchangeOrder} ${uiLabelMap.CommonFor} ${orderId!}</a>
<li><a href="<@ofbizUrl>setOrderCurrencyAgreementShipDates?partyId=${partyId!}&amp;originOrderId=${orderId!}</@ofbizUrl>" class="buttontext">${uiLabelMap.OrderCreateExchangeOrder} ${uiLabelMap.CommonFor} ${orderId!}</a></li>
</#if>
<#if returnHeader.statusId?has_content && "RETURN_ACCEPTED" == returnHeader.statusId>
<#assign returnItems = EntityQuery.use(delegator).from("ReturnItem").where("returnId", returnId!).queryList()!/>
@@ -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 - Order Manager</display-name>
<description>Order Manager Module of the Apache OFBiz Project</description>
@@ -66,6 +66,14 @@ under the License.
</section>
</screen>
<screen name="productvariantjs">
<section>
<widgets>
<platform-specific><html><html-template location="component://order/template/entry/catalog/ProductVariantJS.ftl"/></html></platform-specific>
</widgets>
</section>
</screen>
<screen name="breadcrumbs">
<section>
<actions>
@@ -293,6 +301,8 @@ under the License.
<screen name="ProductUomDropDownOnly">
<section>
<actions>
<property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/>
<property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
<script location="component://order/groovyScripts/entry/catalog/ProductUomDropDownOnly.groovy"/>
</actions>
<widgets>
@@ -27,55 +27,72 @@ under the License.
<screen name="OrderPDF">
<section>
<actions>
<set field="titleProperty" value="OrderOrder"/>
<property-map resource="OrderUiLabels" map-name="uiLabelMap" global="true"/>
<property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
<property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/>
<set field="titleProperty" value="OrderOrder" />
<property-map resource="OrderUiLabels" map-name="uiLabelMap" global="true" />
<property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true" />
<property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true" />
<script location="component://order/groovyScripts/order/OrderView.groovy"/>
<script location="component://order/groovyScripts/order/OrderView.groovy" />
<script location="component://order/groovyScripts/order/OrderViewWebSecure.groovy" />
</actions>
<widgets>
<decorator-screen name="FoReportDecorator" location="component://common/widget/CommonScreens.xml">
<!-- at the top left of every page we put the logo and company information -->
<decorator-section name="topLeft">
<section>
<widgets>
<include-screen name="CompanyLogo" location="component://order/widget/ordermgr/OrderPrintScreens.xml"/>
</widgets>
</section>
</decorator-section>
<!-- at the top right of every page we put the order information -->
<decorator-section name="topRight">
<section>
<widgets>
<platform-specific>
<xsl-fo><html-template location="component://order/template/order/OrderReportHeaderInfo.fo.ftl"/></xsl-fo>
</platform-specific>
</widgets>
</section>
</decorator-section>
<decorator-section name="body">
<section>
<widgets>
<!-- the contach mechanisms, terms, payment and shipping methods are shown in the first page -->
<platform-specific>
<xsl-fo><html-template location="component://order/template/order/OrderReportContactMechs.fo.ftl"/></xsl-fo>
</platform-specific>
<!-- order items and totals -->
<platform-specific>
<xsl-fo><html-template location="component://order/template/order/OrderReportBody.fo.ftl"/></xsl-fo>
</platform-specific>
<!-- return policies and notes are shown in the last page -->
<platform-specific>
<xsl-fo><html-template location="component://order/template/order/OrderReportConditions.fo.ftl"/></xsl-fo>
</platform-specific>
</widgets>
</section>
</decorator-section>
</decorator-screen>
<section>
<condition>
<if-compare operator="equals" value="true" field="hasPermission" />
</condition>
<widgets>
<decorator-screen name="FoReportDecorator" location="component://common/widget/CommonScreens.xml">
<!-- at the top left of every page we put the logo and company information -->
<decorator-section name="topLeft">
<section>
<widgets>
<include-screen name="CompanyLogo" location="component://order/widget/ordermgr/OrderPrintScreens.xml" />
</widgets>
</section>
</decorator-section>
<!-- at the top right of every page we put the order information -->
<decorator-section name="topRight">
<section>
<widgets>
<platform-specific>
<xsl-fo>
<html-template location="component://order/template/order/OrderReportHeaderInfo.fo.ftl" />
</xsl-fo>
</platform-specific>
</widgets>
</section>
</decorator-section>
<decorator-section name="body">
<section>
<widgets>
<!-- the contach mechanisms, terms, payment and shipping methods are shown in the first page -->
<platform-specific>
<xsl-fo>
<html-template location="component://order/template/order/OrderReportContactMechs.fo.ftl" />
</xsl-fo>
</platform-specific>
<!-- order items and totals -->
<platform-specific>
<xsl-fo>
<html-template location="component://order/template/order/OrderReportBody.fo.ftl" />
</xsl-fo>
</platform-specific>
<!-- return policies and notes are shown in the last page -->
<platform-specific>
<xsl-fo>
<html-template location="component://order/template/order/OrderReportConditions.fo.ftl" />
</xsl-fo>
</platform-specific>
</widgets>
</section>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</widgets>
</section>
</screen>
<screen name="CompanyLogo">
<section>
<actions>
@@ -731,6 +731,9 @@
<value xml:lang="zh">无法新建已存在的会员角色</value>
<value xml:lang="zh-TW">無法新建已存在的團體角色</value>
</property>
<property key="PartyRoleAssociationRequired">
<value xml:lang="en">Party id: ${partyId} should be in role: ${roleDescription}</value>
</property>
<property key="partyroleservices.could_not_create_party_role_read">
<value xml:lang="de">Akteur Rolle kann nicht erstellt werden (Lesefehler).</value>
<value xml:lang="en">could not create party role read</value>
@@ -104,7 +104,7 @@ under the License.
<attribute name="partyRelationshipTypeId" type="String" mode="IN" optional="true"/>
<attribute name="ownerPartyIds" type="List" mode="IN" optional="true"/><!-- Lead Owners Parties -->
<attribute name="sortField" type="String" mode="IN" optional="true"/>
<attribute name="partyClassificationGroupId" type="String" mode="IN" optional="true"/>
<attribute name="partyClassificationGroupId" type="List" mode="IN" optional="true"/>
<attribute name="listIt" type="org.apache.ofbiz.entity.util.EntityListIterator" mode="OUT" optional="true"/>
</service>
@@ -89,6 +89,10 @@ public class PartyHelper {
}
}
result.append(UtilFormatOut.checkNull(partyValue.getString("firstName")));
if (partyValue.getString("middleName") != null) {
result.append(" ");
}
result.append(UtilFormatOut.checkNull(partyValue.getString("middleName")));
} else {
result.append(UtilFormatOut.ifNotEmpty(partyValue.getString("firstName"), "", " "));
result.append(UtilFormatOut.ifNotEmpty(partyValue.getString("middleName"), "", " "));
@@ -1688,15 +1688,15 @@ public class PartyServices {
// PartyClassificationGroup Fields
// ----
String partyClassificationGroupId = (String) context.get("partyClassificationGroupId");
if (UtilValidate.isNotEmpty(partyClassificationGroupId)) {
List<String> partyClassificationGroupIds = (List) context.get("partyClassificationGroupId");
if (UtilValidate.isNotEmpty(partyClassificationGroupIds)) {
// add PartyClassification to view
dynamicView.addMemberEntity("PC", "PartyClassification");
dynamicView.addAlias("PC", "partyClassificationGroupId");
dynamicView.addViewLink("PT", "PC", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId"));
// add the expr
andExprs.add(EntityCondition.makeCondition("partyClassificationGroupId", partyClassificationGroupId));
andExprs.add(EntityCondition.makeCondition("partyClassificationGroupId", EntityOperator.IN, partyClassificationGroupIds));
fieldsToSelect.add("partyClassificationGroupId");
}
@@ -54,5 +54,16 @@ under the License.
</select>
<input type="submit" value="${uiLabelMap.CommonUpload}" />
</form>
<div id='progress_bar'><div></div></div>
</div>
</div>
<script type="application/javascript">
jQuery("#uploadPartyContent").validate({
submitHandler: function(form) {
<#-- call upload scripts - functions defined in PartyProfileContent.js -->
uploadPartyContent();
getUploadProgressStatus();
form.submit();
}
});
</script>
@@ -1238,6 +1238,7 @@ under the License.
<request-map uri="LookupEmplPosition"><security auth="true" https="true"/><response name="success" type="view" value="LookupEmplPosition"/></request-map>
<request-map uri="LookupOrderHeader"><security auth="true" https="true"/><response name="success" type="view" value="LookupOrderHeader"/></request-map>
<request-map uri="LookupProduct"><security auth="true" https="true"/><response name="success" type="view" value="LookupProduct"/></request-map>
<request-map uri="LookupBudget"><security auth="true" https="true"/><response name="success" type="view" value="LookupBudget"/></request-map>
<!-- Financial History Report-->
<request-map uri="PartyFinancialHistory">
@@ -1449,6 +1450,7 @@ under the License.
<view-map name="visitdetail" type="screen" page="component://party/widget/partymgr/VisitScreens.xml#visitdetail"/>
<view-map name="listLoggedInUsers" type="screen" page="component://party/widget/partymgr/VisitScreens.xml#ListLoggedInUsers"/>
<view-map name="LookupBudget" type="screen" page="component://humanres/widget/LookupScreens.xml#LookupBudget"/>
<view-map name="LookupPartyName" type="screen" page="component://party/widget/partymgr/LookupScreens.xml#LookupPartyName"/>
<view-map name="LookupPartyEmail" type="screen" page="component://party/widget/partymgr/LookupScreens.xml#LookupPartyEmail"/>
<view-map name="LookupPartyClassificationGroup" type="screen" page="component://party/widget/partymgr/LookupScreens.xml#LookupPartyClassificationGroup"/>
@@ -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">
<description>Party Manager Module of the Apache OFBiz Project</description>
<display-name>Apache OFBiz - Party Manager</display-name>
@@ -80,7 +80,7 @@ under the License.
</field>
<field name="partyClassificationGroupId" title="${uiLabelMap.PartyClassificationGroup}" use-when="parentTypeId == null">
<drop-down allow-multiple="true" size="5" allow-empty="false">
<entity-options entity-name="PartyClassificationGroupAndType" description="${typeDescription}" key-field-name="partyClassificationGroupId">
<entity-options entity-name="PartyClassificationGroupAndType" description="${typeDescription} - ${partyClassificationGroupId}" key-field-name="partyClassificationGroupId">
<entity-order-by field-name="partyClassificationGroupId"/>
</entity-options>
</drop-down>
@@ -142,13 +142,18 @@ under the License.
<field-map field-name="partyId" from-field="partyId"/>
<field-map field-name="userLogin" from-field="userLogin"/>
</service>
<entity-and entity-name="PartyClassification" list="partyClassifications" use-cache="true">
<field-map field-name="partyId" from-field="partyId"/>
</entity-and>
<set field="fieldId" value="partyClassificationGroupId"/>
<set field="partyClassificationGroupIds" value="${groovy:org.apache.ofbiz.entity.util.EntityUtil.getFieldListFromEntityList(partyClassifications, fieldId, true);}"/>
</row-actions>
<field name="partyId" sort-field="true">
<hyperlink description="${partyId}" target="viewprofile">
<parameter param-name="partyId"/>
</hyperlink>
</field>
<field name="ClassificationGroup"><display description="${parameters.partyClassificationGroupId}"/></field>
<field name="ClassificationGroup" use-when="partyClassificationGroupIds.size() > 0"><display description="${partyClassificationGroupIds}"/></field>
<field name="userLoginId" use-when="userLoginSize > 1"><include-grid name="ListPartyUserLogin" location="component://party/widget/partymgr/PartyForms.xml"/></field>
<field name="userLoginId" use-when="userLoginSize == 1"><display description="${logins[0].userLoginId}"/></field>
<field name="userLoginId" use-when="userLoginSize == 0"><display description="(${uiLabelMap.CommonNone})"/></field>
@@ -80,7 +80,16 @@ if (fileType) {
uploadObject = new HttpRequestFileUpload()
uploadObject.setOverrideFilename(defaultFileName)
uploadObject.setSavePath(imageServerPath + "/" + filePathPrefix)
uploadObject.doUpload(request)
if (!uploadObject.doUpload(request, "Image")) {
try {
(new File(imageServerPath + "/" + filePathPrefix, defaultFileName)).delete()
} catch (Exception e) {
logError(e, "error deleting existing file (not necessarily a problem, except if it's a webshell!)")
}
String errorMessage = UtilProperties.getMessage("SecurityUiLabels","SupportedImageFormats", locale)
logError(errorMessage)
return error(errorMessage)
}
clientFileName = uploadObject.getFilename()
if (clientFileName) {
@@ -93,7 +93,16 @@ if (fileType) {
uploadObject = new HttpRequestFileUpload()
uploadObject.setOverrideFilename(defaultFileName)
uploadObject.setSavePath(imageServerPath + "/" + filePathPrefix)
uploadObject.doUpload(request)
if (!uploadObject.doUpload(request, "Image")) {
try {
(new File(imageServerPath + "/" + filePathPrefix, defaultFileName)).delete()
} catch (Exception e) {
logError(e, "error deleting existing file (not necessarily a problem, except if it's a webshell!)")
}
String errorMessage = UtilProperties.getMessage("SecurityUiLabels","SupportedImageFormats", locale)
logError(errorMessage)
return error(errorMessage)
}
clientFileName = uploadObject.getFilename()
if (clientFileName) {
@@ -93,7 +93,16 @@ if (fileType) {
uploadObject = new HttpRequestFileUpload()
uploadObject.setOverrideFilename(defaultFileName)
uploadObject.setSavePath(imageServerPath + "/" + filePathPrefix)
uploadObject.doUpload(request)
if (!uploadObject.doUpload(request, "Image")) {
try {
(new File(imageServerPath + "/" + filePathPrefix, defaultFileName)).delete()
} catch (Exception e) {
logError(e, "error deleting existing file (not necessarily a problem, except if it's a webshell!)")
}
String errorMessage = UtilProperties.getMessage("SecurityUiLabels","SupportedImageFormats", locale)
logError(errorMessage)
return error(errorMessage)
}
clientFileName = uploadObject.getFilename()
if (clientFileName) {
@@ -17,7 +17,6 @@
* under the License.
*/
import org.apache.ofbiz.entity.*
import org.apache.ofbiz.base.util.*
import org.apache.ofbiz.base.util.string.*
import org.apache.ofbiz.entity.util.EntityUtilProperties
@@ -92,7 +91,16 @@ if (fileType) {
uploadObject = new HttpRequestFileUpload()
uploadObject.setOverrideFilename(defaultFileName)
uploadObject.setSavePath(imageServerPath + "/" + filePathPrefix)
uploadObject.doUpload(request)
if (!uploadObject.doUpload(request, "Image")) {
try {
(new File(imageServerPath + "/" + filePathPrefix, defaultFileName)).delete()
} catch (Exception e) {
logError(e, "error deleting existing file (not necessarily a problem, except if it's a webshell!)")
}
String errorMessage = UtilProperties.getMessage("SecurityUiLabels","SupportedImageFormats", locale)
logError(errorMessage)
return error(errorMessage)
}
clientFileName = uploadObject.getFilename()
if (clientFileName) {
@@ -127,12 +135,14 @@ if (fileType) {
} else if(file.isFile() && "original".equals(fileType) && !file.getName().equals(defaultFileName)) {
file.delete()
}
}
}
// Images aren't ordered by productId (${location}/${viewtype}/${sizetype}/${id}) !!! BE CAREFUL !!!
} else {
File[] files = targetDir.listFiles()
for(File file : files) {
if (file.isFile() && !file.getName().equals(defaultFileName) && file.getName().startsWith(productId + ".")) file.delete()
if (file.isFile() && !file.getName().equals(defaultFileName) && file.getName().startsWith(productId + ".")) {
file.delete()
}
}
}
} catch (Exception e) {
@@ -40,6 +40,8 @@ if (shipment) {
context.destinationFacility = shipment.getRelatedOne("DestinationFacility", false)
context.originPostalAddress = shipment.getRelatedOne("OriginPostalAddress", false)
context.destinationPostalAddress = shipment.getRelatedOne("DestinationPostalAddress", false)
context.originTelecomNumber = shipment.getRelatedOne("OriginTelecomNumber", false)
context.destinationTelecomNumber = shipment.getRelatedOne("DestinationTelecomNumber", false)
}
// check permission
@@ -400,8 +400,9 @@ under the License.
<if-compare value="SERIALIZED_INV_ITEM" operator="equals" field="inventoryItem.inventoryItemTypeId">
<if-compare value="INV_AVAILABLE" operator="equals" field="inventoryItem.statusId">
<!-- change status on inventoryItem -->
<set value="INV_PROMISED" field="inventoryItem.statusId"/>
<store-value value-field="inventoryItem"/>
<set field="updateInventoryItemMap.inventoryItemId" from-field="inventoryItem.inventoryItemId"/>
<set field="updateInventoryItemMap.statusId" value="INV_PROMISED"/>
<call-service service-name="updateInventoryItem" in-map-name="updateInventoryItemMap"/>
<!-- store OrderItemShipGrpInvRes record -->
<call-simple-method method-name="getPromisedDateTime"/>
@@ -1122,11 +1122,11 @@ under the License.
<entity-one entity-name="InventoryItem" value-field="inventoryItem" auto-field-map="false">
<field-map field-name="inventoryItemId" from-field="parameters.inventoryItemId"/>
</entity-one>
<entity-and entity-name="ProductFacility" list="productFacilities">
<entity-one entity-name="ProductFacility" value-field="productFacility">
<field-map field-name="productId" from-field="inventoryItem.productId" />
</entity-and>
<if-not-empty field="productFacilities">
<iterate list="productFacilities" entry="productFacility">
<field-map field-name="facilityId" from-field="inventoryItem.facilityId" />
</entity-one>
<if-not-empty field="productFacility">
<set field="serviceInMap.productId" from-field="productFacility.productId"/>
<set field="serviceInMap.facilityId" from-field="productFacility.facilityId"/>
<call-service service-name="getInventoryAvailableByFacility" in-map-name="serviceInMap">
@@ -1138,7 +1138,6 @@ under the License.
<call-service service-name="updateProductFacility" in-map-name="serviceInMap"/>
<clear-field field="productFacility"/>
<clear-field field="serviceInMap"/>
</iterate>
</if-not-empty>
</simple-method>
<simple-method method-name="createUpdateFacilityGeoPoint" short-description="Create or update GeoPoint assigned to facility">
@@ -134,7 +134,7 @@ under the License.
<simple-method method-name="reserveStoreInventory" short-description="Reserve Store Inventory">
<entity-one entity-name="Product" value-field="product" use-cache="true"/>
<entity-one entity-name="ProductStore" value-field="productStore" use-cache="true"/>
<entity-one entity-name="OrderHeader" value-field="orderHeader" use-cache="true"/>
<entity-one entity-name="OrderHeader" value-field="orderHeader"/>
<set field="parameters.priority" from-field="orderHeader.priority"/>
<if-empty field="productStore">
<add-error>
@@ -740,7 +740,7 @@ under the License.
</entity-and>
<first-from-list list="curUserPartyAndContactMechs" entry="curUserPartyAndContactMech"/>
<string-append field="sendEmailMap.sendFrom" string="${curUserPartyAndContactMech.infoString}" prefix=","/>
<string-append field="sendEmailMap.sendFrom" string="${curUserPartyAndContactMech.infoString}"/>
<!-- find email addresses of partyIdFrom, set as sendTo -->
<set from-field="shipment.partyIdFrom" field="sendToPartyIdMap.${shipment.partyIdFrom}"/>
+1 -1
View File
@@ -1016,7 +1016,7 @@ under the License.
<description>Create ProductFeature-DataResource</description>
<auto-attributes include="pk" mode="IN" optional="false"/>
</service>
<service name="removeProductFeatureDataResource" default-entity-name="ProductFeatureDataResource" engine="entity-auto" invoke="remove" auth="true">
<service name="removeProductFeatureDataResource" default-entity-name="ProductFeatureDataResource" engine="entity-auto" invoke="delete" auth="true">
<description>Remove ProductFeature-DataResource</description>
<auto-attributes include="pk" mode="IN" optional="false"/>
</service>
@@ -72,13 +72,14 @@ under the License.
<permission-service service-name="productPriceGenericPermission" main-action="CREATE"/>
<auto-attributes include="pk" mode="OUT" optional="false"/>
<auto-attributes include="nonpk" mode="IN" optional="true"/>
<override name="ruleName" optional="false"/>
<override name="ruleName" optional="false" allow-html="safe"/>
</service>
<service name="updateProductPriceRule" default-entity-name="ProductPriceRule" engine="entity-auto" invoke="update" auth="true">
<description>Update a ProductPriceRule</description>
<permission-service service-name="productPriceGenericPermission" main-action="UPDATE"/>
<auto-attributes include="pk" mode="IN" optional="false"/>
<auto-attributes include="nonpk" mode="IN" optional="true"/>
<override name="ruleName" optional="false" allow-html="safe"/>
</service>
<service name="deleteProductPriceRule" default-entity-name="ProductPriceRule" engine="entity-auto" invoke="delete" auth="true">
<description>Delete a ProductPriceRule</description>
@@ -44,6 +44,7 @@ import org.apache.ofbiz.entity.condition.EntityCondition;
import org.apache.ofbiz.entity.condition.EntityOperator;
import org.apache.ofbiz.entity.util.EntityQuery;
import org.apache.ofbiz.entity.util.EntityUtil;
import org.apache.ofbiz.entity.util.EntityUtilProperties;
import org.apache.ofbiz.product.product.ProductWorker;
import org.apache.ofbiz.service.DispatchContext;
import org.apache.ofbiz.service.ServiceUtil;
@@ -75,7 +76,8 @@ public final class CategoryWorker {
if (topCatName == null)
topCatName = defaultTopCategory;
if (topCatName == null)
topCatName = "CATALOG1";
topCatName = EntityUtilProperties.getPropertyValue("catalog", "top.category.default", "CATALOG1",
(Delegator) request.getAttribute("delegator"));
if (!fromSession) {
if (Debug.infoOn()) Debug.logInfo("[CategoryWorker.getCatalogTopCategory] Setting new top category: " + topCatName, module);
@@ -29,6 +29,7 @@ import java.util.Map;
import javax.imageio.ImageIO;
import org.apache.commons.imaging.ImageReadException;
import org.apache.ofbiz.base.location.FlexibleLocation;
import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.UtilGenerics;
@@ -74,10 +75,11 @@ public class ScaleImage {
* @throws IOException Error prevents the document from being fully parsed
* @throws JDOMException Errors occur in parsing
*/
public static Map<String, Object> scaleImageInAllSize(Map<String, ? extends Object> context, String filenameToUse, String viewType, String viewNumber)
throws IllegalArgumentException, ImagingOpException, IOException, JDOMException {
public static Map<String, Object> scaleImageInAllSize(Map<String, ? extends Object> context, String filenameToUse,
String viewType, String viewNumber) throws IllegalArgumentException, ImagingOpException, IOException, JDOMException {
/* VARIABLES */
Delegator delegator = (Delegator) context.get("delegator");
Locale locale = (Locale) context.get("locale");
int index;
@@ -211,19 +213,23 @@ public class ScaleImage {
// write new image
try {
ImageIO.write(bufNewImg, imgExtension, new File(imageServerPath + "/" + newFileLocation + "." + imgExtension));
String fileToCheck = imageServerPath + "/" + newFileLocation + "." + imgExtension;
ImageIO.write(bufNewImg, imgExtension, new File(fileToCheck));
if (!org.apache.ofbiz.security.SecuredUpload.isValidFile(fileToCheck, "Image", delegator)) {
String errorMessage = UtilProperties.getMessage("SecurityUiLabels", "SupportedImageFormats", locale);
return ServiceUtil.returnError(errorMessage);
}
} catch (IllegalArgumentException e) {
String errMsg = UtilProperties.getMessage(resource, "ScaleImage.one_parameter_is_null", locale) + e.toString();
Debug.logError(errMsg, module);
result.put(ModelService.ERROR_MESSAGE, errMsg);
return result;
} catch (IOException e) {
} catch (IOException | ImageReadException e) {
String errMsg = UtilProperties.getMessage(resource, "ScaleImage.error_occurs_during_writing", locale) + e.toString();
Debug.logError(errMsg, module);
result.put(ModelService.ERROR_MESSAGE, errMsg);
return result;
}
// Save each Url
if (sizeTypeList.contains(sizeType)) {
String imageUrl = imageUrlPrefix + "/" + newFileLocation + "." + imgExtension;
@@ -246,10 +252,11 @@ public class ScaleImage {
}
}
public static Map<String, Object> scaleImageManageInAllSize(Map<String, ? extends Object> context, String filenameToUse, String viewType, String viewNumber , String imageType)
throws IllegalArgumentException, ImagingOpException, IOException, JDOMException {
public static Map<String, Object> scaleImageManageInAllSize(Map<String, ? extends Object> context, String filenameToUse,
String viewType, String viewNumber, String imageType) throws IllegalArgumentException, ImagingOpException, IOException, JDOMException {
/* VARIABLES */
Delegator delegator = (Delegator) context.get("delegator");
Locale locale = (Locale) context.get("locale");
List<String> sizeTypeList = null;
if (UtilValidate.isNotEmpty(imageType)) {
@@ -374,13 +381,18 @@ public class ScaleImage {
// write new image
try {
ImageIO.write(bufNewImg, imgExtension, new File(imageServerPath + "/" + newFilePathPrefix + filenameToUse));
String fileToCheck = imageServerPath + "/" + newFileLocation + "." + imgExtension;
ImageIO.write(bufNewImg, imgExtension, new File(fileToCheck));
if (!org.apache.ofbiz.security.SecuredUpload.isValidFile(fileToCheck, "Image", delegator)) {
String errorMessage = UtilProperties.getMessage("SecurityUiLabels", "SupportedImageFormats", locale);
return ServiceUtil.returnError(errorMessage);
}
} catch (IllegalArgumentException e) {
String errMsg = UtilProperties.getMessage(resource, "ScaleImage.one_parameter_is_null", locale) + e.toString();
Debug.logError(errMsg, module);
result.put(ModelService.ERROR_MESSAGE, errMsg);
return result;
} catch (IOException e) {
} catch (IOException | ImageReadException e) {
String errMsg = UtilProperties.getMessage(resource, "ScaleImage.error_occurs_during_writing", locale) + e.toString();
Debug.logError(errMsg, module);
result.put(ModelService.ERROR_MESSAGE, errMsg);
@@ -41,6 +41,7 @@ import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.swing.ImageIcon;
import org.apache.commons.imaging.ImageReadException;
import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.FileUtil;
import org.apache.ofbiz.base.util.UtilDateTime;
@@ -250,7 +251,8 @@ public class FrameImage {
LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
Delegator delegator = dispatcher.getDelegator();
HttpSession session = request.getSession();
GenericValue userLogin = (GenericValue)session.getAttribute("userLogin");
Locale locale = request.getLocale();
GenericValue userLogin = (GenericValue) session.getAttribute("userLogin");
Map<String, ? extends Object> context = UtilGenerics.checkMap(request.getParameterMap());
String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", delegator), context);
@@ -293,6 +295,11 @@ public class FrameImage {
RandomAccessFile out = new RandomAccessFile(file, "rw");
out.write(imageData.array());
out.close();
if (!org.apache.ofbiz.security.SecuredUpload.isValidFile(file.getAbsolutePath(), "Image", delegator)) {
String errorMessage = UtilProperties.getMessage("SecurityUiLabels", "SupportedFileFormatsIncludingSvg", locale);
request.setAttribute("_ERROR_MESSAGE_", errorMessage);
return "error";
}
//create dataResource
Map<String, Object> dataResourceCtx = new HashMap<>();
@@ -313,7 +320,7 @@ public class FrameImage {
contentCtx.put("userLogin", userLogin);
Map<String, Object> contentResult = dispatcher.runSync("createContent", contentCtx);
contentId = contentResult.get("contentId").toString();
} catch (GenericServiceException | IOException gse) {
} catch (GenericServiceException | IOException | ImageReadException gse) {
request.setAttribute("_ERROR_MESSAGE_", gse.getMessage());
return "error";
}
@@ -34,6 +34,7 @@ import java.util.Map;
import javax.imageio.ImageIO;
import org.apache.commons.imaging.ImageReadException;
import org.apache.ofbiz.base.location.FlexibleLocation;
import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.UtilDateTime;
@@ -68,7 +69,7 @@ public class ImageManagementServices {
private static String imagePath;
public static Map<String, Object> addMultipleuploadForProduct(DispatchContext dctx,
Map<String, ? extends Object> context) {
Map<String, ? extends Object> context) throws ImageReadException {
Map<String, Object> result = new HashMap<>();
LocalDispatcher dispatcher = dctx.getDispatcher();
@@ -135,7 +136,8 @@ public class ImageManagementServices {
}
}
File file = new File(imageServerPath + "/" + productId + "/" + uploadFileName);
String fileToCheck = imageServerPath + "/" + productId + "/" + uploadFileName;
File file = new File(fileToCheck);
String imageName = null;
imagePath = imageServerPath + "/" + productId + "/" + uploadFileName;
file = checkExistsImage(file);
@@ -152,6 +154,10 @@ public class ImageManagementServices {
RandomAccessFile out = new RandomAccessFile(file, "rw");
out.write(imageData.array());
out.close();
if (!org.apache.ofbiz.security.SecuredUpload.isValidFile(fileToCheck, "Image", delegator)) {
String errorMessage = UtilProperties.getMessage("SecurityUiLabels", "SupportedImageFormats", locale);
return ServiceUtil.returnError(errorMessage);
}
} catch (FileNotFoundException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
@@ -164,13 +170,19 @@ public class ImageManagementServices {
}
// Scale Image in different sizes
if (UtilValidate.isNotEmpty(imageResize)) {
File fileOriginal = new File(imageServerPath + "/" + productId + "/" + imageName);
fileToCheck = imageServerPath + "/" + productId + "/" + imageName;
File fileOriginal = new File(fileToCheck);
fileOriginal = checkExistsImage(fileOriginal);
try {
RandomAccessFile outFile = new RandomAccessFile(fileOriginal, "rw");
outFile.write(imageData.array());
outFile.close();
if (!org.apache.ofbiz.security.SecuredUpload.isValidFile(fileToCheck, "Image", delegator)) {
String errorMessage = UtilProperties.getMessage("SecurityUiLabels", "SupportedImageFormats", locale);
return ServiceUtil.returnError(errorMessage);
}
} catch (FileNotFoundException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
@@ -468,7 +480,8 @@ public class ImageManagementServices {
return result;
}
public static Map<String, Object> createContentThumbnail(DispatchContext dctx, Map<String, ? extends Object> context, GenericValue userLogin, ByteBuffer imageData, String productId, String imageName){
public static Map<String, Object> createContentThumbnail(DispatchContext dctx, Map<String, ? extends Object> context,
GenericValue userLogin, ByteBuffer imageData, String productId, String imageName) throws ImageReadException {
Map<String, Object> result = new HashMap<>();
LocalDispatcher dispatcher = dctx.getDispatcher();
Delegator delegator = dctx.getDelegator();
@@ -513,11 +526,17 @@ public class ImageManagementServices {
}
result.put("filenameToUseThumb", filenameToUseThumb);
// Create image file thumbnail to folder product id.
File fileOriginalThumb = new File(imageServerPath + "/" + productId + "/" + filenameToUseThumb);
String fileToCheck = imageServerPath + "/" + productId + "/" + filenameToUseThumb;
File fileOriginalThumb = new File(fileToCheck);
try {
RandomAccessFile outFileThumb = new RandomAccessFile(fileOriginalThumb, "rw");
outFileThumb.write(imageData.array());
outFileThumb.close();
if (!org.apache.ofbiz.security.SecuredUpload.isValidFile(fileToCheck, "Image", delegator)) {
String errorMessage = UtilProperties.getMessage("SecurityUiLabels", "SupportedImageFormats", locale);
return ServiceUtil.returnError(errorMessage);
}
} catch (FileNotFoundException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
@@ -37,6 +37,7 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.commons.imaging.ImageReadException;
import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.UtilDateTime;
import org.apache.ofbiz.base.util.UtilGenerics;
@@ -945,7 +946,7 @@ public class ProductServices {
}
public static Map<String, Object> addAdditionalViewForProduct(DispatchContext dctx,
Map<String, ? extends Object> context) {
Map<String, ? extends Object> context) throws ImageReadException {
LocalDispatcher dispatcher = dctx.getDispatcher();
Delegator delegator = dctx.getDelegator();
@@ -1042,11 +1043,16 @@ public class ProductServices {
}
// Write
try {
File file = new File(imageServerPath + "/" + fileLocation + "." + extension.getString("fileExtensionId"));
String fileToCheck = imageServerPath + "/" + fileLocation + "." + extension.getString("fileExtensionId");
File file = new File(fileToCheck);
try {
RandomAccessFile out = new RandomAccessFile(file, "rw");
RandomAccessFile out = new RandomAccessFile(fileToCheck, "rw");
out.write(imageData.array());
out.close();
if (!org.apache.ofbiz.security.SecuredUpload.isValidFile(fileToCheck, "Image", delegator)) {
String errorMessage = UtilProperties.getMessage("SecurityUiLabels", "SupportedImageFormats", locale);
return ServiceUtil.returnError(errorMessage);
}
} catch (FileNotFoundException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
@@ -1289,8 +1295,7 @@ public class ProductServices {
String filePathPrefix = "";
String filenameToUse = fileLocation;
if (fileLocation.lastIndexOf('/') != -1) {
filePathPrefix = fileLocation.substring(0, fileLocation.lastIndexOf('/') + 1); // adding 1 to include
// the trailing slash
filePathPrefix = fileLocation.substring(0, fileLocation.lastIndexOf('/') + 1); // adding 1 to include the trailing slash
filenameToUse = fileLocation.substring(fileLocation.lastIndexOf('/') + 1);
}
@@ -1314,17 +1319,23 @@ public class ProductServices {
}
}
File file = new File(imageServerPath + "/" + filePathPrefix + filenameToUse);
String fileToCheck = imageServerPath + "/" + filePathPrefix + filenameToUse;
File file = new File(fileToCheck);
try {
RandomAccessFile out = new RandomAccessFile(file, "rw");
out.write(imageData.array());
out.close();
if (!org.apache.ofbiz.security.SecuredUpload.isValidFile(fileToCheck, "Image", delegator)) {
String errorMessage = UtilProperties.getMessage("SecurityUiLabels", "SupportedImageFormats", locale);
return ServiceUtil.returnError(errorMessage);
}
} catch (FileNotFoundException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"ProductImageViewUnableWriteFile", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale));
} catch (IOException e) {
} catch (IOException | ImageReadException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"ProductImageViewUnableWriteBinaryData", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale));
@@ -62,7 +62,7 @@ public class IssuanceTest extends OFBizTestCase {
BigDecimal.valueOf(1000L), false);
String shipmentId = packSession.complete(false);
GenericValue orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).cache().queryOne();
GenericValue orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne();
// Test the OrderShipment is correct
List<GenericValue> orderShipments = orderHeader.getRelated("OrderShipment", null, null, false);
@@ -280,15 +280,25 @@ under the License.
<td>
<div>
<b> ${uiLabelMap.ProductAction} ${(productPromoAction.productPromoActionSeqId)!}</b>
<form method="post" action="<@ofbizUrl>updateProductPromoAction</@ofbizUrl>" name="updateProductPromoAction">
<form method="post" action="<@ofbizUrl>updateProductPromoAction</@ofbizUrl>" name="updateProductPromoAction_${productPromoRule_index}_${productPromoAction_index}">
<input type="hidden" name="productPromoId" value="${(productPromoAction.productPromoId)!}" />
<input type="hidden" name="productPromoRuleId" value="${(productPromoAction.productPromoRuleId)!}" />
<input type="hidden" name="productPromoActionSeqId" value="${(productPromoAction.productPromoActionSeqId)!}" />
<select name="productPromoActionEnumId" size="1">
<#if (productPromoAction.productPromoActionEnumId)??>
<#assign productPromoActionCurEnum = productPromoAction.getRelatedOne("ActionEnumeration", true)>
<option value="${(productPromoAction.productPromoActionEnumId)!}"><#if productPromoActionCurEnum??>${(productPromoActionCurEnum.get("description",locale))!}<#else>[${(productPromoAction.productPromoActionEnumId)!}]</#if></option>
<option value="${(productPromoAction.productPromoActionEnumId)!}">&nbsp;</option>
<#assign productPromoActionCustomMethod = productPromoAction.getRelatedOne("CustomMethod", true)>
<option value="${(productPromoAction.customMethodId)!}">
<#if (productPromoActionCurEnum = productPromoAction.getRelatedOne("ActionEnumeration", true))??>
${(productPromoActionCurEnum.get("description",locale))!}
<#else>
${(productPromoActionCustomMethod.get("description",locale))!}
</#if>
</option>
<option value="${(productPromoAction.customMethodId)!}">&nbsp;</option>
<#elseif (productPromoAction.productPromoActionEnumId)??>
<#assign actionEnumeration = productPromoAction.getRelatedOne("ActionEnumeration", true)! />
<#assign customMethod = EntityQuery.use(delegator).from("CustomMethod").where("customMethodId", actionEnumeration.enumCode!).cache().queryOne()!>
<option value="${(customMethod.customMethodId)!}">${(actionEnumeration.get("description",locale))!}</option>
<#else>
<option value="">&nbsp;</option>
</#if>
@@ -300,15 +310,14 @@ under the License.
${uiLabelMap.ProductQuantity}:&nbsp;<input type="text" size="5" name="quantity" value="${(productPromoAction.quantity)!}" />
${uiLabelMap.ProductAmount}:&nbsp;<input type="text" size="5" name="amount" value="${(productPromoAction.amount)!}" />
<br/>
${uiLabelMap.ProductItemId}:&nbsp;<@htmlTemplate.lookupField value="${(productPromoAction.productId)!}" formName="updateProductPromoAction" name="productId" id="productId" fieldFormName="LookupProduct"/>
${uiLabelMap.ProductItemId}:&nbsp;<@htmlTemplate.lookupField value="${(productPromoAction.productId)!}" formName="updateProductPromoAction_${productPromoRule_index}_${productPromoAction_index}" name="productId" id="productId" fieldFormName="LookupProduct"/>
<br/>
${uiLabelMap.PartyParty}:&nbsp;<@htmlTemplate.lookupField value="${(productPromoAction.partyId)!}" formName="updateProductPromoAction" name="partyId" id="partyId" fieldFormName="LookupUserLoginAndPartyDetails"/>
${uiLabelMap.PartyParty}:&nbsp;<@htmlTemplate.lookupField value="${(productPromoAction.partyId)!}" formName="updateProductPromoAction_${productPromoRule_index}_${productPromoAction_index}" name="partyId" id="partyId" fieldFormName="LookupUserLoginAndPartyDetails"/>
<br/>
${uiLabelMap.ProductServiceName}:&nbsp;<input type="text" size="20" name="serviceName" value="${(productPromoAction.serviceName)!}" />
${uiLabelMap.UseCartQuantity}:&nbsp;
<select name="useCartQuantity">
<#if (productPromoAction.useCartQuantity)??>
<#assign productPromoActionCurEnum = productPromoAction.getRelatedOne("ActionEnumeration", true)>
<option value="${(productPromoAction.useCartQuantity)!}"><#if ("Y" == productPromoAction.useCartQuantity)>${uiLabelMap.CommonY}<#else>${uiLabelMap.CommonN}</#if></option>
<option value="${(productPromoAction.useCartQuantity)!}">&nbsp;</option>
<#else>
@@ -383,7 +392,7 @@ under the License.
<div>
${(actionProduct.internalName)!} [${actionProductPromoProduct.productId}]
- ${(actionApplEnumeration.get("description",locale))?default(actionProductPromoProduct.productPromoApplEnumId)}
<form name="deleteProductPromoProductAction_${productPromoRule_index}_${productPromoAction_index}_${actionProductPromoProduct_index}" method="post" action="<@ofbizUrl>deleteProductPromoProduct</@ofbizUrl>">
<form name="deleteProductPromoProductAction_${productPromoRule_index}_${productPromoAction_index}_${actionProductPromoProduct_index}" method="post" action="<@ofbizUrl>deleteProductPromoProduct</@ofbizUrl>">
<input type="hidden" name="productPromoId" value="${(actionProductPromoProduct.productPromoId)!}" />
<input type="hidden" name="productPromoRuleId" value="${(actionProductPromoProduct.productPromoRuleId)!}" />
<input type="hidden" name="productPromoCondSeqId" value="${(actionProductPromoProduct.productPromoCondSeqId)!}" />
@@ -20,7 +20,7 @@
under the License.
-->
<#-- FreeMarker template for Fedex FDXShipRequest -->
<#-- FTL emplate for Fedex FDXShipRequest -->
<FDXShipRequest xmlns:api="http://www.fedex.com/fsmapi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FDXShipRequest.xsd">
<RequestHeader>
@@ -121,4 +121,4 @@
</FDXShipRequest>
</#compress>
</#compress>
@@ -20,7 +20,7 @@
under the License.
-->
<#-- FreeMarker template for Fedex FDXSubscriptionRequest -->
<#-- FTL template for Fedex FDXSubscriptionRequest -->
<FDXSubscriptionRequest xmlns:api="http://www.fedex.com/fsmapi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FDXSubscriptionRequest.xsd">
<RequestHeader>
@@ -34,7 +34,7 @@
<FaxNumber>${FaxNumber?xml}</FaxNumber>
</#if>
<#if EMailAddress??>
<#-- Freemarker has a problem with the E-MailAddress tag name, so the opening and closing tags need to be wrapped in the noparse directive. -->
<#-- Free-marker has a problem with the E-MailAddress tag name, so the opening and closing tags need to be wrapped in the noparse directive. -->
<#noparse><E-MailAddress></#noparse>${EMailAddress?xml}<#noparse></E-MailAddress></#noparse>
</#if>
</Contact>
@@ -26,7 +26,9 @@ under the License.
<li>
<ul>
<li<#if selected="ViewShipment"> class="selected"</#if>><a href="<@ofbizUrl>ViewShipment?shipmentId=${shipmentId}</@ofbizUrl>">${uiLabelMap.CommonView}</a></li>
<li<#if selected="EditShipment"> class="selected"</#if>><a href="<@ofbizUrl>EditShipment?shipmentId=${shipmentId}</@ofbizUrl>">${uiLabelMap.CommonEdit}</a></li>
<#if (shipment.statusId)?? && (shipment.statusId != "PURCH_SHIP_RECEIVED" && shipment.statusId != "SHIPMENT_SHIPPED")>
<li<#if selected="EditShipment"> class="selected"</#if>><a href="<@ofbizUrl>EditShipment?shipmentId=${shipmentId}</@ofbizUrl>">${uiLabelMap.CommonEdit}</a></li>
</#if>
<#if (shipment.shipmentTypeId)?? && shipment.shipmentTypeId = "PURCHASE_RETURN">
<li<#if selected="AddItemsFromInventory"> class="selected"</#if>><a href="<@ofbizUrl>AddItemsFromInventory?shipmentId=${shipmentId}</@ofbizUrl>">${uiLabelMap.ProductOrderItems}</a></li>
</#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 - Catalog</display-name>
<description>Catalog Module of the Apache OFBiz Project</description>
@@ -1266,7 +1266,7 @@ under the License.
<response name="error" type="view" value="EditFacility"/>
</request-map>
<!-- Shipment Gateway Config -->
<!-- Shipment Gateway Config -->
<request-map uri="FindShipmentGatewayConfig">
<security https="true" auth="true"/>
<response name="success" type="view" value="FindShipmentGatewayConfig"/>
@@ -1350,6 +1350,8 @@ under the License.
<request-map uri="LookupContent"><security auth="true" https="true"/><response name="success" type="view" value="LookupContent"/></request-map>
<request-map uri="LookupWorkEffort"><security https="true" auth="true"/><response name="success" type="view" value="LookupWorkEffort"/></request-map>
<request-map uri="LookupShipment"><security auth="true" https="true"/><response name="success" type="view" value="LookupShipment"/></request-map>
<request-map uri="LookupDataResource"><security auth="true" https="true"/><response name="success" type="view" value="LookupDataResource"/></request-map>
<request-map uri="LookupFixedAsset"><security auth="true" https="true"/><response name="success" type="view" value="LookupFixedAsset"/></request-map>
<!-- end of request mappings -->
<!-- View Mappings -->
@@ -1454,7 +1456,8 @@ under the License.
<view-map name="LookupContent" type="screen" page="component://content/widget/content/ContentScreens.xml#LookupContent"/>
<view-map name="LookupWorkEffort" type="screen" page="component://workeffort/widget/LookupScreens.xml#LookupWorkEffort"/>
<view-map name="LookupShipment" type="screen" page="component://product/widget/facility/LookupScreens.xml#LookupShipment"/>
<view-map name="LookupDataResource" type="screen" page="component://content/widget/content/DataResourceScreens.xml#LookupDataResource"/>
<view-map name="LookupFixedAsset" type="screen" page="component://accounting/widget/LookupScreens.xml#LookupFixedAsset"/>
<!-- Shipment Gateway Config -->
<view-map name="FindShipmentGatewayConfig" type="screen" page="component://product//widget/facility/ShipmentGatewayConfigScreens.xml#FindShipmentGatewayConfig"/>
<view-map name="EditShipmentGatewayConfig" type="screen" page="component://product//widget/facility/ShipmentGatewayConfigScreens.xml#EditShipmentGatewayConfig"/>
@@ -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 - Facility Manager</display-name>
<description>Facility Manager Module of the Apache OFBiz Project</description>
@@ -2333,7 +2333,7 @@ under the License.
<field name="fromDate" title="${uiLabelMap.ProductDealStartDate}"><display/></field>
<field name="thruDate" title="${uiLabelMap.ProductDealEndDate}"><display/></field>
<field name="statusId" title="${uiLabelMap.CommonStatus}"><display-entity entity-name="StatusItem" key-field-name="statusId"/></field>
<field name="editLink" use-when="${groovy: return reqOrderQty.compareTo(soldOrderQty)!= 0;}&amp;&amp;${groovy: return thruDate.compareTo(org.apache.ofbiz.base.util.UtilDateTime.nowTimestamp()) == 1}" title=" " widget-style="buttontext">
<field name="editLink" use-when="${groovy: return reqOrderQty.compareTo(soldOrderQty) != 0 &amp;&amp; thruDate.compareTo(org.apache.ofbiz.base.util.UtilDateTime.nowTimestamp()) == 1}" title=" " widget-style="buttontext">
<hyperlink description="${uiLabelMap.CommonEdit}" target="EditProductGroupOrder" also-hidden="false">
<parameter param-name="productId"/>
<parameter param-name="groupOrderId"/>
@@ -71,7 +71,7 @@ under the License.
</service>
</actions>
<field name="shipmentId" title="${uiLabelMap.ProductShipmentId}" widget-style="buttontext">
<hyperlink description="${shipmentId}" target="EditShipment">
<hyperlink description="${shipmentId}" target="ViewShipment">
<parameter param-name="shipmentId" from-field="shipmentId"/>
</hyperlink>
</field>
@@ -22,7 +22,7 @@ under the License.
xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd">
<simple-method method-name="testCreateWorkEffortAndPartyAssign" short-description="Test the service createWorkEffortAndPartyAssign" login-required="false">
<set field="serviceCtx.partyId" value="TestParty-1"/>
<set field="serviceCtx.roleTypeId" value="CONTACT"/>
<set field="serviceCtx.roleTypeId" value="CAL_OWNER"/>
<set field="serviceCtx.statusId" value="PRTYASGN_ASSIGNED"/>
<set field="serviceCtx.workEffortId" value="TestWorkEffort-1"/>
<set field="serviceCtx.partyTypeId" value="PARTY_GROUP"/>
@@ -39,7 +39,7 @@ under the License.
<entity-one entity-name="WorkEffort" value-field="workEffort"/>
<set field="lookupKeyValue.workEffortId" from-field="workEffortId"/>
<set field="lookupKeyValue.partyId" value="TestParty-1"/>
<set field="lookupKeyValue.roleTypeId" value="CONTACT"/>
<set field="lookupKeyValue.roleTypeId" value="CAL_OWNER"/>
<find-by-and entity-name="WorkEffortPartyAssignment" map="lookupKeyValue" list="workEffortPartyAssignmentList"/>
<first-from-list entry="workEffortPartyAssignment" list="workEffortPartyAssignmentList"/>
<assert>
@@ -577,4 +577,4 @@ under the License.
</assert>
<check-errors/>
</simple-method>
</simple-methods>
</simple-methods>
@@ -22,6 +22,22 @@ under the License.
xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd">
<simple-method method-name="createWorkEffortAndPartyAssign" short-description="Create Work Effort and assign to a party with a role">
<entity-one entity-name="PartyRole" value-field="partyRole">
<field-map field-name="partyId" from-field="parameters.partyId"/>
<field-map field-name="roleTypeId" value="CAL_OWNER"/>
</entity-one>
<if-empty field="partyRole">
<entity-one entity-name="RoleType" value-field="roleType">
<field-map field-name="roleTypeId" value="CAL_OWNER"/>
</entity-one>
<if-not-empty field="roleType">
<set field="roleDescription" from-field="roleType.description"/>
</if-not-empty>
<set field="partyId" from-field="parameters.partyId"></set>
<add-error>
<fail-property resource="PartyErrorUiLabels" property="PartyRoleAssociationRequired" />
</add-error>
</if-empty>
<set-service-fields service-name="createWorkEffort" map="parameters" to-map="create"/>
<call-service service-name="createWorkEffort" in-map-name="create">
<result-to-field result-name="workEffortId"/>
@@ -38,7 +38,7 @@ under the License.
<Party partyId="TestParty-1" partyTypeId="PERSON" statusId="PARTY_ENABLED"/>
<Person partyId="TestParty-1" firstName="Test" lastName="Party"/>
<PartyRole partyId="TestParty-1" roleTypeId="CONTACT"/>
<PartyRole partyId="TestParty-1" roleTypeId="CAL_OWNER"/>
<PartyRole partyId="TestParty-1" roleTypeId="CUSTOMER"/>
<PartyRole partyId="TestParty-1" roleTypeId="ACCOUNTANT"/>
<PartyStatus partyId="TestParty-1" statusId="PARTY_ENABLED" statusDate="2001-01-01 12:00:00.0"/>
@@ -79,4 +79,4 @@ under the License.
<TimeEntry timeEntryId="TestTimeEntry-3" hours="8.0" workEffortId="TestWorkeffort-4" invoiceId="TestInvoice" partyId="TestParty" rateTypeId="STANDARD"/>
<RateAmount rateTypeId="STANDARD" workEffortId="_NA_" partyId="TestParty" periodTypeId="RATE_HOUR" emplPositionTypeId="_NA_" fromDate="2000-01-01 00:00:00.0" rateAmount="95.00" rateCurrencyUomId="USD"/>
</entity-engine-xml>
</entity-engine-xml>
@@ -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 - iCalendar Server</display-name>
<description>iCalendar Server Module of the Apache OFBiz Project</description>
@@ -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 - Work Manager</display-name>
<description>Work Manager Module of the Apache OFBiz Project</description>
+52 -11
View File
@@ -53,6 +53,7 @@ if (project.hasProperty('jvmArgs')) {
ext.ofbizMainClass = 'org.apache.ofbiz.base.start.Start'
javadoc.failOnError = true
javadoc.title = "OFBiz R17.12 API"
javadoc.options {
encoding "UTF-8"
charSet "UTF-8"
@@ -138,13 +139,13 @@ dependencies {
compile 'org.apache.httpcomponents:httpclient-cache:4.5.4'
compile 'org.apache.logging.log4j:log4j-api:2.10.0' // the API of log4j 2
compile 'org.apache.shiro:shiro-core:1.4.0'
compile 'org.apache.tika:tika-core:1.20'
compile 'org.apache.tika:tika-parsers:1.20'
compile 'org.apache.tika:tika-core:1.24.1'
compile 'org.apache.tika:tika-parsers:1.24.1'
compile 'org.apache.poi:poi:3.17'
compile 'org.apache.tomcat:tomcat-catalina-ha:9.0.31'
compile 'org.apache.tomcat:tomcat-catalina:9.0.31'
compile 'org.apache.tomcat:tomcat-jasper:9.0.31'
compile 'org.apache.tomcat:tomcat-tribes:9.0.31'
compile 'org.apache.tomcat:tomcat-catalina-ha:9.0.36'
compile 'org.apache.tomcat:tomcat-catalina:9.0.36'
compile 'org.apache.tomcat:tomcat-jasper:9.0.36'
compile 'org.apache.tomcat:tomcat-tribes:9.0.36'
compile 'org.apache.xmlgraphics:fop:2.2'
compile 'org.apache.xmlrpc:xmlrpc-client:3.1.3'
compile 'org.apache.xmlrpc:xmlrpc-server:3.1.3'
@@ -157,6 +158,9 @@ dependencies {
compile 'oro:oro:2.0.8'
compile 'wsdl4j:wsdl4j:1.6.3'
compile 'org.jsoup:jsoup:1.11.2'
compile 'net.lingala.zip4j:zip4j:2.6.4'
compile 'org.apache.commons:commons-imaging:1.0-alpha2' // Alpha but OK, "Imaging was working and was used by a number of projects in production even before reaching its initial release as an Apache Commons component."
compile 'batik:batik-svg-dom:1.6-1'
// ofbiz unit-test compile libs
testCompile 'org.mockito:mockito-core:2.+'
@@ -536,6 +540,16 @@ task deleteAllPluginsDocumentation {
}
task generateReadmeFiles(group: docsGroup, type: AsciidoctorTask) {
doFirst { delete "${buildDir}/asciidoc/readme" }
description 'Generate OFBiz README files'
sourceDir "${rootDir}"
sources {
include 'README.adoc', 'CHANGELOG.adoc', 'CONTRIBUTING.adoc'
}
outputDir file("${buildDir}/asciidoc/readme/")
}
task generateOfbizDocumentation(group: docsGroup, type: AsciidoctorTask) {
dependsOn deleteOfbizDocumentation
description 'Generate OFBiz documentation manuals'
@@ -562,6 +576,7 @@ task generatePluginDocumentation(group: docsGroup) {
} else {
println "No documentation found for plugin ${component.name}"
}
doLast { delete "${component}/src/docs/asciidoc/images/OFBiz-Logo.svg" }
mustRunAfter deletePluginDocumentation
}
dependsOn pluginAsciidoc
@@ -582,21 +597,25 @@ task generateAllPluginsDocumentation(group: docsGroup,
// the other inner task temporary created by the generatePluginDocumentation task
def pluginAsciidoc = task "${component.name}-Documentation" (type: AsciidoctorTask) {
def asciidocFolder = new File("${component}/src/docs/asciidoc")
if (asciidocFolder.exists()) {
copy {
from "${rootDir}/docs/asciidoc/images/OFBiz-Logo.svg"
into "${component}/src/docs/asciidoc/images"
doFirst {
if (asciidocFolder.exists()) {
copy {
from "${rootDir}/docs/asciidoc/images/OFBiz-Logo.svg"
into "${component}/src/docs/asciidoc/images"
}
}
}
if (asciidocFolder.exists()) {
sourceDir file("${component}/src/docs/asciidoc")
outputDir file("${buildDir}/asciidoc/plugins/${component.name}")
doLast { println "Documentation generated for plugin ${component.name}" }
}
mustRunAfter deleteAllPluginsDocumentation
doLast { delete "${component}/src/docs/asciidoc/images/OFBiz-Logo.svg" }
}
dependsOn pluginAsciidoc
}
doLast { delete "${component}/src/docs/asciidoc/images/OFBiz-Logo.svg" }
}
}
}
@@ -973,6 +992,19 @@ def cleanTasks = getTasksMatchingRegex(/^clean.+/)
task cleanAll(group: cleanupGroup, dependsOn: [cleanTasks, clean]) {
description 'Execute all cleaning tasks.'
}
/*
* With OFBIZ-11304, Checkstyle pre-push hook is installed using the
* com.github.jakemarsden.git-hooks Gradle plugin
* As the checkstyle plugin has some limitations
* with Gradle 3.2 we are not able to backport.
* See https://issues.apache.org/jira/browse/OFBIZ-11251
* https://issues.apache.org/jira/browse/OFBIZ-11304
* Hook once added cannot be removed when branch is
* switched, adding dummy task to avoid push failures
* due to absence of checkstyle plugin in R17.12
*/
task checkstyleMain {}
/* ========================================================
* Rules-based OFBiz server commands
@@ -1128,3 +1160,12 @@ def gradlewSubprocess(commandList) {
fullCommand.addAll(commandList)
exec { commandLine fullCommand }
}
def gradle = project.getGradle()
new File("${gradle.getGradleUserHomeDir().getAbsolutePath()}/daemon/${gradle.getGradleVersion()}").listFiles().each {
if (it.getName().endsWith('.out.log')) {
logger.debug("Cleaning up daemon log file $it")
it.delete()
}
}
@@ -1,3 +1,22 @@
/*******************************************************************************
* 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.
*******************************************************************************/
package org.apache.ofbiz.base.html;
import java.util.regex.Pattern;
@@ -1,3 +1,21 @@
/*******************************************************************************
* 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.
*******************************************************************************/
package org.apache.ofbiz.base.html;
import java.util.regex.Pattern;
@@ -41,6 +41,9 @@ import java.util.Set;
import org.apache.commons.io.FileUtils;
import org.apache.ofbiz.base.location.ComponentLocationResolver;
import net.lingala.zip4j.ZipFile;
import net.lingala.zip4j.exception.ZipException;
/**
* File Utilities
*
@@ -414,4 +417,26 @@ public final class FileUtil {
return new File(filePath).toPath().normalize().toFile();
}
/**
* Unzip file structure of the given zipFile to specified outputFolder The Zip slip vulnerabilty is handled since version 1.3.3 of
* net.lingala.zip4j.ZipFile; unzipFileToFolder is not as reliable and does not handle passwords
* @param source
* @param destination
* @param password optional
* @return true if OK
*/
public static boolean unZip(String source, String destination, String password) {
try {
if (password.isEmpty()) {
new ZipFile(source).extractAll(destination);
} else {
new ZipFile(source, password.toCharArray()).extractAll(destination);
}
} catch (ZipException e) {
Debug.logError("Error extracting [" + source + "] file to dir destination: " + destination, e.toString(), module);
return false;
}
return true;
}
}
@@ -30,6 +30,8 @@ import java.util.Map;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.imaging.ImageReadException;
import org.apache.ofbiz.entity.Delegator;
/**
* HttpRequestFileUpload - Receive a file upload through an HttpServletRequest
@@ -112,19 +114,19 @@ public class HttpRequestFileUpload {
}
}
public void doUpload(HttpServletRequest request) throws IOException {
public boolean doUpload(HttpServletRequest request, String fileType) throws IOException {
Delegator delegator = (Delegator) request.getAttribute("delegator");
ServletInputStream in = request.getInputStream();
String reqLengthString = request.getHeader("content-length");
Debug.logInfo("expect " + reqLengthString + " bytes.", module);
int requestLength = 0;
try {
requestLength = Integer.parseInt(reqLengthString);
} catch (Exception e2) {
e2.printStackTrace();
return;
} catch (NumberFormatException e) {
Debug.logError(e, e.getMessage(), module);
return false;
}
byte[] line = new byte[BUFFER_SIZE];
@@ -133,7 +135,8 @@ public class HttpRequestFileUpload {
i = waitingReadLine(in, line, 0, BUFFER_SIZE, requestLength);
requestLength -= i;
if (i < 3) {
return;
Debug.logError("Possibly a waitingReadLine error", module);
return false;
}
int boundaryLength = i - 2;
@@ -152,7 +155,7 @@ public class HttpRequestFileUpload {
if (newLine.indexOf("filename=\"") != -1) {
setFilename(new String(line, 0, i - 2, UtilIO.getUtf8()));
if (filename == null) {
return;
return false;
}
// this is the file content
i = waitingReadLine(in, line, 0, BUFFER_SIZE, requestLength);
@@ -190,8 +193,8 @@ public class HttpRequestFileUpload {
}
}
try (
FileOutputStream fos = new FileOutputStream(savePath + filenameToUse);) {
String fileTocheck = savePath + filenameToUse;
try (FileOutputStream fos = new FileOutputStream(fileTocheck);) {
boolean bail = (new String(line, 0, i, UtilIO.getUtf8()).startsWith(boundary));
boolean oneByteLine = (i == 1); // handle one-byte lines
@@ -231,11 +234,13 @@ public class HttpRequestFileUpload {
}
}
fos.flush();
fos.close();
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
if (!org.apache.ofbiz.security.SecuredUpload.isValidFile(fileTocheck, fileType, delegator)) {
return false;
}
} catch (ImageReadException e) {
Debug.logError(e, module);
return false;
}
} else {
// this is a field
@@ -259,7 +264,7 @@ public class HttpRequestFileUpload {
i = waitingReadLine(in, line, 0, BUFFER_SIZE, requestLength);
requestLength -= i;
if ((i == boundaryLength + 2 || i == boundaryLength + 4) // + 4 is eof
&& (new String(line, 0, i).startsWith(boundary))) {
&& (new String(line, 0, i).startsWith(boundary))) {
fieldValue.append(newLine.substring(0, newLine.length() - 2));
} else {
fieldValue.append(newLine);
@@ -275,6 +280,7 @@ public class HttpRequestFileUpload {
}
} // end while
return true;
}
// reads a line, waiting if there is nothing available and reqLen > 0
@@ -295,7 +301,7 @@ public class HttpRequestFileUpload {
while (endMS > (new Date().getTime())) {
try {
wait(WAIT_INTERVAL);
} catch (Exception e3) {
} catch (InterruptedException e) {
Debug.logInfo(".", module);
}
}
@@ -303,4 +309,5 @@ public class HttpRequestFileUpload {
}
return i;
}
}
@@ -64,6 +64,10 @@ public final class SafeObjectInputStream extends ObjectInputStream {
@Override
protected Class<?> resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException {
if (!whitelistPattern.matcher(classDesc.getName()).find()) {
// DiskFileItem, FileItemHeadersImpl are not serializable.
if (classDesc.getName().contains("org.apache.commons.fileupload")) {
return null;
}
Debug.logWarning("***Incompatible class***: "
+ classDesc.getName()
+ ". Please see OFBIZ-10837. Report to dev ML if you use OFBiz without changes. "
@@ -51,7 +51,7 @@ public class UtilCodec {
private static final StringEncoder stringEncoder = new StringEncoder();
private static final UrlCodec urlCodec = new UrlCodec();
private static final List<Codec> codecs;
// From https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet#Event_Handlers
// From https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet#Event_Handlers
private static final List<String> jsEventList = Arrays.asList(new String[] { "onAbort", "onActivate",
"onAfterPrint", "onAfterUpdate", "onBeforeActivate", "onBeforeCopy", "onBeforeCut", "onBeforeDeactivate",
"onBeforeEditFocus", "onBeforePaste", "onBeforePrint", "onBeforeUnload", "onBeforeUpdate", "onBegin",
@@ -113,13 +113,9 @@ public class UtilCodec {
}
/**
* This method will start a configurable sanitizing process. The sanitizer can
* be turns off through "sanitizer.enable=false", the default value is true. It
* is possible to configure a custom policy using the properties
* "sanitizer.permissive.policy" and "sanitizer.custom.permissive.policy.class".
* The custom policy has to implement
* {@link org.apache.ofbiz.base.html.SanitizerCustomPolicy}.
*
* This method will start a configurable sanitizing process. The sanitizer can be turns off through "sanitizer.enable=false", the default
* value is true. It is possible to configure a custom policy using the properties "sanitizer.permissive.policy" and
* "sanitizer.custom.permissive.policy.class". The custom policy has to implement {@link org.apache.ofbiz.base.html.SanitizerCustomPolicy}.
* @param original
* @param contentTypeId
* @return sanitized HTML-Code if enabled, original HTML-Code when disabled
@@ -360,7 +356,7 @@ public class UtilCodec {
* @param errorMessageList an empty list passed by and modified in case of issues
* @param locale
*/
public static String checkStringForHtmlStrictNone(String valueName, String value, List<String> errorMessageList,
public static String checkStringForHtmlStrictNone(String valueName, String value, List<String> errorMessageList,
Locale locale) {
if (UtilValidate.isEmpty(value)) {
return value;
@@ -379,7 +375,7 @@ public class UtilCodec {
issueMsg = "In field [" + valueName + "] found character escaping (mixed or double) "
+ "that is not allowed or other format consistency error: ";
} else {
issueMsg = UtilProperties.getMessage("SecurityUiLabels","PolicyNoneMixedOrDouble",
issueMsg = UtilProperties.getMessage("SecurityUiLabels", "PolicyNoneMixedOrDouble",
UtilMisc.toMap("valueName", valueName), locale);
}
errorMessageList.add(issueMsg + e.toString());
@@ -391,7 +387,7 @@ public class UtilCodec {
if (locale.equals(new Locale("test"))) {
issueMsg = "In field [" + valueName + "] less-than (<) and greater-than (>) symbols are not allowed.";
} else {
issueMsg = UtilProperties.getMessage("SecurityUiLabels","PolicyNoneLess-thanGreater-than",
issueMsg = UtilProperties.getMessage("SecurityUiLabels", "PolicyNoneLess-thanGreater-than",
UtilMisc.toMap("valueName", valueName), locale);
}
errorMessageList.add(issueMsg);
@@ -399,13 +395,13 @@ public class UtilCodec {
// check for js events
String onEvent = "on" + StringUtils.substringBetween(value, " on", "=");
if (jsEventList.stream().anyMatch(str -> StringUtils.containsIgnoreCase(str, onEvent))
if (jsEventList.stream().anyMatch(str -> StringUtils.containsIgnoreCase(str, onEvent))
|| value.contains("seekSegmentTime")) {
String issueMsg = null;
if (locale.equals(new Locale("test"))) {
issueMsg = "In field [" + valueName + "] Javascript events are not allowed.";
} else {
issueMsg = UtilProperties.getMessage("SecurityUiLabels","PolicyNoneJsEvents",
issueMsg = UtilProperties.getMessage("SecurityUiLabels", "PolicyNoneJsEvents",
UtilMisc.toMap("valueName", valueName), locale);
}
errorMessageList.add(issueMsg);
@@ -422,18 +418,14 @@ public class UtilCodec {
}
/**
* This method check if the input is safe HTML.
* It is possible to configure a safe policy using the properties
* "sanitizer.safe.policy" and "sanitizer.custom.safe.policy.class".
* The safe policy has to implement
* {@link org.apache.ofbiz.base.html.SanitizerCustomPolicy}.
*
* This method check if the input is safe HTML. It is possible to configure a safe policy using the properties "sanitizer.safe.policy" and
* "sanitizer.custom.safe.policy.class". The safe policy has to implement {@link org.apache.ofbiz.base.html.SanitizerCustomPolicy}.
* @param valueName field name checked
* @param value value checked
* @param errorMessageList an empty list passed by and modified in case of issues
* @param locale
*/
public static String checkStringForHtmlSafe(String valueName, String value, List<String> errorMessageList,
public static String checkStringForHtmlSafe(String valueName, String value, List<String> errorMessageList,
Locale locale, boolean enableSanitizer) {
if (!enableSanitizer) {
return value;
@@ -459,25 +451,27 @@ public class UtilCodec {
+ "Beware: the result is not rightly checked!", module);
}
String filtered = policy.sanitize(value);
if (!value.equals(StringEscapeUtils.unescapeHtml4(filtered))) {
String issueMsg = null;
if (locale.equals(new Locale("test"))) {
issueMsg = "In field [" + valueName + "] by our input policy, your input has not been accepted "
+ "for security reason. Please check and modify accordingly, thanks.";
} else {
issueMsg = UtilProperties.getMessage("SecurityUiLabels","PolicySafe",
UtilMisc.toMap("valueName", valueName), locale);
if (value != null) {
String filtered = policy.sanitize(value);
if (filtered != null && !value.equals(StringEscapeUtils.unescapeEcmaScript(StringEscapeUtils.unescapeHtml4(filtered)))) {
String issueMsg = null;
if (locale.equals(new Locale("test"))) {
issueMsg = "In field [" + valueName + "] by our input policy, your input has not been accepted "
+ "for security reason. Please check and modify accordingly, thanks.";
} else {
issueMsg = UtilProperties.getMessage("SecurityUiLabels", "PolicySafe",
UtilMisc.toMap("valueName", valueName), locale);
}
errorMessageList.add(issueMsg);
}
errorMessageList.add(issueMsg);
}
return value;
}
/**
* A simple Map wrapper class that will do HTML encoding.
* To be used for passing a Map to something that will expand Strings with it as a context, etc.
* A simple Map wrapper class that will do HTML encoding. To be used for passing a Map to something that will expand Strings with it as a context,
* etc.
*/
public static class HtmlEncodingMapWrapper<K> implements Map<K, Object> {
public static <K> HtmlEncodingMapWrapper<K> getHtmlEncodingMapWrapper(Map<K, Object> mapToWrap, SimpleEncoder encoder) {
@@ -529,5 +523,4 @@ public class UtilCodec {
@Override
public String toString() { return this.internalMap.toString(); }
}
}
@@ -27,9 +27,14 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.FileNameMap;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLConnection;
import java.net.URLDecoder;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Arrays;
@@ -56,8 +61,9 @@ import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.fileupload.servlet.ServletRequestContext;
import org.apache.commons.lang.RandomStringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
@@ -137,7 +143,7 @@ public final class UtilHttp {
* @return The resulting Map
*/
public static Map<String, Object> getParameterMap(HttpServletRequest request, Set<? extends String> nameSet, Boolean onlyIncludeOrSkip) {
boolean onlyIncludeOrSkipPrim = onlyIncludeOrSkip == null ? true : onlyIncludeOrSkip.booleanValue();
boolean onlyIncludeOrSkipPrim = onlyIncludeOrSkip == null ? true : onlyIncludeOrSkip;
Map<String, Object> paramMap = new HashMap<>();
// add all the actual HTTP request parameters
@@ -177,6 +183,19 @@ public final class UtilHttp {
Debug.logVerbose("Made Request Parameter Map with [" + paramMap.size() + "] Entries", module);
}
// Handles encoded queryStrings
String requestURI = request.getRequestURI();
if (paramMap.isEmpty() && !requestURI.isEmpty()) {
try {
List<NameValuePair> nameValuePairs = URLEncodedUtils.parse(new URI(URLDecoder.decode(requestURI, "UTF-8")), Charset.forName("UTF-8"));
for (NameValuePair element : nameValuePairs) {
paramMap.put(element.getName(), element.getValue());
}
} catch (UnsupportedEncodingException | URISyntaxException e1) {
Debug.logError("Can't handle encoded queryString " + requestURI, module);
}
}
return canonicalizeParameterMap(paramMap);
}
@@ -304,7 +323,18 @@ public final class UtilHttp {
int equalsIndex = token.indexOf("=");
if (equalsIndex > 0) {
String name = token.substring(0, equalsIndex);
paramMap.put(name, token.substring(equalsIndex + 1));
String paramValue = UtilCodec.getDecoder("url").decode(token.substring(equalsIndex + 1));
if (UtilValidate.isEmpty(paramMap.get(name))) {
paramMap.put(name, paramValue);
} else {
if (paramMap.get(name) instanceof Collection<?>){
List<String> valueList = UtilGenerics.cast(paramMap.get(name));
valueList.add(paramValue);
paramMap.put(name, valueList);
} else {
paramMap.put(name, UtilMisc.toList(paramMap.get(name), paramValue));
}
}
}
}
}
@@ -677,7 +707,7 @@ public final class UtilHttp {
if (request.getContextPath().length() > 1) {
appName = request.getContextPath().substring(1);
}
// When you set a mountpoint which contains a slash inside its name (ie not only a slash as a trailer, which is possible),
// When you set a mountpoint which contains a slash inside its name (ie not only a slash as a trailer, which is possible),
// as it's needed with OFBIZ-10765, OFBiz tries to create a cookie with a slash in its name and that's impossible.
return appName.replaceAll("/","_");
}
@@ -1138,18 +1168,20 @@ public final class UtilHttp {
}
}
/** The only x-content-type-options defined value, "nosniff", prevents Internet Explorer from MIME-sniffing a response away from the declared content-type.
This also applies to Google Chrome, when downloading extensions. */
/**
* The only x-content-type-options defined value, "nosniff", prevents Internet Explorer from MIME-sniffing a response away from the declared
* content-type. This also applies to Google Chrome, when downloading extensions.
*/
resp.addHeader("x-content-type-options", "nosniff");
/** This header enables the Cross-site scripting (XSS) filter built into most recent web browsers.
It's usually enabled by default anyway, so the role of this header is to re-enable the filter for this particular website if it was disabled by the user.
This header is supported in IE 8+, and in Chrome (not sure which versions). The anti-XSS filter was added in Chrome 4. Its unknown if that version honored this header.
FireFox has still an open bug entry and "offers" only the noscript plugin
https://wiki.mozilla.org/Security/Features/XSS_Filter
https://bugzilla.mozilla.org/show_bug.cgi?id=528661
/**
* This header enables the Cross-site scripting (XSS) filter built into most recent web browsers. It's usually enabled by default anyway, so
* the role of this header is to re-enable the filter for this particular website if it was disabled by the user. This header is supported in
* IE 8+, and in Chrome (not sure which versions). The anti-XSS filter was added in Chrome 4. Its unknown if that version honored this header.
* FireFox has still an open bug entry and "offers" only the noscript plugin https://wiki.mozilla.org/Security/Features/XSS_Filter
* https://bugzilla.mozilla.org/show_bug.cgi?id=528661
**/
resp.addHeader("X-XSS-Protection","1; mode=block");
resp.addHeader("X-XSS-Protection", "1; mode=block");
resp.setHeader("Referrer-Policy", "no-referrer-when-downgrade"); // This is the default (in Firefox at least)
@@ -180,12 +180,26 @@ public final class UtilMisc {
if (Debug.verboseOn()) {
Debug.logVerbose("Found Map value that is not Serializable: " + mapEntry.getKey() + "=" + mapEntry.getValue(), module);
}
}
}
for (String keyToRemove: keysToRemove) { map.remove(keyToRemove); }
}
/**
* This change an ArrayList to be Serializable by removing all entries that are not Serializable.
* @param arrayList
*/
public static <V> void makeArrayListSerializable(ArrayList<Object> arrayList) {
// now filter out all non-serializable values
Iterator itr = arrayList.iterator();
while (itr.hasNext()) {
Object obj = itr.next();
if (!(obj instanceof Serializable)) {
itr.remove();
}
}
}
/**
* Sort a List of Maps by specified consistent keys.
* @param listOfMaps List of Map objects to sort.

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