New ticket Depends On field

I have RT 4.2.3 and PostgreSQL database.

When user creates new ticket in field “Depends on” there is such attribute:

exclude=“new”

as result such request for autocomplete generates:

http://localhost:9090/ticket/Helpers/Autocomplete/Tickets?exclude=new
<http://localhost:9090/ticket/Helpers/Autocomplete/Tickets?exclude=new&term=
825467> &term=825467

In share/html/Helpers/Autocomplete/Tickets there are such lines:

98 if ( @excludes ) { # exclude ids already these

99 $sql = join ’ AND ', “($sql)”, map { qq{id != ‘$_’} } @excludes;

100 }

As result I have such SQL

SELECT main.* FROM Tickets main WHERE (main.IsMerged IS NULL) AND
(main.Status != ‘deleted’) AND (main.Type = ‘ticket’) AND ( ( main.Subject
ILIKE ‘%825467%’ OR CAST(main.id AS TEXT) LIKE ‘825467%’ ) AND main.id !=
‘new’) LIMIT 10’

And then I have database error:

ERROR: invalid input syntax for integer: “new”

LINE 10: AND main.id != ‘new’

                       ^

********** Ошибка **********

ERROR: invalid input syntax for integer: “new”

As I see problem in comparison integer and string with operator !=. But few
symbols upper above RT adds ‘cast(: as text)’.

I think problem that RT add cast as text only if see
MATCHES|ENDSWITH|STARTSWITH|LIKE

For modification existing tickets autocomplete works fine.

May be in file share/html/Helpers/Autocomplete/Tickets change line

$sql = join ’ AND ', “($sql)”, map { qq{id != ‘$_’} } @excludes;

to

$sql = join ’ AND ', “($sql)”, map { qq{id not like ‘$_’} } @excludes;

?

I have RT 4.2.3 and PostgreSQL database.

When user creates new ticket in field “Depends on” there is such
attribute:

exclude=“new”

Good catch; the “new” should never have been passed to the autcompleter
in the first place. Fixed in 4.2/autocomplete-new.

  • Alex