[ 
https://issues.apache.org/jira/browse/OFBIZ-6770?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Forrest Rae updated OFBIZ-6770:
-------------------------------
    Description: 
This [commit|https://fisheye6.atlassian.com/changelog/ofbiz?cs=768661] disabled 
the mimeTypeId argument in 
applications/order/widget/ordermgr/CustRequestForms.xml, in order to provide 
"various fixes".  I wonder how many people have been frustrated by this when 
looking for example code on how to upload documents.  

The issue is that mimeTypeId field that was commented out, is a required 
parameter by 
[createCustRequestContent|https://fisheye6.atlassian.com/browse/~br=trunk/ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestEvents.xml?r=1328827#to23].
  Lines 52-54 check it's value for the following:

Line 
[52|https://fisheye6.atlassian.com/browse/~br=trunk/ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestEvents.xml?r=1328827#to52]:
 if-compare is "Does the web browser's choice of mimeTypeId equal what the user 
thinks the mimeTypeId is?"
Line 
[53|https://fisheye6.atlassian.com/browse/~br=trunk/ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestEvents.xml?r=1328827#to53]:
 if-compare is "Did the user select anything at all in the mimeTypeId 
dropdown?" (Before the mimeTypeId field was commented out.)
Line 
[54|https://fisheye6.atlassian.com/browse/~br=trunk/ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestEvents.xml?r=1328827#to54]:
 if-compare is "Did the user submit mimeTypeId form field, but remove the 
value, submitting a blank form field?"  This is the weird case, as really this 
should be a is-null check.

My question is why are we even doing any of this when the event just goes on to 
set the mimeType to what the web browser decided it was, and then to call 
createContentFromUploadedFile service?  Also, if mimeTypeId is in fact empty, 
the call to createContentFromUploadedFile calls createDataResource, which at 
applications/content/script/org/ofbiz/content/data/DataServices.xml:53 calls 
org.apache.tika.Tika#detect(byte[]) to detect the mimeType anyway.  Why not 
just let tika handle the mimeType?

Anyway, I dunno enough about the Content component to make the decision here.  
I've attached three different patches.



  was:
This [commit|https://fisheye6.atlassian.com/changelog/ofbiz?cs=768661] disabled 
the mimeTypeId argument in 
applications/order/widget/ordermgr/CustRequestForms.xml, in order to provide 
"various fixes".  I wonder how many people have been frustrated by this when 
looking for example code on how to upload documents.  

The issue is that mimeTypeId field that was commented out, is a required 
parameter by 
[createCustRequestContent|https://fisheye6.atlassian.com/browse/~br=trunk/ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestEvents.xml?r=1328827#to23].
  Lines 52-54 check it's value for the following:

Line 
[52|https://fisheye6.atlassian.com/browse/~br=trunk/ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestEvents.xml?r=1328827#to52]:
 if-compare is "Does the web browser's choice of mimeTypeId equal what the user 
thinks the mimeTypeId is?"
Line 
[53|https://fisheye6.atlassian.com/browse/~br=trunk/ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestEvents.xml?r=1328827#to53]:
 if-compare is "Did the user select anything at all in the mimeTypeId 
dropdown?" (Before the mimeTypeId field was commented out.)
Line 
[54|https://fisheye6.atlassian.com/browse/~br=trunk/ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestEvents.xml?r=1328827#to54]:
 if-compare is "Did the user submit mimeTypeId form field, but remove the 
value, submitting a blank form field?"  This is the weird case, as really this 
should be a is-null check.

The issue lies in the seemly arbitrary check of the mimeTypeId parameter in 
applications/order/script/org/ofbiz/order/request/CustRequestEvents.xml, lines 
52-54.


My question is why are we even doing any of this when the event just goes on to 
set the mimeType to what the web browser decided it was, and then to call 
createContentFromUploadedFile service?  Also, if mimeTypeId is in fact empty, 
the call to createContentFromUploadedFile calls createDataResource, which at 
applications/content/script/org/ofbiz/content/data/DataServices.xml:53 calls 
org.apache.tika.Tika#detect(byte[]) to detect the mimeType anyway.  Why not 
just let tika handle the mimeType?

Anyway, I dunno enough about the Content component to make the decision here.  
I've attached three different patches.




> createCustRequestContent Hasn't worked in 6 years and 7 months
> --------------------------------------------------------------
>
>                 Key: OFBIZ-6770
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-6770
>             Project: OFBiz
>          Issue Type: Bug
>          Components: order
>    Affects Versions: Release Branch 11.04, Release Branch 12.04, Release 
> Branch 13.07, Release Branch 14.12, Trunk
>            Reporter: Forrest Rae
>         Attachments: OFBIZ-6770-option1.patch, OFBIZ-6770-option2.patch, 
> OFBIZ-6770-option3.patch
>
>
> This [commit|https://fisheye6.atlassian.com/changelog/ofbiz?cs=768661] 
> disabled the mimeTypeId argument in 
> applications/order/widget/ordermgr/CustRequestForms.xml, in order to provide 
> "various fixes".  I wonder how many people have been frustrated by this when 
> looking for example code on how to upload documents.  
> The issue is that mimeTypeId field that was commented out, is a required 
> parameter by 
> [createCustRequestContent|https://fisheye6.atlassian.com/browse/~br=trunk/ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestEvents.xml?r=1328827#to23].
>   Lines 52-54 check it's value for the following:
> Line 
> [52|https://fisheye6.atlassian.com/browse/~br=trunk/ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestEvents.xml?r=1328827#to52]:
>  if-compare is "Does the web browser's choice of mimeTypeId equal what the 
> user thinks the mimeTypeId is?"
> Line 
> [53|https://fisheye6.atlassian.com/browse/~br=trunk/ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestEvents.xml?r=1328827#to53]:
>  if-compare is "Did the user select anything at all in the mimeTypeId 
> dropdown?" (Before the mimeTypeId field was commented out.)
> Line 
> [54|https://fisheye6.atlassian.com/browse/~br=trunk/ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestEvents.xml?r=1328827#to54]:
>  if-compare is "Did the user submit mimeTypeId form field, but remove the 
> value, submitting a blank form field?"  This is the weird case, as really 
> this should be a is-null check.
> My question is why are we even doing any of this when the event just goes on 
> to set the mimeType to what the web browser decided it was, and then to call 
> createContentFromUploadedFile service?  Also, if mimeTypeId is in fact empty, 
> the call to createContentFromUploadedFile calls createDataResource, which at 
> applications/content/script/org/ofbiz/content/data/DataServices.xml:53 calls 
> org.apache.tika.Tika#detect(byte[]) to detect the mimeType anyway.  Why not 
> just let tika handle the mimeType?
> Anyway, I dunno enough about the Content component to make the decision here. 
>  I've attached three different patches.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to