entity
(OFBIZ-11218)
I see no reason to no have it as it's in all other cases.
Thanks: reported by Rajesh Mallah, improved with a patch from Devanshu Vyas.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1867665 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-11213)
This refactoring was initiated since using UelFunction::getSize throws
ClassCastException and log a consequent unneeded stack trace to test
Object class type. The log is unnecessary, because it is the result of
each supported class cast trial.
This issue show up that lot of possible NPE were not checked against,
but catched by 'Exception'.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1867635 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-11190)
Currently when you rendering a screen, the transaction timeout would be resolve from the context or use default value (60s)
I reviewed this code part to reorganize timeout resolution on dedicate function (transaction timeout on widget screen is pre-apache)
and introduce possibility to set a default value by properties on 'widget.property' with name 'widget.screen.transaction.defaultTimeout'.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1867620 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-11208)
Currenlty if we use the java helper class OrderReadHelper to resolve the orderItemAttributes, it didn't use the a local cache and call each time the delegator throw a static function.
I added a non static function to optimise database calling when you have multiple get to do.
public String getOrderItemAttribute(String orderItemSeqId, String attributeName) {
GenericValue orderItemAttribute = null;
if (orderHeader != null) {
if (orderItemAttributes == null) {
try{
orderItemAttributes = EntityQuery.use(orderHeader.getDelegator()) .from("OrderItemAttribute") .where("orderId", getOrderId()) .queryList();
} catch (GenericEntityException e) { Debug.logError(e, module); }
}
orderItemAttribute = EntityUtil.getFirst(
EntityUtil.filterByAnd(orderItemAttributes,
UtilMisc.toMap("orderItemSeqId", orderItemSeqId, "attrName", attributeName)));
}
return orderItemAttribute != null ? orderItemAttribute.getString("attrValue"): null;
}
At the first call, we populate the OrderReadHelper with all orderItemAttributes liked to an order, and after just filter with the orderItemSeqId and the attribute name wanted
Example:
OrderReadHelper orh = new OrderReadHelper(orderHeader)
...
for (GenericValue orderItem : orh.getOrderItems()) {
listAttr <<
[startValue : orh.getOrderItemAttribute(orderItem.orderItemSeqId, "MyStartValue"),
endValue : orh.getOrderItemAttribute(orderItem.orderItemSeqId, "MyEndValue")]
}
We request only for the first passage, after for all other line we use the local OrderReadHelper cache.
Added also the same logical for OrderReadHelper.getOrderAttributes
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1867590 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-11201)
These are similar issues in Minilang than the one fixed initially for
<set field="userLoginSize" value="${util:size(logins)}" type="Integer"/>
Fixed by replacing by
<set field="userLoginSize" value="${groovy:logins.size()}"/>
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1867585 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-11212)
When you use a date-find element on form, the defaut option are in code like to greater_than and less _than
public DateFindField(int fieldSource, String type) {
super(fieldSource, type);
this.defaultOptionFrom = greaterThanEqualTo;
this.defaultOptionThru = lessThanEqualTo;
}
but on macro
<#macro renderDateFindField ...
<option value=greaterThan<#if defaultOptionFrom==greaterThan> selected=selected</#if>></option><#rt/>
...
<option value=opLessThan<#if defaultOptionThru==opLessThan> selected=selected</#if>></option><#rt/>
...
</#macro>
So the value java isn't correct with ftl values and default value never used.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1867582 13f79535-47bb-0310-9956-ffa450edef68
communication about the order (mail, phone etc.)
(OFBIZ-11210)
This is in order detail view for following communication about the order
(mail, phone etc.) to keep an eye about all com' event linked to the order.
Thanks: Carl Demus
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1867581 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-11211)
The issue is that when closing the modal the div inside html dom is not removed.
Then opening a second time create another identical div. Since a lookup is based
on an unique id, this id is no more unique...
Thanks: Carl Demus
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1867577 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-11192)
The unnecessary declared ‘ContainerException’ exception has been removed. A
switch statement has been used and the javadoc has been rewritten.
Additionally the method has been renamed to ‘ComponentContainer#loadComponent’.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1867499 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-11207)
When you create a xml form with upload as type, you can't use on-event-update-area element to submit it by ajax.
Otherwise, OFBiz return an error message on 'uploadFile is empty.
To solve it, we analyze the enctype's form before submit it to move on FormData instead a direct serialize [1]
example form where the problem has been present
****
<form name='AddNicelyFile' type='upload' target='CreateNicelyFile'>
<field name='uploadedFile' title='File'><file/></field>
<field name='addButton'><submit/></field>
<on-event-update-area event-type='submit' area-id='window' area-target='FileDisplaying'/>
</form>
****
Thanks to Samuel Tregouet for this fix
[1] https://developer.mozilla.org/en-US/docs/Web/API/FormData/Using_FormData_Objects
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1867435 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-11192)
This redefines the ‘ComponentLoaderConfig#ComponentDef’ class by
removing its unused name attribute.
The ‘java.nio.file’ API has been used to represent the relative path
of a component location.
Various cleanups and Javadoc added.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1867394 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-11203)
When doing some informal tests, it is useful to be able to create
small programs using the OFBiz delegator without requiring every
components to be loaded as done by the ‘Start#main’ static method.
To achieve that with the current singleton based implementation, we
need to instantiate a custom ‘Config’ object and use it as the global
configuration.
Thanks: Samuel Trégouët for your contribution.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1867343 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-11201)
There is this a (long stack trace) error in log (only), mostly
java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Map
at org.apache.ofbiz.base.util.string.UelFunctions.getSize(UelFunctions.java:318)
I did not notice any other effect, so the fix only cleans the log.
It's actually an issue in ListParty grid with this line:
<set field="userLoginSize" value="${util:size(logins)}" type="Integer"/>
This fixes it by replacing by
<set field="userLoginSize" value="${groovy:logins.size()}"/>
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1867099 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-8341)
In many Java and Groovy files we have auto generated catch blocks or empty catch
blocks.
To avoid such exception swallowing this should be improved to at least log the
error and also return error in case of service.
Missed this one in last commit
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866985 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-11161)
In order to have an independent deployable jar, we need to include the
properties and labels inside the jar.
The properties and labels file was previously excluded from the jar
because it was not possible to replace the compile time values by
invalidating OFBiz caches which is convenient when developing
OFBiz. It was then necessary to reconstruct the jar and restart
OFBiz (See OFBIZ-8321 for more details).
With the recent improvment from revision 1865719 allowing to run OFBiz
without building a jar, it is now possible to enable this cache
invalidation by running both ‘gradle run’ in one shell and ‘gradlew
--continuous classes’ in a separate shell. Doing so make the
combination of editing the label files and clearing the caches use
the new value defined in the source file.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866971 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-8341)
In many Java and Groovy files we have auto generated catch blocks or empty catch
blocks.
To avoid such exception swallowing this should be improved to at least log the
error and also return error in case of service.
Last ones :)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866958 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-8341)
In many Java and Groovy files we have auto generated catch blocks or empty catch
blocks.
To avoid such exception swallowing this should be improved to at least log the
error and also return error in case of service.
Here we use 3 try-with-ressource blocks and log some errors
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866957 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-8341)
In many Java and Groovy files we have auto generated catch blocks or empty catch
blocks.
To avoid such exception swallowing this should be improved to at least log the
error and also return error in case of service.
Here we use a try-with-ressource block and log some errors
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866952 13f79535-47bb-0310-9956-ffa450edef68
In my previous commit I forgot I used FileUtile::normalizePath (old name
of now normalizeFilePath) in FileUtile::getFile. This is useless, and reverted
here
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866927 13f79535-47bb-0310-9956-ffa450edef68
While working on OFBIZ-11196,I renamed the normalizePath() method in FileUtil
class to createFileWithNormalizedPath() and added the normalizeFilePath()
method which deals only with String (in -> out), could be useful later...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866924 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-11196)
These are not really path traversal issues.
We can't solve them using the traditional way to fix path traversal issues
(ie normalising path). Because Fetchlogs and ViewFile are actually reading
files and if you have the right to read these files then nothing will prevent
you to read them.
The problem is more what those requests are supposed to do.
Fetchlogs is supposed to read a log in the log dir
and ViewFile is supposed to read a file containing labels
(ie either an XML or Properties file).
So the solution is to allow these requests to only do what they are supposed to
do. This is what is done in ViewFile and FetLogs Groovy files.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866920 13f79535-47bb-0310-9956-ffa450edef68
EntityListIterator::hasNext method
(OFBIZ-11198)
FindAPInvoices request does not suffer from this issue nor findInvoice request.
This was due to <screen name="FindArInvoices"> definition
Using something similar than <screen name="FindApInvoices"> fixes the issue
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866890 13f79535-47bb-0310-9956-ffa450edef68
called directly.
(OFBIZ-11199)
I suppose this issue is similar to OFBIZ-11152. So I'm handling it the same.
It's not an end to the underneath issue but at least it can reassure user about
things being handled...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866855 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-10837)
Fixes CVE-2019-0189
Allows users to easily override the list of accepted objects by using the
listOfSafeObjectsForInputStream property
CVE-2019-0189
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866834 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-7113)
As mentioned by Mathieu on dev ML uses rather a boolean than a token for
"require-new-transaction" and "return-error-on-failure"
Also some formatting while at it.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866589 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-10636)
services converted:
* createPicklist
* updatePicklist
* deletePicklist
* createPicklistBin
* deletePicklistBin
* createPicklistItem
* updatePicklistItem
* updatePicklistItem
* deletePicklistItem
* createPicklistRole
* deletePicklistRole
Entity Picklist received to new field createdDate and lastModifiedDate
that needed to support automatic setting of createdByUserLogin natevily
by entity auto engine
Thanks to Pallavi Goyal for this issue and Suraj Khurana for the remind.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866561 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-11183)
Currently the entity auto engine manage the status change operation on an Entity
during an update, with analyse the field statusId as new status and compare with current
value through StatusValidChange system. If the change is validated, the previous status
is returned in oldStatusId service parameter.
Service definition example :
<service name=updateRequirement default-entity-name=Requirement engine=entity-auto invoke=update auth=true>
<description>Update an existing requirement</description>
<auto-attributes include=pk mode=IN optional=false/>
<auto-attributes include=nonpk mode=IN optional=true/>
<attribute name=oldStatusId type=String mode=OUT optional=true/>
</service>
I extend this process to an other standard status field: itemStatusId and oldItemStatusId, often present on item element
<service name=updatePicklistItem default-entity-name=PicklistItem engine=entity-auto invoke=update auth=true>
<description>Update PicklistItem</description>
<auto-attributes include=pk mode=IN optional=false/>
<auto-attributes include=nonpk mode=IN optional=true/>
<attribute name=oldItemStatusId type=String mode=OUT optional=true/>
</service>
To realize this, I convert all call on statusId and oldStatusId raw naming by a dynamic resolution field name resolution.
Like this the logical for statusId or itemStatusId are exactly the same
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866559 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-11182)
The entity PicklistStatusHistory record each status change realized on picklist.
It can't be convert to entity-auto easily because PicklistStatusHistory's fields pattern
doesn't follow same entities like ShipmentStatus and PartyStatus.
To solve this issue, I deprecate PicklistStatusHistory and move it to OldPicklistStatusHistory
and replace it by new entity PicklistStatus that can use natively with entityauto.
I added a new migration service migrateOldPicklistStatusHistoryToPickListStatus to forward all
picklist status history to new entity.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866558 13f79535-47bb-0310-9956-ffa450edef68
(including admin) via "Forget Your Password"
(OFBIZ-4361)
Adds the security.token.key value and change the login.secret_key_string value
The security.token.key value is not mandatory for the "Forget Your Password"
feature but then only the username and password are used to create the JWT key.
Adds a reference for both properties to the
"Passwords and JWT (JSON Web Tokens) usage"
documentation to suggest users to choose the way to store these keys
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866518 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-11035)
When try to define a temporal expression for a recurring job where the temporal expression should be evaluated using a timezone other than whatever the default timezone is for the system.
The use case is having a system that runs on UTC time but needs to send a report at 5 pm Pacific Time every day regardless of whether or not daylight savings is in effect.
To do this:
Added a new field to JobSandbox such as recurrenceTimeZone and modified code to use this timeZone if available.
Thanks: Scott Gray for reporting and Nicolas Malin for the review.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866499 13f79535-47bb-0310-9956-ffa450edef68