RT 4.0.0, bulk update and autocomplete customfields

Hi guys,

During my test upgrade to RT 4.0.0 I’m copying our local modifications
to the new version directory tree. One of those modifications is a fix
allowing Autocomplete CustomFields to be updated by the Bulk Update
tool.
In the 3.8 versions we did it with this patch applied on
Search/Bulk.html:
*** 196,201 ****
— 196,204 ----
% } elsif ($cf->Type eq ‘Text’) {

<& /Elements/EditCustomFieldText, @add &>   + % } elsif ($cf->Type eq 'Autocomplete') { + <& /Elements/EditCustomFieldAutocomplete, @add &> +   % } else { % $RT::Logger->crit("Unknown CustomField type: " . $cf->Type); % }

After applying this patch in the 4.0.0 dir tree I get an error in the
javascript error console:

Erro: a is null
https://RT_URL/NoAuth/js/squished-0250d779a57b569b917c8528747f9e45.js
Line: 7

Since I’m not an javascript expert and the js is “squished” I’m stuck…

Any ideas?

Robert Wysocki
CONTIUM S.A., http://www.contium.pl

After applying this patch in the 4.0.0 dir tree I get an error in the
javascript error console:

Erro: a is null
https://RT_URL/NoAuth/js/squished-0250d779a57b569b917c8528747f9e45.js
Line: 7

Since I’m not an javascript expert and the js is “squished” I’m stuck…

Run in DevelMode, you’ll get unsquished JS

Dnia 2011-05-11, śro o godzinie 08:22 -0400, Kevin Falcone pisze:

After applying this patch in the 4.0.0 dir tree I get an error in the
javascript error console:

Erro: a is null
https://RT_URL/NoAuth/js/squished-0250d779a57b569b917c8528747f9e45.js
Line: 7

Since I’m not an javascript expert and the js is “squished” I’m stuck…

Run in DevelMode, you’ll get unsquished JS

Well, unsquished js doesn’t give me much more clues to go on, the error
was:
a is null
https://RT_URL/NoAuth/js/jquery-ui-1.8.4.custom.min.js
Line: 98

So I manually inserted some newlines into the js and it turned out that
the error was in the line:
_response:function(a){if(a.length){
in the jQuery autocomplete function.
Is it a bug in jQueryUI?

Robert Wysocki
CONTIUM S.A., http://www.contium.pl

Dnia 2011-05-11, śro o godzinie 08:22 -0400, Kevin Falcone pisze:

After applying this patch in the 4.0.0 dir tree I get an error in the
javascript error console:

Erro: a is null
https://RT_URL/NoAuth/js/squished-0250d779a57b569b917c8528747f9e45.js
Line: 7

Since I’m not an javascript expert and the js is “squished” I’m stuck…

Run in DevelMode, you’ll get unsquished JS

Well, unsquished js doesn’t give me much more clues to go on, the error
was:
a is null
https://RT_URL/NoAuth/js/jquery-ui-1.8.4.custom.min.js
Line: 98

So I manually inserted some newlines into the js and it turned out that
the error was in the line:
_response:function(a){if(a.length){
in the jQuery autocomplete function.
Is it a bug in jQueryUI?

I doubt it’s a jQuery bug unless the autocompleter doesn’t work
elsewhere. It is more likely that your patch needs updating for 4.0

-kevin

Dnia 2011-05-12, czw o godzinie 10:06 -0400, Kevin Falcone pisze:

I doubt it’s a jQuery bug unless the autocompleter doesn’t work
elsewhere. It is more likely that your patch needs updating for 4.0

Kevin, take a look at my patch – it’s really simple and it uses
standard RT element – EditCustomFieldAutocomplete. That’s my only
modification, nothing else.
Both the javascript and the EditCustomFieldAutocomplete work in the
other templates.
BTW: Why autocomplete customfileds aren’t supported in bulk update
out-of-the box?

Robert Wysocki
CONTIUM S.A., http://www.contium.pl

I doubt it’s a jQuery bug unless the autocompleter doesn’t work
elsewhere. It is more likely that your patch needs updating for 4.0

Kevin, take a look at my patch – it’s really simple and it uses
standard RT element – EditCustomFieldAutocomplete. That’s my only
modification, nothing else.
Both the javascript and the EditCustomFieldAutocomplete work in the
other templates.

Your patch passes an invalid CF key to the EditCustomFieldAutocomplete
component. The autocomplete endpoint returns nothing (causing the JS
error) when given an invalid CF key. Your patch needs fixing for 4.0.0.

I’m not entirely sure how it worked on 3.8, which expects the same kind
of CF key, but I’ll take your word for it. It’s possible you made a
corresponding modification to make it work in 3.8 but didn’t port that
over as well.

BTW: Why autocomplete customfileds aren’t supported in bulk update
out-of-the box?

Bulk update was overlooked, and that should be fixed. Filing a bug to
include all CF types on bulk update would be useful.
rt-bugs@bestpractical.com

Cheers,
Thomas

Dnia 2011-05-12, czw o godzinie 10:48 -0400, Thomas Sibley pisze:

Your patch passes an invalid CF key to the EditCustomFieldAutocomplete
component. The autocomplete endpoint returns nothing (causing the JS
error) when given an invalid CF key. Your patch needs fixing for 4.0.0.

Thank’s for explaning that.

I’m not entirely sure how it worked on 3.8, which expects the same kind
of CF key, but I’ll take your word for it. It’s possible you made a
corresponding modification to make it work in 3.8 but didn’t port that
over as well.

Actually that patch is a legacy left by another empleyee, I just came
across it and have been asked to port it to the new version.
Our wiki says that’s the only modification that has been made in order
to fix the issue.

BTW: Why autocomplete customfileds aren’t supported in bulk update
out-of-the box?

Bulk update was overlooked, and that should be fixed. Filing a bug to
include all CF types on bulk update would be useful.
rt-bugs@bestpractical.com

OK, will do that.

Robert Wysocki
CONTIUM S.A., http://www.contium.pl

Actually that patch is a legacy left by another empleyee, I just came
across it and have been asked to port it to the new version.
Our wiki says that’s the only modification that has been made in order
to fix the issue.

I’d look at your 3.8 local/ for other customizations and even
share/html/Helpers/Autocomplete/CustomFieldValues to see if the stock
component was modified in place but not documented.

Thomas

Thomas,

I’ve never used “Auto-complete” for a custom field. What does it do for you?

Kenn
LBNLOn Fri, May 13, 2011 at 7:40 AM, Thomas Sibley trs@bestpractical.comwrote:

On 05/13/2011 01:54 AM, Robert Wysocki wrote:

Actually that patch is a legacy left by another empleyee, I just came
across it and have been asked to port it to the new version.
Our wiki says that’s the only modification that has been made in order
to fix the issue.

I’d look at your 3.8 local/ for other customizations and even
share/html/Helpers/Autocomplete/CustomFieldValues to see if the stock
component was modified in place but not documented.

Thomas

I’ve never used “Auto-complete” for a custom field. What does it do for you?

It autocompletes from the available values of the CF. A multiple value
field is rendered as a textarea, and a single value field as a text field.

Thomas

Thomas,

By “Auto-complete” you mean the ticket is resolved without having to change
the status? It’s the “Auto-complete” part of the description I don’t
understand. I don’t mean to be dense.

Kenn
LBNLOn Fri, May 13, 2011 at 9:26 AM, Thomas Sibley trs@bestpractical.comwrote:

On 05/13/2011 12:21 PM, Kenneth Crocker wrote:

I’ve never used “Auto-complete” for a custom field. What does it do for
you?

It autocompletes from the available values of the CF. A multiple value
field is rendered as a textarea, and a single value field as a text field.

Thomas