[Rt-commit] [svn] r1803 - in rt/branches/PLATANO-EXPERIMENTAL-CSS:
. etc html/Search html/Ticket html/Ticket/Elements lib/RT
lib/RT/Action lib/RT/Interface sbin
jesse at pallas.eruditorum.org
jesse at pallas.eruditorum.org
Thu Nov 11 03:08:02 EST 2004
Author: jesse
Date: Thu Nov 11 03:08:01 2004
New Revision: 1803
Modified:
rt/branches/PLATANO-EXPERIMENTAL-CSS/ (props changed)
rt/branches/PLATANO-EXPERIMENTAL-CSS/configure.ac
rt/branches/PLATANO-EXPERIMENTAL-CSS/etc/RT_Config.pm.in
rt/branches/PLATANO-EXPERIMENTAL-CSS/html/Search/Results.tsv
rt/branches/PLATANO-EXPERIMENTAL-CSS/html/Ticket/Elements/EditCustomField
rt/branches/PLATANO-EXPERIMENTAL-CSS/html/Ticket/ModifyAll.html
rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Action/SendEmail.pm
rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Interface/Email.pm
rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Interface/Web.pm
rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Ticket_Overlay.pm
rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Tickets_Overlay.pm
rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Tickets_Overlay_SQL.pm
rt/branches/PLATANO-EXPERIMENTAL-CSS/sbin/rt-setup-database.in
Log:
r9065 at tinbook: jesse | 2004-11-11T02:54:36.542352Z
r1652 at tinbook: jesse | 2004-10-10T04:30:49.336195Z
r1650 at tinbook: jesse | 2004-10-10T04:23:58.456281Z
Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/configure.ac
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/configure.ac (original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/configure.ac Thu Nov 11 03:08:01 2004
@@ -248,6 +248,8 @@
bin/rt-crontool
bin/rt-mailgate
bin/rt
- bin/webmux.pl]
- )
+ bin/webmux.pl],
+ [chmod ug+x sbin/rt-test-dependencies
+ chmod ug+x sbin/rt-setup-database]
+ )
AC_OUTPUT
Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/etc/RT_Config.pm.in
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/etc/RT_Config.pm.in (original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/etc/RT_Config.pm.in Thu Nov 11 03:08:01 2004
@@ -133,8 +133,8 @@
# (These values are passed to the CanonicalizeEmailAddress subroutine in RT/User.pm)
# By default, that routine performs a s/$Match/$Replace/gi on any address passed to it
-Set($CanonicalizeEmailAddressMatch , 'subdomain.example.com$');
-Set($CanonicalizeEmailAddressReplace , 'example.com');
+#Set($CanonicalizeEmailAddressMatch , '@subdomain\.example\.com$');
+#Set($CanonicalizeEmailAddressReplace , '@example.com');
# set this to true and the create new user page will use the values that you
# enter in the form but use the function CanonicalizeUserInfo in User_Local.pm
Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/html/Search/Results.tsv
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/html/Search/Results.tsv (original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/html/Search/Results.tsv Thu Nov 11 03:08:01 2004
@@ -84,7 +84,8 @@
my @header;
foreach my $attr (@attrs) {
my $label = $attr;
- $label =~ s'Obj-.(AsString|Name|ISO)''g;
+ $label =~ s'Obj-.(?:AsString|Name|ISO)''g;
+ $label =~ s'-\>MemberEmailAddressesAsString''g;
push @header, $label;
}
foreach my $id (sort keys %known_cfs) {
Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/html/Ticket/Elements/EditCustomField
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/html/Ticket/Elements/EditCustomField (original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/html/Ticket/Elements/EditCustomField Thu Nov 11 03:08:01 2004
@@ -60,7 +60,7 @@
% my $content;
% if ($TicketObj) {
% while (my $value = $Values->Next ) {
-% $content .= $value->Content;
+% $content .= "\n" . $value->Content;
% }
% } elsif ($Default) {
value="<%$Default ? $Default : ''%>"
Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/html/Ticket/ModifyAll.html
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/html/Ticket/ModifyAll.html (original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/html/Ticket/ModifyAll.html Thu Nov 11 03:08:01 2004
@@ -144,7 +144,6 @@
unless ($OnlySearchForPeople) {
@wresults = ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS);
- @results = ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS);
@cf_results = ProcessObjectCustomFieldUpdates( Object => $Ticket, ARGSRef => \%ARGS);
@dresults = ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS);
@lresults = ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS);
@@ -167,15 +166,11 @@
$ARGS{'UpdateContent'} =~ s/\r+\n/\n/g;
- if ($ARGS{'UpdateAttachments'} || (
- $ARGS{'UpdateContent'} &&
- $ARGS{'UpdateContent'} ne "-- \n" .
- $session{'CurrentUser'}->UserObj->Signature
- )) {
- ProcessUpdateMessage(TicketObj => $Ticket,
- ARGSRef=>\%ARGS,
- Actions=>\@results);
+ if ($ARGS{'UpdateAttachments'} || ( $ARGS{'UpdateContent'} && $ARGS{'UpdateContent'} ne "-- \n" .
+ $session{'CurrentUser'}->UserObj->Signature)) {
+ ProcessUpdateMessage(TicketObj => $Ticket, ARGSRef=>\%ARGS, Actions=>\@results);
}
+ @results = ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS);
}
push @results, @wresults;
push @results, @dresults;
Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Action/SendEmail.pm
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Action/SendEmail.pm (original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Action/SendEmail.pm Thu Nov 11 03:08:01 2004
@@ -150,6 +150,10 @@
# try to convert message body from utf-8 to $RT::EmailOutputEncoding
$self->SetHeader( 'Content-Type', 'text/plain; charset="utf-8"' );
+ # fsck.com #5959: Since RT sends 8-bit mail, we should say so.
+ $self->SetHeader( 'Content-Transfer-Encoding','8-bit');
+
+
RT::I18N::SetMIMEEntityToEncoding( $MIMEObj, $RT::EmailOutputEncoding,
'mime_words_ok' );
$self->SetHeader( 'Content-Type', 'text/plain; charset="' . $RT::EmailOutputEncoding . '"' );
Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Interface/Email.pm
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Interface/Email.pm (original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Interface/Email.pm Thu Nov 11 03:08:01 2004
@@ -139,8 +139,8 @@
my ($From, $junk) = ParseSenderAddressFromHead($head);
- if (($From =~ /^mailer-daemon/i) or
- ($From =~ /^postmaster/i)){
+ if (($From =~ /^mailer-daemon\@/i) or
+ ($From =~ /^postmaster\@/i)){
return (1);
}
@@ -342,9 +342,9 @@
foreach my $AddrObj (@ToObjs, @CcObjs) {
my $Address = $AddrObj->address;
$Address = $args{'CurrentUser'}->UserObj->CanonicalizeEmailAddress($Address);
- next if ($args{'CurrentUser'}->EmailAddress =~ /^$Address$/i);
- next if ($args{'QueueObj'}->CorrespondAddress =~ /^$Address$/i);
- next if ($args{'QueueObj'}->CommentAddress =~ /^$Address$/i);
+ next if ($args{'CurrentUser'}->EmailAddress =~ /^\Q$Address\E$/i);
+ next if ($args{'QueueObj'}->CorrespondAddress =~ /^\Q$Address\E$/i);
+ next if ($args{'QueueObj'}->CommentAddress =~ /^\Q$Address\E$/i);
next if (IsRTAddress($Address));
push (@Addresses, $Address);
Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Interface/Web.pm
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Interface/Web.pm (original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Interface/Web.pm Thu Nov 11 03:08:01 2004
@@ -294,8 +294,18 @@
);
foreach my $arg (%ARGS) {
if ($arg =~ /^CustomField-(\d+)(.*?)$/) {
+ my $cfid = $1;
+
next if ($arg =~ /-Magic$/);
- $create_args{"CustomField-".$1} = $ARGS{"$arg"};
+ my $cf = new RT::CustomField( $RT::SystemUser );
+ $cf->Load($cfid);
+
+ if ($cf->Type eq 'FreeformMultiple') {
+ $ARGS{$arg} =~ s/\r\n/\n/g;
+ $ARGS{$arg} = [split('\n', $ARGS{$arg})];
+ }
+
+ $create_args{"CustomField-".$cfid} = $ARGS{"$arg"};
}
}
@@ -1008,7 +1018,10 @@
}
}
- $ARGSRef->{'Status'} ||= $TicketObj->Status;
+
+ # Status isn't a field that can be set to a null value.
+ # RT core complains if you try
+ delete $ARGSRef->{'Status'} unless ($ARGSRef->{'Status'});
my @results = UpdateRecordObject(
AttributesRef => \@attribs,
Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Ticket_Overlay.pm
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Ticket_Overlay.pm (original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Ticket_Overlay.pm Thu Nov 11 03:08:01 2004
@@ -302,9 +302,9 @@
id
Queue - Either a Queue object or a Queue Name
- Requestor - A reference to a list of RT::User objects, email addresses or RT user Names
- Cc - A reference to a list of RT::User objects, email addresses or Names
- AdminCc - A reference to a list of RT::User objects, email addresses or Names
+ Requestor - A reference to a list of email addresses or RT user Names
+ Cc - A reference to a list of email addresses or Names
+ AdminCc - A reference to a list of email addresses or Names
Type -- The ticket\'s type. ignore this for now
Owner -- This ticket\'s owner. either an RT::User object or this user\'s id
Subject -- A string describing the subject of the ticket
@@ -676,7 +676,7 @@
foreach my $link (
ref( $args{$type} ) ? @{ $args{$type} } : ( $args{$type} ) )
{
- my ( $wval, $wmsg ) = $self->AddLink(
+ my ( $wval, $wmsg ) = $self->_AddLink(
Type => $LINKTYPEMAP{$type}->{'Type'},
$LINKTYPEMAP{$type}->{'Mode'} => $link,
Silent => 1
@@ -2544,6 +2544,24 @@
return ( 0, $self->loc("Permission Denied") );
}
+
+ $self->_AddLink(%args);
+}
+
+=head2 _AddLink
+
+Private non-acled variant of AddLink so that links can be added during create.
+
+=cut
+
+sub _AddLink {
+ my $self = shift;
+ my %args = ( Target => '',
+ Base => '',
+ Type => '',
+ Silent => undef,
+ @_ );
+
# {{{ If the other URI is an RT::Ticket, we want to make sure the user
# can modify it too...
my $other_ticket_uri = RT::URI->new($self->CurrentUser);
@@ -2726,10 +2744,10 @@
while ( my $watcher = $people->Next ) {
$MergeInto->_AddWatcher(
Type => $watcher_type,
- Silent => 1,
+ Silent => 1,
PrincipalId => $watcher->MemberId
);
- }
+ }
}
Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Tickets_Overlay.pm
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Tickets_Overlay.pm (original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Tickets_Overlay.pm Thu Nov 11 03:08:01 2004
@@ -124,6 +124,7 @@
Filename => ['TRANSFIELD',],
TransactionDate => ['TRANSDATE',],
Requestor => ['WATCHERFIELD' => 'Requestor',],
+ Requestors => ['WATCHERFIELD' => 'Requestor',],
Cc => ['WATCHERFIELD' => 'Cc',],
AdminCc => ['WATCHERFIELD' => 'AdminCC',],
Watcher => ['WATCHERFIELD'],
@@ -593,79 +594,162 @@
Meta Data:
1: Field to query on
-=cut
-sub _WatcherLimit {
- my ($self,$field,$op,$value, at rest) = @_;
- my %rest = @rest;
+=begin testing
- $self->_OpenParen;
+# Test to make sure that you can search for tickets by requestor address and
+# by requestor name.
- my $groups = $self->NewAlias('Groups');
- my $groupmembers = $self->NewAlias('CachedGroupMembers');
- my $users = $self->NewAlias('Users');
+my ($id,$msg);
+my $u1 = RT::User->new($RT::SystemUser);
+($id, $msg) = $u1->Create( Name => 'RequestorTestOne', EmailAddress => 'rqtest1 at example.com');
+ok ($id,$msg);
+my $u2 = RT::User->new($RT::SystemUser);
+($id, $msg) = $u2->Create( Name => 'RequestorTestTwo', EmailAddress => 'rqtest2 at example.com');
+ok ($id,$msg);
+my $t1 = RT::Ticket->new($RT::SystemUser);
+my ($trans);
+($id,$trans,$msg) =$t1->Create (Queue => 'general', Subject => 'Requestor test one', Requestor => [$u1->EmailAddress]);
+ok ($id, $msg);
- #Find user watchers
-# my $subclause = undef;
-# my $aggregator = 'OR';
-# if ($restriction->{'OPERATOR'} =~ /!|NOT/i ){
-# $subclause = 'AndEmailIsNot';
-# $aggregator = 'AND';
-# }
+my $t2 = RT::Ticket->new($RT::SystemUser);
+($id,$trans,$msg) =$t2->Create (Queue => 'general', Subject => 'Requestor test one', Requestor => [$u2->EmailAddress]);
+ok ($id, $msg);
+
+
+my $t3 = RT::Ticket->new($RT::SystemUser);
+($id,$trans,$msg) =$t3->Create (Queue => 'general', Subject => 'Requestor test one', Requestor => [$u2->EmailAddress, $u1->EmailAddress]);
+ok ($id, $msg);
+
+
+my $tix1 = RT::Tickets->new($RT::SystemUser);
+$tix1->FromSQL('Requestor.EmailAddress LIKE "rqtest1" OR Requestor.EmailAddress LIKE "rqtest2"');
+
+is ($tix1->Count, 3);
+
+my $tix2 = RT::Tickets->new($RT::SystemUser);
+$tix2->FromSQL('Requestor.Name LIKE "TestOne" OR Requestor.Name LIKE "TestTwo"');
+
+is ($tix2->Count, 3);
+
+
+my $tix3 = RT::Tickets->new($RT::SystemUser);
+$tix3->FromSQL('Requestor.EmailAddress LIKE "rqtest1"');
+
+is ($tix3->Count, 2);
+
+my $tix4 = RT::Tickets->new($RT::SystemUser);
+$tix4->FromSQL('Requestor.Name LIKE "TestOne" ');
+
+is ($tix4->Count, 2);
+
+# Searching for tickets that have two requestors isn't supported
+# There's no way to differentiate "one requestor name that matches foo and bar"
+# and "two requestors, one matching foo and one matching bar"
+
+# my $tix5 = RT::Tickets->new($RT::SystemUser);
+# $tix5->FromSQL('Requestor.Name LIKE "TestOne" AND Requestor.Name LIKE "TestTwo"');
+#
+# is ($tix5->Count, 1);
+#
+# my $tix6 = RT::Tickets->new($RT::SystemUser);
+# $tix6->FromSQL('Requestor.EmailAddress LIKE "rqtest1" AND Requestor.EmailAddress LIKE "rqtest2"');
+#
+# is ($tix6->Count, 1);
+
+
+=end testing
+
+=cut
+
+sub _WatcherLimit {
+ my $self = shift;
+ my $field = shift;
+ my $op = shift;
+ my $value = shift;
+ my %rest = (@_);
- if (ref $field) { # gross hack
- my @bundle = @$field;
$self->_OpenParen;
- for my $chunk (@bundle) {
- ($field,$op,$value, at rest) = @$chunk;
- $self->_SQLLimit(ALIAS => $users,
- FIELD => $rest{SUBKEY} || 'EmailAddress',
- VALUE => $value,
- OPERATOR => $op,
- CASESENSITIVE => 0,
- @rest,
- );
+
+ my $groups = $self->NewAlias('Groups');
+ my $groupmembers = $self->NewAlias('CachedGroupMembers');
+ my $users = $self->NewAlias('Users');
+
+ # If we're looking for multiple watchers of a given type,
+ # TicketSQL will be handing it to us as an array of cluases in
+ # $field
+ if ( ref $field ) { # gross hack
+ $self->_OpenParen;
+ for my $chunk (@$field) {
+ ( $field, $op, $value, %rest ) = @$chunk;
+ $self->_SQLLimit(
+ ALIAS => $users,
+ FIELD => $rest{SUBKEY} || 'EmailAddress',
+ VALUE => $value,
+ OPERATOR => $op,
+ CASESENSITIVE => 0,
+ %rest
+ );
+ }
+ $self->_CloseParen;
+ }
+ else {
+ $self->_SQLLimit(
+ ALIAS => $users,
+ FIELD => $rest{SUBKEY} || 'EmailAddress',
+ VALUE => $value,
+ OPERATOR => $op,
+ CASESENSITIVE => 0,
+ %rest,
+ );
}
- $self->_CloseParen;
- } else {
- $self->_SQLLimit(ALIAS => $users,
- FIELD => $rest{SUBKEY} || 'EmailAddress',
- VALUE => $value,
- OPERATOR => $op,
- CASESENSITIVE => 0,
- @rest,
- );
- }
- # {{{ Tie to groups for tickets we care about
- $self->_SQLLimit(ALIAS => $groups,
- FIELD => 'Domain',
- VALUE => 'RT::Ticket-Role',
- ENTRYAGGREGATOR => 'AND');
+ # {{{ Tie to groups for tickets we care about
+ $self->_SQLLimit(
+ ALIAS => $groups,
+ FIELD => 'Domain',
+ VALUE => 'RT::Ticket-Role',
+ ENTRYAGGREGATOR => 'AND'
+ );
- $self->_SQLJoin(ALIAS1 => $groups, FIELD1 => 'Instance',
- ALIAS2 => 'main', FIELD2 => 'id');
- # }}}
+ $self->_SQLJoin(
+ ALIAS1 => $groups,
+ FIELD1 => 'Instance',
+ ALIAS2 => 'main',
+ FIELD2 => 'id'
+ );
- # If we care about which sort of watcher
- my $meta = $FIELDS{$field};
- my $type = ( defined $meta->[1] ? $meta->[1] : undef );
+ # }}}
- if ( $type ) {
- $self->_SQLLimit(ALIAS => $groups,
- FIELD => 'Type',
- VALUE => $type,
- ENTRYAGGREGATOR => 'AND');
- }
+ # If we care about which sort of watcher
+ my $meta = $FIELDS{$field};
+ my $type = ( defined $meta->[1] ? $meta->[1] : undef );
- $self->_SQLJoin (ALIAS1 => $groups, FIELD1 => 'id',
- ALIAS2 => $groupmembers, FIELD2 => 'GroupId');
+ if ($type) {
+ $self->_SQLLimit(
+ ALIAS => $groups,
+ FIELD => 'Type',
+ VALUE => $type,
+ ENTRYAGGREGATOR => 'AND'
+ );
+ }
- $self->_SQLJoin( ALIAS1 => $groupmembers, FIELD1 => 'MemberId',
- ALIAS2 => $users, FIELD2 => 'id');
+ $self->_SQLJoin(
+ ALIAS1 => $groups,
+ FIELD1 => 'id',
+ ALIAS2 => $groupmembers,
+ FIELD2 => 'GroupId'
+ );
- $self->_CloseParen;
+ $self->_SQLJoin(
+ ALIAS1 => $groupmembers,
+ FIELD1 => 'MemberId',
+ ALIAS2 => $users,
+ FIELD2 => 'id'
+ );
+
+ $self->_CloseParen;
}
Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Tickets_Overlay_SQL.pm
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Tickets_Overlay_SQL.pm (original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Tickets_Overlay_SQL.pm Thu Nov 11 03:08:01 2004
@@ -149,20 +149,18 @@
use constant VALUE => 1;
use constant AGGREG => 2;
use constant OP => 4;
-use constant PAREN => 8;
-use constant KEYWORD => 16;
-use constant SELECT => 32;
-use constant WHERE => 64;
-use constant COLUMN => 128;
-my @tokens = qw[VALUE AGGREG OP PAREN KEYWORD SELECT WHERE COLUMN];
+use constant OPEN_PAREN => 8;
+use constant CLOSE_PAREN => 16;
+use constant KEYWORD => 32;
+my @tokens = qw[VALUE AGGREG OP OPEN_PAREN CLOSE_PAREN KEYWORD];
my $re_aggreg = qr[(?i:AND|OR)];
-my $re_select = qr[(?i:SELECT)];
-my $re_where = qr[(?i:WHERE)];
-my $re_value = qr[$RE{delimited}{-delim=>qq{\'\"}}|\d+];
-my $re_keyword = qr[$RE{delimited}{-delim=>qq{\'\"}}|(?:\{|\}|\w|\.)+];
+my $re_delim = qr[$RE{delimited}{-delim=>qq{\'\"}}];
+my $re_value = qr[$re_delim|\d+];
+my $re_keyword = qr[$re_delim|(?:\{|\}|\w|\.)+];
my $re_op = qr[=|!=|>=|<=|>|<|(?i:IS NOT)|(?i:IS)|(?i:NOT LIKE)|(?i:LIKE)]; # long to short
-my $re_paren = qr'\(|\)';
+my $re_open_paren = qr'\(';
+my $re_close_paren = qr'\)';
sub _close_bundle
{
@@ -198,7 +196,7 @@
sub _parser {
my ($self,$string) = @_;
- my $want = SELECT | KEYWORD | PAREN;
+ my $want = KEYWORD | OPEN_PAREN;
my $last = undef;
my $depth = 0;
@@ -215,26 +213,23 @@
while ($string =~ /(
- $re_select
- |$re_where
- |$re_aggreg
+ $re_aggreg
|$re_op
|$re_keyword
|$re_value
- |$re_paren
- )/igx ) {
+ |$re_open_paren
+ |$re_close_paren
+ )/iogx ) {
my $val = $1;
my $current = 0;
# Highest priority is last
- $current = OP if $val =~ /^$re_op$/io;
- $current = VALUE if $val =~ /^$re_value$/io;
- $current = KEYWORD if $val =~ /^$re_keyword$/io && ($want & KEYWORD);
- $current = AGGREG if $val =~ /^$re_aggreg$/io;
- $current = PAREN if $val =~ /^$re_paren$/io;
- $current = COLUMN if $val =~ /^$re_keyword$/io && ($want & COLUMN);
- $current = WHERE if $val =~ /^$re_where$/io && ($want & WHERE);
- $current = SELECT if $val =~ /^$re_select$/io;
+ $current = OP if ($want & OP) && $val =~ /^$re_op$/io;
+ $current = VALUE if ($want & VALUE) && $val =~ /^$re_value$/io;
+ $current = KEYWORD if ($want & KEYWORD) && $val =~ /^$re_keyword$/io;
+ $current = AGGREG if ($want & AGGREG) && $val =~ /^$re_aggreg$/io;
+ $current = OPEN_PAREN if ($want & OPEN_PAREN) && $val =~ /^$re_open_paren$/io;
+ $current = CLOSE_PAREN if ($want & CLOSE_PAREN) && $val =~ /^$re_close_paren$/io;
unless ($current && $want & $current) {
@@ -248,43 +243,23 @@
#$RT::Logger->debug("We've just found a '$current' called '$val'");
# Parens are highest priority
- if ($current & PAREN) {
- if ($val eq "(") {
- $self->_close_bundle(@bundle); @bundle = ();
- $depth++;
- $self->_OpenParen;
-
- } else {
- $self->_close_bundle(@bundle); @bundle = ();
- $depth--;
- $self->_CloseParen;
- }
-
- $want = KEYWORD | PAREN | AGGREG;
- }
- elsif ($current & SELECT ) {
- $want = COLUMN | WHERE;
- }
-
- elsif ($current & COLUMN ) {
- if ($val =~ /$RE{delimited}{-delim=>qq{\'\"}}/) {
- substr($val,0,1) = "";
- substr($val,-1,1) = "";
- }
- # Unescape escaped characters
- $val =~ s!\\(.)!$1!g;
- $self->_DisplayColumn($val);
-
- $want = COLUMN | WHERE;
-
- }
- elsif ($current & WHERE ) {
- $want = KEYWORD | PAREN;
+ if ($current & OPEN_PAREN) {
+ $self->_close_bundle(@bundle); @bundle = ();
+ $depth++;
+ $self->_OpenParen;
+
+ $want = KEYWORD | OPEN_PAREN;
+ }
+ elsif ( $current & CLOSE_PAREN ) {
+ $self->_close_bundle(@bundle); @bundle = ();
+ $depth--;
+ $self->_CloseParen;
+ $want = CLOSE_PAREN | AGGREG;
}
elsif ( $current & AGGREG ) {
$ea = $val;
- $want = KEYWORD | PAREN;
+ $want = KEYWORD | OPEN_PAREN;
}
elsif ( $current & KEYWORD ) {
$key = $val;
@@ -299,17 +274,17 @@
# Remove surrounding quotes from $key, $val
# (in future, simplify as for($key,$val) { action on $_ })
- if ($key =~ /$RE{delimited}{-delim=>qq{\'\"}}/) {
+ if ($key =~ /$re_delim/o) {
substr($key,0,1) = "";
substr($key,-1,1) = "";
}
- if ($val =~ /$RE{delimited}{-delim=>qq{\'\"}}/) {
+ if ($val =~ /$re_delim/o) {
substr($val,0,1) = "";
substr($val,-1,1) = "";
}
# Unescape escaped characters
- $key =~ s!\\(.)!$1!g;
- $val =~ s!\\(.)!$1!g;
+ $key =~ s!\\(.)!$1!g;
+ $val =~ s!\\(.)!$1!g;
# print "$ea Key=[$key] op=[$op] val=[$val]\n";
@@ -365,7 +340,7 @@
($ea,$key,$op,$value) = ("","","","");
- $want = PAREN | AGGREG;
+ $want = CLOSE_PAREN | AGGREG;
} else {
die "I'm lost";
}
@@ -376,10 +351,10 @@
$self->_close_bundle(@bundle); @bundle = ();
die "Incomplete query"
- unless (($want | PAREN) || ($want | KEYWORD));
+ unless (($want | CLOSE_PAREN) || ($want | KEYWORD));
die "Incomplete Query"
- unless ($last && ($last | PAREN) || ($last || VALUE));
+ unless ($last && ($last | CLOSE_PAREN) || ($last || VALUE));
# This will never happen, because the parser will complain
die "Mismatched parentheses"
@@ -427,60 +402,63 @@
use RT::Tickets;
-my $query = "SELECT id WHERE Status = 'open'";
+
my $tix = RT::Tickets->new($RT::SystemUser);
+my $query = "Status = 'open'";
my ($id, $msg) = $tix->FromSQL($query);
ok ($id, $msg);
-my @cols = $tix->DisplayColumns;
-ok ($cols[0]->{'attribute'} == 'id', "We're displaying the ticket id");
-ok ($cols[1] == undef, "We're displaying the ticket id");
+my (@ids, @expectedids);
+my $t = RT::Ticket->new($RT::SystemUser);
-my $query = "SELECT id, Status WHERE Status = 'open'";
+my $string = 'subject/content SQL test';
+ok( $t->Create(Queue => 'General', Subject => $string), "Ticket Created");
-my $tix = RT::Tickets->new($RT::SystemUser);
-
-my ($id, $msg) = $tix->FromSQL($query);
-
-ok ($id, $msg);
+push @ids, $t->Id;
-my @cols = $tix->DisplayColumns;
+my $Message = MIME::Entity->build(
+ Subject => 'this is my subject',
+ From => 'jesse at example.com',
+ Data => [ $string ],
+ );
-ok ($cols[0]->{'attribute'} == 'id', "We're only displaying the ticket id");
-ok ($cols[1]->{'attribute'} == 'Status', "We're only displaying the ticket id");
+ok( $t->Create(Queue => 'General', Subject => 'another ticket', MIMEObj => $Message, MemberOf => $ids[0]), "Ticket Created");
-my $query = qq[SELECT id, Status, '<A href="/Ticket/Display.html?id=##id##">Subject, this: ##Subject##</a>' WHERE Status = 'open'];
+push @ids, $t->Id;
-my $tix = RT::Tickets->new($RT::SystemUser);
+$query = ("Subject LIKE '$string' OR Content LIKE '$string'");
-my ($id, $msg) = $tix->FromSQL($query);
+my ($id, $msg) = $tix->FromSQL($query);
ok ($id, $msg);
-my @cols = $tix->DisplayColumns;
+is ($tix->Count, scalar @ids, "number of returned tickets same as entered");
-ok ($cols[0]->{'attribute'} == 'id', "We're only displaying the ticket id");
-ok ($cols[1]->{'attribute'} == 'Status', "We're only displaying the ticket id");
+while (my $tick = $tix->Next) {
+ push @expectedids, $tick->Id;
+}
+ok (eq_array(\@ids, \@expectedids), "returned expected tickets");
+$query = ("id = $ids[0] OR MemberOf = $ids[0]");
-$query = "Status = 'open'";
-my ($id, $msg) = $tix->FromSQL($query);
+my ($id, $msg) = $tix->FromSQL($query);
ok ($id, $msg);
-my @cols = $tix->DisplayColumns;
-
-ok ($cols[0] == undef, "We haven't explicitly asked to display anything");
-
-
+is ($tix->Count, scalar @ids, "number of returned tickets same as entered");
+ at expectedids = ();
+while (my $tick = $tix->Next) {
+ push @expectedids, $tick->Id;
+}
+ok (eq_array(\@ids, \@expectedids), "returned expected tickets");
=end testing
@@ -547,22 +525,6 @@
Returns the query that this object was initialized with
-=begin testing
-
-my $query = "SELECT id, Status WHERE Status = 'open'";
-
-my $tix = RT::Tickets->new($RT::SystemUser);
-
-my ($id, $msg) = $tix->FromSQL($query);
-
-ok ($id, $msg);
-
-my $newq = $tix->Query();
-
-is ($query, $newq);
-
-=end testing
-
=cut
sub Query {
@@ -571,71 +533,6 @@
}
-=head2 _DisplayColumn COL
-
-Add COL to this search's list of "Columns to display"
-
-COL can either be a
-
-LiteralColumnName
-"QuotedString" (Containing ##LiteralColumnName## to embed the colum name inside it)
-
-What else?
-
-
-
-=cut
-
-sub _DisplayColumn {
- my $self = shift;
- my $col = shift;
-
- my $colref;
- if ( $col =~ s/\/STYLE:(.*?)$//io ) {
- $colref->{'style'} = $1;
- }
- if ( $col =~ s/\/CLASS:(.*?)$//io ) {
- $colref->{'class'} = $1;
- }
- if ( $col =~ s/\/TITLE:(.*?)$//io ) {
- $colref->{'title'} = $1;
- }
- if ( $col =~ /__(.*?)__/gio ) {
- my @subcols;
- while ( $col =~ s/^(.*?)__(.*?)__//o ) {
- push ( @subcols, $1 ) if ($1);
- push ( @subcols, "__$2__" );
- $colref->{'attribute'} = $2;
- }
- push ( @subcols, $col );
- @{ $colref->{'output'} } = @subcols;
- }
- else {
- @{ $colref->{'output'} } = ( "__" . $col . "__" );
- $colref->{'attribute'} = $col;
- }
-
- if ( !$colref->{'title'} && grep { /^__(.*?)__$/io }
- @{ $colref->{'output'} } )
- {
- $colref->{'title'} = $1;
- $colref->{'attribute'} = $1;
- }
- push @{ $self->{'_sql_columns_to_display'} }, $colref;
-
-}
-
-=head2 DisplayColumns
-
-Returns an array of the columns to show in the printed results of this object
-
-=cut
-
-sub DisplayColumns {
- my $self = shift;
- return (@{$self->{'_sql_columns_to_display'}});
-}
-
1;
Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/sbin/rt-setup-database.in
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/sbin/rt-setup-database.in (original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/sbin/rt-setup-database.in Thu Nov 11 03:08:01 2004
@@ -402,7 +402,8 @@
RealName => 'The RT System itself',
Comments =>
'Do not delete or modify this user. It is integral to RT\'s internal database structures',
- Creator => '1' );
+ Creator => '1',
+ LastUpdatedBy => '1' );
unless ($val) {
print "$msg\n";
More information about the Rt-commit
mailing list