[Rt-commit] r9057 - in rt/branches/3.7-EXPERIMENTAL: html/Admin/Elements html/Admin/Queues html/Admin/Users html/Elements html/REST/1.0/Forms/queue html/REST/1.0/Forms/ticket html/Search/Elements html/Ticket html/Ticket/Elements lib/RT lib/RT/Interface

sunnavy at bestpractical.com sunnavy at bestpractical.com
Fri Sep 14 17:03:38 EDT 2007


Author: sunnavy
Date: Fri Sep 14 17:03:31 2007
New Revision: 9057

Modified:
   rt/branches/3.7-EXPERIMENTAL/html/Admin/Elements/EditCustomFieldValues
   rt/branches/3.7-EXPERIMENTAL/html/Admin/Elements/EditScrip
   rt/branches/3.7-EXPERIMENTAL/html/Admin/Elements/SelectStage
   rt/branches/3.7-EXPERIMENTAL/html/Admin/Queues/Modify.html
   rt/branches/3.7-EXPERIMENTAL/html/Admin/Users/Modify.html
   rt/branches/3.7-EXPERIMENTAL/html/Admin/Users/MyRT.html
   rt/branches/3.7-EXPERIMENTAL/html/Elements/PageLayout
   rt/branches/3.7-EXPERIMENTAL/html/Elements/SelectKey
   rt/branches/3.7-EXPERIMENTAL/html/Elements/SelectQueue
   rt/branches/3.7-EXPERIMENTAL/html/Elements/ValidateCustomFields
   rt/branches/3.7-EXPERIMENTAL/html/REST/1.0/Forms/queue/default
   rt/branches/3.7-EXPERIMENTAL/html/REST/1.0/Forms/ticket/attachments
   rt/branches/3.7-EXPERIMENTAL/html/REST/1.0/Forms/ticket/history
   rt/branches/3.7-EXPERIMENTAL/html/REST/1.0/Forms/ticket/links
   rt/branches/3.7-EXPERIMENTAL/html/REST/1.0/Forms/user/default
   rt/branches/3.7-EXPERIMENTAL/html/Search/Elements/Chart
   rt/branches/3.7-EXPERIMENTAL/html/Ticket/Display.html
   rt/branches/3.7-EXPERIMENTAL/html/Ticket/Elements/EditBasics
   rt/branches/3.7-EXPERIMENTAL/lib/RT/ACE_Overlay.pm
   rt/branches/3.7-EXPERIMENTAL/lib/RT/CustomField_Overlay.pm
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Group_Overlay.pm
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/REST.pm
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Web.pm
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Principal_Overlay.pm
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Queue_Overlay.pm
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Record.pm
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Test.pm
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Tickets_Overlay.pm
   rt/branches/3.7-EXPERIMENTAL/lib/RT/User_Overlay.pm

Log:
fixed many `uninitialized value' warnings, though not 100%.
use keys %hash == 0 instead of %hash == 0

Modified: rt/branches/3.7-EXPERIMENTAL/html/Admin/Elements/EditCustomFieldValues
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Admin/Elements/EditCustomFieldValues	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Admin/Elements/EditCustomFieldValues	Fri Sep 14 17:03:31 2007
@@ -71,7 +71,8 @@
 <td><input type="text" size="30" name="<% $paramtag %>-Name" value="<% $value->Name %>" /></td>
 <td><input type="text" size="50" name="<% $paramtag %>-Description" value="<% $value->Description %>" /></td>
 % if ( $CustomField->Type ne 'Combobox' ) {
-<td><input type="text" size="10" name="<% $paramtag %>-Category" value="<% $value->Category %>" /></td>
+<td><input type="text" size="10" name="<% $paramtag %>-Category" 
+    value="<% $value->Category || '' %>" /></td>
 % }
 </tr>
 % }

Modified: rt/branches/3.7-EXPERIMENTAL/html/Admin/Elements/EditScrip
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Admin/Elements/EditScrip	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Admin/Elements/EditScrip	Fri Sep 14 17:03:31 2007
@@ -55,7 +55,8 @@
 <table>
 
 <tr><td align="right"><&|/l&>Description</&>:</td><td>
-<input name="Scrip-<% $id %>-Description" value="<% $ARGS{"Scrip-$id-Description"} || $scrip->Description %>" />
+<input name="Scrip-<% $id %>-Description" 
+    value="<% $ARGS{"Scrip-$id-Description"} || $scrip->Description || '' %>" />
 </td></tr>
 
 <tr><td align="right"><&|/l&>Condition</&>:</td><td>
@@ -99,24 +100,24 @@
 </td></tr>
 
 <tr><td class="labeltop"><&|/l&>Custom condition</&>:</td><td>
-% my $code = $ARGS{"Scrip-$id-CustomIsApplicableCode"} || $scrip->CustomIsApplicableCode;
+% my $code = $ARGS{"Scrip-$id-CustomIsApplicableCode"} || $scrip->CustomIsApplicableCode || '';
 % my $lines = @{[ $code =~ /\n/gs ]} + 3;
 % $lines = $min_lines if $lines < $min_lines;
 <textarea cols="80" rows="<% $lines %>" name="Scrip-<% $id %>-CustomIsApplicableCode"><% $code %></textarea>
 </td></tr>
 
 <tr><td class="labeltop"><&|/l&>Custom action preparation code</&>:</td><td>
-% $code = $ARGS{"Scrip-$id-CustomPrepareCode"} || $scrip->CustomPrepareCode;
+% $code = $ARGS{"Scrip-$id-CustomPrepareCode"} || $scrip->CustomPrepareCode || '';
 % $lines = @{[ $code =~ /\n/gs ]} + 3;
 % $lines = $min_lines if $lines < $min_lines;
 <textarea cols="80" rows="<% $lines %>" name="Scrip-<% $id %>-CustomPrepareCode"><% $code %></textarea>
 </td></tr>
 
 <tr><td class="labeltop"><&|/l&>Custom action cleanup code</&>:</td><td>
-% $code = $ARGS{"Scrip-$id-CustomCommitCode"} || $scrip->CustomCommitCode;
+% $code = $ARGS{"Scrip-$id-CustomCommitCode"} || $scrip->CustomCommitCode || '';
 % $lines = @{[ $code =~ /\n/gs ]} + 3;
 % $lines = $min_lines if $lines < $min_lines;
-<textarea cols="80" rows="<% $lines %>" name="Scrip-<% $id %>-CustomCommitCode"><% $code %></textarea>
+<textarea cols="80" rows="<% $lines %>" name="Scrip-<% $id || '' %>-CustomCommitCode"><% $code %></textarea>
 </td></tr>
 
 </table>

Modified: rt/branches/3.7-EXPERIMENTAL/html/Admin/Elements/SelectStage
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Admin/Elements/SelectStage	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Admin/Elements/SelectStage	Fri Sep 14 17:03:31 2007
@@ -53,7 +53,7 @@
 </option>
 % }
 <%INIT>
-if ($Default eq '') {
+if ( !defined $Default || $Default eq '') {
     $Default = 'TransactionCreate';
 }
 my @stages = 'TransactionCreate';

Modified: rt/branches/3.7-EXPERIMENTAL/html/Admin/Queues/Modify.html
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Admin/Queues/Modify.html	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Admin/Queues/Modify.html	Fri Sep 14 17:03:31 2007
@@ -124,7 +124,7 @@
     $current_tab = 'Admin/Queues/Modify.html?Create=1';
     $title = loc("Create a queue");
 } else {
-    if ( $id eq 'new' ) {
+    if ( defined $id && $id eq 'new' ) {
         my ($val, $msg) = $QueueObj->Create( Name => $Name );
         Abort("$msg") unless $val;
         delete $session{'create_in_queues'};

Modified: rt/branches/3.7-EXPERIMENTAL/html/Admin/Users/Modify.html
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Admin/Users/Modify.html	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Admin/Users/Modify.html	Fri Sep 14 17:03:31 2007
@@ -259,8 +259,9 @@
 } 
 else {
 
-    $current_tab = 'Admin/Users/Modify.html?id='.$id;
-    if ($id eq 'new') {
+    $current_tab = 'Admin/Users/Modify.html?id='.$id if $id;
+
+    if ( defined $id && $id eq 'new') {
 	( $val, $msg ) = $UserObj->Create(
 	    Name                  => $Name,
 	    EmailAddress          => $ARGS{'EmailAddress'},
@@ -307,7 +308,8 @@
 		push @results, loc('User could not be created: [_1]', $msg);
 	}
     } else {
-	    $UserObj->Load($id) || $UserObj->Load($Name) || Abort("Couldn't load user '$Name'");
+	    $UserObj->Load($id) || $UserObj->Load($Name) 
+            || Abort("Couldn't load user '" . ( $Name || '') . "'");
         $val = $UserObj->Id();
     }
 

Modified: rt/branches/3.7-EXPERIMENTAL/html/Admin/Users/MyRT.html
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Admin/Users/MyRT.html	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Admin/Users/MyRT.html	Fri Sep 14 17:03:31 2007
@@ -71,9 +71,10 @@
 % }
 
 <%init>
-my $current_tab = 'Admin/Users/MyRT.html?id='.$id;
+my $current_tab;
+$current_tab = 'Admin/Users/MyRT.html?id='.$id if $id;
 my $UserObj = new RT::User($session{'CurrentUser'});
-$UserObj->Load($id) || Abort("Couldn't load user '$id'");
+$UserObj->Load($id) || Abort("Couldn't load user '" . ($id || '') . "'");
 my $title = loc("RT at a glance for the user [_1]", $UserObj->Name);
 
 if ($ARGS{Reset}) {

Modified: rt/branches/3.7-EXPERIMENTAL/html/Elements/PageLayout
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Elements/PageLayout	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Elements/PageLayout	Fri Sep 14 17:03:31 2007
@@ -208,7 +208,8 @@
   <%init>
     if ($current) {
       for my $key (keys %$data) {
-          next if $data->{$key}->{'path'} ne $current;
+          next if !defined $data->{$key}->{'path'} 
+                    || $data->{$key}->{'path'} ne $current;
           next unless    ref( $data->{$key} ) eq 'HASH'
                       && ref( $data->{$key}->{'subtabs'} ) eq 'HASH'
                       && keys %{ $data->{$key}->{'subtabs'} };

Modified: rt/branches/3.7-EXPERIMENTAL/html/Elements/SelectKey
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Elements/SelectKey	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Elements/SelectKey	Fri Sep 14 17:03:31 2007
@@ -62,7 +62,7 @@
 my %res = RT::Crypt::GnuPG::GetKeysForEncryption($EmailAddress);
 # move the preferred key to the top of the list
 my @keys = map {
-               $_->{'Fingerprint'} eq $Default
+               $_->{'Fingerprint'} eq ( $Default || '' )
                    ?  do { $d = $_; () }
                    : $_
            }

Modified: rt/branches/3.7-EXPERIMENTAL/html/Elements/SelectQueue
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Elements/SelectQueue	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Elements/SelectQueue	Fri Sep 14 17:03:31 2007
@@ -56,7 +56,8 @@
   <option value="">-</option>
 %     }
 %     for my $queue (@{$session{$cache_key}}) {
-  <option value="<% ($NamedValues ? $queue->{Name} : $queue->{Id}) %>" <% ($queue->{Id} eq $Default ? 'selected="selected"' : '') |n %>>
+  <option value="<% ($NamedValues ? $queue->{Name} : $queue->{Id}) %>" 
+      <% ( $queue->{Id} eq ($Default||'') ? 'selected="selected"' : '') |n %>>
     <%$queue->{Name}%>
 %             if ($Verbose and $queue->{Description}) {
     (<%$queue->{Description}%>)

Modified: rt/branches/3.7-EXPERIMENTAL/html/Elements/ValidateCustomFields
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Elements/ValidateCustomFields	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Elements/ValidateCustomFields	Fri Sep 14 17:03:31 2007
@@ -69,7 +69,7 @@
     } elsif ( $CF->Type =~ /text/i ) {
         @values = ($value);
     } else {
-        @values = split /\r*\n/, $value;
+        @values = split /\r*\n/, ($value||'');
     }
     @values = grep $_ ne '',
         map {

Modified: rt/branches/3.7-EXPERIMENTAL/html/REST/1.0/Forms/queue/default
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/REST/1.0/Forms/queue/default	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/REST/1.0/Forms/queue/default	Fri Sep 14 17:03:31 2007
@@ -116,7 +116,7 @@
     }
 }
 
-if (%data == 0) {
+if ( keys %data == 0) {
     my @data;
 
     push @data, [ id => "queue/".$queue->Id ];

Modified: rt/branches/3.7-EXPERIMENTAL/html/REST/1.0/Forms/ticket/attachments
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/REST/1.0/Forms/ticket/attachments	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/REST/1.0/Forms/ticket/attachments	Fri Sep 14 17:03:31 2007
@@ -61,10 +61,10 @@
     return [ "# Ticket $id does not exist.", [], {}, 1 ];
 }
 
-my @arglist = split('/', $args);
+my @arglist = split('/', $args || '');
 my ($aid, $content);
 
-if ($arglist[1] eq 'content') {
+if ( defined $arglist[1] && $arglist[1] eq 'content') {
     $aid = $arglist[0];
     $content = 1;
 } else {
@@ -115,7 +115,7 @@
     while (my $t = $transactions->Next) {
         my $attachments = $t->Attachments;
         while (my $a = $attachments->Next) {
-            my $size = length($a->Content);
+            my $size = length($a->Content || '');
             if ($size > 1024) { $size  = int($size/102.4)/10 . "k" }
             else              { $size .= "b" }
             push @attachments, $a->Id.": ".($a->Filename || '(Unnamed)')." (".$a->ContentType . " / ".$size.")";

Modified: rt/branches/3.7-EXPERIMENTAL/html/REST/1.0/Forms/ticket/history
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/REST/1.0/Forms/ticket/history	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/REST/1.0/Forms/ticket/history	Fri Sep 14 17:03:31 2007
@@ -65,13 +65,18 @@
 my $trans = $ticket->Transactions();
 my $total = $trans->Count();
 
-chomp $args;
-my @arglist = split('/', $args);
-my ($type, $tid);
+if ( $args ) {
+    chomp $args;
+}
+else {
+    $args = '';
+}
 
-if ($arglist[0] eq 'type') {
+my @arglist = split('/', $args );
+my ($type, $tid);
+if (defined $arglist[0] && $arglist[0] eq 'type') {
     $type = $arglist[1];
-} elsif ($arglist[0] eq 'id') {
+} elsif ( defined $arglist[0] && $arglist[0] eq 'id') {
     $tid = $arglist[1];
 } else {
     $type = $args;

Modified: rt/branches/3.7-EXPERIMENTAL/html/REST/1.0/Forms/ticket/links
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/REST/1.0/Forms/ticket/links	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/REST/1.0/Forms/ticket/links	Fri Sep 14 17:03:31 2007
@@ -159,7 +159,7 @@
         while (my $link = $ticket->$key->Next) {
             push @val, $link->$field;
         }
-        push(@val, "") if (@val == 0 && $format eq 'l');
+        push(@val, "") if (@val == 0 && defined $format && $format eq 'l');
         push @data, [ $key => [ @val ] ] if @val;
     }
 

Modified: rt/branches/3.7-EXPERIMENTAL/html/REST/1.0/Forms/user/default
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/REST/1.0/Forms/user/default	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/REST/1.0/Forms/user/default	Fri Sep 14 17:03:31 2007
@@ -71,7 +71,7 @@
     }
 }
 else {
-    if (%data == 0) {
+    if (keys %data == 0) {
         return [
             "# Required: Name, EmailAddress",
             [ qw(id Name EmailAddress Organization Password Comments) ],
@@ -109,11 +109,11 @@
         $id = $user->Id;
         delete $data{id};
         push(@comments, "# User $id created.");
-        goto DONE if %data == 0;
+        goto DONE if keys %data == 0;
     }
 }
 
-if (%data == 0) {
+if (keys %data == 0) {
     my @data;
 
     push @data, [ id => "user/".$user->Id ];

Modified: rt/branches/3.7-EXPERIMENTAL/html/Search/Elements/Chart
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Search/Elements/Chart	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Search/Elements/Chart	Fri Sep 14 17:03:31 2007
@@ -132,7 +132,7 @@
 <%loc('Total')%>
 </td>
 <td class="value collection-as-table">
-<%$total%>
+<%$total||''%>
 </td>
 </tr>
 

Modified: rt/branches/3.7-EXPERIMENTAL/html/Ticket/Display.html
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Ticket/Display.html	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Ticket/Display.html	Fri Sep 14 17:03:31 2007
@@ -137,11 +137,11 @@
             Actions => \@Actions);
     
     $ARGS{'UpdateContent'} =~ s/\r\n/\n/g if defined $ARGS{'UpdateContent'};
+    my $signature = $session{'CurrentUser'}->UserObj->Signature || '';
     if ( $ARGS{'UpdateTimeWorked'} || (
         defined $ARGS{'UpdateContent'}
         && $ARGS{'UpdateContent'} ne ''
-        && $ARGS{'UpdateContent'} ne "-- \n"
-           . $session{'CurrentUser'}->UserObj->Signature ) )
+        && $ARGS{'UpdateContent'} ne "-- \n" . $signature ))
     {
         $ARGS{UpdateAttachments} = $session{'Attachments'};
         push @Actions, ProcessUpdateMessage(

Modified: rt/branches/3.7-EXPERIMENTAL/html/Ticket/Elements/EditBasics
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Ticket/Elements/EditBasics	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Ticket/Elements/EditBasics	Fri Sep 14 17:03:31 2007
@@ -73,33 +73,36 @@
   <tr>
       <td class="label"><&|/l&>Time Estimated</&>:</td>
       <td class="value">
-        <input name="TimeEstimated" value="<% $TicketObj->TimeEstimated |h%>" size="5" />
+        <input name="TimeEstimated" 
+            value="<% $TicketObj->TimeEstimated || '' |h%>" size="5" />
         <& /Elements/SelectTimeUnits, Name =>'TimeEstimated' &>
       </td>
     </tr>
   <tr>
     <td class="label"><&|/l&>Time Worked</&>:</td>
     <td class="value">
-      <input name="TimeWorked" value="<% $TicketObj->TimeWorked |h%>" size="5" />
+      <input name="TimeWorked" value="<% $TicketObj->TimeWorked || '' |h%>" size="5" />
       <& /Elements/SelectTimeUnits, Name =>'TimeWorked' &>
     </td>
   </tr>
   <tr>
     <td class="label"><&|/l&>Time Left</&>:</td>
     <td class="value">
-        <input name="TimeLeft" value="<%$TicketObj->TimeLeft|h%>" size="5" />
+        <input name="TimeLeft" value="<%$TicketObj->TimeLeft || ''|h%>" size="5" />
         <& /Elements/SelectTimeUnits, Name =>'TimeLeft' &>
       </td>
     </tr>
 
   <tr>
       <td class="label"><&|/l&>Priority</&>:</td>
-      <td class="value"><input name="Priority" value="<%$TicketObj->Priority|h%>" size="5" /></td>
+      <td class="value"><input name="Priority" 
+        value="<%$TicketObj->Priority || ''|h%>" size="5" /></td>
     </tr>
 
   <tr>
       <td class="label"><&|/l&>Final Priority</&>:</td>
-      <td class="value"><input name="FinalPriority" value="<%$TicketObj->FinalPriority|h%>" size="5" /></td>
+      <td class="value"><input name="FinalPriority" 
+            value="<%$TicketObj->FinalPriority || '' |h%>" size="5" /></td>
     </tr>
 
 

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/ACE_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/ACE_Overlay.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/ACE_Overlay.pm	Fri Sep 14 17:03:31 2007
@@ -660,7 +660,7 @@
 sub _CanonicalizePrincipal {
     my $self       = shift;
     my $princ_id   = shift;
-    my $princ_type = shift;
+    my $princ_type = shift || '';
 
     my $princ_obj = RT::Principal->new($RT::SystemUser);
     $princ_obj->Load($princ_id);

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/CustomField_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/CustomField_Overlay.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/CustomField_Overlay.pm	Fri Sep 14 17:03:31 2007
@@ -237,7 +237,7 @@
 
 sub Load {
     my $self = shift;
-    my $id = shift;
+    my $id = shift || '';
 
     if ( $id =~ /^\d+$/ ) {
         return $self->SUPER::Load( $id );
@@ -500,6 +500,7 @@
 
     my $type = @_ ? shift : $self->Type;
     my $max  = @_ ? shift : $self->MaxValues;
+    $max = 0 unless $max;
 
     if (my $friendly_type = $FieldTypes{$type}[$max>2 ? 2 : $max]) {
         return ( $self->loc( $friendly_type, $max ) );
@@ -740,7 +741,7 @@
 
 sub TypeComposite {
     my $self = shift;
-    join('-', $self->Type, $self->MaxValues);
+    join('-', $self->Type || '', $self->MaxValues || '');
 }
 
 =head2 TypeComposites
@@ -953,10 +954,9 @@
 
 sub MatchPattern {
     my $self = shift;
-    my $regex = $self->Pattern;
+    my $regex = $self->Pattern or return 1;
 
-    return 1 unless length $regex;
-    return ($_[0] =~ $regex);
+    return (($_[0] || '') =~ $regex);
 }
 
 

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Group_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Group_Overlay.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Group_Overlay.pm	Fri Sep 14 17:03:31 2007
@@ -997,7 +997,7 @@
 
 sub HasMember {
     my $self    = shift;
-    my $principal = shift;
+    my $principal = shift || '';
 
 
     unless (UNIVERSAL::isa($principal,'RT::Principal')) {
@@ -1307,9 +1307,11 @@
 
 sub PrincipalObj {
     my $self = shift;
-    unless ($self->{'PrincipalObj'} &&
+    unless ( defined $self->{'PrincipalObj'} &&
+             defined $self->{'PrincipalObj'}->ObjectId &&
             ($self->{'PrincipalObj'}->ObjectId == $self->Id) &&
-            ($self->{'PrincipalObj'}->PrincipalType eq 'Group')) {
+            (defined $self->{'PrincipalObj'}->PrincipalType && 
+                $self->{'PrincipalObj'}->PrincipalType eq 'Group')) {
 
             $self->{'PrincipalObj'} = RT::Principal->new($self->CurrentUser);
             $self->{'PrincipalObj'}->LoadByCols('ObjectId' => $self->Id,

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/REST.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/REST.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/REST.pm	Fri Sep 14 17:03:31 2007
@@ -198,7 +198,8 @@
                 $sp = " "x4 if length($sp) > 16;
 
                 foreach $v (@values) {
-                    if ($v =~ /\n/) {
+                    $v = '' unless $v;
+                    if ( $v =~ /\n/) {
                         $v =~ s/^/$sp/gm;
                         $v =~ s/^$sp//;
 
@@ -268,7 +269,7 @@
 
     foreach $line (map {split /\n/} (ref $val eq 'ARRAY') ? @$val : $val)
     {
-        # XXX: This should become a real parser, à la Text::ParseWords.
+        # XXX: This should become a real parser, ? la Text::ParseWords.
         $line =~ s/^\s+//;
         $line =~ s/\s+$//;
         push @words, split /\s*,\s*/, $line;

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Web.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Web.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Web.pm	Fri Sep 14 17:03:31 2007
@@ -59,8 +59,6 @@
 =cut
 
 
-use URI;
-
 use strict;
 use warnings;
 

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Principal_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Principal_Overlay.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Principal_Overlay.pm	Fri Sep 14 17:03:31 2007
@@ -74,7 +74,8 @@
 
 sub IsGroup {
     my $self = shift;
-    if ( $self->PrincipalType eq 'Group' ) {
+    if ( defined $self->PrincipalType && 
+            $self->PrincipalType eq 'Group' ) {
         return 1;
     }
     return undef;

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Queue_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Queue_Overlay.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Queue_Overlay.pm	Fri Sep 14 17:03:31 2007
@@ -662,10 +662,11 @@
 
     # {{{ Check ACLS
     #If the watcher we're trying to add is for the current user
-    if ( $self->CurrentUser->PrincipalId  eq $args{'PrincipalId'}) {
+    if ( defined $args{'PrincipalID'} && 
+            $self->CurrentUser->PrincipalId  eq $args{'PrincipalId'}) {
         #  If it's an AdminCc and they don't have 
         #   'WatchAsAdminCc' or 'ModifyTicket', bail
-        if ( $args{'Type'} eq 'AdminCc' ) {
+        if ( defined $args{'Type'} && ($args{'Type'} eq 'AdminCc') ) {
             unless ( $self->CurrentUserHasRight('ModifyQueueWatchers')
                 or $self->CurrentUserHasRight('WatchAsAdminCc') ) {
                 return ( 0, $self->loc('Permission Denied'))

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Record.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Record.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Record.pm	Fri Sep 14 17:03:31 2007
@@ -891,7 +891,7 @@
             my $object = $attribute . "Obj";
             next if ($self->$object->Name eq $value);
         };
-        next if ( $value eq $self->$attribute() );
+        next if ( $value eq ( $self->$attribute() || '' ) );
         my $method = "Set$attribute";
         my ( $code, $msg ) = $self->$method($value);
         my ($prefix) = ref($self) =~ /RT(?:.*)::(\w+)/;

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Test.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Test.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Test.pm	Fri Sep 14 17:03:31 2007
@@ -39,7 +39,6 @@
 
 $port = generate_port() unless $port;
 
-
 sub import {
     my $class = shift;
     my %args = @_;
@@ -135,7 +134,7 @@
     require RT::Test::Web;
     if ( $existing_server ) {
         ok(1, "using existing server $existing_server");
-        warn $existing_server;
+        RT::Logger->warning( $existing_server);
         return ($existing_server, RT::Test::Web->new);
     }
     my $s = RT::Interface::Web::Standalone->new($port);
@@ -346,7 +345,7 @@
         my @rights = ref $e->{'Right'}? @{ $e->{'Right'} }: ($e->{'Right'});
         foreach my $right ( @rights ) {
             my ($status, $msg) = $principal->GrantRight( %$e, Right => $right );
-            warn "$msg";
+            $RT::Logger->warning($msg);
         }
     }
     return 1;

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm	Fri Sep 14 17:03:31 2007
@@ -152,9 +152,9 @@
     # thing. be careful to cache all the interim tickets we try so we don't loop forever.
 
     # FIXME: there is no TicketBaseURI option in config
-    my $base_uri = RT->Config->Get('TicketBaseURI');
+    my $base_uri = RT->Config->Get('TicketBaseURI') || '';
     #If it's a local URI, turn it into a ticket id
-    if ( $base_uri && $id =~ /^$base_uri(\d+)$/ ) {
+    if ( $base_uri && defined $id && $id =~ /^$base_uri(\d+)$/ ) {
         $id = $1;
     }
 
@@ -164,7 +164,7 @@
     }
 
     #If we have an integer URI, load the ticket
-    if ( $id =~ /^\d+$/ ) {
+    if ( defined $id && $id =~ /^\d+$/ ) {
         my ($ticketid,$msg) = $self->LoadById($id);
 
         unless ($self->Id) {
@@ -1386,7 +1386,6 @@
     unless ( $self->CurrentUserHasRight('ShowTicket') ) {
         return undef;
     }
-
     return ( $self->Cc->MemberEmailAddressesAsString);
 
 }

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Tickets_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Tickets_Overlay.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Tickets_Overlay.pm	Fri Sep 14 17:03:31 2007
@@ -1386,7 +1386,7 @@
         }
         my ( $field, $subkey ) = split /\./, $row->{FIELD}, 2;
         my $meta = $self->FIELDS->{$field};
-        if ( $meta->[0] eq 'WATCHERFIELD' ) {
+        if ( defined $meta->[0] && $meta->[0] eq 'WATCHERFIELD' ) {
             # cache alias as we want to use one alias per watcher type for sorting
             my $users = $self->{_sql_u_watchers_alias_for_sort}{ $meta->[1] };
             unless ( $users ) {

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/User_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/User_Overlay.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/User_Overlay.pm	Fri Sep 14 17:03:31 2007
@@ -1103,6 +1103,12 @@
 
 sub PrincipalObj {
     my $self = shift;
+
+#    unless ( $self->id ) {
+#        $RT::Logger->error('User not found');
+#        return;
+#    }
+
     unless ( $self->{'PrincipalObj'} ) {
         my $obj = RT::Principal->new( $self->CurrentUser );
         $obj->LoadById( $self->id );


More information about the Rt-commit mailing list