Commit Graph
97 Commits
Author SHA1 Message Date
Sebastian Berg bcb76eb607 Improved: Convert ImageManagementServices.xml minilang to groovy (OFBIZ-11604) 2021-02-26 18:53:22 +01:00
Jacques Le Roux d5c336ed3a Fixed: Error on quick ship complete order (OFBIZ-12185)
When we try to quick ship entire order from the Order Manager, the following
error is thrown (in some cases, specifically when we have added a telecom number
for the customer

This was broken by OFBIZ-11462

Thanks: Priya Sharma
2021-02-21 14:14:38 +01:00
SebastianEcomify 8a96462538 Improved: Convert CostService.xml minilang to groovy
(OFBIZ-11595)

Thanks: Sebastian Berg for implementation
2021-02-21 11:38:21 +00:00
Jacques Le Roux a608fa4b56 Improved: puts dates in migration services to be able to remove them later 2021-02-10 11:02:59 +01:00
Jacques Le Roux e73616caf1 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.
2020-12-01 10:16:04 +01:00
Jacques Le Roux 19ef23a3e2 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:52:54 +01:00
Jacques Le Roux f81bd88525 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:50:27 +01:00
Jacques Le Roux 2c86f9a8c0 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:20:57 +01:00
Jacques Le Roux 1be480b68c 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:39:12 +01:00
Nicolas Malin c0054e97ea Improved: Convert ProductStoreServices.xml file from mini-lang to groovy DSL
(OFBIZ-11449)

Thanks to Sebastian Berg for this patch
2020-09-16 09:35:32 +02:00
Mridul Pathak 8487df8666 Fixed: MessagingException in sendShipmentScheduledNotification service (OFBIZ-11984)
The sendFrom emailAddress had the unnecessary comma prefix. The sendTo emailAddress list was a list of lists instead of list of strings.
Also affected sendOrderDeliveryScheduleNotification minilang service. <string-append> tag was used with comma prefix for sendFrom emailAddress, since the sender would only be one used <set> tag without any prefix instead.
2020-08-27 23:58:27 +05:30
Mridul Pathak ef56f80bb3 Fixed: Error in sendShipmentScheduledNotification service (OFBIZ-11983) (#234)
sendTo field was wrongly being fetched from PartyAndContactMech view to get emailAddress, replaced it with the correct entity field infoString.

Thanks: Jacques for input.
2020-08-26 21:30:07 +05:30
Jacques Le Roux 421f8c6569 Fixed: error log of a fresh trunk installation (OFBIZ-11953)
Typo: missing quotes

Thanks: Alex Bodnaru for report
2020-08-13 12:09:13 +02:00
Pawan Verma 034e03abf4 Improved: Inconsistent String Comparisons(OFBIZ-9254)
There are some inconsistencies in the code for string comparison statusId.equals(PRUN_COMPLETED) whereas it should be written as PRUN_COMPLETED.equals(statusId) cause the former can throw NullPointerException if the variable found to be NULL.

Thanks: Devanshu for your contribution.
2020-07-30 17:01:54 +05:30
lodhiravi 4739019732 Fixed: Error in Quick Receive Purchase Order process. (OFBIZ-11911) (#219)
Corrected typo
2020-07-25 12:11:12 +05:30
lodhiravi 356af00b83 Fixed: Converted GString to String while setting success message in receiveInventoryProduct service to avoid the ClassCastException. Also corrected loop condition while creating inventory information during PO receiving to fix the issue where each product is getting received two times (doubled the qty) instead of single time.(OFBIZ-11909) (#218) 2020-07-25 12:04:03 +05:30
Pawan Verma 52983af7c7 Fixed: Unable to delete Group Order(OFBIZ-11773) (#172)
At 0da10ea897, We converted deleteProductGroupOrder service from XML to Groovy, which generates this issue.
Reimplemented full groovy service to remove releated records.
2020-07-04 22:58:56 +05:30
Pawan Verma efc016e5c9 Fixed: BigDecimal casting in Groovy (OFBIZ-11862)
Sometimes use wrong type castings for BigDecimal:

Used BigDecimal.ZERO and BigDecimal.ONE instead.
2020-07-03 14:08:14 +05:30
Jacques Le Roux 4bf23fdd9c Fixed: BigDecimal casting in Groovy (OFBIZ-11862)
Fixes syntax errors introduced by my previous commit
2020-06-30 18:42:43 +02:00
Jacques Le Roux df179777b6 Fixed: BigDecimal casting in Groovy (OFBIZ-11862)
Sometimes use wrong type castings for BigDecimal:

I have observed that for typecasting in groovy, we have used the wrong coding
pattern like

(BigDecimal) 0
It should be like
0 as BigDecimal

Note that this does not apply to decimal because in case of decimal, the default
type is always BigDecimal in Groovy.

Thanks: Pritam Kute for spotting the issue in OFBIZ-11843
2020-06-30 15:17:47 +02:00
Jacques Le Roux ebe18e45f1 Improved: Unable to upload additional image for a product (OFBIZ-11844)
OFBIZ-11436 broke the uploadProductAdditionalViewImages service but something
else remains which prevents to create a content

Thanks: Arpit Mor for report
2020-06-28 21:48:44 +02:00
Priya SharmaandPriya Sharma 5a144c0bed Improved: Use GroovyBaseScript's makeValue utility methods in each Groovy files (OFBIZ-11779)
Co-authored-by: Priya Sharma <priya.sharma@hotwaxsystems.com>
2020-06-28 01:24:32 +05:30
Jacques Le Roux 3926134950 Improved: Moves Shipment Services files from sub-dirs to shipment dir (OFBIZ-11468)
In PR#150 Pierre Smits suggested to move this new Groovy files updir:

"There is no need to have subfolders defining where the services belong to when
such is already captured in the name of the file, e.g.:
folder /shipment/receipt/ when the filename has ShipmentReceiptServices.groovy
Similarly
/shipment/issuance/ when the filename has ShipmentIssuanceServices.groovy"
2020-06-27 08:01:08 +02:00
wpaetzoldandWiebke Pätzold 7335ce021a OFBIZ-11468 Improved: Convert ShipmentReceiptServices.xml mini lang to groovy (#150)
* Improved: Convert ShipmentReceiptServices.xml mini lang to groovy

(OFBIZ-11468)

Also converted getTotalIssuedQuantityForOrderItem in IssuanceServices, because it is used in ShipmentReceiptServices and needed more return values.

* split to long lines

Co-authored-by: Wiebke Pätzold <Wiebke.Paetzold@ecomify.de>
2020-06-24 10:57:28 +02:00
Priya SharmaandPriya Sharma 15aec7e8f7 WIP: [Improved]: Use GroovyBaseScript's logging utility methods instead of using Debug (OFBIZ-11762) (#185)
* [Improved]: Use GroovyBaseScript's logging utility methods instead of using Debug
- Replaced the debug.log methods with the respective groovy utility method
- Enhanced the GroovyBaseScript to entertain the fetch the current class name as the module name for logging
- Overloaded the logError method to entertain throwbale object for better logging
- Removed unused import statements and module variables.

(OFBIZ-11762)

* [Removed]: Extra line spaces. (OFBIZ-11762)

* [Revert]: Unwanted changes. (OFBIZ-11762)

* [Added] Same changes to these files. (OFBIZ-11762)

Co-authored-by: Priya Sharma <priya.sharma@example.com>
2020-06-06 10:17:23 +02:00
Pawan Verma aa57e68088 Fixed: ViewShipment in facility does not show phone details(OFBIZ-11785)
Thanks, Pierre for the report.
2020-06-02 15:33:56 +05:30
Nicolas Malin b862632a94 Fixed: Convert InventoryIssueServices.xml mini lang to groovy
(OFBIZ-11591)

Side effect: Inventory Issuance use generic shipment service to control the authorization
but without a shipment, checkCanChangeShipmentStatusGeneral failed with NPE.

I complete the function to escape if a shipment isn't present and only valid with facility permission
2020-05-29 16:28:18 +02:00
Sebastian Berg 7968f62e51 Improved: Convert InventoryIssueServices.xml mini lang to groovy
(OFBIZ-11591)
2020-05-29 16:28:11 +02:00
Suraj Khurana 8bdb6c9985 Improved: Make shipment services loosely coupled with work-effort generation. (#132)
* Improved: Make shipment services loosely coupled with work-effort generation.
(OFBIZ-11678)
Removed workeffort generation related code in separate service, in createShipment and updateShipment service. In this effort, createShipment has been successfully changed to entity-auto as well.
Thanks: Pierre Smits and Arun Patidar for discussion and review.
2020-05-23 15:26:26 +05:30
Jacques Le Roux fb447e7b62 Fixed: Unable to navigate to 'Recently approved' screen under image management
(OFBIZ-11403)

It works on stable demo which uses 2.4.13 instead of 2.5.11 for trunk.

I guess it's because since Groovy 2.5 DateTimeFormatter, introduced with Java 8,
is used underneath.

This fixes and improves it regarding localisation. Because it's easier with
DateTimeFormatter and LocalDateTime to handle localisation
2020-05-14 13:35:49 +02:00
Nicolas Malin a6cfaf8732 Improved: getAssociatedPriceRulesConds service return huge result
(OFBIZ-11701)

The service getAssociatedPriceRulesConds return some element to help the selection on product prise rule condition screen.
The problem: all query to resolve element are realized without filter :
     from("Product").queryList()

On big database, a call on this service generate a server saturation (load 1 Million product to a dropdown, isn't logical)
To keep the benefit of this service as example to implement a custom service with filter, I introduce a limit range to 200. For much more it's better to improve the screen with a lookup.

I also simplify the list generation to homogenize and help the reader.
2020-05-13 16:08:06 +02:00
Nicolas Malin b9b8c1405b Improved: Convert PriceServices.xml mini lang to groovy
(OFBIZ-11578)

Second pass:
 * slimdown code
 * move saveProductPriceChange to entity-auto
2020-05-13 16:08:06 +02:00
Sebastian Berg 4ebdcdd9d0 Improved: Convert PriceServices.xml mini lang to groovy
(OFBIZ-11578)
2020-05-13 16:08:06 +02:00
Sebastian Berg 7fcde49d82 Improved: Convert ShipmentServices.xml mini lang to groovy
(OFBIZ-11462)
2020-05-12 17:48:12 +02:00
Jacques Le Roux 9e08611e13 Fixed: Freamework only integration tests don't pass due to missing data only
present in ecommerce

(OFBIZ- OFBIZ-6110)

OFBIZ-10031 and OFBIZ-8579 did not take care of that. It seems that, for a
reason, fixing OFBIZ-11620 mades them popup
2020-05-04 20:59:35 +02:00
Pawan Verma 0f777b7de2 Fixed: The producttests test suite is brooken
(OFBIZ-11620)

Corrected Class name and ProductAssoc entity name.

Thanks: Jacques for the partial fix.
2020-04-29 14:53:26 +05:30
Jacques Le Roux 649614507b Fixed: The producttests test suite is brooken
(OFBIZ-11620)

It was initially broken by OFBIZ-9905 so only trunk was concerned.
The fix is simple: there should be no space at the beginning of the file.

But then, when running the test suite, other issues raise.
I guess they  were hidden because of the initial issue.

OFBIZ-10231 introduced 2 issues
A syntax error:
product.removeRelated("ProductKeyword", product)
instead of
product.removeRelated("ProductKeyword")

A wrong usage of storeByCondition

This fixes the 3 issues, to test:
gradlew "ofbiz --test component=product --test suitename=producttests"

Thanks: Pawan for initial report
2020-04-29 10:02:07 +02:00
Pawan Verma 91673f1b41 Fixed: Specified key was too long; max key length is 767 bytes for ProductPromoCodeEmail entity.(OFBIZ-5426) (#44)
* Fixed: Specified key was too long; max key length is 767 bytes for ProductPromoCodeEmail entity.
(OFBIZ-5426)

The problem is in the entity model. An email address should not be used in the primary key - mainly because an email address is case-insensitive. A better design would be to use the email address contact mechanism ID in the primary key.

Done Following:
1. Changed Entity Name from ProductPromoCodeEmail to ProductPromoCodeContMech
2. Related Changes for the entity name change
3. Migration service to migrate old data

Thanks, Leon for the report and Adrian Crum, Jacques Le Roux, Ingo Wolfmayr, Deepak Dixit, Pierre Smits and Gil Portenseigne for the discussion and review.

* Improved: Added new line in service definition file and lincence in MigrationServices file.
(OFBIZ-5426)

Thanks, Jacopo for the review.
2020-03-23 17:08:58 +05:30
Nicolas Malin 43b44f53e0 Improved: Convert ProductContentServices.xml mini lang to groovy
(OFBIZ-11436)

Thanks to Sebastian Berg for providing the patch
2020-03-10 09:32:37 +01:00
Nicolas Malin 92963609da Improved: Convert ProductFeatureServices.xml mini lang to groovy
(OFBIZ-11439)

Thanks to Sebastian Berg for providing the patch
2020-03-06 11:36:32 +01:00
Nicolas Malin 51837c8cbf Fixed: Convert ProductServices.xml mini lang to groovy: productPriceGenericPermission failed
(OFBIZ-10231)

After groovy conversion the method productPriceGenericPermission failed to validate a user

Problem due to bad call on hasEntityPermission instead of hasPermission
2020-03-04 21:46:11 +01:00
Nicolas Malin 80026c76c0 Improved: Convert ProductServices.xml mini lang to groovy
(OFBIZ-10231)

After groovy conversion the method checkProductRelatedPermission
has been broken for other minilang method that didn't converted.

To solve this problem, I created new permission service checkProductRelatedPermission
and convert all previous minilang method call by a permission service on the related service call
2020-03-04 21:44:11 +01:00
Nicolas Malin 8ec3886d7f Fixed: Code refactoring to support groovy syntax
(OFBIZ-10231)

No functional change

This commit contains multiple refactoring to decrease code quantity :
 * use groovy syntax for empty/not empty value
 * use kelvin syntax
 * exploit DSL syntax and EntityQuery as possible
 * refactoring redundant "if block"
 * remove unnecessary transfer variable

Thanks to Gil Portenseigne for help my as his second eye
2020-02-28 17:47:41 +01:00
Michael Brohl f3d3547515 Improved: Convert CategoryContentServices.xml mini lang to groovy.
(OFBIZ-10001)

Thanks Dennis Balkir for reporting and the initial work,
Deepak Dixit for review and Sebastian Berg for the refactored patch.
2020-02-25 20:27:51 +01:00
Michael Brohl e0a26fce43 Improved: Convert ProductServices.xml mini lang to groovy
(OFBIZ-10231)

Thanks Dennis Balkir for reporting and Sebastian Berg for the implementation.
2020-02-21 17:50:58 +01:00
Jacques Le Roux 8c3423ab00 Fixed: Fix Default or Empty Catch block in Java and Groovy files
(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
2019-09-16 08:13:19 +00:00
Jacques Le Roux cfff42cdc4 Fixed: Fix Default or Empty Catch block in Java and Groovy files
(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
2019-09-15 07:48:09 +00:00
Nicolas Malin 1e5c621420 Improved: PicklistStatusHistory doesn't follow history entity status pattern
(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
2019-09-07 15:51:06 +00:00
Gil Portenseigne 8e9df028b6 Fix parenthesis syntax error in groovy
(OFBIZ-11186)

Thanks Samuel Trégouët for your contribution

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866513 13f79535-47bb-0310-9956-ffa450edef68
2019-09-06 14:56:33 +00:00
Nicolas Malin 44d4c3363f Improved: Convert CatalogServices.xml mini lang to groovy
(OFBIZ-9992) (OFBIZ-9350)
Thanks to Dennis Balkir for this conversion

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1865912 13f79535-47bb-0310-9956-ffa450edef68
2019-08-26 08:07:41 +00:00