[Rt-commit] r7568 - in rtir/branches/2.3-EXPERIMENTAL: .
html/Callbacks/RTIR/Elements/MakeClicky html/RTIR/Elements
ruz at bestpractical.com
ruz at bestpractical.com
Thu Apr 19 09:49:56 EDT 2007
Author: ruz
Date: Thu Apr 19 09:49:55 2007
New Revision: 7568
Modified:
rtir/branches/2.3-EXPERIMENTAL/ (props changed)
rtir/branches/2.3-EXPERIMENTAL/html/Callbacks/RTIR/Elements/MakeClicky/Default
rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Elements/Header
rtir/branches/2.3-EXPERIMENTAL/lib/RT/Action/RTIR_SetConstituency.pm
Log:
r1858 at cubic-pc (orig r6801): ruz | 2007-01-24 03:12:33 +0300
r1855 at cubic-pc (orig r6791): ruz | 2007-01-22 23:58:21 +0300
r1853 at cubic-pc: cubic | 2007-01-22 12:24:28 +0300
* CF != 'xxx' autmatically adds 'OR CF IS NULL' in RT's code,
so don't do this twice
r1859 at cubic-pc (orig r6802): ruz | 2007-01-24 03:12:50 +0300
r1856 at cubic-pc (orig r6792): ruz | 2007-01-22 23:58:33 +0300
r1854 at cubic-pc: cubic | 2007-01-23 00:09:40 +0300
* split query into two by OR to improve mysql's plan
r1865 at cubic-pc (orig r6921): ruz | 2007-02-06 04:38:14 +0300
* make regexp a little bit smarter
r1866 at cubic-pc (orig r6988): ruz | 2007-02-13 17:31:15 +0300
* add RTIR's name instead of rt's one to header
Modified: rtir/branches/2.3-EXPERIMENTAL/html/Callbacks/RTIR/Elements/MakeClicky/Default
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/Callbacks/RTIR/Elements/MakeClicky/Default (original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/Callbacks/RTIR/Elements/MakeClicky/Default Thu Apr 19 09:49:55 2007
@@ -100,7 +100,7 @@
},
{
name => "domain",
- regex => q[(?:[\w-]+\.)+[A-Za-z]{2,3}],
+ regex => q[(?:[\w-]+\.)+[A-Za-z]{2,3}\b],
action => "host",
},
{
Modified: rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Elements/Header
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Elements/Header (original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Elements/Header Thu Apr 19 09:49:55 2007
@@ -21,4 +21,8 @@
%# inclusion in the work.
%#
%#
-<& /Elements/Header, URL => RT->Config->Get('WebPath')."/RTIR/index.html", %ARGS &>
+<& /Elements/Header,
+ URL => RT->Config->Get('WebPath') ."/RTIR/index.html",
+ Name => loc("RTIR for [_1]", RT->Config->Get('rtirname')),
+ %ARGS
+&>
Modified: rtir/branches/2.3-EXPERIMENTAL/lib/RT/Action/RTIR_SetConstituency.pm
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/lib/RT/Action/RTIR_SetConstituency.pm (original)
+++ rtir/branches/2.3-EXPERIMENTAL/lib/RT/Action/RTIR_SetConstituency.pm Thu Apr 19 09:49:55 2007
@@ -37,24 +37,26 @@
." OR Queue = 'Incident Reports'"
." OR Queue = 'Investigations'"
." OR Queue = 'Blocks'"
- .")"
- ." AND ( MemberOf = ". $ticket->Id ." OR HasMember = ". $ticket->Id ." )";
+ .")";
if ( $constituency ) {
- $query .= " AND ( CF.{_RTIR_Constituency} != '$constituency' OR CF.{_RTIR_Constituency} IS NULL )";
+ $query .= " AND CF.{_RTIR_Constituency} != '$constituency'";
} else {
- $query .= " AND ( CF.{_RTIR_Constituency} IS NOT NULL )";
+ $query .= " AND CF.{_RTIR_Constituency} IS NOT NULL";
}
- my $tickets = RT::Tickets->new( $RT::SystemUser );
- $tickets->FromSQL( $query );
- while ( my $t = $tickets->Next ) {
- $RT::Logger->debug( "Ticket #". $t->id ." inherits constituency from ticket #". $ticket->id );
- my ($res, $msg) = $t->AddCustomFieldValue(
- Field => '_RTIR_Constituency',
- Value => $constituency,
- );
- $RT::Logger->warning( "Couldn't set CF: $msg" ) unless $res;
+ # do two queries as mysql couldn't optimize things well
+ foreach my $link_type (qw(MemberOf HasMember)) {
+ my $tickets = RT::Tickets->new( $RT::SystemUser );
+ $tickets->FromSQL( $query ." AND $link_type = ". $ticket->Id );
+ while ( my $t = $tickets->Next ) {
+ $RT::Logger->debug( "Ticket #". $t->id ." inherits constituency from ticket #". $ticket->id );
+ my ($res, $msg) = $t->AddCustomFieldValue(
+ Field => '_RTIR_Constituency',
+ Value => $constituency,
+ );
+ $RT::Logger->warning( "Couldn't set CF: $msg" ) unless $res;
+ }
}
return 1;
}
More information about the Rt-commit
mailing list