Re: [rt-users] RT 4.2.9 Simple Search, Subject LIKE instead of Id =

2015-01-20 Thread Vladimir Nikolic
On 20. 01. 2015 02:41, Alex Vandiver wrote:
 On Mon, 19 Jan 2015 22:50:07 +0100 Vladimir Nikolic
 vladimir.niko...@amis.net wrote:
 Hello,

 after upgrade to 4.2.9 (from 4.2.2), we noticed that Simple Search by 
 Ticket id doesn't work.
 If I enter 783509 in Search box, Edit Search shows sql query:

 ( Subject LIKE 783502 ) AND (  Status = 'new' OR Status = 'open' OR 
 Status = 'resolved' OR Status = 'stalled' OR Status = 'rejected' OR 
 Status = 'deleted' )
 
 This does not occur on a stock RT 4.2.9.
 
 /usr/local/lib/perl5/site_perl/RT/Search/Simple.pm has lines:

  # Assume that numbers were actually defaults if we have other
  # limits
  if ($limits-{id} and keys %{$limits}  1) {
  my $values = delete $limits-{id};
  for my $value (@{$values}) {
  $value =~ /(\d+)/ or next;
  my ($key, @tsql) = $self-HandleDefault($1);
  push @{$limits-{$key}}, @tsql;
  }
  }

 which rewrites 'Id =' to 'Subject LIKE'.
 
 It only does so _if_ there are other limits -- as the comment
 describes.  This is so, in a stock RT, entering «rt 4» into the search
 box does not attempt to load ticket #4.
 
 
 Double-check that you do not have any customizations in this area.  For
 the following command, a stock RT 4.2.9 should return only the ID
 clause:
 
 perl -I/opt/rt4/lib -MRT=-init -MRT::Search::Simple \
  -le 'print RT::Search::Simple-new(TicketsObj =
 RT::Tickets-new(RT-SystemUser))-QueryToSQL(783502)'
 
 
  - Alex
 

Hello,
 perl -I/opt/rt4/lib -MRT=-init -MRT::Search::Simple \
  -le 'print RT::Search::Simple-new(TicketsObj =
 RT::Tickets-new(RT-SystemUser))-QueryToSQL(783502)'

returns ( Id = 783502 ), which is ok.

The problem is that $query consists of ticket id and various states -
new, open, resolved, stalled, rejected and deleted. These are other
limits and because of them search by id doesn't work.

sub QueryToSQL {
my $self = shift;
$RT::Logger-error(self $self\n);
my $query = shift || $self-Argument;
...

I don't know from where it gets all these states.

Regards,
Vladimir



Re: [rt-users] RT 4.2.9 Simple Search, Subject LIKE instead of Id =

2015-01-19 Thread Alex Vandiver
On Mon, 19 Jan 2015 22:50:07 +0100 Vladimir Nikolic
vladimir.niko...@amis.net wrote:
 Hello,
 
 after upgrade to 4.2.9 (from 4.2.2), we noticed that Simple Search by 
 Ticket id doesn't work.
 If I enter 783509 in Search box, Edit Search shows sql query:
 
 ( Subject LIKE 783502 ) AND (  Status = 'new' OR Status = 'open' OR 
 Status = 'resolved' OR Status = 'stalled' OR Status = 'rejected' OR 
 Status = 'deleted' )

This does not occur on a stock RT 4.2.9.

 /usr/local/lib/perl5/site_perl/RT/Search/Simple.pm has lines:
 
  # Assume that numbers were actually defaults if we have other
  # limits
  if ($limits-{id} and keys %{$limits}  1) {
  my $values = delete $limits-{id};
  for my $value (@{$values}) {
  $value =~ /(\d+)/ or next;
  my ($key, @tsql) = $self-HandleDefault($1);
  push @{$limits-{$key}}, @tsql;
  }
  }
 
 which rewrites 'Id =' to 'Subject LIKE'.

It only does so _if_ there are other limits -- as the comment
describes.  This is so, in a stock RT, entering «rt 4» into the search
box does not attempt to load ticket #4.


Double-check that you do not have any customizations in this area.  For
the following command, a stock RT 4.2.9 should return only the ID
clause:

perl -I/opt/rt4/lib -MRT=-init -MRT::Search::Simple \
 -le 'print RT::Search::Simple-new(TicketsObj =
RT::Tickets-new(RT-SystemUser))-QueryToSQL(783502)'


 - Alex