[Rt-commit] r17326 - in rt/3.8/branches/cfcleanups: . bin etc lib/RT share/html/Elements share/html/REST/1.0/Forms/ticket share/html/Ticket/Elements t/web

falcone at bestpractical.com falcone at bestpractical.com
Wed Dec 24 11:49:32 EST 2008


Author: falcone
Date: Wed Dec 24 11:49:32 2008
New Revision: 17326

Removed:
   rt/3.8/branches/cfcleanups/etc/acl.Pg-8.2
Modified:
   rt/3.8/branches/cfcleanups/   (props changed)
   rt/3.8/branches/cfcleanups/Makefile.in
   rt/3.8/branches/cfcleanups/bin/rt.in
   rt/3.8/branches/cfcleanups/config.layout
   rt/3.8/branches/cfcleanups/etc/acl.Pg
   rt/3.8/branches/cfcleanups/lib/RT/I18N/fr.po
   rt/3.8/branches/cfcleanups/lib/RT/Tickets_Overlay.pm
   rt/3.8/branches/cfcleanups/share/html/Elements/EditCustomField
   rt/3.8/branches/cfcleanups/share/html/Elements/QueueSummary
   rt/3.8/branches/cfcleanups/share/html/REST/1.0/Forms/ticket/default
   rt/3.8/branches/cfcleanups/share/html/Ticket/Elements/ShowRequestor
   rt/3.8/branches/cfcleanups/t/web/command_line.t

Log:
- Merge //mirror/bps-public/rt/3.8/trunk to //mirror/bps-public/rt/3.8/branches/cfcleanups

Modified: rt/3.8/branches/cfcleanups/Makefile.in
==============================================================================
--- rt/3.8/branches/cfcleanups/Makefile.in	(original)
+++ rt/3.8/branches/cfcleanups/Makefile.in	Wed Dec 24 11:49:32 2008
@@ -172,7 +172,6 @@
 
 ETC_FILES		=	acl.Informix \
 			acl.Pg \
-			acl.Pg-8.2 \
 			acl.Oracle \
 			acl.mysql \
 			acl.Sybase \

Modified: rt/3.8/branches/cfcleanups/bin/rt.in
==============================================================================
--- rt/3.8/branches/cfcleanups/bin/rt.in	(original)
+++ rt/3.8/branches/cfcleanups/bin/rt.in	Wed Dec 24 11:49:32 2008
@@ -1502,37 +1502,7 @@
         # XXX: This should become a real parser, à la Text::ParseWords.
         $line =~ s/^\s+//;
         $line =~ s/\s+$//;
-        my ( $a, $b ) = split /,/, $line, 2;
-
-        while ($a) {
-            no warnings 'uninitialized';
-            if ( $a =~ /^'/ ) {
-                my $s = $a;
-                while ( $a !~ /'$/ || (   $a !~ /(\\\\)+'$/
-                            && $a =~ /(\\)+'$/ )) {
-                    ( $a, $b ) = split /,/, $b, 2;
-                    $s .= ',' . $a;
-                }
-                push @words, $s;
-            }
-            elsif ( $a =~ /^q{/ ) {
-                my $s = $a;
-                while ( $a !~ /}$/ ) {
-                    ( $a, $b ) =
-                      split /,/, $b, 2;
-                    $s .= ',' . $a;
-                }
-                $s =~ s/^q{/'/;
-                $s =~ s/}/'/;
-                push @words, $s;
-            }
-            else {
-                push @words, $a;
-            }
-            ( $a, $b ) = split /,/, $b, 2;
-        }
-
-
+        push @words, split /\s*,\s*/, $line;
     }
 
     return \@words;

Modified: rt/3.8/branches/cfcleanups/config.layout
==============================================================================
--- rt/3.8/branches/cfcleanups/config.layout	(original)
+++ rt/3.8/branches/cfcleanups/config.layout	Wed Dec 24 11:49:32 2008
@@ -130,7 +130,7 @@
 
 #   RH path layout.
 <Layout RH>
-  prefix:		/usr/
+  prefix:		/usr
   exec_prefix:		${prefix}
   bindir:		${exec_prefix}/bin
   sbindir:		${exec_prefix}/sbin
@@ -140,7 +140,7 @@
   datadir:		/var/rt
   htmldir:		${datadir}/html
   manualdir:		${datadir}/doc
-  localstatedir:	/var/
+  localstatedir:	/var
   logfiledir:		${localstatedir}/log/rt
   masonstatedir:	${localstatedir}/rt/mason_data
   sessionstatedir:	${localstatedir}/rt/session_data

Modified: rt/3.8/branches/cfcleanups/etc/acl.Pg
==============================================================================
--- rt/3.8/branches/cfcleanups/etc/acl.Pg	(original)
+++ rt/3.8/branches/cfcleanups/etc/acl.Pg	Wed Dec 24 11:49:32 2008
@@ -57,10 +57,14 @@
 	 push @acls, "CREATE USER $db_user WITH PASSWORD '$db_pass' NOCREATEDB NOCREATEUSER;";
     }
 
+    my $sequence_right
+        = ( $dbh->{pg_server_version} >= 80200 )
+        ? "USAGE, SELECT, UPDATE"
+        : "SELECT, UPDATE";
     foreach my $table (@tables) {
         if ( $table =~ /^[a-z]/ && $table ne 'sessions' ) {
 # table like objectcustomfields_id_s
-            push @acls, "GRANT SELECT, UPDATE ON $table TO $db_user;"
+            push @acls, "GRANT $sequence_right ON $table TO $db_user;"
         }
         else {
             push @acls, "GRANT SELECT, INSERT, UPDATE, DELETE ON $table TO $db_user;"

Modified: rt/3.8/branches/cfcleanups/lib/RT/I18N/fr.po
==============================================================================
--- rt/3.8/branches/cfcleanups/lib/RT/I18N/fr.po	(original)
+++ rt/3.8/branches/cfcleanups/lib/RT/I18N/fr.po	Wed Dec 24 11:49:32 2008
@@ -2663,7 +2663,7 @@
 
 #: etc/initialdata:354 etc/upgrade/3.7.15/content:4 share/html/Ticket/Elements/ShowTransaction:208
 msgid "Forward"
-msgstr "Suivi"
+msgstr "Transfert"
 
 #: share/html/Ticket/Forward.html:79
 msgid "Forward Message"
@@ -4551,7 +4551,7 @@
 
 #: lib/RT/Queue_Overlay.pm:112
 msgid "OwnTicket"
-msgstr "PrendreTicket"
+msgstr "GérerTicket"
 
 #: lib/RT/ACE_Overlay.pm:99 lib/RT/Graph/Tickets.pm:158 lib/RT/Tickets_Overlay.pm:2112 lib/RT/Tickets_Overlay.pm:98 share/html/Elements/QuickCreate:58 share/html/Elements/RT__Ticket/ColumnMap:269 share/html/Elements/RT__Ticket/ColumnMap:89 share/html/Search/Elements/PickBasics:114 share/html/Ticket/Create.html:76 share/html/Ticket/Elements/EditBasics:63 share/html/Ticket/Elements/EditPeople:66 share/html/Ticket/Elements/EditPeople:67 share/html/Ticket/Elements/Reminders:135 share/html/Ticket/Elements/ShowPeople:50 share/html/Ticket/Update.html:70
 msgid "Owner"

Modified: rt/3.8/branches/cfcleanups/lib/RT/Tickets_Overlay.pm
==============================================================================
--- rt/3.8/branches/cfcleanups/lib/RT/Tickets_Overlay.pm	(original)
+++ rt/3.8/branches/cfcleanups/lib/RT/Tickets_Overlay.pm	Wed Dec 24 11:49:32 2008
@@ -1344,6 +1344,13 @@
         $null_columns_ok = 1;
     }
 
+    my $fix_op = sub {
+        my $op = shift;
+        return $op unless RT->Config->Get('DatabaseType') eq 'Oracle';
+        return 'MATCHES' if $op eq '=';
+        return 'NOT MATCHES' if $op eq '!=';
+    };
+
     my $cfkey = $cfid ? $cfid : "$queue.$field";
     my ($TicketCFs, $CFs) = $self->_CustomFieldJoin( $cfkey, $cfid, $field );
 
@@ -1358,7 +1365,7 @@
         $self->_SQLLimit(
             ALIAS      => $TicketCFs,
             FIELD      => $column,
-            OPERATOR   => $op,
+            OPERATOR   => ($column ne 'LargeContent'? $op : $fix_op->($op)),
             VALUE      => $value,
             %rest
         );
@@ -1392,7 +1399,7 @@
         $self->_SQLLimit(
             ALIAS => $TicketCFs,
             FIELD => 'LargeContent',
-            OPERATOR => $op,
+            OPERATOR => $fix_op->($op),
             VALUE => $value,
             ENTRYAGGREGATOR => 'AND',
         );

Modified: rt/3.8/branches/cfcleanups/share/html/Elements/EditCustomField
==============================================================================
--- rt/3.8/branches/cfcleanups/share/html/Elements/EditCustomField	(original)
+++ rt/3.8/branches/cfcleanups/share/html/Elements/EditCustomField	Wed Dec 24 11:49:32 2008
@@ -59,13 +59,7 @@
     $Values = $Object->CustomFieldValues( $CustomField->id );
     $Values->Columns( qw( id CustomField ObjectType ObjectId Disabled Content ContentType ContentEncoding SortOrder Creator Created LastUpdatedBy LastUpdated ) );
     $NamePrefix ||= join('-', 'Object', ref($Object), $Object->Id, 'CustomField', '');
-}
-
-# Don't take care of $Values if there isn't values inside
-undef ( $Values ) unless ( $Values->Count );
-
-# Always fill $Default with submited values if it's empty
-if ( not $Default ) {
+} elsif (not $Default) {
     my %TOP = $m->request_args;
     $Default = $TOP{ $NamePrefix .$CustomField->Id . '-Values' }
             || $TOP{ $NamePrefix .$CustomField->Id . '-Value' };

Modified: rt/3.8/branches/cfcleanups/share/html/Elements/QueueSummary
==============================================================================
--- rt/3.8/branches/cfcleanups/share/html/Elements/QueueSummary	(original)
+++ rt/3.8/branches/cfcleanups/share/html/Elements/QueueSummary	Wed Dec 24 11:49:32 2008
@@ -58,7 +58,7 @@
 %   my $name = $queue->{Name};
 %   $name =~ s/'/\\'/g;
 %   my $queue_cond = "Queue = '$name' AND ";
-%   my $all_q = $queue_cond . '(' . join( " OR ", map "Status = '$_'", RT::Queue->ActiveStatusArray()) . ')';
+%   my $all_q = $queue_cond . "(".join( " OR ", map $_->{cond}, @$conditions).")";
 <tr class="<% $i%2 ? 'oddline' : 'evenline'%>" >
 <td><a href="<% RT->Config->Get('WebPath') %>/Search/Results.html?Query=<% $all_q |u,n %>" title="<% $queue->{Description} %>"><% $queue->{Name} %></a></td>
 %   for my $condition (@$conditions) {
@@ -69,6 +69,14 @@
 % }
 </table>
 <%INIT>
+# Ensure sane default
+unless ( @$conditions ) {
+    foreach (RT::Queue->ActiveStatusArray()) {
+        push @$conditions, { cond => "Status = '$_'", name => loc($_) };
+    }
+}
+
+
 my @queues;
 
 if ($cache && exists $session{$cache}) {

Modified: rt/3.8/branches/cfcleanups/share/html/REST/1.0/Forms/ticket/default
==============================================================================
--- rt/3.8/branches/cfcleanups/share/html/REST/1.0/Forms/ticket/default	(original)
+++ rt/3.8/branches/cfcleanups/share/html/REST/1.0/Forms/ticket/default	Wed Dec 24 11:49:32 2008
@@ -229,21 +229,8 @@
 
         my $vals = $ticket->CustomFieldValues($cf->Id());
         my @out = ();
-        if ( $cf->SingleValue ) {
-            my $v = $vals->Next;
-            push @out, $v->Content if $v;
-        }
-        else {
-            while (my $v = $vals->Next()) {
-                my $content = $v->Content;
-                $content =~ s/'/\\'/g;
-                if ( $v->Content =~ /,/ ) {
-                    push @out, q{'} . $content . q{'};
-                }
-                else {
-                    push @out, $content;
-                }
-            }
+        while (my $v = $vals->Next()) {
+            push @out, $v->Content;
         }
         push @data, [ ('CF.{' . $cf->Name . '}') => join ',', @out ];
     }
@@ -340,77 +327,9 @@
                 $s = "Unknown custom field.";
             }
             else {
-                my $vals = $ticket->CustomFieldValues($cf->id);
-
-                if ( $cf->SingleValue ) {
-                    my $old = $vals->Next;
-                    if ( $old ) {
-                        if ( $val ne $old->Content ) {
-                            $old->Delete;
-                            ($n, $s) = $ticket->AddCustomFieldValue(
-                                 Field => $cf, Value => $val );
-                            $s =~ s/^# // if defined $s;
-                        }
-                    }
-                    else {
-                        ($n, $s) = $ticket->AddCustomFieldValue(
+                ($n, $s) = $ticket->AddCustomFieldValue(
                              Field => $cf, Value => $val );
-                        $s =~ s/^# // if defined $s;
-                    }
-                }
-                else {
-                    my @new;
-                    my ( $a, $b ) = split /,/, $val, 2;
-                    while ($a) {
-                        no warnings 'uninitialized';
-                        if ( $a =~ /^'/ ) {
-                            my $s = $a;
-                            while ( $a !~ /'$/ || ( $a !~ /(\\\\)+'$/
-                                            && $a =~ /(\\)+'$/ ) ) {
-                                ( $a, $b ) = split /,/, $b, 2;
-                                $s .= ',' . $a;
-                            }
-                            $s =~ s/^'//;
-                            $s =~ s/'$//;
-                            $s =~ s/\\'/'/g;
-                            push @new, $s;
-                        }
-                        elsif ( $a =~ /^q{/ ) {
-                            my $s = $a;
-                            while ( $a !~ /}$/ ) {
-                                ( $a, $b ) = split /,/, $b, 2;
-                                $s .= ',' . $a;
-                            }
-                            $s =~ s/^q{//;
-                            $s =~ s/}//;
-                            push @new, $s;
-                        }
-                        else {
-                            push @new, $a;
-                        }
-                        ( $a, $b ) = split /,/, $b, 2;
-                    }
-
-                    my %new;
-                    $new{$_}++ for @new;
-
-                    while (my $v = $vals->Next()) {
-                        my $c = $v->Content;
-                        if ( $new{$c} ) {
-                            $new{$c}--;
-                        }
-                        else {
-                            $v->Delete();
-                        }
-                    }
-                    for ( @new ) {
-                        while ( $new{$_} && $new{$_}-- ) {
-                            ($n, $s) = $ticket->AddCustomFieldValue(
-                                Field => $cf, Value => $_ );
-                            $s =~ s/^# // if defined $s;
-                        }
-                    }
-                }
+                $s =~ s/^# // if defined $s;
             }
         }
         elsif ($key ne 'id' && $key ne 'type' && $key ne 'creator') {

Modified: rt/3.8/branches/cfcleanups/share/html/Ticket/Elements/ShowRequestor
==============================================================================
--- rt/3.8/branches/cfcleanups/share/html/Ticket/Elements/ShowRequestor	(original)
+++ rt/3.8/branches/cfcleanups/share/html/Ticket/Elements/ShowRequestor	Wed Dec 24 11:49:32 2008
@@ -46,6 +46,12 @@
 %# 
 %# END BPS TAGGED BLOCK }}}
 <%PERL>
+# Unsure sane default
+unless ( @$conditions ) {
+    foreach (RT::Queue->ActiveStatusArray()) {
+        push @$conditions, { cond => "Status = '$_'", name => loc($_) };
+    }
+}
 my $rows = 10;
 my $has_right_adminusers = $session{'CurrentUser'}->HasRight(Object => $RT::System, Right => 'AdminUsers');
 my $people = $Ticket->Requestors->UserMembersObj;
@@ -54,7 +60,7 @@
     my $name = $m->scomp('/Elements/ShowUser', User => $requestor);
 
     my $tickets = RT::Tickets->new( $session{'CurrentUser'} );
-    $tickets->FromSQL( "Requestor.id = ". $requestor->id ." AND (Status = 'open' OR Status = 'new')" );
+    $tickets->FromSQL( "Requestor.id = ". $requestor->id ." AND (".join( " OR ", map $_->{cond}, @$conditions).")" );
     $tickets->RowsPerPage( $rows );
     $tickets->OrderBy( FIELD => 'Priority', ORDER => 'DESC' );
 </%PERL>
@@ -88,4 +94,5 @@
 <%ARGS>
 $Ticket=>undef
 $DisplayPath => "/Ticket/Display.html"
+$conditions => []
 </%ARGS>

Modified: rt/3.8/branches/cfcleanups/t/web/command_line.t
==============================================================================
--- rt/3.8/branches/cfcleanups/t/web/command_line.t	(original)
+++ rt/3.8/branches/cfcleanups/t/web/command_line.t	Wed Dec 24 11:49:32 2008
@@ -3,7 +3,7 @@
 use strict;
 use File::Spec ();
 use Test::Expect;
-use Test::More tests => 295;
+use Test::More tests => 243;
 use RT::Test;
 my ($baseurl, $m) = RT::Test->started_ok;
 
@@ -98,10 +98,6 @@
 ($val,$msg) = $othercf->Create(Name => 'My CF'.$$, Type => 'FreeformSingle', Queue => $queue_id);
 ok($val,$msg);
 
-my $multiple_cf = RT::CustomField->new($RT::SystemUser);
-($val,$msg) = $multiple_cf->Create(Name => 'MultipleCF'.$$, Type =>
-        'FreeformMultiple', Queue => $queue_id);
-ok($val,$msg);
 
 
 # add a comment to ticket
@@ -191,70 +187,12 @@
 expect_send("show ticket/$ticket_id -f 'CF.{my CF$$}'", 'Checking initial value');
 expect_like(qr/CF\.{my CF$$}: VALUE/i, 'Verified change');
 expect_send("edit ticket/$ticket_id set 'CF.{my CF$$}=NEW' ", 'Changing CF...');
+expect_like(qr/Ticket $ticket_id updated/, 'Changed cf');
 expect_send("show ticket/$ticket_id -f 'CF.{my CF$$}'", 'Checking new value');
 expect_like(qr/CF\.{my CF$$}: NEW/i, 'Verified change');
 expect_send("ls -l 'id = $ticket_id' -f 'CF.{my CF$$}'", 'Checking new value');
 expect_like(qr/CF\.{my CF$$}: NEW/i, 'Verified change');
 
-# Test reading and setting single value custom field with commas or quotes
-expect_send("show ticket/$ticket_id -f CF-myCF$$", 'Checking initial value');
-expect_like(qr/CF\.{myCF$$}:/i, 'Verified change');
-expect_send("edit ticket/$ticket_id set CF-myCF$$=1,2,3", 'Changing CF...');
-expect_like(qr/Ticket $ticket_id updated/, 'Changed cf');
-expect_send("show ticket/$ticket_id -f CF-myCF$$", 'Checking new value');
-expect_like(qr/CF\.{myCF$$}: 1,2,3/i, 'Verified change');
-expect_send("edit ticket/$ticket_id set CF-myCF$$=\"1's,2,3\"", 'Changing CF...');
-expect_like(qr/Ticket $ticket_id updated/, 'Changed cf');
-expect_send("show ticket/$ticket_id -f CF-myCF$$", 'Checking new value');
-expect_like(qr/CF\.{myCF$$}: 1's,2,3/i, 'Verified change');
-
-# Test reading and setting custom fields with multiple values
-expect_send("show ticket/$ticket_id -f CF-MultipleCF$$", 'Checking initial value');
-expect_like(qr/CF\.{MultipleCF$$}:/i, 'Verified multiple cf change');
-expect_send("edit ticket/$ticket_id set CF.{MultipleCF$$}=1,2,3 ", 'Changing CF...');
-expect_like(qr/Ticket $ticket_id updated/, 'Changed multiple cf');
-expect_send("show ticket/$ticket_id -f CF.{MultipleCF$$}", 'Checking new value');
-expect_like(qr/CF\.{MultipleCF$$}: 1,\s*2,\s*3/i, 'Verified multiple cf change');
-expect_send("edit ticket/$ticket_id set CF.{MultipleCF$$}=a,b,c ", 'Changing CF...');
-expect_like(qr/Ticket $ticket_id updated/, 'Changed multiple cf');
-expect_send("show ticket/$ticket_id -f CF.{MultipleCF$$}", 'Checking new value');
-expect_like(qr/CF\.{MultipleCF$$}: a,\s*b,\s*c/i, 'Verified change');
-expect_send("edit ticket/$ticket_id del CF.{MultipleCF$$}=a", 'Changing CF...');
-expect_like(qr/Ticket $ticket_id updated/, 'del multiple cf');
-expect_send("show ticket/$ticket_id -f CF.{MultipleCF$$}", 'Checking new value');
-expect_like(qr/CF\.{MultipleCF$$}: b,\s*c/i, 'Verified multiple cf change');
-expect_send("edit ticket/$ticket_id add CF.{MultipleCF$$}=o", 'Changing CF...');
-expect_like(qr/Ticket $ticket_id updated/, 'Changed multiple cf');
-expect_send("show ticket/$ticket_id -f CF.{MultipleCF$$}", 'Checking new value');
-expect_like(qr/CF\.{MultipleCF$$}: b,\s*c,\s*o/i, 'Verified multiple cf change');
-
-expect_send("edit ticket/$ticket_id set CF.{MultipleCF$$}=\"'a,b,c'\" ", 'Changing CF...');
-expect_like(qr/Ticket $ticket_id updated/, 'Changed multiple cf');
-expect_send("show ticket/$ticket_id -f CF.{MultipleCF$$}", 'Checking new value');
-expect_like(qr/CF\.{MultipleCF$$}: 'a,b,c'/i, 'Verified change');
-expect_send("edit ticket/$ticket_id del CF.{MultipleCF$$}=a", 'Changing CF...');
-expect_like(qr/Ticket $ticket_id updated/, 'Changed multiple cf');
-expect_send("show ticket/$ticket_id -f CF.{MultipleCF$$}", 'Checking new value');
-expect_like(qr/CF\.{MultipleCF$$}: 'a,b,c'/i, 'Verified change');
-
-expect_send("edit ticket/$ticket_id set CF.{MultipleCF$$}=q{a,b,c}", 'Changing CF...');
-expect_like(qr/Ticket $ticket_id updated/, 'Changed multiple cf');
-expect_send("show ticket/$ticket_id -f CF.{MultipleCF$$}", 'Checking new value');
-expect_like(qr/CF\.{MultipleCF$$}: 'a,b,c'/i, 'Verified change');
-expect_send("edit ticket/$ticket_id del CF.{MultipleCF$$}=a", 'Changing CF...');
-expect_like(qr/Ticket $ticket_id updated/, 'Changed multiple cf');
-expect_send("show ticket/$ticket_id -f CF.{MultipleCF$$}", 'Checking new value');
-expect_like(qr/CF\.{MultipleCF$$}: 'a,b,c'/i, 'Verified change');
-expect_send("edit ticket/$ticket_id del CF.{MultipleCF$$}=\"'a,b,c'\"", 'Changing CF...');
-expect_like(qr/Ticket $ticket_id updated/, 'Changed multiple cf');
-expect_send("show ticket/$ticket_id -f CF.{MultipleCF$$}", 'Checking new value');
-expect_like(qr/CF\.{MultipleCF$$}: \s*$/i, 'Verified change');
-
-expect_send("edit ticket/$ticket_id set CF.{MultipleCF$$}=\"q{1,2's,3}\"", 'Changing CF...');
-expect_like(qr/Ticket $ticket_id updated/, 'Changed multiple cf');
-expect_send("show ticket/$ticket_id -f CF.{MultipleCF$$}", 'Checking new value');
-expect_like(qr/CF\.{MultipleCF$$}: '1,2\\'s,3'/i, 'Verified change');
-
 # ...
 # change a ticket's ...[other properties]...
 # ...
@@ -540,6 +478,4 @@
     expect_is($attachment_content,"Attachment contains original text");
 }
 
-
-
 1;


More information about the Rt-commit mailing list