You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2011/06/22 15:47:14 UTC

svn commit: r1138463 - /ofbiz/trunk/framework/images/webapp/images/selectall.js

Author: jleroux
Date: Wed Jun 22 13:47:14 2011
New Revision: 1138463

URL: http://svn.apache.org/viewvc?rev=1138463&view=rev
Log:
Fixes a bug reported by someone on main OFBiz wiki page (will be removed from there)

=======================================================================
ajax FieldLookup bug for ofbiz 11.04
showDescription="false" is not work
you should add the code in [selectall.js] file
method "function ajaxAutoCompleter(areaCsvString, showDescription, defaultMinLength, formName){"

at header:
{code:title=selectall.js|borderStyle=solid}
////////////////////////////////////////////////////////////
 if(typeof(showDescription)=="string"){
  showDescription = showDescription== "false"? false : true;
 }
////////////////////////////////////////////////////////////
{code}

then it will be work.
=======================================================================

Modified:
    ofbiz/trunk/framework/images/webapp/images/selectall.js

Modified: ofbiz/trunk/framework/images/webapp/images/selectall.js
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/selectall.js?rev=1138463&r1=1138462&r2=1138463&view=diff
==============================================================================
--- ofbiz/trunk/framework/images/webapp/images/selectall.js (original)
+++ ofbiz/trunk/framework/images/webapp/images/selectall.js Wed Jun 22 13:47:14 2011
@@ -393,6 +393,10 @@ function ajaxAutoCompleter(areaCsvString
     var areaArray = areaCsvString.replace(/&/g, '&').split(",");
     var numAreas = parseInt(areaArray.length / 3);
     
+    if (typeof(showDescription) == "string") {
+      showDescription = showDescription == "false" ? false : true;
+    }            
+    
     for (var i = 0; i < numAreas * 3; i = i + 3) {
         var url = areaArray[i + 1] + "?" + areaArray[i + 2];
         var div = areaArray[i];



Re: svn commit: r1138463 - /ofbiz/trunk/framework/images/webapp/images/selectall.js

Posted by Jacques Le Roux <ja...@les7arts.com>.
Thanks for your work Adrian,

I must admit this part was not done the right way. At least a pb was well spotted.

About the cover macro, I thought there were good reasons for that and never questionned it (I had a lot of other things to check,
believe me). Now that Bilgin explained the why, obviously I was wrong.

Jacques

From: "Adrian Crum" <ad...@sandglass-software.com>
> Btw, this commit demonstrates the wrong way to fix things. It was obvious that a JavaScript function had a boolean parameter and
> some code somewhere was passing in a String argument. So, instead of finding the code that is passing the incorrect data type, we
> cover up the problem in JavaScript by testing the argument's data type and converting it.
>
> What troubles me more about this kind of approach is that when I point it out, I am asked why I don't just play along and write
> (or use existing) cover-up code too.
>
> -Adrian
>
> On 6/22/2011 3:53 PM, Adrian Crum wrote:
>> Fixed in rev
>>
>> 1138485
>>
>> -Adrian
>>
>>
>> On 6/22/2011 3:19 PM, Jacques Le Roux wrote:
>>> OK, I will then not backport in R11.04 and will wait the complete fix (I used it in a custom app)
>>>
>>> Jacques
>>>
>>> From: "Adrian Crum" <ad...@sandglass-software.com>
>>>> This should be fixed in the macro (which I'm working on now). The bug isn't in the JavaScript, it is in the macro that treats a
>>>> boolean as a String.
>>>>
>>>> -Adrian
>>>>
>>>> On 6/22/2011 2:47 PM, jleroux@apache.org wrote:
>>>>> Author: jleroux
>>>>> Date: Wed Jun 22 13:47:14 2011
>>>>> New Revision: 1138463
>>>>>
>>>>> URL: http://svn.apache.org/viewvc?rev=1138463&view=rev
>>>>> Log:
>>>>> Fixes a bug reported by someone on main OFBiz wiki page (will be removed from there)
>>>>>
>>>>> =======================================================================
>>>>> ajax FieldLookup bug for ofbiz 11.04
>>>>> showDescription="false" is not work
>>>>> you should add the code in [selectall.js] file
>>>>> method "function ajaxAutoCompleter(areaCsvString, showDescription, defaultMinLength, formName){"
>>>>>
>>>>> at header:
>>>>> {code:title=selectall.js|borderStyle=solid}
>>>>> ////////////////////////////////////////////////////////////
>>>>>   if(typeof(showDescription)=="string"){
>>>>>    showDescription = showDescription== "false"? false : true;
>>>>>   }
>>>>> ////////////////////////////////////////////////////////////
>>>>> {code}
>>>>>
>>>>> then it will be work.
>>>>> =======================================================================
>>>>>
>>>>> Modified:
>>>>>      ofbiz/trunk/framework/images/webapp/images/selectall.js
>>>>>
>>>>> Modified: ofbiz/trunk/framework/images/webapp/images/selectall.js
>>>>> URL:
>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/selectall.js?rev=1138463&r1=1138462&r2=1138463&view=diff
>>>>> ==============================================================================
>>>>> --- ofbiz/trunk/framework/images/webapp/images/selectall.js (original)
>>>>> +++ ofbiz/trunk/framework/images/webapp/images/selectall.js Wed Jun 22 13:47:14 2011
>>>>> @@ -393,6 +393,10 @@ function ajaxAutoCompleter(areaCsvString
>>>>>       var areaArray = areaCsvString.replace(/&amp;/g, '&').split(",");
>>>>>       var numAreas = parseInt(areaArray.length / 3);
>>>>>
>>>>> +    if (typeof(showDescription) == "string") {
>>>>> +      showDescription = showDescription == "false" ? false : true;
>>>>> +    }
>>>>> +
>>>>>       for (var i = 0; i<  numAreas * 3; i = i + 3) {
>>>>>           var url = areaArray[i + 1] + "?" + areaArray[i + 2];
>>>>>           var div = areaArray[i];
>>>>>
>>>>>
>>>
>>>



Re: svn commit: r1138463 - /ofbiz/trunk/framework/images/webapp/images/selectall.js

Posted by Adrian Crum <ad...@sandglass-software.com>.
Btw, this commit demonstrates the wrong way to fix things. It was 
obvious that a JavaScript function had a boolean parameter and some code 
somewhere was passing in a String argument. So, instead of finding the 
code that is passing the incorrect data type, we cover up the problem in 
JavaScript by testing the argument's data type and converting it.

What troubles me more about this kind of approach is that when I point 
it out, I am asked why I don't just play along and write (or use 
existing) cover-up code too.

-Adrian

On 6/22/2011 3:53 PM, Adrian Crum wrote:
> Fixed in rev
>
> 1138485
>
> -Adrian
>
>
> On 6/22/2011 3:19 PM, Jacques Le Roux wrote:
>> OK, I will then not backport in R11.04 and will wait the complete fix 
>> (I used it in a custom app)
>>
>> Jacques
>>
>> From: "Adrian Crum" <ad...@sandglass-software.com>
>>> This should be fixed in the macro (which I'm working on now). The 
>>> bug isn't in the JavaScript, it is in the macro that treats a 
>>> boolean as a String.
>>>
>>> -Adrian
>>>
>>> On 6/22/2011 2:47 PM, jleroux@apache.org wrote:
>>>> Author: jleroux
>>>> Date: Wed Jun 22 13:47:14 2011
>>>> New Revision: 1138463
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=1138463&view=rev
>>>> Log:
>>>> Fixes a bug reported by someone on main OFBiz wiki page (will be 
>>>> removed from there)
>>>>
>>>> ======================================================================= 
>>>>
>>>> ajax FieldLookup bug for ofbiz 11.04
>>>> showDescription="false" is not work
>>>> you should add the code in [selectall.js] file
>>>> method "function ajaxAutoCompleter(areaCsvString, showDescription, 
>>>> defaultMinLength, formName){"
>>>>
>>>> at header:
>>>> {code:title=selectall.js|borderStyle=solid}
>>>> ////////////////////////////////////////////////////////////
>>>>   if(typeof(showDescription)=="string"){
>>>>    showDescription = showDescription== "false"? false : true;
>>>>   }
>>>> ////////////////////////////////////////////////////////////
>>>> {code}
>>>>
>>>> then it will be work.
>>>> ======================================================================= 
>>>>
>>>>
>>>> Modified:
>>>>      ofbiz/trunk/framework/images/webapp/images/selectall.js
>>>>
>>>> Modified: ofbiz/trunk/framework/images/webapp/images/selectall.js
>>>> URL: 
>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/selectall.js?rev=1138463&r1=1138462&r2=1138463&view=diff
>>>> ============================================================================== 
>>>>
>>>> --- ofbiz/trunk/framework/images/webapp/images/selectall.js (original)
>>>> +++ ofbiz/trunk/framework/images/webapp/images/selectall.js Wed Jun 
>>>> 22 13:47:14 2011
>>>> @@ -393,6 +393,10 @@ function ajaxAutoCompleter(areaCsvString
>>>>       var areaArray = areaCsvString.replace(/&amp;/g, '&').split(",");
>>>>       var numAreas = parseInt(areaArray.length / 3);
>>>>
>>>> +    if (typeof(showDescription) == "string") {
>>>> +      showDescription = showDescription == "false" ? false : true;
>>>> +    }
>>>> +
>>>>       for (var i = 0; i<  numAreas * 3; i = i + 3) {
>>>>           var url = areaArray[i + 1] + "?" + areaArray[i + 2];
>>>>           var div = areaArray[i];
>>>>
>>>>
>>
>>

Re: svn commit: r1138463 - /ofbiz/trunk/framework/images/webapp/images/selectall.js

Posted by Adrian Crum <ad...@sandglass-software.com>.
Fixed in rev

1138485

-Adrian


On 6/22/2011 3:19 PM, Jacques Le Roux wrote:
> OK, I will then not backport in R11.04 and will wait the complete fix 
> (I used it in a custom app)
>
> Jacques
>
> From: "Adrian Crum" <ad...@sandglass-software.com>
>> This should be fixed in the macro (which I'm working on now). The bug 
>> isn't in the JavaScript, it is in the macro that treats a boolean as 
>> a String.
>>
>> -Adrian
>>
>> On 6/22/2011 2:47 PM, jleroux@apache.org wrote:
>>> Author: jleroux
>>> Date: Wed Jun 22 13:47:14 2011
>>> New Revision: 1138463
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1138463&view=rev
>>> Log:
>>> Fixes a bug reported by someone on main OFBiz wiki page (will be 
>>> removed from there)
>>>
>>> =======================================================================
>>> ajax FieldLookup bug for ofbiz 11.04
>>> showDescription="false" is not work
>>> you should add the code in [selectall.js] file
>>> method "function ajaxAutoCompleter(areaCsvString, showDescription, 
>>> defaultMinLength, formName){"
>>>
>>> at header:
>>> {code:title=selectall.js|borderStyle=solid}
>>> ////////////////////////////////////////////////////////////
>>>   if(typeof(showDescription)=="string"){
>>>    showDescription = showDescription== "false"? false : true;
>>>   }
>>> ////////////////////////////////////////////////////////////
>>> {code}
>>>
>>> then it will be work.
>>> =======================================================================
>>>
>>> Modified:
>>>      ofbiz/trunk/framework/images/webapp/images/selectall.js
>>>
>>> Modified: ofbiz/trunk/framework/images/webapp/images/selectall.js
>>> URL: 
>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/selectall.js?rev=1138463&r1=1138462&r2=1138463&view=diff
>>> ============================================================================== 
>>>
>>> --- ofbiz/trunk/framework/images/webapp/images/selectall.js (original)
>>> +++ ofbiz/trunk/framework/images/webapp/images/selectall.js Wed Jun 
>>> 22 13:47:14 2011
>>> @@ -393,6 +393,10 @@ function ajaxAutoCompleter(areaCsvString
>>>       var areaArray = areaCsvString.replace(/&amp;/g, '&').split(",");
>>>       var numAreas = parseInt(areaArray.length / 3);
>>>
>>> +    if (typeof(showDescription) == "string") {
>>> +      showDescription = showDescription == "false" ? false : true;
>>> +    }
>>> +
>>>       for (var i = 0; i<  numAreas * 3; i = i + 3) {
>>>           var url = areaArray[i + 1] + "?" + areaArray[i + 2];
>>>           var div = areaArray[i];
>>>
>>>
>
>

Re: svn commit: r1138463 - /ofbiz/trunk/framework/images/webapp/images/selectall.js

Posted by Jacques Le Roux <ja...@les7arts.com>.
I finally backported the simple fix below, there were conflicts and I had no time to handle all by hand (could be done, then beware 
of the new delay parameter which is not a bugfix)

Jacques

From: "Jacques Le Roux" <ja...@les7arts.com>
> OK, I will then not backport in R11.04 and will wait the complete fix (I used it in a custom app)
>
> Jacques
>
> From: "Adrian Crum" <ad...@sandglass-software.com>
>> This should be fixed in the macro (which I'm working on now). The bug isn't in the JavaScript, it is in the macro that treats a 
>> boolean as a String.
>>
>> -Adrian
>>
>> On 6/22/2011 2:47 PM, jleroux@apache.org wrote:
>>> Author: jleroux
>>> Date: Wed Jun 22 13:47:14 2011
>>> New Revision: 1138463
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1138463&view=rev
>>> Log:
>>> Fixes a bug reported by someone on main OFBiz wiki page (will be removed from there)
>>>
>>> =======================================================================
>>> ajax FieldLookup bug for ofbiz 11.04
>>> showDescription="false" is not work
>>> you should add the code in [selectall.js] file
>>> method "function ajaxAutoCompleter(areaCsvString, showDescription, defaultMinLength, formName){"
>>>
>>> at header:
>>> {code:title=selectall.js|borderStyle=solid}
>>> ////////////////////////////////////////////////////////////
>>>   if(typeof(showDescription)=="string"){
>>>    showDescription = showDescription== "false"? false : true;
>>>   }
>>> ////////////////////////////////////////////////////////////
>>> {code}
>>>
>>> then it will be work.
>>> =======================================================================
>>>
>>> Modified:
>>>      ofbiz/trunk/framework/images/webapp/images/selectall.js
>>>
>>> Modified: ofbiz/trunk/framework/images/webapp/images/selectall.js
>>> URL: 
>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/selectall.js?rev=1138463&r1=1138462&r2=1138463&view=diff
>>> ==============================================================================
>>> --- ofbiz/trunk/framework/images/webapp/images/selectall.js (original)
>>> +++ ofbiz/trunk/framework/images/webapp/images/selectall.js Wed Jun 22 13:47:14 2011
>>> @@ -393,6 +393,10 @@ function ajaxAutoCompleter(areaCsvString
>>>       var areaArray = areaCsvString.replace(/&amp;/g, '&').split(",");
>>>       var numAreas = parseInt(areaArray.length / 3);
>>>
>>> +    if (typeof(showDescription) == "string") {
>>> +      showDescription = showDescription == "false" ? false : true;
>>> +    }
>>> +
>>>       for (var i = 0; i<  numAreas * 3; i = i + 3) {
>>>           var url = areaArray[i + 1] + "?" + areaArray[i + 2];
>>>           var div = areaArray[i];
>>>
>>>
>
> 



Re: svn commit: r1138463 - /ofbiz/trunk/framework/images/webapp/images/selectall.js

Posted by Jacques Le Roux <ja...@les7arts.com>.
OK, I will then not backport in R11.04 and will wait the complete fix (I used it in a custom app)

Jacques

From: "Adrian Crum" <ad...@sandglass-software.com>
> This should be fixed in the macro (which I'm working on now). The bug isn't in the JavaScript, it is in the macro that treats a 
> boolean as a String.
>
> -Adrian
>
> On 6/22/2011 2:47 PM, jleroux@apache.org wrote:
>> Author: jleroux
>> Date: Wed Jun 22 13:47:14 2011
>> New Revision: 1138463
>>
>> URL: http://svn.apache.org/viewvc?rev=1138463&view=rev
>> Log:
>> Fixes a bug reported by someone on main OFBiz wiki page (will be removed from there)
>>
>> =======================================================================
>> ajax FieldLookup bug for ofbiz 11.04
>> showDescription="false" is not work
>> you should add the code in [selectall.js] file
>> method "function ajaxAutoCompleter(areaCsvString, showDescription, defaultMinLength, formName){"
>>
>> at header:
>> {code:title=selectall.js|borderStyle=solid}
>> ////////////////////////////////////////////////////////////
>>   if(typeof(showDescription)=="string"){
>>    showDescription = showDescription== "false"? false : true;
>>   }
>> ////////////////////////////////////////////////////////////
>> {code}
>>
>> then it will be work.
>> =======================================================================
>>
>> Modified:
>>      ofbiz/trunk/framework/images/webapp/images/selectall.js
>>
>> Modified: ofbiz/trunk/framework/images/webapp/images/selectall.js
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/selectall.js?rev=1138463&r1=1138462&r2=1138463&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/framework/images/webapp/images/selectall.js (original)
>> +++ ofbiz/trunk/framework/images/webapp/images/selectall.js Wed Jun 22 13:47:14 2011
>> @@ -393,6 +393,10 @@ function ajaxAutoCompleter(areaCsvString
>>       var areaArray = areaCsvString.replace(/&amp;/g, '&').split(",");
>>       var numAreas = parseInt(areaArray.length / 3);
>>
>> +    if (typeof(showDescription) == "string") {
>> +      showDescription = showDescription == "false" ? false : true;
>> +    }
>> +
>>       for (var i = 0; i<  numAreas * 3; i = i + 3) {
>>           var url = areaArray[i + 1] + "?" + areaArray[i + 2];
>>           var div = areaArray[i];
>>
>> 



Re: svn commit: r1138463 - /ofbiz/trunk/framework/images/webapp/images/selectall.js

Posted by Adrian Crum <ad...@sandglass-software.com>.
This should be fixed in the macro (which I'm working on now). The bug 
isn't in the JavaScript, it is in the macro that treats a boolean as a 
String.

-Adrian

On 6/22/2011 2:47 PM, jleroux@apache.org wrote:
> Author: jleroux
> Date: Wed Jun 22 13:47:14 2011
> New Revision: 1138463
>
> URL: http://svn.apache.org/viewvc?rev=1138463&view=rev
> Log:
> Fixes a bug reported by someone on main OFBiz wiki page (will be removed from there)
>
> =======================================================================
> ajax FieldLookup bug for ofbiz 11.04
> showDescription="false" is not work
> you should add the code in [selectall.js] file
> method "function ajaxAutoCompleter(areaCsvString, showDescription, defaultMinLength, formName){"
>
> at header:
> {code:title=selectall.js|borderStyle=solid}
> ////////////////////////////////////////////////////////////
>   if(typeof(showDescription)=="string"){
>    showDescription = showDescription== "false"? false : true;
>   }
> ////////////////////////////////////////////////////////////
> {code}
>
> then it will be work.
> =======================================================================
>
> Modified:
>      ofbiz/trunk/framework/images/webapp/images/selectall.js
>
> Modified: ofbiz/trunk/framework/images/webapp/images/selectall.js
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/selectall.js?rev=1138463&r1=1138462&r2=1138463&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/images/webapp/images/selectall.js (original)
> +++ ofbiz/trunk/framework/images/webapp/images/selectall.js Wed Jun 22 13:47:14 2011
> @@ -393,6 +393,10 @@ function ajaxAutoCompleter(areaCsvString
>       var areaArray = areaCsvString.replace(/&amp;/g, '&').split(",");
>       var numAreas = parseInt(areaArray.length / 3);
>
> +    if (typeof(showDescription) == "string") {
> +      showDescription = showDescription == "false" ? false : true;
> +    }
> +
>       for (var i = 0; i<  numAreas * 3; i = i + 3) {
>           var url = areaArray[i + 1] + "?" + areaArray[i + 2];
>           var div = areaArray[i];
>
>