You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Jacques Le Roux (Jira)" <ji...@apache.org> on 2020/05/14 11:32:00 UTC

[jira] [Commented] (OFBIZ-11403) Unable to navigate to 'Recently approved' screen under image mangement

    [ https://issues.apache.org/jira/browse/OFBIZ-11403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17107222#comment-17107222 ] 

Jacques Le Roux commented on OFBIZ-11403:
-----------------------------------------

This is due to

{{def date1 = sdf.format(today-i)}} in ImageRecentlyApproved.groovy

{noformat}
2020-05-13 14:08:46,633 |jsse-nio-8443-exec-4 |ScreenFactory                 |I| Got 23 screens in 0.026s from: file:/C:/projectsASF/Git/ofbiz-framework/applications/product/widget/catalog/ImageManagementScreens.xml
2020-05-13 14:08:46,787 |jsse-nio-8443-exec-4 |ScriptUtil                    |W| Error running script at location [component://product/groovyScripts/catalog/imagemanagement/ImageRecentlyApproved.groovy]: groovy.lang.MissingMethodExceptio
n: No signature of method: java.util.Date.minus() is applicable for argument types: (Integer) values: [0]
Possible solutions: find(), find(groovy.lang.Closure), is(java.lang.Object), any(), print(java.lang.Object), with(groovy.lang.Closure)
groovy.lang.MissingMethodException: No signature of method: java.util.Date.minus() is applicable for argument types: (Integer) values: [0]
Possible solutions: find(), find(groovy.lang.Closure), is(java.lang.Object), any(), print(java.lang.Object), with(groovy.lang.Closure)
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:70) ~[groovy-2.5.11.jar:2.5.11]
        at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46) ~[groovy-2.5.11.jar:2.5.11]
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) ~[groovy-2.5.11.jar:2.5.11]
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115) ~[groovy-2.5.11.jar:2.5.11]
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127) ~[groovy-2.5.11.jar:2.5.11]
        at ImageRecentlyApproved.run(ImageRecentlyApproved.groovy:36) ~[?:?]

{noformat}

But weird this work in Groovy 2.5.11 console:


{code:java}
import java.text.SimpleDateFormat

def sdf = new SimpleDateFormat("EEEE yyyy-MM-dd 00:00:00.000")
def today = new Date()
sdf.format(today-0) + " " + sdf.format(today-13)
{code}

{noformat}
groovy> import java.text.SimpleDateFormat
groovy> def sdf = new SimpleDateFormat("EEEE yyyy-MM-dd 00:00:00.000")
groovy> def today = new Date()
groovy> sdf.format(today-0) + " " + sdf.format(today-13)

Result: mercredi 2020-05-13 00:00:00.000 jeudi 2020-04-30 00:00:00.000
{noformat}
And 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.

Anyway, I'll commit a solution. It's a little bit improved, because it's easier with DateTimeFormatter and LocalDateTime to handle localisation.

> Unable to navigate to 'Recently approved' screen under image mangement
> ----------------------------------------------------------------------
>
>                 Key: OFBIZ-11403
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-11403
>             Project: OFBiz
>          Issue Type: Bug
>          Components: product
>    Affects Versions: Trunk
>            Reporter: Dikpal Kanungo
>            Assignee: Jacques Le Roux
>            Priority: Major
>         Attachments: Issue with recently approved screen.png
>
>
> Steps to regenerate-
> 1. Navigate to - [https://demo-trunk.ofbiz.apache.org/catalog/control/ImageApprove]
> 2. Click on - RECENTLY APPROVED (Catalog Manager->Image Management->Recently Approved)
> 3. The broken page will be displayed (Please have a look at the attached screenshot) !Issue with recently approved screen.png!



--
This message was sent by Atlassian Jira
(v8.3.4#803005)