[freeside-commits] freeside/rt/lib/RT Action.pm, 1.2, 1.3 Condition.pm, 1.2, 1.3 Config.pm, 1.7, 1.8 CustomField.pm, 1.2, 1.3 CustomField_Overlay.pm, 1.2, 1.3 Date.pm, 1.3, 1.4 Groups_Overlay.pm, 1.5, 1.6 Principal_Overlay.pm, 1.2, 1.3 Queue_Overlay.pm, 1.2, 1.3 Record.pm, 1.8, 1.9 Scrip_Overlay.pm, 1.2, 1.3 SearchBuilder.pm, 1.8, 1.9 System.pm, 1.2, 1.3 Test.pm, 1.2, 1.3 Ticket_Overlay.pm, 1.16, 1.17 Tickets_Overlay.pm, 1.10, 1.11 Transaction_Overlay.pm, 1.4, 1.5 User_Overlay.pm, 1.6, 1.7 Users_Overlay.pm, 1.5, 1.6

Ivan,,, ivan at wavetail.420.am
Wed Feb 16 16:52:27 PST 2011


Update of /home/cvs/cvsroot/freeside/rt/lib/RT
In directory wavetail.420.am:/tmp/cvs-serv29643/lib/RT

Modified Files:
	Action.pm Condition.pm Config.pm CustomField.pm 
	CustomField_Overlay.pm Date.pm Groups_Overlay.pm 
	Principal_Overlay.pm Queue_Overlay.pm Record.pm 
	Scrip_Overlay.pm SearchBuilder.pm System.pm Test.pm 
	Ticket_Overlay.pm Tickets_Overlay.pm Transaction_Overlay.pm 
	User_Overlay.pm Users_Overlay.pm 
Log Message:
commiting rt 3.8.9 to HEAD

Index: SearchBuilder.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/SearchBuilder.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -w -d -r1.8 -r1.9
--- SearchBuilder.pm	18 May 2010 19:20:28 -0000	1.8
+++ SearchBuilder.pm	17 Feb 2011 00:52:25 -0000	1.9
@@ -2,8 +2,8 @@
 # 
 # COPYRIGHT:
 # 
-# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
-#                                          <jesse at bestpractical.com>
+# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+#                                          <sales at bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
 # 

Index: User_Overlay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/User_Overlay.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -d -r1.6 -r1.7
--- User_Overlay.pm	18 May 2010 19:20:28 -0000	1.6
+++ User_Overlay.pm	17 Feb 2011 00:52:25 -0000	1.7
@@ -2,8 +2,8 @@
 # 
 # COPYRIGHT:
 # 
-# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
-#                                          <jesse at bestpractical.com>
+# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+#                                          <sales at bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
 # 
@@ -69,6 +69,7 @@
 use strict;
 no warnings qw(redefine);
 
+use Digest::SHA;
 use Digest::MD5;
 use RT::Principals;
 use RT::ACE;
@@ -988,20 +989,28 @@
 
 }
 
-=head3 _GeneratePassword PASSWORD
+=head3 _GeneratePassword PASSWORD [, SALT]
 
-returns an MD5 hash of the password passed in, in hexadecimal encoding.
+Returns a salted SHA-256 hash of the password passed in, in base64
+encoding.
 
 =cut
 
 sub _GeneratePassword {
     my $self = shift;
-    my $password = shift;
+    my ($password, $salt) = @_;
 
-    my $md5 = Digest::MD5->new();
-    $md5->add(encode_utf8($password));
-    return ($md5->hexdigest);
+    # Generate a random 4-byte salt
+    $salt ||= pack("C4",map{int rand(256)} 1..4);
 
+    # Encode the salt, and a truncated SHA256 of the MD5 of the
+    # password.  The additional, un-necessary level of MD5 allows for
+    # transparent upgrading to this scheme, from the previous unsalted
+    # MD5 one.
+    return MIME::Base64::encode_base64(
+        $salt . substr(Digest::SHA::sha256($salt . Digest::MD5::md5($password)),0,26),
+        "" # No newline
+    );
 }
 
 =head3 _GeneratePasswordBase64 PASSWORD
@@ -1064,23 +1073,32 @@
         return(undef);
      }
 
-    # generate an md5 password 
-    if ($self->_GeneratePassword($value) eq $self->__Value('Password')) {
-        return(1);
-    }
-
-    #  if it's a historical password we say ok.
-    if ($self->__Value('Password') eq crypt(encode_utf8($value), $self->__Value('Password'))
-        or $self->_GeneratePasswordBase64($value) eq $self->__Value('Password'))
-    {
-        # ...but upgrade the legacy password inplace.
-        $self->SUPER::SetPassword( $self->_GeneratePassword($value) );
-        return(1);
+    my $stored = $self->__Value('Password');
+    if (length $stored == 40) {
+        # The truncated SHA256(salt,MD5(passwd)) form from 2010/12 is 40 characters long
+        my $hash = MIME::Base64::decode_base64($stored);
+        # The first 4 bytes are the salt, the rest is substr(SHA256,0,26)
+        my $salt = substr($hash, 0, 4, "");
+        return substr(Digest::SHA::sha256($salt . Digest::MD5::md5($value)), 0, 26) eq $hash;
+    } elsif (length $stored == 32) {
+        # Hex nonsalted-md5
+        return 0 unless Digest::MD5::md5_hex(encode_utf8($value)) eq $stored;
+    } elsif (length $stored == 22) {
+        # Base64 nonsalted-md5
+        return 0 unless Digest::MD5::md5_base64(encode_utf8($value)) eq $stored;
+    } elsif (length $stored == 13) {
+        # crypt() output
+        return 0 unless crypt(encode_utf8($value), $stored) eq $stored;
+    } else {
+        $RT::Logger->warn("Unknown password form");
+        return 0;
     }
 
-    # no password check has succeeded. get out
-
-    return (undef);
+    # We got here by validating successfully, but with a legacy
+    # password form.  Update to the most recent form.
+    my $obj = $self->isa("RT::CurrentUser") ? $self->UserObj : $self;
+    $obj->_Set(Field => 'Password', Value =>  $self->_GeneratePassword($value) );
+    return 1;
 }
 
 sub CurrentUserRequireToSetPassword {
@@ -1614,7 +1632,7 @@
 
 sub CurrentUserCanModify {
     my $self  = shift;
-    my $right = shift;
+    my $field = shift;
 
     if ( $self->CurrentUser->HasRight(Right => 'AdminUsers', Object => $RT::System) ) {
         return (1);
@@ -1622,7 +1640,7 @@
 
     #If the field is marked as an "administrators only" field, 
     # don\'t let the user touch it.
-    elsif ( $self->_Accessible( $right, 'admin' ) ) {
+    elsif ( $self->_Accessible( $field, 'admin' ) ) {
         return (undef);
     }
 
@@ -1968,6 +1986,14 @@
 {
     my $self = shift;
     return undef unless RT->Config->Get('GnuPG')->{'Enable'};
+
+    if ( ($self->CurrentUser->Id != $self->Id )  &&
+          !$self->CurrentUser->HasRight(Right =>'AdminUsers', Object => $RT::System) ) {
+          return undef;
+    }
+
+
+
     my $prefkey = $self->FirstAttribute('PreferredKey');
     return $prefkey->Content if $prefkey;
 
@@ -1994,6 +2020,16 @@
 sub PrivateKey {
     my $self = shift;
 
+
+    #If the user wants to see their own values, let them.
+    #If the user is an admin, let them.
+    #Otherwwise, don't let them.
+    #
+    if ( ($self->CurrentUser->Id != $self->Id )  &&
+          !$self->CurrentUser->HasRight(Right =>'AdminUsers', Object => $RT::System) ) {
+          return undef;
+    }
+
     my $key = $self->FirstAttribute('PrivateKey') or return undef;
     return $key->Content;
 }
@@ -2001,7 +2037,11 @@
 sub SetPrivateKey {
     my $self = shift;
     my $key = shift;
-    # XXX: ACL
+
+    unless ($self->CurrentUserCanModify('PrivateKey')) {
+        return (0, $self->loc("Permission Denied"));
+    }
+
     unless ( $key ) {
         my ($status, $msg) = $self->DeleteAttribute('PrivateKey');
         unless ( $status ) {
@@ -2024,7 +2064,7 @@
     );
     return ($status, $self->loc("Couldn't set private key"))    
         unless $status;
-    return ($status, $self->loc("Unset private key"));
+    return ($status, $self->loc("Set private key"));
 }
 
 sub BasicColumns {

Index: Principal_Overlay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Principal_Overlay.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -d -r1.2 -r1.3
--- Principal_Overlay.pm	1 Jan 2011 00:47:01 -0000	1.2
+++ Principal_Overlay.pm	17 Feb 2011 00:52:25 -0000	1.3
@@ -2,8 +2,8 @@
 # 
 # COPYRIGHT:
 # 
-# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
-#                                          <jesse at bestpractical.com>
+# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+#                                          <sales at bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
 # 

Index: CustomField_Overlay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/CustomField_Overlay.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -d -r1.2 -r1.3
--- CustomField_Overlay.pm	20 Jul 2010 00:59:01 -0000	1.2
+++ CustomField_Overlay.pm	17 Feb 2011 00:52:25 -0000	1.3
@@ -2,8 +2,8 @@
 # 
 # COPYRIGHT:
 # 
-# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
-#                                          <jesse at bestpractical.com>
+# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+#                                          <sales at bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
 # 
@@ -117,6 +117,7 @@
 our $RIGHTS = {
     SeeCustomField            => 'See custom fields',       # loc_pair
     AdminCustomField          => 'Create, delete and modify custom fields',        # loc_pair
+    AdminCustomFieldValues    => 'Create, delete and modify custom fields values',        # loc_pair
     ModifyCustomField         => 'Add, delete and modify custom field values for objects' #loc_pair
 };
 
@@ -405,7 +406,7 @@
     my $self = shift;
     my %args = @_;
 
-    unless ($self->CurrentUserHasRight('AdminCustomField')) {
+    unless ($self->CurrentUserHasRight('AdminCustomField') || $self->CurrentUserHasRight('AdminCustomFieldValues')) {
         return (0, $self->loc('Permission Denied'));
     }
 
@@ -434,7 +435,7 @@
 sub DeleteValue {
     my $self = shift;
     my $id = shift;
-    unless ( $self->CurrentUserHasRight('AdminCustomField') ) {
+    unless ( $self->CurrentUserHasRight('AdminCustomField') || $self->CurrentUserHasRight('AdminCustomFieldValues') ) {
         return (0, $self->loc('Permission Denied'));
     }
 

Index: Action.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Action.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -d -r1.2 -r1.3
--- Action.pm	17 Nov 2010 20:44:11 -0000	1.2
+++ Action.pm	17 Feb 2011 00:52:25 -0000	1.3
@@ -2,8 +2,8 @@
 # 
 # COPYRIGHT:
 # 
-# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
-#                                          <jesse at bestpractical.com>
+# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+#                                          <sales at bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
 # 

Index: Groups_Overlay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Groups_Overlay.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -d -r1.5 -r1.6
--- Groups_Overlay.pm	18 May 2010 19:20:28 -0000	1.5
+++ Groups_Overlay.pm	17 Feb 2011 00:52:25 -0000	1.6
@@ -2,8 +2,8 @@
 # 
 # COPYRIGHT:
 # 
-# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
-#                                          <jesse at bestpractical.com>
+# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+#                                          <sales at bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
 # 

Index: Date.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Date.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -d -r1.3 -r1.4
--- Date.pm	28 Jan 2011 21:30:06 -0000	1.3
+++ Date.pm	17 Feb 2011 00:52:25 -0000	1.4
@@ -2,8 +2,8 @@
 # 
 # COPYRIGHT:
 # 
-# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
-#                                          <jesse at bestpractical.com>
+# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+#                                          <sales at bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
 # 
@@ -910,7 +910,7 @@
                  Seconds => 1, DayOfWeek => 1,
                );
 
-    my $res = $self->RFC2822( @_ );
+    my $res = $self->RFC2822( %args );
     $res =~ s/\s*[+-]\d\d\d\d$/ GMT/ if $args{'Time'};
     return $res;
 }

Index: Record.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Record.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -w -d -r1.8 -r1.9
--- Record.pm	20 Jul 2010 00:59:01 -0000	1.8
+++ Record.pm	17 Feb 2011 00:52:25 -0000	1.9
@@ -2,8 +2,8 @@
 # 
 # COPYRIGHT:
 # 
-# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
-#                                          <jesse at bestpractical.com>
+# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+#                                          <sales at bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
 # 
@@ -724,7 +724,7 @@
 sub _EncodeLOB {
         my $self = shift;
         my $Body = shift;
-        my $MIMEType = shift;
+        my $MIMEType = shift || '';
 
         my $ContentEncoding = 'none';
 

Index: Ticket_Overlay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Ticket_Overlay.pm,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -w -d -r1.16 -r1.17
--- Ticket_Overlay.pm	10 Sep 2010 06:17:04 -0000	1.16
+++ Ticket_Overlay.pm	17 Feb 2011 00:52:25 -0000	1.17
@@ -2,8 +2,8 @@
 # 
 # COPYRIGHT:
 # 
-# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
-#                                          <jesse at bestpractical.com>
+# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+#                                          <sales at bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
 # 
@@ -229,7 +229,7 @@
 the ticket id to be linked to as a value (or a URI when linking to other objects).
 Multiple links of the same type can be created by passing an array ref. For example:
 
-  Parent => 45,
+  Parents => 45,
   DependsOn => [ 15, 22 ],
   RefersTo => 'http://www.bestpractical.com',
 

Index: Transaction_Overlay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Transaction_Overlay.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -d -r1.4 -r1.5
--- Transaction_Overlay.pm	31 Dec 2009 14:00:28 -0000	1.4
+++ Transaction_Overlay.pm	17 Feb 2011 00:52:25 -0000	1.5
@@ -2,8 +2,8 @@
 # 
 # COPYRIGHT:
 # 
-# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
-#                                          <jesse at bestpractical.com>
+# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+#                                          <sales at bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
 # 
@@ -176,7 +176,7 @@
        # Entry point of the rule system
        my $ticket = RT::Ticket->new($RT::SystemUser);
        $ticket->Load($args{'ObjectId'});
-       my $rules = RT::Ruleset->FindAllRules(
+       my $rules = $self->{rules} = RT::Ruleset->FindAllRules(
             Stage       => 'TransactionCreate',
             Type        => $args{'Type'},
             TicketObj   => $ticket,
@@ -211,6 +211,22 @@
 }
 
 
+=head2 Rules
+
+Returns the array of Rule objects for this transaction.
+This routine is only useful on a freshly created transaction object.
+Rules do not get persisted to the database with transactions.
+
+
+=cut
+
+
+sub Rules {
+    my $self = shift;
+    return($self->{'rules'});
+}
+
+
 # {{{ sub Delete
 
 =head2 Delete
@@ -292,14 +308,14 @@
 part of the message, if available.  Otherwise it looks for a text/plain
 part. If $args{'Type'} is missing, it defaults to the value of 
 C<$RT::Transaction::PreferredContentType>, if that's missing too, 
-defaults to 'text/plain'.
+defaults to textual.
 
 =cut
 
 sub Content {
     my $self = shift;
     my %args = (
-        Type  => $PreferredContentType || 'text/plain',
+        Type => $PreferredContentType || '',
         Quote => 0,
         Wrap  => 70,
         Wrap  => ( $RT::MessageBoxWidth || 72 ) - 2,
@@ -307,7 +323,9 @@
     );
 
     my $content;
-    if ( my $content_obj = $self->ContentObj( Type => $args{Type} ) ) {
+    if ( my $content_obj =
+        $self->ContentObj( $args{Type} ? ( Type => $args{Type} ) : () ) )
+    {
         $content = $content_obj->Content ||'';
 
         if ( lc $content_obj->ContentType eq 'text/html' ) {
@@ -398,12 +416,16 @@
 
 sub ContentObj {
     my $self = shift;
-    my %args = ( Type => $PreferredContentType || 'text/plain',
-                 @_ );
+    my %args = ( Type => $PreferredContentType, Attachment => undef, @_ );
 
     # If we don't have any content, return undef now.
     # Get the set of toplevel attachments to this transaction.
-    return undef unless my $Attachment = $self->Attachments->First;
+
+    my $Attachment = $args{'Attachment'};
+
+    $Attachment ||= $self->Attachments->First;
+
+    return undef unless ($Attachment);
 
     # If it's a textual part, just return the body.
     if ( RT::I18N::IsTextualContentType($Attachment->ContentType) ) {
@@ -413,7 +435,15 @@
     # If it's a multipart object, first try returning the first part with preferred
     # MIME type ('text/plain' by default).
 
-    elsif ( $Attachment->ContentType =~ '^multipart/' ) {
+    elsif ( $Attachment->ContentType =~ qr|^multipart/mixed|i ) {
+        my $kids = $Attachment->Children;
+        while (my $child = $kids->Next) {
+            my $ret =  $self->ContentObj(%args, Attachment => $child);
+            return $ret if ($ret);
+        }
+    }
+    elsif ( $Attachment->ContentType =~ qr|^multipart/|i ) {
+        if ( $args{Type} ) {
         my $plain_parts = $Attachment->Children;
         $plain_parts->ContentType( VALUE => $args{Type} );
         $plain_parts->LimitNotEmpty;
@@ -422,6 +452,7 @@
         if ( my $first = $plain_parts->First ) {
             return $first;
         }
+        }
 
         # If that fails, return the first textual part which has some content.
         my $all_parts = $self->Attachments;
@@ -527,6 +558,8 @@
     my $self = shift;
 
     my $main_content = $self->ContentObj;
+    return unless $main_content;
+
     my $entity = $main_content->ContentAsMIME;
 
     if ( $main_content->Parent ) {
@@ -558,11 +591,7 @@
         OPERATOR => 'NOT STARTSWITH',
         VALUE => 'multipart/',
     );
-    $attachments->Limit(
-        FIELD => 'Content',
-        OPERATOR => '!=',
-        VALUE => '',
-    );
+    $attachments->LimitNotEmpty;
     while ( my $a = $attachments->Next ) {
         $entity->make_multipart unless $entity->is_multipart;
         $entity->add_part( $a->ContentAsMIME );
@@ -656,6 +685,9 @@
             )
         );
     }
+    elsif ( $type =~ /SystemError/ ) {
+        return $self->loc("System error");
+    }
 
     if ( my $code = $_BriefDescriptions{$type} ) {
         return $code->($self);

Index: Test.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Test.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -d -r1.2 -r1.3
--- Test.pm	1 Jan 2011 00:47:01 -0000	1.2
+++ Test.pm	17 Feb 2011 00:52:25 -0000	1.3
@@ -2,8 +2,8 @@
 # 
 # COPYRIGHT:
 # 
-# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
-#                                          <jesse at bestpractical.com>
+# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+#                                          <sales at bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
 # 
@@ -221,12 +221,10 @@
         or die "Couldn't open $tmp{'config'}{'RT'}: $!";
 
     print $config qq{
+Set( \$WebDomain, "localhost");
 Set( \$WebPort , $port);
-Set( \$WebBaseURL , "http://localhost:\$WebPort");
-Set( \$LogToSyslog , undef);
-Set( \$LogToScreen , "warning");
+Set( \$WebPath,   "");
 Set( \$RTAddressRegexp , qr/^bad_re_that_doesnt_match\$/);
-Set( \$MailCommand, 'testfile');
 };
     if ( $ENV{'RT_TEST_DB_SID'} ) { # oracle case
         print $config "Set( \$DatabaseName , '$ENV{'RT_TEST_DB_SID'}' );\n";
@@ -238,6 +236,8 @@
     print $config "Set( \$DevelMode, 0 );\n"
         if $INC{'Devel/Cover.pm'};
 
+    $self->bootstrap_logging( $config );
+
     # set mail catcher
     my $mail_catcher = $tmp{'mailbox'} = File::Spec->catfile(
         $tmp{'directory'}->dirname, 'mailbox.eml'
@@ -264,6 +264,29 @@
     return $config;
 }
 
+sub bootstrap_logging {
+    my $self = shift;
+    my $config = shift;
+
+    # prepare file for logging
+    $tmp{'log'}{'RT'} = File::Spec->catfile(
+        "$tmp{'directory'}", 'rt.debug.log'
+    );
+    open my $fh, '>', $tmp{'log'}{'RT'}
+        or die "Couldn't open $tmp{'config'}{'RT'}: $!";
+    # make world writable so apache under different user
+    # can write into it
+    chmod 0666, $tmp{'log'}{'RT'};
+
+    print $config <<END;
+Set( \$LogToSyslog , undef);
+Set( \$LogToScreen , "warning");
+Set( \$LogToFile, 'debug' );
+Set( \$LogDir, q{$tmp{'directory'}} );
+Set( \$LogToFileNamed, 'rt.debug.log' );
+END
+}
+
 sub set_config_wrapper {
     my $self = shift;
 
@@ -389,6 +412,12 @@
     RT->Config->Set( Plugins => @plugins );
     RT->InitPluginPaths;
 
+    my $dba_dbh;
+    $dba_dbh = _get_dbh(
+        RT::Handle->DSN,
+        $ENV{RT_DBA_USER}, $ENV{RT_DBA_PASSWORD},
+    ) if @plugins;
+
     require File::Spec;
     foreach my $name ( @plugins ) {
         my $plugin = RT::Plugin->new( name => $name );
@@ -400,10 +429,10 @@
             if $ENV{'TEST_VERBOSE'};
 
         if ( -e $etc_path ) {
-            my ($ret, $msg) = $RT::Handle->InsertSchema( undef, $etc_path );
+            my ($ret, $msg) = $RT::Handle->InsertSchema( $dba_dbh, $etc_path );
             Test::More::ok($ret || $msg =~ /^Couldn't find schema/, "Created schema: ".($msg||''));
 
-            ($ret, $msg) = $RT::Handle->InsertACL( undef, $etc_path );
+            ($ret, $msg) = $RT::Handle->InsertACL( $dba_dbh, $etc_path );
             Test::More::ok($ret || $msg =~ /^Couldn't find ACLs/, "Created ACL: ".($msg||''));
 
             my $data_file = File::Spec->catfile( $etc_path, 'initialdata' );
@@ -423,6 +452,7 @@
 
         $RT::Handle->Connect; # XXX: strange but mysql can loose connection
     }
+    $dba_dbh->disconnect if $dba_dbh;
 }
 
 sub _get_dbh {
@@ -687,6 +717,8 @@
     my $self = shift;
     my %args = @_;
 
+    my $after_open = delete $args{after_open};
+
     my $cmd = delete $args{'command'};
     die "Couldn't find command ($cmd)" unless -f $cmd;
 
@@ -704,7 +736,7 @@
     my ($child_out, $child_in);
     my $pid = IPC::Open2::open2($child_out, $child_in, $cmd);
 
-    $args{after_open}->($child_in, $child_out) if $args{after_open};
+    $after_open->($child_in, $child_out) if $after_open;
 
     close $child_in;
 

Index: Users_Overlay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Users_Overlay.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -d -r1.5 -r1.6
--- Users_Overlay.pm	18 May 2010 19:20:28 -0000	1.5
+++ Users_Overlay.pm	17 Feb 2011 00:52:25 -0000	1.6
@@ -2,8 +2,8 @@
 # 
 # COPYRIGHT:
 # 
-# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
-#                                          <jesse at bestpractical.com>
+# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+#                                          <sales at bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
 # 

Index: Condition.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Condition.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -d -r1.2 -r1.3
--- Condition.pm	17 Nov 2010 20:44:11 -0000	1.2
+++ Condition.pm	17 Feb 2011 00:52:25 -0000	1.3
@@ -2,8 +2,8 @@
 # 
 # COPYRIGHT:
 # 
-# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
-#                                          <jesse at bestpractical.com>
+# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+#                                          <sales at bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
 # 

Index: System.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/System.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -d -r1.2 -r1.3
--- System.pm	1 Jan 2011 00:47:01 -0000	1.2
+++ System.pm	17 Feb 2011 00:52:25 -0000	1.3
@@ -2,8 +2,8 @@
 # 
 # COPYRIGHT:
 # 
-# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
-#                                          <jesse at bestpractical.com>
+# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+#                                          <sales at bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
 # 

Index: Config.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Config.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -w -d -r1.7 -r1.8
--- Config.pm	18 Nov 2010 02:30:48 -0000	1.7
+++ Config.pm	17 Feb 2011 00:52:25 -0000	1.8
@@ -2,8 +2,8 @@
 # 
 # COPYRIGHT:
 # 
-# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
-#                                          <jesse at bestpractical.com>
+# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+#                                          <sales at bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
 # 
@@ -231,6 +231,29 @@
             },  
         },  
     },
+    ResolveDefaultUpdateType => {
+        Section         => 'General',                                      #loc
+        Overridable     => 1,
+        SortOrder       => 9,
+        Widget          => '/Widgets/Form/Select',
+        WidgetArguments => {
+            Description => 'Default Update Type when Resolving',           #loc
+            Values      => [qw(Comment Respond)],
+            ValuesLabel => {
+                Comment => "Comments (Not sent to requestors)",            #loc
+                Respond => "Reply to requestors",                          #loc
+            },
+        },
+    },
+    SuppressAutoOpenOnUpdate => {
+        Section => 'General',
+        Overridable => 1,
+        SortOrder => 10,
+        Widget => '/Widgets/Form/Boolean',
+        WidgetArguments => {
+            Description => 'Suppress automatic new to open status change on ticket update' # loc
+        }
+    },
 
     # User overridable options for RT at a glance
     DefaultSummaryRows => {
@@ -350,15 +373,13 @@
             my $value = $self->Get('RTAddressRegexp');
             return if $value;
 
-            #XXX freeside - should fix this at some point, but it is being WAY
-            #too noisy in the logs
-            #$RT::Logger->error(
-            #    'The RTAddressRegexp option is not set in the config.'
-            #    .' Not setting this option results in additional SQL queries to'
-            #    .' check whether each address belongs to RT or not.'
-            #    .' It is especially important to set this option if RT recieves'
-            #    .' emails on addresses that are not in the database or config.'
-            #);
+            $RT::Logger->debug(
+                'The RTAddressRegexp option is not set in the config.'
+                .' Not setting this option results in additional SQL queries to'
+                .' check whether each address belongs to RT or not.'
+                .' It is especially important to set this option if RT recieves'
+                .' emails on addresses that are not in the database or config.'
+            );
         },
     },
     # User overridable mail options
@@ -795,8 +816,8 @@
                 # RTIR's options is set in main site config or RTFM's
                 warn
                     "Change of config option '$name' at $args{'File'} line $args{'Line'} has been ignored."
-                    ." It's may be ok, but we want you to be aware."
-                    ." This option earlier has been set in $source{'File'} line $source{'Line'}."
+                    ." It may be ok, but we want you to be aware."
+                    ." This option has been set earlier in $source{'File'} line $source{'Line'}."
                 ;
             }
 

Index: Scrip_Overlay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Scrip_Overlay.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -d -r1.2 -r1.3
--- Scrip_Overlay.pm	17 Nov 2010 20:44:11 -0000	1.2
+++ Scrip_Overlay.pm	17 Feb 2011 00:52:25 -0000	1.3
@@ -2,8 +2,8 @@
 # 
 # COPYRIGHT:
 # 
-# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
-#                                          <jesse at bestpractical.com>
+# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+#                                          <sales at bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
 # 
@@ -588,5 +588,65 @@
 
 # }}}
 
+
+=head2 SetScripAction
+
+=cut
+
+sub SetScripAction {
+    my $self  = shift;
+    my $value = shift;
+
+    return ( 0, $self->loc("Action is mandatory argument") ) unless $value;
+
+    require RT::ScripAction;
+    my $action = RT::ScripAction->new( $self->CurrentUser );
+    $action->Load($value);
+    return ( 0, $self->loc( "Action '[_1]' not found", $value ) )
+      unless $action->Id;
+
+    return $self->_Set( Field => 'ScripAction', Value => $action->Id );
+}
+
+=head2 SetScripCondition
+
+=cut
+
+sub SetScripCondition {
+    my $self  = shift;
+    my $value = shift;
+
+    return ( 0, $self->loc("Condition is mandatory argument") )
+      unless $value;
+
+    require RT::ScripCondition;
+    my $condition = RT::ScripCondition->new( $self->CurrentUser );
+    $condition->Load($value);
+
+    return ( 0, $self->loc( "Condition '[_1]' not found", $value ) )
+      unless $condition->Id;
+
+    return $self->_Set( Field => 'ScripCondition', Value => $condition->Id );
+}
+
+=head2 SetTemplate
+
+=cut
+
+sub SetTemplate {
+    my $self  = shift;
+    my $value = shift;
+
+    return ( 0, $self->loc("Template is mandatory argument") ) unless $value;
+
+    require RT::Template;
+    my $template = RT::Template->new( $self->CurrentUser );
+    $template->Load($value);
+    return ( 0, $self->loc( "Template '[_1]' not found", $value ) )
+      unless $template->Id;
+
+    return $self->_Set( Field => 'Template', Value => $template->Id );
+}
+
 1;
 

Index: Tickets_Overlay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Tickets_Overlay.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -w -d -r1.10 -r1.11
--- Tickets_Overlay.pm	31 Jan 2011 23:58:59 -0000	1.10
+++ Tickets_Overlay.pm	17 Feb 2011 00:52:25 -0000	1.11
@@ -2,8 +2,8 @@
 # 
 # COPYRIGHT:
 # 
-# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
-#                                          <jesse at bestpractical.com>
+# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+#                                          <sales at bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
 # 

Index: Queue_Overlay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Queue_Overlay.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -d -r1.2 -r1.3
--- Queue_Overlay.pm	1 Jan 2011 00:47:01 -0000	1.2
+++ Queue_Overlay.pm	17 Feb 2011 00:52:25 -0000	1.3
@@ -2,8 +2,8 @@
 # 
 # COPYRIGHT:
 # 
-# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
-#                                          <jesse at bestpractical.com>
+# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+#                                          <sales at bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
 # 

Index: CustomField.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/CustomField.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -d -r1.2 -r1.3
--- CustomField.pm	1 Sep 2010 23:39:23 -0000	1.2
+++ CustomField.pm	17 Feb 2011 00:52:25 -0000	1.3
@@ -2,8 +2,8 @@
 # 
 # COPYRIGHT:
 # 
-# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
-#                                          <jesse at bestpractical.com>
+# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+#                                          <sales at bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
 # 



More information about the freeside-commits mailing list