diff options
Diffstat (limited to 'rt/lib')
45 files changed, 1703 insertions, 3364 deletions
diff --git a/rt/lib/RT.pm b/rt/lib/RT.pm index 7e941a2b2..90c332bc0 100644 --- a/rt/lib/RT.pm +++ b/rt/lib/RT.pm @@ -47,7 +47,7 @@ use vars qw($VERSION $System $SystemUser $Nobody $Handle $Logger $MasonSessionDir ); -$VERSION = '3.0.9'; +$VERSION = '3.0.4'; $CORE_CONFIG_FILE = "/opt/rt3/etc/RT_Config.pm"; $SITE_CONFIG_FILE = "/opt/rt3/etc/RT_SiteConfig.pm"; @@ -117,10 +117,13 @@ sub LoadConfig { =cut sub Init { - + require RT::Handle; #Get a database connection - ConnectToDatabase(); - + unless ($Handle && $Handle->dbh->ping) { + $Handle = RT::Handle->new(); + } + $Handle->Connect(); + #RT's system user is a genuine database user. its id lives here $SystemUser = new RT::CurrentUser(); $SystemUser->LoadByName('RT_System'); @@ -134,21 +137,6 @@ sub Init { InitLogging(); } - -=head2 ConnectToDatabase - -Get a database connection - -=cut - -sub ConnectToDatabase { - require RT::Handle; - unless ($Handle && $Handle->dbh && $Handle->dbh->ping) { - $Handle = RT::Handle->new(); - } - $Handle->Connect(); -} - =head2 InitLogging Create the RT::Logger object. @@ -294,15 +282,8 @@ sub DropSetGIDPermissions { =head1 BUGS -Please report them to rt-3.0-bugs@fsck.com, if you know what's broken and have at least some idea of what needs to be fixed. -If you're not sure what's going on, report them rt-devel@lists.fsck.com. - =head1 SEE ALSO -L<RT::StyleGuide> -L<DBIx::SearchBuilder> - - =begin testing diff --git a/rt/lib/RT/ACE.pm b/rt/lib/RT/ACE.pm index cbcd99fd0..1501a125e 100755 --- a/rt/lib/RT/ACE.pm +++ b/rt/lib/RT/ACE.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # Autogenerated by DBIx::SearchBuilder factory (by <jesse@bestpractical.com>) # WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST. # @@ -83,7 +61,7 @@ sub _Init { -=head2 Create PARAMHASH +=item Create PARAMHASH Create takes a hash of values and creates a row in the database: @@ -126,7 +104,7 @@ sub Create { -=head2 id +=item id Returns the current value of id. (In the database, id is stored as int(11).) @@ -135,14 +113,14 @@ Returns the current value of id. =cut -=head2 PrincipalType +=item PrincipalType Returns the current value of PrincipalType. (In the database, PrincipalType is stored as varchar(25).) -=head2 SetPrincipalType VALUE +=item SetPrincipalType VALUE Set PrincipalType to VALUE. @@ -153,14 +131,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 PrincipalId +=item PrincipalId Returns the current value of PrincipalId. (In the database, PrincipalId is stored as int(11).) -=head2 SetPrincipalId VALUE +=item SetPrincipalId VALUE Set PrincipalId to VALUE. @@ -171,14 +149,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 RightName +=item RightName Returns the current value of RightName. (In the database, RightName is stored as varchar(25).) -=head2 SetRightName VALUE +=item SetRightName VALUE Set RightName to VALUE. @@ -189,14 +167,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 ObjectType +=item ObjectType Returns the current value of ObjectType. (In the database, ObjectType is stored as varchar(25).) -=head2 SetObjectType VALUE +=item SetObjectType VALUE Set ObjectType to VALUE. @@ -207,14 +185,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 ObjectId +=item ObjectId Returns the current value of ObjectId. (In the database, ObjectId is stored as int(11).) -=head2 SetObjectId VALUE +=item SetObjectId VALUE Set ObjectId to VALUE. @@ -225,14 +203,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 DelegatedBy +=item DelegatedBy Returns the current value of DelegatedBy. (In the database, DelegatedBy is stored as int(11).) -=head2 SetDelegatedBy VALUE +=item SetDelegatedBy VALUE Set DelegatedBy to VALUE. @@ -243,14 +221,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 DelegatedFrom +=item DelegatedFrom Returns the current value of DelegatedFrom. (In the database, DelegatedFrom is stored as int(11).) -=head2 SetDelegatedFrom VALUE +=item SetDelegatedFrom VALUE Set DelegatedFrom to VALUE. @@ -262,7 +240,7 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. -sub _CoreAccessible { +sub _ClassAccessible { { id => diff --git a/rt/lib/RT/ACL.pm b/rt/lib/RT/ACL.pm index 8fd548e4f..81f59c6d0 100755 --- a/rt/lib/RT/ACL.pm +++ b/rt/lib/RT/ACL.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # Autogenerated by DBIx::SearchBuilder factory (by <jesse@bestpractical.com>) # WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST. # @@ -86,7 +64,7 @@ sub _Init { } -=head2 NewItem +=item NewItem Returns an empty new RT::ACE item diff --git a/rt/lib/RT/Action/Autoreply.pm b/rt/lib/RT/Action/Autoreply.pm index 6d2894f54..81f7bddfa 100755 --- a/rt/lib/RT/Action/Autoreply.pm +++ b/rt/lib/RT/Action/Autoreply.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# CONTRIBUTION SUBMISSION POLICY: # -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) -# -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. -# -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK package RT::Action::Autoreply; require RT::Action::SendEmail; @@ -50,18 +28,6 @@ use strict; use vars qw/@ISA/; @ISA = qw(RT::Action::SendEmail); -=head2 Prepare - -Set up the relevant recipients, then call our parent. - -=cut - - -sub Prepare { - my $self = shift; - $self->SetRecipients(); - $self->SUPER::Prepare(); -} # {{{ sub SetRecipients @@ -108,18 +74,10 @@ sub SetReturnAddress { } unless ($self->TemplateObj->MIMEObj->head->get('From')) { - if ($RT::UseFriendlyFromLine) { - my $friendly_name = $self->TicketObj->QueueObj->Description || - $self->TicketObj->QueueObj->Name; - $friendly_name =~ s/"/\\"/g; - $self->SetHeader( 'From', - sprintf($RT::FriendlyFromLineFormat, - $self->MIMEEncodeString( $friendly_name, $RT::EmailOutputEncoding ), $replyto), - ); - } - else { - $self->SetHeader( 'From', $replyto ); - } + my $friendly_name = $self->TicketObj->QueueObj->Description || + $self->TicketObj->QueueObj->Name; + $friendly_name =~ s/"/\\"/g; + $self->SetHeader('From', "\"$friendly_name\" <$replyto>"); } unless ($self->TemplateObj->MIMEObj->head->get('Reply-To')) { diff --git a/rt/lib/RT/Action/Generic.pm b/rt/lib/RT/Action/Generic.pm index 5e80f40d7..007d299c7 100755 --- a/rt/lib/RT/Action/Generic.pm +++ b/rt/lib/RT/Action/Generic.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. -# -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK =head1 NAME RT::Action::Generic - a generic baseclass for RT Actions @@ -66,9 +44,6 @@ ok (require RT::Action::Generic); package RT::Action::Generic; use strict; -use Scalar::Util; - -use base qw/RT::Base/; # {{{ sub new sub new { @@ -81,6 +56,13 @@ sub new { } # }}} +# {{{ sub new +sub loc { + my $self = shift; + return $self->{'ScripObj'}->loc(@_); +} +# }}} + # {{{ sub _Init sub _Init { my $self = shift; @@ -90,7 +72,6 @@ sub _Init { TemplateObj => undef, Argument => undef, Type => undef, - CurrentUser => undef, @_ ); @@ -100,16 +81,6 @@ sub _Init { $self->{'TransactionObj'} = $args{'TransactionObj'}; $self->{'TemplateObj'} = $args{'TemplateObj'}; $self->{'Type'} = $args{'Type'}; - $self->CurrentUser( $args{'CurrentUser'}); - Scalar::Util::weaken($self->{'ScripObj'}); - Scalar::Util::weaken($self->{'TicketObj'}); - Scalar::Util::weaken($self->{'TemplateObj'}); - Scalar::Util::weaken($self->{'TransactionObj'}); - - - - - } # }}} diff --git a/rt/lib/RT/Action/Notify.pm b/rt/lib/RT/Action/Notify.pm index 4131a8c68..1e4e4c073 100755 --- a/rt/lib/RT/Action/Notify.pm +++ b/rt/lib/RT/Action/Notify.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,51 +14,20 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK -# +# END LICENSE BLOCK package RT::Action::Notify; require RT::Action::SendEmail; -use Mail::Address; + use strict; use vars qw/@ISA/; @ISA = qw(RT::Action::SendEmail); - -=head2 Prepare - -Set up the relevant recipients, then call our parent. - -=cut - - -sub Prepare { - my $self = shift; - $self->SetRecipients(); - $self->SUPER::Prepare(); -} - # {{{ sub SetRecipients =head2 SetRecipients @@ -84,18 +47,10 @@ sub SetRecipients { my ( @To, @PseudoTo, @Cc, @Bcc ); - if ( $arg =~ /\bOtherRecipients\b/ ) { - if ( $self->TransactionObj->Attachments->First ) { - my @cc_addresses = Mail::Address->parse($self->TransactionObj->Attachments->First->GetHeader('RT-Send-Cc')); - foreach my $addr (@cc_addresses) { - push @Cc, $addr->address; - } - my @bcc_addresses = Mail::Address->parse($self->TransactionObj->Attachments->First->GetHeader('RT-Send-Bcc')); - - foreach my $addr (@bcc_addresses) { - push @Bcc, $addr->address; - } - + if ($arg =~ /\bOtherRecipients\b/) { + if ($self->TransactionObj->Attachments->First) { + push (@Cc, $self->TransactionObj->Attachments->First->GetHeader('RT-Send-Cc')); + push (@Bcc, $self->TransactionObj->Attachments->First->GetHeader('RT-Send-Bcc')); } } @@ -163,7 +118,7 @@ sub SetRecipients { @{ $self->{'Bcc'} } = grep ( !/^$creator$/, @Bcc ); } @{ $self->{'PseudoTo'} } = @PseudoTo; - + return (1); } diff --git a/rt/lib/RT/Action/NotifyAsComment.pm b/rt/lib/RT/Action/NotifyAsComment.pm index 475e3555f..210e4ab15 100755 --- a/rt/lib/RT/Action/NotifyAsComment.pm +++ b/rt/lib/RT/Action/NotifyAsComment.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK package RT::Action::NotifyAsComment; require RT::Action::Notify; diff --git a/rt/lib/RT/Action/ResolveMembers.pm b/rt/lib/RT/Action/ResolveMembers.pm index 4d751eb6d..02ff3a58c 100644 --- a/rt/lib/RT/Action/ResolveMembers.pm +++ b/rt/lib/RT/Action/ResolveMembers.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # This Action will resolve all members of a resolved group ticket package RT::Action::ResolveMembers; diff --git a/rt/lib/RT/Action/SendEmail.pm b/rt/lib/RT/Action/SendEmail.pm index a85c169b8..dac8fc8e7 100755 --- a/rt/lib/RT/Action/SendEmail.pm +++ b/rt/lib/RT/Action/SendEmail.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. -# -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # Portions Copyright 2000 Tobias Brox <tobix@cpan.org> package RT::Action::SendEmail; @@ -55,7 +33,6 @@ use vars qw/@ISA/; use MIME::Words qw(encode_mimeword); use RT::EmailParser; -use Mail::Address; =head1 NAME @@ -74,6 +51,13 @@ RT::Action::AutoReply is a good example subclass. Basically, you create another module RT::Action::YourAction which ISA RT::Action::SendEmail. +If you want to set the recipients of the mail to something other than +the addresses mentioned in the To, Cc, Bcc and headers in +the template, you should subclass RT::Action::SendEmail and override +either the SetRecipients method or the SetTo, SetCc, etc methods (see +the comments for the SetRecipients sub). + + =begin testing ok (require RT::Action::SendEmail); @@ -93,201 +77,228 @@ perl(1). # {{{ Scrip methods (_Init, Commit, Prepare, IsApplicable) +# {{{ sub _Init +# We use _Init from RT::Action +# }}} # {{{ sub Commit - +#Do what we need to do and send it out. sub Commit { my $self = shift; - return($self->SendMessage($self->TemplateObj->MIMEObj)); -} + my $MIMEObj = $self->TemplateObj->MIMEObj; + my $msgid = $MIMEObj->head->get('Message-Id'); + chomp $msgid; + $RT::Logger->info($msgid." #".$self->TicketObj->id."/".$self->TransactionObj->id." - Scrip ". $self->ScripObj->id ." ".$self->ScripObj->Description); + #send the email -# }}} + # Weed out any RT addresses. We really don't want to talk to ourselves! + @{$self->{'To'}} = RT::EmailParser::CullRTAddresses("", @{$self->{'To'}}); + @{$self->{'Cc'}} = RT::EmailParser::CullRTAddresses("", @{$self->{'Cc'}}); + @{$self->{'Bcc'}} = RT::EmailParser::CullRTAddresses("", @{$self->{'Bcc'}}); + # If there are no recipients, don't try to send the message. + # If the transaction has content and has the header RT-Squelch-Replies-To -# {{{ sub Prepare + if ( defined $self->TransactionObj->Attachments->First() ) { -sub Prepare { - my $self = shift; + my $squelch = $self->TransactionObj->Attachments->First->GetHeader( 'RT-Squelch-Replies-To'); - my ( $result, $message ) = $self->TemplateObj->Parse( - Argument => $self->Argument, - TicketObj => $self->TicketObj, - TransactionObj => $self->TransactionObj - ); - if ( !$result ) { - return (undef); + if ($squelch) { + my @blacklist = split ( /,/, $squelch ); + + # Cycle through the people we're sending to and pull out anyone on the + # system blacklist + + foreach my $person_to_yank (@blacklist) { + $person_to_yank =~ s/\s//g; + @{ $self->{'To'} } = + grep ( !/^$person_to_yank$/, @{ $self->{'To'} } ); + @{ $self->{'Cc'} } = + grep ( !/^$person_to_yank$/, @{ $self->{'Cc'} } ); + @{ $self->{'Bcc'} } = + grep ( !/^$person_to_yank$/, @{ $self->{'Bcc'} } ); + } + } } - my $MIMEObj = $self->TemplateObj->MIMEObj; - - # Header - $self->SetRTSpecialHeaders(); - - $self->RemoveInappropriateRecipients(); - # Go add all the Tos, Ccs and Bccs that we need to to the message to # make it happy, but only if we actually have values in those arrays. - # TODO: We should be pulling the recipients out of the template and shove them into To, Cc and Bcc - - $self->SetHeader( 'To', join ( ', ', @{ $self->{'To'} } ) ) - if ( ! $MIMEObj->head->get('To') && $self->{'To'} && @{ $self->{'To'} } ); - $self->SetHeader( 'Cc', join ( ', ', @{ $self->{'Cc'} } ) ) - if ( !$MIMEObj->head->get('Cc') && $self->{'Cc'} && @{ $self->{'Cc'} } ); - $self->SetHeader( 'Bcc', join ( ', ', @{ $self->{'Bcc'} } ) ) - if ( !$MIMEObj->head->get('Bcc') && $self->{'Bcc'} && @{ $self->{'Bcc'} } ); + $self->SetHeader( 'To', join ( ',', @{ $self->{'To'} } ) ) + if ( $self->{'To'} && @{ $self->{'To'} } ); + $self->SetHeader( 'Cc', join ( ',', @{ $self->{'Cc'} } ) ) + if ( $self->{'Cc'} && @{ $self->{'Cc'} } ); + $self->SetHeader( 'Bcc', join ( ',', @{ $self->{'Bcc'} } ) ) + if ( $self->{'Cc'} && @{ $self->{'Bcc'} } ); - # PseudoTo (fake to headers) shouldn't get matched for message recipients. - # If we don't have any 'To' header (but do have other recipients), drop in - # the pseudo-to header. - $self->SetHeader( 'To', join ( ', ', @{ $self->{'PseudoTo'} } ) ) - if ( $self->{'PseudoTo'} && ( @{ $self->{'PseudoTo'} } ) - and ( !$MIMEObj->head->get('To') ) ) and ( $MIMEObj->head->get('Cc') or $MIMEObj->head->get('Bcc')); - # We should never have to set the MIME-Version header - $self->SetHeader( 'MIME-Version', '1.0' ); + $self->SetHeader('MIME-Version', '1.0'); # try to convert message body from utf-8 to $RT::EmailOutputEncoding $self->SetHeader( 'Content-Type', 'text/plain; charset="utf-8"' ); - RT::I18N::SetMIMEEntityToEncoding( $MIMEObj, $RT::EmailOutputEncoding, - 'mime_words_ok' ); + RT::I18N::SetMIMEEntityToEncoding( $MIMEObj, $RT::EmailOutputEncoding, 'mime_words_ok' ); $self->SetHeader( 'Content-Type', 'text/plain; charset="' . $RT::EmailOutputEncoding . '"' ); + # Build up a MIME::Entity that looks like the original message. - $self->AddAttachments() if ( $MIMEObj->head->get('RT-Attach-Message') ); - return $result; + my $do_attach = $self->TemplateObj->MIMEObj->head->get('RT-Attach-Message'); -} + if ($do_attach) { + $self->TemplateObj->MIMEObj->head->delete('RT-Attach-Message'); -# }}} + my $attachments = RT::Attachments->new($RT::SystemUser); + $attachments->Limit( FIELD => 'TransactionId', + VALUE => $self->TransactionObj->Id ); + $attachments->OrderBy('id'); -# }}} + my $transaction_content_obj = $self->TransactionObj->ContentObj; + # attach any of this transaction's attachments + while ( my $attach = $attachments->Next ) { + # Don't attach anything blank + next unless ( $attach->ContentLength ); -=head2 To + # We want to make sure that we don't include the attachment that's being sued as the "Content" of this message" + next + if ( $transaction_content_obj + && $transaction_content_obj->Id == $attach->Id + && $transaction_content_obj->ContentType =~ qr{text/plain}i + ); + $MIMEObj->make_multipart('mixed'); + $MIMEObj->attach( Type => $attach->ContentType, + Charset => $attach->OriginalEncoding, + Data => $attach->OriginalContent, + Filename => $self->MIMEEncodeString( $attach->Filename, $RT::EmailOutputEncoding ), + Encoding => '-SUGGEST'); + } -Returns an array of Mail::Address objects containing all the To: recipients for this notification + } -=cut -sub To { - my $self = shift; - return ($self->_AddressesFromHeader('To')); -} + my $retval = $self->SendMessage($MIMEObj); -=head2 Cc -Returns an array of Mail::Address objects containing all the Cc: recipients for this notification + return ($retval); +} -=cut +# }}} -sub Cc { +# {{{ sub Prepare + +sub Prepare { my $self = shift; - return ($self->_AddressesFromHeader('Cc')); -} -=head2 Bcc + # This actually populates the MIME::Entity fields in the Template Object -Returns an array of Mail::Address objects containing all the Bcc: recipients for this notification + unless ( $self->TemplateObj ) { + $RT::Logger->warning("No template object handed to $self\n"); + } -=cut + unless ( $self->TransactionObj ) { + $RT::Logger->warning("No transaction object handed to $self\n"); + } -sub Bcc { - my $self = shift; - return ($self->_AddressesFromHeader('Bcc')); + unless ( $self->TicketObj ) { + $RT::Logger->warning("No ticket object handed to $self\n"); -} + } -sub _AddressesFromHeader { - my $self = shift; - my $field = shift; - my $header = $self->TemplateObj->MIMEObj->head->get($field); - my @addresses = Mail::Address->parse($header); + my ( $result, $message ) = $self->TemplateObj->Parse( + Argument => $self->Argument, + TicketObj => $self->TicketObj, + TransactionObj => $self->TransactionObj + ); + if ($result) { + + # Header + $self->SetSubject(); + $self->SetSubjectToken(); + $self->SetRecipients(); + $self->SetReturnAddress(); + $self->SetRTSpecialHeaders(); + if ($RT::EmailOutputEncoding) { + + # l10n related header + $self->SetHeaderAsEncoding( 'Subject', $RT::EmailOutputEncoding ); + } + } + + return $result; - return (@addresses); } +# }}} -# {{{ SendMessage +# }}} +# {{{ SendMessage =head2 SendMessage MIMEObj sends the message using RT's preferred API. -TODO: Break this out to a separate module +TODO: Break this out to a seperate module =cut sub SendMessage { - my $self = shift; + my $self = shift; my $MIMEObj = shift; my $msgid = $MIMEObj->head->get('Message-Id'); - chomp $msgid; - $RT::Logger->info( $msgid . " #" - . $self->TicketObj->id . "/" - . $self->TransactionObj->id - . " - Scrip " - . $self->ScripObj->id . " " - . $self->ScripObj->Description ); #If we don't have any recipients to send to, don't send a message; - unless ( $MIMEObj->head->get('To') - || $MIMEObj->head->get('Cc') - || $MIMEObj->head->get('Bcc') ) - { - $RT::Logger->info( $msgid . " No recipients found. Not sending.\n" ); + unless ( $MIMEObj->head->get('To') + || $MIMEObj->head->get('Cc') + || $MIMEObj->head->get('Bcc') ) { + $RT::Logger->info($msgid. " No recipients found. Not sending.\n"); return (1); } + # PseudoTo (fake to headers) shouldn't get matched for message recipients. + # If we don't have any 'To' header, drop in the pseudo-to header. + $self->SetHeader( 'To', join ( ',', @{ $self->{'PseudoTo'} } ) ) + if ( $self->{'PseudoTo'} && ( @{ $self->{'PseudoTo'} } ) + and ( !$MIMEObj->head->get('To') ) ); if ( $RT::MailCommand eq 'sendmailpipe' ) { eval { - open( MAIL, "|$RT::SendmailPath $RT::SendmailArguments" ) || die $!; + open( MAIL, "|$RT::SendmailPath $RT::SendmailArguments" ); print MAIL $MIMEObj->as_string; close(MAIL); - }; - if ($@) { - $RT::Logger->crit( $msgid . "Could not send mail. -" . $@ ); + }; + if ($@) { + $RT::Logger->crit($msgid. "Could not send mail. -".$@ ); } } else { - my @mailer_args = ($RT::MailCommand); - - local $ENV{MAILADDRESS}; + my @mailer_args = ($RT::MailCommand); + local $ENV{MAILADDRESS}; if ( $RT::MailCommand eq 'sendmail' ) { - push @mailer_args, split(/\s+/, $RT::SendmailArguments); + push @mailer_args, $RT::SendmailArguments; } elsif ( $RT::MailCommand eq 'smtp' ) { - $ENV{MAILADDRESS} = $RT::SMTPFrom || $MIMEObj->head->get('From'); - push @mailer_args, ( Server => $RT::SMTPServer ); - push @mailer_args, ( Debug => $RT::SMTPDebug ); - } - else { - push @mailer_args, $RT::MailParams; + $ENV{MAILADDRESS} = $RT::SMTPFrom || $MIMEObj->head->get('From'); + push @mailer_args, (Server => $RT::SMTPServer); + push @mailer_args, (Debug => $RT::SMTPDebug); } + else { + push @mailer_args, $RT::MailParams; + } - unless ( $MIMEObj->send(@mailer_args) ) { - $RT::Logger->crit( $msgid . "Could not send mail." ); + unless ( $MIMEObj->send( @mailer_args ) ) { + $RT::Logger->crit($msgid. "Could not send mail." ); return (0); } } - my $success = - ( $msgid - . " sent To: " - . $MIMEObj->head->get('To') . " Cc: " - . $MIMEObj->head->get('Cc') . " Bcc: " - . $MIMEObj->head->get('Bcc') ); - $success =~ s/\n//gi; - - $self->RecordOutgoingMailTransaction($MIMEObj) if ($RT::RecordOutgoingEmail); + my $success = ($msgid. " sent To: ".$MIMEObj->head->get('To') . " Cc: ".$MIMEObj->head->get('Cc') . " Bcc: ".$MIMEObj->head->get('Bcc')); + $success =~ s/\n//gi; $RT::Logger->info($success); return (1); @@ -295,139 +306,51 @@ sub SendMessage { # }}} -# {{{ AddAttachments - -=head2 AddAttachments +# {{{ Deal with message headers (Set* subs, designed for easy overriding) -Takes any attachments to this transaction and attaches them to the message -we're building. - -=cut - - -sub AddAttachments { - my $self = shift; - - my $MIMEObj = $self->TemplateObj->MIMEObj; - - $MIMEObj->head->delete('RT-Attach-Message'); - - my $attachments = RT::Attachments->new($RT::SystemUser); - $attachments->Limit( - FIELD => 'TransactionId', - VALUE => $self->TransactionObj->Id - ); - $attachments->OrderBy('id'); - - my $transaction_content_obj = $self->TransactionObj->ContentObj; - - # attach any of this transaction's attachments - while ( my $attach = $attachments->Next ) { - - # Don't attach anything blank - next unless ( $attach->ContentLength ); - -# We want to make sure that we don't include the attachment that's being sued as the "Content" of this message" - next - if ( $transaction_content_obj - && $transaction_content_obj->Id == $attach->Id - && $transaction_content_obj->ContentType =~ qr{text/plain}i ); - $MIMEObj->make_multipart('mixed'); - $MIMEObj->attach( - Type => $attach->ContentType, - Charset => $attach->OriginalEncoding, - Data => $attach->OriginalContent, - Filename => $self->MIMEEncodeString( $attach->Filename, - $RT::EmailOutputEncoding ), - 'RT-Attachment:' => $self->TicketObj->Id."/".$self->TransactionObj->Id."/".$attach->id, - Encoding => '-SUGGEST' - ); - } - -} - -# }}} - -# {{{ RecordOutgoingMailTransaction +# {{{ sub SetRTSpecialHeaders -=head2 RecordOutgoingMailTransaction MIMEObj +=head2 SetRTSpecialHeaders -Record a transaction in RT with this outgoing message for future record-keeping purposes +This routine adds all the random headers that RT wants in a mail message +that don't matter much to anybody else. =cut - - -sub RecordOutgoingMailTransaction { +sub SetRTSpecialHeaders { my $self = shift; - my $MIMEObj = shift; - - - my @parts = $MIMEObj->parts; - my @attachments; - my @keep; - foreach my $part (@parts) { - my $attach = $part->head->get('RT-Attachment'); - if ($attach) { - $RT::Logger->debug("We found an attachment. we want to not record it."); - push @attachments, $attach; - } else { - $RT::Logger->debug("We found a part. we want to record it."); - push @keep, $part; - } - } - $MIMEObj->parts(\@keep); - foreach my $attachment (@attachments) { - $MIMEObj->head->add('RT-Attachment', $attachment); - } - - RT::I18N::SetMIMEEntityToEncoding( $MIMEObj, 'utf-8', 'mime_words_ok' ); - - my $transaction = RT::Transaction->new($self->TransactionObj->CurrentUser); - # XXX: TODO -> Record attachments as references to things in the attachments table, maybe. + $self->SetReferences(); - my $type; - if ($self->TransactionObj->Type eq 'Comment') { - $type = 'CommentEmailRecord'; - } else { - $type = 'EmailRecord'; - } + $self->SetMessageID(); + $self->SetPrecedence(); - - my ( $id, $msg ) = $transaction->Create( - Ticket => $self->TicketObj->Id, - Type => $type, - Data => $MIMEObj->head->get('Message-Id'), - MIMEObj => $MIMEObj, - ActivateScrips => 0 - ); + $self->SetHeader( 'X-RT-Loop-Prevention', $RT::rtname ); + $self->SetHeader( 'RT-Ticket', + $RT::rtname . " #" . $self->TicketObj->id() ); + $self->SetHeader( 'Managed-by', + "RT $RT::VERSION (http://www.bestpractical.com/rt/)" ); + $self->SetHeader( 'RT-Originator', + $self->TransactionObj->CreatorObj->EmailAddress ); + return (); } -# }}} -# - -# {{{ sub SetRTSpecialHeaders - -=head2 SetRTSpecialHeaders +# {{{ sub SetReferences -This routine adds all the random headers that RT wants in a mail message -that don't matter much to anybody else. +=head2 SetReferences + + # This routine will set the References: and In-Reply-To headers, +# autopopulating it with all the correspondence on this ticket so +# far. This should make RT responses threadable. =cut -sub SetRTSpecialHeaders { +sub SetReferences { my $self = shift; - $self->SetSubject(); - $self->SetSubjectToken(); - $self->SetHeaderAsEncoding( 'Subject', $RT::EmailOutputEncoding ) - if ($RT::EmailOutputEncoding); - $self->SetReturnAddress(); - # TODO: this one is broken. What is this email really a reply to? # If it's a reply to an incoming message, we'll need to use the # actual message-id from the appropriate Attachment object. For @@ -435,93 +358,46 @@ sub SetRTSpecialHeaders { # References. $self->SetHeader( 'In-Reply-To', - "<rt-" . $self->TicketObj->id() . "\@" . $RT::rtname . ">" ); + "<rt-" . $self->TicketObj->id() . "\@" . $RT::rtname . ">" ); # TODO We should always add References headers for all message-ids # of previous messages related to this ticket. - - $self->SetHeader( 'Message-ID', - "<rt-" - . $RT::VERSION . "-" - . $self->TicketObj->id() . "-" - . $self->TransactionObj->id() . "-" - . $self->ScripObj->Id . "." - . rand(20) . "\@" - . $RT::Organization . ">" ) - unless $self->TemplateObj->MIMEObj->head->get('Message-ID'); - - $self->SetHeader( 'Precedence', "bulk" ) - unless ( $self->TemplateObj->MIMEObj->head->get("Precedence") ); - - $self->SetHeader( 'X-RT-Loop-Prevention', $RT::rtname ); - $self->SetHeader( 'RT-Ticket', - $RT::rtname . " #" . $self->TicketObj->id() ); - $self->SetHeader( 'Managed-by', - "RT $RT::VERSION (http://www.bestpractical.com/rt/)" ); - - $self->SetHeader( 'RT-Originator', - $self->TransactionObj->CreatorObj->EmailAddress ); - } # }}} +# {{{ sub SetMessageID -# }}} - -# {{{ RemoveInappropriateRecipients +=head2 SetMessageID -=head2 RemoveInappropriateRecipients - -Remove addresses that are RT addresses or that are on this transaction's blacklist +Without this one, threading won't work very nice in email agents. +Anyway, I'm not really sure it's that healthy if we need to send +several separate/different emails about the same transaction. =cut -sub RemoveInappropriateRecipients { +sub SetMessageID { my $self = shift; - my @blacklist; - - # Weed out any RT addresses. We really don't want to talk to ourselves! - @{ $self->{'To'} } = - RT::EmailParser::CullRTAddresses( "", @{ $self->{'To'} } ); - @{ $self->{'Cc'} } = - RT::EmailParser::CullRTAddresses( "", @{ $self->{'Cc'} } ); - @{ $self->{'Bcc'} } = - RT::EmailParser::CullRTAddresses( "", @{ $self->{'Bcc'} } ); + # TODO this one might be sort of broken. If we have several scrips +++ + # sending several emails to several different persons, we need to + # pull out different message-ids. I'd suggest message ids like + # "rt-ticket#-transaction#-scrip#-receipient#" - # If there are no recipients, don't try to send the message. - # If the transaction has content and has the header RT-Squelch-Replies-To - - if ( defined $self->TransactionObj->Attachments->First() ) { - my $squelch = - $self->TransactionObj->Attachments->First->GetHeader( - 'RT-Squelch-Replies-To'); - - if ($squelch) { - @blacklist = split ( /,/, $squelch ); - } - } - -# Let's grab the SquelchMailTo attribue and push those entries into the @blacklist - my @non_recipients = $self->TicketObj->SquelchMailTo; - foreach my $attribute (@non_recipients) { - push @blacklist, $attribute->Content; - } - - # Cycle through the people we're sending to and pull out anyone on the - # system blacklist - - foreach my $person_to_yank (@blacklist) { - $person_to_yank =~ s/\s//g; - @{ $self->{'To'} } = grep ( !/^$person_to_yank$/, @{ $self->{'To'} } ); - @{ $self->{'Cc'} } = grep ( !/^$person_to_yank$/, @{ $self->{'Cc'} } ); - @{ $self->{'Bcc'} } = - grep ( !/^$person_to_yank$/, @{ $self->{'Bcc'} } ); - } + $self->SetHeader( 'Message-ID', + "<rt-" + . $RT::VERSION ."-" + . $self->TicketObj->id() . "-" + . $self->TransactionObj->id() . "." + . rand(20) . "\@" + . $RT::Organization . ">" ) + unless $self->TemplateObj->MIMEObj->head->get('Message-ID'); } # }}} + +# }}} + # {{{ sub SetReturnAddress =head2 SetReturnAddress is_comment => BOOLEAN @@ -533,10 +409,8 @@ Calculate and set From and Reply-To headers based on the is_comment flag. sub SetReturnAddress { my $self = shift; - my %args = ( - is_comment => 0, - @_ - ); + my %args = ( is_comment => 0, + @_ ); # From and Reply-To # $args{is_comment} should be set if the comment address is to be used. @@ -552,26 +426,21 @@ sub SetReturnAddress { } unless ( $self->TemplateObj->MIMEObj->head->get('From') ) { - if ($RT::UseFriendlyFromLine) { - my $friendly_name = $self->TransactionObj->CreatorObj->RealName; - if ( $friendly_name =~ /^"(.*)"$/ ) { # a quoted string - $friendly_name = $1; - } - - $friendly_name =~ s/"/\\"/g; - $self->SetHeader( - 'From', - sprintf( - $RT::FriendlyFromLineFormat, - $self->MIMEEncodeString( $friendly_name, - $RT::EmailOutputEncoding ), - $replyto - ), - ); - } - else { - $self->SetHeader( 'From', $replyto ); - } + if ($RT::UseFriendlyFromLine) { + my $friendly_name = $self->TransactionObj->CreatorObj->RealName; + if ( $friendly_name =~ /^"(.*)"$/ ) { # a quoted string + $friendly_name = $1; + } + + $friendly_name =~ s/"/\\"/g; + $self->SetHeader( 'From', + sprintf($RT::FriendlyFromLineFormat, + $self->MIMEEncodeString( $friendly_name, $RT::EmailOutputEncoding ), $replyto), + ); + } + else { + $self->SetHeader( 'From', $replyto ); + } } unless ( $self->TemplateObj->MIMEObj->head->get('Reply-To') ) { @@ -604,6 +473,82 @@ sub SetHeader { # }}} +# {{{ sub SetRecipients + +=head2 SetRecipients + +Dummy method to be overriden by subclasses which want to set the recipients. + +=cut + +sub SetRecipients { + my $self = shift; + return (); +} + +# }}} + +# {{{ sub SetTo + +=head2 SetTo + +Takes a string that is the addresses you want to send mail to + +=cut + +sub SetTo { + my $self = shift; + my $addresses = shift; + return $self->SetHeader( 'To', $addresses ); +} + +# }}} + +# {{{ sub SetCc + +=head2 SetCc + +Takes a string that is the addresses you want to Cc + +=cut + +sub SetCc { + my $self = shift; + my $addresses = shift; + + return $self->SetHeader( 'Cc', $addresses ); +} + +# }}} + +# {{{ sub SetBcc + +=head2 SetBcc + +Takes a string that is the addresses you want to Bcc + +=cut + +sub SetBcc { + my $self = shift; + my $addresses = shift; + + return $self->SetHeader( 'Bcc', $addresses ); +} + +# }}} + +# {{{ sub SetPrecedence + +sub SetPrecedence { + my $self = shift; + + unless ( $self->TemplateObj->MIMEObj->head->get("Precedence") ) { + $self->SetHeader( 'Precedence', "bulk" ); + } +} + +# }}} # {{{ sub SetSubject @@ -619,33 +564,36 @@ sub SetSubject { my $self = shift; my $subject; - my $message = $self->TransactionObj->Attachments; - if ( $self->TemplateObj->MIMEObj->head->get('Subject') ) { - return (); - } - if ( $self->{'Subject'} ) { - $subject = $self->{'Subject'}; - } - elsif ( ( $message->First() ) && ( $message->First->Headers ) ) { - my $header = $message->First->Headers(); - $header =~ s/\n\s+/ /g; - if ( $header =~ /^Subject: (.*?)$/m ) { - $subject = $1; + unless ( $self->TemplateObj->MIMEObj->head->get('Subject') ) { + my $message = $self->TransactionObj->Attachments; + my $ticket = $self->TicketObj->Id; + + if ( $self->{'Subject'} ) { + $subject = $self->{'Subject'}; + } + elsif ( ( $message->First() ) + && ( $message->First->Headers ) ) { + my $header = $message->First->Headers(); + $header =~ s/\n\s+/ /g; + if ( $header =~ /^Subject: (.*?)$/m ) { + $subject = $1; + } + else { + $subject = $self->TicketObj->Subject(); + } + } else { $subject = $self->TicketObj->Subject(); } - } - else { - $subject = $self->TicketObj->Subject(); - } + $subject =~ s/(\r\n|\n|\s)/ /gi; - $subject =~ s/(\r\n|\n|\s)/ /gi; - - chomp $subject; - $self->SetHeader( 'Subject', $subject ); + chomp $subject; + $self->SetHeader( 'Subject', $subject ); + } + return ($subject); } # }}} @@ -673,7 +621,7 @@ sub SetSubjectToken { # }}} -# {{{ SetHeadingAsEncoding +# {{{ =head2 SetHeaderAsEncoding($field_name, $charset_encoding) @@ -704,7 +652,7 @@ sub SetHeaderAsEncoding { } # }}} -# {{{ MIMEEncodeString +# {{{ MIMENcodeString =head2 MIMEEncodeString STRING ENCODING @@ -715,41 +663,15 @@ Takes a string and a possible encoding and returns the string wrapped in MIME go sub MIMEEncodeString { my $self = shift; my $value = shift; - # using RFC2047 notation, sec 2. - # encoded-word = "=?" charset "?" encoding "?" encoded-text "?=" - my $charset = shift; - my $encoding = 'B'; - # An 'encoded-word' may not be more than 75 characters long - # - # MIME encoding increases 4/3*(number of bytes), and always in multiples - # of 4. Thus we have to find the best available value of bytes available - # for each chunk. - # - # First we get the integer max which max*4/3 would fit on space. - # Then we find the greater multiple of 3 lower or equal than $max. - my $max = int(((75-length('=?'.$charset.'?'.$encoding.'?'.'?='))*3)/4); - $max = int($max/3)*3; + my $enc = shift; chomp $value; return ($value) unless $value =~ /[^\x20-\x7e]/; $value =~ s/\s*$//; Encode::_utf8_off($value); - my $res = Encode::from_to( $value, "utf-8", $charset ); - - if ($max > 0) { - # copy value and split in chuncks - my $str=$value; - my @chunks = unpack("a$max" x int(length($str)/$max - + ((length($str) % $max) ? 1:0)), $str); - # encode an join chuncks - $value = join " ", - map encode_mimeword( $_, $encoding, $charset ), @chunks ; - return($value); - } else { - # gives an error... - $RT::Logger->crit("Can't encode! Charset or encoding too big.\n"); - } + my $res = Encode::from_to( $value, "utf-8", $enc ); + $value = encode_mimeword( $value, 'B', $enc ); } # }}} diff --git a/rt/lib/RT/Attachment.pm b/rt/lib/RT/Attachment.pm index 71aa4d5ea..2ed520162 100755 --- a/rt/lib/RT/Attachment.pm +++ b/rt/lib/RT/Attachment.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # Autogenerated by DBIx::SearchBuilder factory (by <jesse@bestpractical.com>) # WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST. # @@ -83,7 +61,7 @@ sub _Init { -=head2 Create PARAMHASH +=item Create PARAMHASH Create takes a hash of values and creates a row in the database: @@ -132,7 +110,7 @@ sub Create { -=head2 id +=item id Returns the current value of id. (In the database, id is stored as int(11).) @@ -141,14 +119,14 @@ Returns the current value of id. =cut -=head2 TransactionId +=item TransactionId Returns the current value of TransactionId. (In the database, TransactionId is stored as int(11).) -=head2 SetTransactionId VALUE +=item SetTransactionId VALUE Set TransactionId to VALUE. @@ -159,14 +137,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Parent +=item Parent Returns the current value of Parent. (In the database, Parent is stored as int(11).) -=head2 SetParent VALUE +=item SetParent VALUE Set Parent to VALUE. @@ -177,14 +155,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 MessageId +=item MessageId Returns the current value of MessageId. (In the database, MessageId is stored as varchar(160).) -=head2 SetMessageId VALUE +=item SetMessageId VALUE Set MessageId to VALUE. @@ -195,14 +173,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Subject +=item Subject Returns the current value of Subject. (In the database, Subject is stored as varchar(255).) -=head2 SetSubject VALUE +=item SetSubject VALUE Set Subject to VALUE. @@ -213,14 +191,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Filename +=item Filename Returns the current value of Filename. (In the database, Filename is stored as varchar(255).) -=head2 SetFilename VALUE +=item SetFilename VALUE Set Filename to VALUE. @@ -231,14 +209,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 ContentType +=item ContentType Returns the current value of ContentType. (In the database, ContentType is stored as varchar(80).) -=head2 SetContentType VALUE +=item SetContentType VALUE Set ContentType to VALUE. @@ -249,14 +227,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 ContentEncoding +=item ContentEncoding Returns the current value of ContentEncoding. (In the database, ContentEncoding is stored as varchar(80).) -=head2 SetContentEncoding VALUE +=item SetContentEncoding VALUE Set ContentEncoding to VALUE. @@ -267,14 +245,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Content +=item Content Returns the current value of Content. (In the database, Content is stored as longtext.) -=head2 SetContent VALUE +=item SetContent VALUE Set Content to VALUE. @@ -285,14 +263,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Headers +=item Headers Returns the current value of Headers. (In the database, Headers is stored as longtext.) -=head2 SetHeaders VALUE +=item SetHeaders VALUE Set Headers to VALUE. @@ -303,7 +281,7 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Creator +=item Creator Returns the current value of Creator. (In the database, Creator is stored as int(11).) @@ -312,7 +290,7 @@ Returns the current value of Creator. =cut -=head2 Created +=item Created Returns the current value of Created. (In the database, Created is stored as datetime.) @@ -322,7 +300,7 @@ Returns the current value of Created. -sub _CoreAccessible { +sub _ClassAccessible { { id => diff --git a/rt/lib/RT/Attachments.pm b/rt/lib/RT/Attachments.pm index 9ab11f3a6..177cdd094 100755 --- a/rt/lib/RT/Attachments.pm +++ b/rt/lib/RT/Attachments.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # Autogenerated by DBIx::SearchBuilder factory (by <jesse@bestpractical.com>) # WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST. # @@ -86,7 +64,7 @@ sub _Init { } -=head2 NewItem +=item NewItem Returns an empty new RT::Attachment item diff --git a/rt/lib/RT/Condition/AnyTransaction.pm b/rt/lib/RT/Condition/AnyTransaction.pm index a338523b7..4519fcf5a 100644 --- a/rt/lib/RT/Condition/AnyTransaction.pm +++ b/rt/lib/RT/Condition/AnyTransaction.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK package RT::Condition::AnyTransaction; diff --git a/rt/lib/RT/Condition/Generic.pm b/rt/lib/RT/Condition/Generic.pm index 1f291fcca..bd269315e 100755 --- a/rt/lib/RT/Condition/Generic.pm +++ b/rt/lib/RT/Condition/Generic.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK =head1 NAME RT::Condition::Generic - ; @@ -79,8 +57,10 @@ ok (require RT::Condition::Generic); package RT::Condition::Generic; +use RT::Base; use strict; -use base qw/RT::Base/; +use vars qw/@ISA/; +@ISA = qw(RT::Base); # {{{ sub new sub new { @@ -102,7 +82,6 @@ sub _Init { TemplateObj => undef, Argument => undef, ApplicableTransTypes => undef, - CurrentUser => undef, @_ ); $self->{'Argument'} = $args{'Argument'}; @@ -110,7 +89,6 @@ sub _Init { $self->{'TicketObj'} = $args{'TicketObj'}; $self->{'TransactionObj'} = $args{'TransactionObj'}; $self->{'ApplicableTransTypes'} = $args{'ApplicableTransTypes'}; - $self->CurrentUser($args{'CurrentUser'}); } # }}} diff --git a/rt/lib/RT/Condition/StatusChange.pm b/rt/lib/RT/Condition/StatusChange.pm index 1182fcd70..8afabcda0 100644 --- a/rt/lib/RT/Condition/StatusChange.pm +++ b/rt/lib/RT/Condition/StatusChange.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK diff --git a/rt/lib/RT/CurrentUser.pm b/rt/lib/RT/CurrentUser.pm index d147fe62e..4ca2f9891 100755 --- a/rt/lib/RT/CurrentUser.pm +++ b/rt/lib/RT/CurrentUser.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. -# -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK =head1 NAME RT::CurrentUser - an RT object representing the current user @@ -73,7 +51,8 @@ use RT::Record; use RT::I18N; use strict; -use base qw/RT::Record/; +use vars qw/@ISA/; +@ISA= qw(RT::Record); # {{{ sub _Init @@ -81,30 +60,17 @@ use base qw/RT::Record/; # to be a CurrentUser object. but that's hard to do when we're trying to load # the CurrentUser object -sub _Init { - my $self = shift; - my $User = shift; - - $self->{'table'} = "Users"; - - if ( defined($User) ) { - - if ( UNIVERSAL::isa( $User, 'RT::User' ) - || UNIVERSAL::isa( $User, 'RT::CurrentUser' ) ) - { - $self->Load( $User->id ); +sub _Init { + my $self = shift; + my $Name = shift; - } - elsif ( ref($User) ) { - $RT::Logger->crit( - "RT::CurrentUser->new() called with a bogus argument: $User"); - } - else { - $self->Load($User); - } - } + $self->{'table'} = "Users"; - $self->_BuildTableAttributes(); + if (defined($Name)) { + $self->Load($Name); + } + + $self->CurrentUser($self); } # }}} @@ -138,13 +104,15 @@ sub Delete { sub UserObj { my $self = shift; + unless ($self->{'UserObj'}) { use RT::User; - my $user = RT::User->new($self); - - unless ($user->Load($self->Id)) { + $self->{'UserObj'} = RT::User->new($self); + unless ($self->{'UserObj'}->Load($self->Id)) { $RT::Logger->err($self->loc("Couldn't load [_1] from the users database.\n", $self->Id)); } - return ($user); + + } + return ($self->{'UserObj'}); } # }}} @@ -185,18 +153,18 @@ sub PrincipalId { # {{{ sub _Accessible - - - sub _CoreAccessible { - { - Name => { 'read' => 1 }, - Gecos => { 'read' => 1 }, - RealName => { 'read' => 1 }, - Lang => { 'read' => 1 }, - Password => { 'read' => 0, 'write' => 0 }, - EmailAddress => { 'read' => 1, 'write' => 0 } - }; - +sub _Accessible { + my $self = shift; + my %Cols = ( + Name => 'read', + Gecos => 'read', + RealName => 'read', + Password => 'neither', + EmailAddress => 'read', + Privileged => 'read', + IsAdministrator => 'read' + ); + return($self->SUPER::_Accessible(@_, %Cols)); } # }}} @@ -273,11 +241,6 @@ sub Load { if ($identifier !~ /\D/) { $self->SUPER::LoadById($identifier); } - - elsif (UNIVERSAL::isa($identifier,"RT::User")) { - # DWIM if they pass a user in - $self->SUPER::LoadById($identifier->Id); - } else { # This is a bit dangerous, we might get false authen if somebody # uses ambigous userids or real names: @@ -363,24 +326,16 @@ ok ($cu->loc('Before') eq "Avant", "Localized TEST_STRING into Frenc"); sub LanguageHandle { my $self = shift; - if ( ( !defined $self->{'LangHandle'} ) - || ( !UNIVERSAL::can( $self->{'LangHandle'}, 'maketext' ) ) - || (@_) ) { - if ( (!$RT::SystemUser || $self->id == $RT::SystemUser->id() )) { - @_ = qw(en-US); - } - - elsif ( $self->Lang ) { - push @_, $self->Lang; - } + if ((!defined $self->{'LangHandle'}) || + (!UNIVERSAL::can($self->{'LangHandle'}, 'maketext')) || + (@_)) { $self->{'LangHandle'} = RT::I18N->get_handle(@_); } - # Fall back to english. - unless ( $self->{'LangHandle'} ) { + unless ($self->{'LangHandle'}) { die "We couldn't get a dictionary. Nye mogu naidti slovar. No puedo encontrar dictionario."; } - return ( $self->{'LangHandle'} ); + return ($self->{'LangHandle'}); } sub loc { @@ -410,20 +365,6 @@ sub loc_fuzzy { } # }}} - -=head2 CurrentUser - -Return the current currentuser object - -=cut - -sub CurrentUser { - my $self = shift; - return($self); - -} - - eval "require RT::CurrentUser_Vendor"; die $@ if ($@ && $@ !~ qr{^Can't locate RT/CurrentUser_Vendor.pm}); eval "require RT::CurrentUser_Local"; diff --git a/rt/lib/RT/Date.pm b/rt/lib/RT/Date.pm index a000b8d00..355370ada 100644 --- a/rt/lib/RT/Date.pm +++ b/rt/lib/RT/Date.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. -# -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK =head1 NAME RT::Date - a simple Object Oriented date. @@ -352,8 +330,7 @@ sub DurationAsString { $s = int( $duration / $YEAR ); $time_unit = $self->loc("years"); } - - if ($negative) { + if (0) { # For now, never display the "AGO" # $negative) { return $self->loc( "[_1] [_2] ago", $s, $time_unit ); } else { @@ -552,24 +529,6 @@ sub ISO { # }}} -# {{{ sub W3CDTF - -=head2 W3CDTF - -Takes nothing - -Returns the object's date in W3C DTF format - -=cut - -sub W3CDTF { - my $self = shift; - my $date = $self->ISO . 'Z'; - $date =~ s/ /T/; - return $date; -}; - -# }}} # {{{ sub LocalTimezone =head2 LocalTimezone diff --git a/rt/lib/RT/Group.pm b/rt/lib/RT/Group.pm index 60f7fb71e..4dcef3f07 100755 --- a/rt/lib/RT/Group.pm +++ b/rt/lib/RT/Group.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# CONTRIBUTION SUBMISSION POLICY: # -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) -# -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. -# -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # Autogenerated by DBIx::SearchBuilder factory (by <jesse@bestpractical.com>) # WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST. # @@ -83,7 +61,7 @@ sub _Init { -=head2 Create PARAMHASH +=item Create PARAMHASH Create takes a hash of values and creates a row in the database: @@ -91,7 +69,7 @@ Create takes a hash of values and creates a row in the database: varchar(255) 'Description'. varchar(64) 'Domain'. varchar(64) 'Type'. - int(11) 'Instance'. + varchar(64) 'Instance'. =cut @@ -120,7 +98,7 @@ sub Create { -=head2 id +=item id Returns the current value of id. (In the database, id is stored as int(11).) @@ -129,14 +107,14 @@ Returns the current value of id. =cut -=head2 Name +=item Name Returns the current value of Name. (In the database, Name is stored as varchar(200).) -=head2 SetName VALUE +=item SetName VALUE Set Name to VALUE. @@ -147,14 +125,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Description +=item Description Returns the current value of Description. (In the database, Description is stored as varchar(255).) -=head2 SetDescription VALUE +=item SetDescription VALUE Set Description to VALUE. @@ -165,14 +143,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Domain +=item Domain Returns the current value of Domain. (In the database, Domain is stored as varchar(64).) -=head2 SetDomain VALUE +=item SetDomain VALUE Set Domain to VALUE. @@ -183,14 +161,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Type +=item Type Returns the current value of Type. (In the database, Type is stored as varchar(64).) -=head2 SetType VALUE +=item SetType VALUE Set Type to VALUE. @@ -201,26 +179,26 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Instance +=item Instance Returns the current value of Instance. -(In the database, Instance is stored as int(11).) +(In the database, Instance is stored as varchar(64).) -=head2 SetInstance VALUE +=item SetInstance VALUE Set Instance to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. -(In the database, Instance will be stored as a int(11).) +(In the database, Instance will be stored as a varchar(64).) =cut -sub _CoreAccessible { +sub _ClassAccessible { { id => @@ -234,7 +212,7 @@ sub _CoreAccessible { Type => {read => 1, write => 1, type => 'varchar(64)', default => ''}, Instance => - {read => 1, write => 1, type => 'int(11)', default => ''}, + {read => 1, write => 1, type => 'varchar(64)', default => ''}, } }; diff --git a/rt/lib/RT/GroupMember.pm b/rt/lib/RT/GroupMember.pm index e11651956..8de1a73fe 100755 --- a/rt/lib/RT/GroupMember.pm +++ b/rt/lib/RT/GroupMember.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # Autogenerated by DBIx::SearchBuilder factory (by <jesse@bestpractical.com>) # WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST. # @@ -83,7 +61,7 @@ sub _Init { -=head2 Create PARAMHASH +=item Create PARAMHASH Create takes a hash of values and creates a row in the database: @@ -111,7 +89,7 @@ sub Create { -=head2 id +=item id Returns the current value of id. (In the database, id is stored as int(11).) @@ -120,14 +98,14 @@ Returns the current value of id. =cut -=head2 GroupId +=item GroupId Returns the current value of GroupId. (In the database, GroupId is stored as int(11).) -=head2 SetGroupId VALUE +=item SetGroupId VALUE Set GroupId to VALUE. @@ -138,14 +116,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 MemberId +=item MemberId Returns the current value of MemberId. (In the database, MemberId is stored as int(11).) -=head2 SetMemberId VALUE +=item SetMemberId VALUE Set MemberId to VALUE. @@ -157,7 +135,7 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. -sub _CoreAccessible { +sub _ClassAccessible { { id => diff --git a/rt/lib/RT/GroupMembers.pm b/rt/lib/RT/GroupMembers.pm index bd74c5155..31cb9536f 100755 --- a/rt/lib/RT/GroupMembers.pm +++ b/rt/lib/RT/GroupMembers.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # Autogenerated by DBIx::SearchBuilder factory (by <jesse@bestpractical.com>) # WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST. # @@ -86,7 +64,7 @@ sub _Init { } -=head2 NewItem +=item NewItem Returns an empty new RT::GroupMember item diff --git a/rt/lib/RT/Groups.pm b/rt/lib/RT/Groups.pm index 1c4278c74..29f12a5a0 100755 --- a/rt/lib/RT/Groups.pm +++ b/rt/lib/RT/Groups.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # Autogenerated by DBIx::SearchBuilder factory (by <jesse@bestpractical.com>) # WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST. # @@ -86,7 +64,7 @@ sub _Init { } -=head2 NewItem +=item NewItem Returns an empty new RT::Group item diff --git a/rt/lib/RT/Handle.pm b/rt/lib/RT/Handle.pm index 8d4563b66..5cdb65e5b 100644 --- a/rt/lib/RT/Handle.pm +++ b/rt/lib/RT/Handle.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# CONTRIBUTION SUBMISSION POLICY: # -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) -# -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. -# -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK =head1 NAME RT::Handle - RT's database handle @@ -70,13 +48,7 @@ use vars qw/@ISA/; eval "use DBIx::SearchBuilder::Handle::$RT::DatabaseType; \@ISA= qw(DBIx::SearchBuilder::Handle::$RT::DatabaseType);"; - -if ($@) { - die "Unable to load DBIx::SearchBuilder database handle for '$RT::DatabaseType'.". - "\n". - "Perhaps you've picked an invalid database type or spelled it incorrectly.". - "\n". $@; -} +#TODO check for errors here. =head2 Connect @@ -86,18 +58,14 @@ Takes nothing. Calls SUPER::Connect with the needed args =cut sub Connect { - my $self = shift; +my $self=shift; - if ($RT::DatabaseType eq 'Oracle') { - $ENV{'NLS_LANG'} = ".UTF8"; - } +# Unless the database port is a positive integer, we really don't want to pass it. - $self->SUPER::Connect( +$self->SUPER::Connect( User => $RT::DatabaseUser, Password => $RT::DatabasePassword, ); - - $self->dbh->{LongReadLen} = $RT::MaxAttachmentSize; } @@ -111,11 +79,9 @@ from the config file. sub BuildDSN { my $self = shift; -# Unless the database port is a positive integer, we really don't want to pass it. $RT::DatabasePort = undef unless (defined $RT::DatabasePort && $RT::DatabasePort =~ /^(\d+)$/); $RT::DatabaseHost = undef unless (defined $RT::DatabaseHost && $RT::DatabaseHost ne ''); - $self->SUPER::BuildDSN(Host => $RT::DatabaseHost, Database => $RT::DatabaseName, Port => $RT::DatabasePort, diff --git a/rt/lib/RT/Interface/CLI.pm b/rt/lib/RT/Interface/CLI.pm index 417999473..ec0e877b4 100644 --- a/rt/lib/RT/Interface/CLI.pm +++ b/rt/lib/RT/Interface/CLI.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK use strict; use RT; @@ -55,7 +33,7 @@ BEGIN { use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); # set the version for version checking - $VERSION = do { my @r = (q$Revision: 1.1.1.2 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker + $VERSION = do { my @r = (q$Revision: 1.2 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker @ISA = qw(Exporter); diff --git a/rt/lib/RT/Interface/Email.pm b/rt/lib/RT/Interface/Email.pm index 04539a3a6..7eec0502f 100755 --- a/rt/lib/RT/Interface/Email.pm +++ b/rt/lib/RT/Interface/Email.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,43 +14,27 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. -# -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK package RT::Interface::Email; use strict; use Mail::Address; use MIME::Entity; use RT::EmailParser; -use File::Temp; + BEGIN { use Exporter (); use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); # set the version for version checking - $VERSION = do { my @r = (q$Revision: 1.1.1.4 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker + $VERSION = do { my @r = (q$Revision: 1.2 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker @ISA = qw(Exporter); @@ -79,7 +57,7 @@ BEGIN { =head1 NAME - RT::Interface::Email - helper functions for parsing email sent to RT + RT::Interface::CLI - helper functions for creating a commandline RT interface =head1 SYNOPSIS @@ -175,7 +153,6 @@ sub MailError { Subject => 'There has been an error', Explanation => 'Unexplained error', MIMEObj => undef, - Attach => undef, LogLevel => 'crit', @_); @@ -188,7 +165,6 @@ sub MailError { Bcc => $args{'Bcc'}, To => $args{'To'}, Subject => $args{'Subject'}, - Precedence => 'bulk', 'X-RT-Loop-Prevention' => $RT::rtname, ); @@ -199,19 +175,14 @@ sub MailError { $mimeobj->sync_headers(); $entity->add_part($mimeobj); } - - if ($args{'Attach'}) { - $entity->attach(Data => $args{'Attach'}, Type => 'message/rfc822'); - - } - + if ($RT::MailCommand eq 'sendmailpipe') { open (MAIL, "|$RT::SendmailPath $RT::SendmailArguments") || return(0); print MAIL $entity->as_string; close(MAIL); } else { - $entity->send($RT::MailCommand, $RT::MailParams); + $entity->send($RT::MailCommand, $RT::MailParams); } } @@ -223,6 +194,12 @@ sub CreateUser { my ($Username, $Address, $Name, $ErrorsTo, $entity) = @_; my $NewUser = RT::User->new($RT::SystemUser); + # This data is tainted by some Very Broken mailers. + # (Sometimes they send raw ISO 8859-1 data here. fear that. + require Encode; + $Username = Encode::encode(utf8 => $Username, Encode::FB_PERLQQ()) if defined $Username; + $Name = Encode::encode(utf8 => $Name, Encode::FB_PERLQQ()) if defined $Name; + my ($Val, $Message) = $NewUser->Create(Name => ($Username || $Address), EmailAddress => $Address, @@ -384,82 +361,36 @@ sub ParseAddressFromHeader{ -=head2 Gateway ARGSREF - - -Takes parameters: - - action - queue - message - +=head2 Gateway This performs all the "guts" of the mail rt-mailgate program, and is designed to be called from the web interface with a message, user object, and so on. -Can also take an optional 'ticket' parameter; this ticket id overrides -any ticket id found in the subject. - -Returns: - - An array of: - - (status code, message, optional ticket object) - - status code is a numeric value. - - for temporary failures, status code should be -75 - - for permanent failures which are handled by RT, status code should be 0 - - for succces, the status code should be 1 - - - =cut sub Gateway { - my $argsref = shift; - - my %args = %$argsref; - - # Set some reasonable defaults - $args{'action'} = 'correspond' unless ( $args{'action'} ); - $args{'queue'} = '1' unless ( $args{'queue'} ); + my %args = ( message => undef, + queue => 1, + action => 'correspond', + ticket => undef, + @_ ); # Validate the action unless ( $args{'action'} =~ /^(comment|correspond|action)$/ ) { # Can't safely loc this. What object do we loc around? - $RT::Logger->crit("Mail gateway called with an invalid action paramenter '".$args{'action'}."' for queue '".$args{'queue'}."'"); - - return ( -75, "Invalid 'action' parameter", undef ); + return ( 0, "Invalid 'action' parameter", undef ); } my $parser = RT::EmailParser->new(); - - $parser->SmartParseMIMEEntityFromScalar( Message => $args{'message'}); - - if (!$parser->Entity()) { - MailError( - To => $RT::OwnerEmail, - Subject => "RT Bounce: Unparseable message", - Explanation => "RT couldn't process the message below", - Attach => $args{'message'} - ); - - return(0,"Failed to parse this message. Something is likely badly wrong with the message"); - } + $parser->ParseMIMEEntityFromScalar( $args{'message'} ); my $Message = $parser->Entity(); - my $head = $Message->head; + my $head = $Message->head; my ( $CurrentUser, $AuthStat, $status, $error ); - # Initalize AuthStat so comparisons work correctly - $AuthStat = -9999999; - my $ErrorsTo = ParseErrorsToAddressFromHead($head); my $MessageId = $head->get('Message-Id') @@ -469,111 +400,88 @@ sub Gateway { my $Subject = $head->get('Subject') || ''; chomp $Subject; + $args{'ticket'} ||= $parser->ParseTicketId($Subject); my $SystemTicket; - my $Right = 'CreateTicket'; - if ( $args{'ticket'} ) { + if ($args{'ticket'} ) { $SystemTicket = RT::Ticket->new($RT::SystemUser); - $SystemTicket->Load( $args{'ticket'} ); - # if there's an existing ticket, this must be a reply - $Right = 'ReplyToTicket'; + $SystemTicket->Load($args{'ticket'}); } #Set up a queue object my $SystemQueueObj = RT::Queue->new($RT::SystemUser); $SystemQueueObj->Load( $args{'queue'} ); + # We can safely have no queue of we have a known-good ticket unless ( $args{'ticket'} || $SystemQueueObj->id ) { - return ( -75, "RT couldn't find the queue: " . $args{'queue'}, undef ); + MailError( + To => $RT::OwnerEmail, + Subject => "RT Bounce: $Subject", + Explanation => "RT couldn't find the queue: " . $args{'queue'}, + MIMEObj => $Message ); + return ( 0, "RT couldn't find the queue: " . $args{'queue'}, undef ); } # Authentication Level - # -1 - Get out. this user has been explicitly declined + # -1 - Get out. this user has been explicitly declined # 0 - User may not do anything (Not used at the moment) # 1 - Normal user # 2 - User is allowed to specify status updates etc. a la enhanced-mailgate - push @RT::MailPlugins, "Auth::MailFrom" unless @RT::MailPlugins; - + push @RT::MailPlugins, "Auth::MailFrom" unless @RT::MailPlugins; # Since this needs loading, no matter what - foreach (@RT::MailPlugins) { + for (@RT::MailPlugins) { my $Code; my $NewAuthStat; if ( ref($_) eq "CODE" ) { $Code = $_; } else { - $_ = "RT::Interface::Email::".$_ unless $_ =~ /^RT::Interface::Email::/; + $_ = "RT::Interface::Email::$_" unless /^RT::Interface::Email::/; eval "require $_;"; if ($@) { - $RT::Logger->crit("Couldn't load module '$_': $@"); + die ("Couldn't load module $_: $@"); next; } no strict 'refs'; if ( !defined( $Code = *{ $_ . "::GetCurrentUser" }{CODE} ) ) { - $RT::Logger->crit("No GetCurrentUser code found in $_ module"); + die ("No GetCurrentUser code found in $_ module"); next; } } - ( $CurrentUser, $NewAuthStat ) = $Code->( - Message => $Message, - RawMessageRef => \$args{'message'}, - CurrentUser => $CurrentUser, - AuthLevel => $AuthStat, - Action => $args{'action'}, - Ticket => $SystemTicket, - Queue => $SystemQueueObj - ); - - - # If a module returns a "-1" then we discard the ticket, so. - $AuthStat = -1 if $NewAuthStat == -1; + ( $CurrentUser, $NewAuthStat ) = $Code->( Message => $Message, + CurrentUser => $CurrentUser, + AuthLevel => $AuthStat, + Action => $args{'action'}, + Ticket => $SystemTicket, + Queue => $SystemQueueObj ); # You get the highest level of authentication you were assigned. - $AuthStat = $NewAuthStat if $NewAuthStat > $AuthStat; last if $AuthStat == -1; + $AuthStat = $NewAuthStat if $NewAuthStat > $AuthStat; } # {{{ If authentication fails and no new user was created, get out. if ( !$CurrentUser or !$CurrentUser->Id or $AuthStat == -1 ) { # If the plugins refused to create one, they lose. - unless ( $AuthStat == -1 ) { - - # Notify the RT Admin of the failure. - # XXX Should this be configurable? - MailError( - To => $RT::OwnerEmail, - Subject => "Could not load a valid user", - Explanation => <<EOT, -RT could not load a valid user, and RT's configuration does not allow -for the creation of a new user for this email ($ErrorsTo). - -You might need to grant 'Everyone' the right '$Right' for the -queue @{[$args{'queue'}]}. - -EOT - MIMEObj => $Message, - LogLevel => 'error' - ); - - # Also notify the requestor that his request has been dropped. - MailError( - To => $ErrorsTo, - Subject => "Could not load a valid user", - Explanation => <<EOT, + MailError( + Subject => "Could not load a valid user", + Explanation => <<EOT, RT could not load a valid user, and RT's configuration does not allow for the creation of a new user for your email. +Your RT administrator needs to grant 'Everyone' the right 'CreateTicket' +for this queue. + EOT - MIMEObj => $Message, - LogLevel => 'error' - ); - } + MIMEObj => $Message, + LogLevel => 'error' ) + unless $AuthStat == -1; return ( 0, "Could not load a valid user", undef ); } @@ -600,11 +508,10 @@ EOT # {{{ Drop it if it's disallowed if ( $AuthStat == 0 ) { MailError( - To => $ErrorsTo, - Subject => "Permission Denied", - Explanation => "You do not have permission to communicate with RT", - MIMEObj => $Message - ); + To => $ErrorsTo, + Subject => "Permission Denied", + Explanation => "You do not have permission to communicate with RT", + MIMEObj => $Message ); } # }}} @@ -616,16 +523,14 @@ EOT #Should we mail it to RTOwner? if ($RT::LoopsToRTOwner) { - MailError( - To => $RT::OwnerEmail, - Subject => "RT Bounce: $Subject", - Explanation => "RT thinks this message may be a bounce", - MIMEObj => $Message - ); - } + MailError( To => $RT::OwnerEmail, + Subject => "RT Bounce: $Subject", + Explanation => "RT thinks this message may be a bounce", + MIMEObj => $Message ); - #Do we actually want to store it? - return ( 0, "Message Bounced", undef ) unless ($RT::StoreLoops); + #Do we actually want to store it? + return ( 0, "Message Bounced", undef ) unless ($RT::StoreLoops); + } } # }}} @@ -633,10 +538,8 @@ EOT # {{{ Squelch replies if necessary # Don't let the user stuff the RT-Squelch-Replies-To header. if ( $head->get('RT-Squelch-Replies-To') ) { - $head->add( - 'RT-Relocated-Squelch-Replies-To', - $head->get('RT-Squelch-Replies-To') - ); + $head->add( 'RT-Relocated-Squelch-Replies-To', + $head->get('RT-Squelch-Replies-To') ); $head->delete('RT-Squelch-Replies-To'); } @@ -661,27 +564,22 @@ EOT my @Requestors = ( $CurrentUser->id ); if ($RT::ParseNewMessageForTicketCcs) { - @Cc = ParseCcAddressesFromHead( - Head => $head, - CurrentUser => $CurrentUser, - QueueObj => $SystemQueueObj - ); + @Cc = ParseCcAddressesFromHead( Head => $head, + CurrentUser => $CurrentUser, + QueueObj => $SystemQueueObj ); } my ( $id, $Transaction, $ErrStr ) = $Ticket->Create( - Queue => $SystemQueueObj->Id, - Subject => $Subject, - Requestor => \@Requestors, - Cc => \@Cc, - MIMEObj => $Message - ); + Queue => $SystemQueueObj->Id, + Subject => $Subject, + Requestor => \@Requestors, + Cc => \@Cc, + MIMEObj => $Message ); if ( $id == 0 ) { - MailError( - To => $ErrorsTo, - Subject => "Ticket creation failed", - Explanation => $ErrStr, - MIMEObj => $Message - ); + MailError( To => $ErrorsTo, + Subject => "Ticket creation failed", + Explanation => $ErrStr, + MIMEObj => $Message ); $RT::Logger->error("Create failed: $id / $Transaction / $ErrStr "); return ( 0, "Ticket creation failed", $Ticket ); } @@ -693,17 +591,15 @@ EOT # If the action is comment, add a comment. elsif ( $args{'action'} =~ /^(comment|correspond)$/i ) { - $Ticket->Load( $args{'ticket'} ); + $Ticket->Load($args{'ticket'}); unless ( $Ticket->Id ) { - my $message = "Could not find a ticket with id " . $args{'ticket'}; - MailError( - To => $ErrorsTo, - Subject => "Message not recorded", - Explanation => $message, - MIMEObj => $Message - ); - - return ( 0, $message ); + my $message = "Could not find a ticket with id ".$args{'ticket'}; + MailError( To => $ErrorsTo, + Subject => "Message not recorded", + Explanation => $message, + MIMEObj => $Message ); + + return ( 0, $message); } my ( $status, $msg ); @@ -716,12 +612,10 @@ EOT unless ($status) { #Warn the sender that we couldn't actually submit the comment. - MailError( - To => $ErrorsTo, - Subject => "Message not recorded", - Explanation => $msg, - MIMEObj => $Message - ); + MailError( To => $ErrorsTo, + Subject => "Message not recorded", + Explanation => $msg, + MIMEObj => $Message ); return ( 0, "Message not recorded", $Ticket ); } } @@ -729,30 +623,22 @@ EOT else { #Return mail to the sender with an error - MailError( - To => $ErrorsTo, - Subject => "RT Configuration error", - Explanation => "'" - . $args{'action'} - . "' not a recognized action." - . " Your RT administrator has misconfigured " - . "the mail aliases which invoke RT", - MIMEObj => $Message - ); + MailError( To => $ErrorsTo, + Subject => "RT Configuration error", + Explanation => "'" + . $args{'action'} + . "' not a recognized action." + . " Your RT administrator has misconfigured " + . "the mail aliases which invoke RT", + MIMEObj => $Message ); $RT::Logger->crit( $args{'action'} . " type unknown for $MessageId" ); - return ( - -75, - "Configuration error: " - . $args{'action'} - . " not a recognized action", - $Ticket - ); + return ( 0, "Configuration error: " . $args{'action'} . " not a recognized action", $Ticket ); } - return ( 1, "Success", $Ticket ); -} +return ( 1, "Success", $Ticket ); +} eval "require RT::Interface::Email_Vendor"; die $@ if ($@ && $@ !~ qr{^Can't locate RT/Interface/Email_Vendor.pm}); diff --git a/rt/lib/RT/Interface/Web.pm b/rt/lib/RT/Interface/Web.pm index 0151cc1f1..5097f54a4 100644 --- a/rt/lib/RT/Interface/Web.pm +++ b/rt/lib/RT/Interface/Web.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK ## Portions Copyright 2000 Tobias Brox <tobix@fsck.com> ## This is a library of static subs to be used by the Mason web @@ -67,83 +45,94 @@ use strict; -# {{{ EscapeUTF8 -=head2 EscapeUTF8 SCALARREF -does a css-busting but minimalist escaping of whatever html you're passing in. +# {{{ sub NewApacheHandler -=cut +=head2 NewApacheHandler -sub EscapeUTF8 { - my $ref = shift; - my $val = $$ref; - use bytes; - $val =~ s/&/&/g; - $val =~ s/</</g; - $val =~ s/>/>/g; - $val =~ s/\(/(/g; - $val =~ s/\)/)/g; - $val =~ s/"/"/g; - $val =~ s/'/'/g; - $$ref = $val; - Encode::_utf8_on($$ref); + Takes extra options to pass to HTML::Mason::ApacheHandler->new + Returns a new Mason::ApacheHandler object +=cut +sub NewApacheHandler { + require HTML::Mason::ApacheHandler; + my $ah = new HTML::Mason::ApacheHandler( + + comp_root => [ + [ local => $RT::MasonLocalComponentRoot ], + [ standard => $RT::MasonComponentRoot ] + ], + args_method => "CGI", + default_escape_flags => 'h', + allow_globals => [qw(%session)], + data_dir => "$RT::MasonDataDir", + @_ + ); + + $ah->interp->set_escape( h => \&RT::Interface::Web::EscapeUTF8 ); + + return ($ah); } # }}} -# {{{ WebCanonicalizeInfo +# {{{ sub NewCGIHandler -=head2 WebCanonicalizeInfo(); +=head2 NewCGIHandler -Different web servers set different environmental varibles. This -function must return something suitable for REMOTE_USER. By default, -just downcase $ENV{'REMOTE_USER'} + Returns a new Mason::CGIHandler object =cut -sub WebCanonicalizeInfo { - my $user; - - if ( defined $ENV{'REMOTE_USER'} ) { - $user = lc ( $ENV{'REMOTE_USER'} ) if( length($ENV{'REMOTE_USER'}) ); - } +sub NewCGIHandler { + my %args = ( + @_ + ); - return $user; -} + my $handler = HTML::Mason::CGIHandler->new( + comp_root => [ + [ local => $RT::MasonLocalComponentRoot ], + [ standard => $RT::MasonComponentRoot ] + ], + data_dir => "$RT::MasonDataDir", + default_escape_flags => 'h', + allow_globals => [qw(%session)] + ); + -# }}} + $handler->interp->set_escape( h => \&RT::Interface::Web::EscapeUTF8 ); -# {{{ WebExternalAutoInfo -=head2 WebExternalAutoInfo($user); + return ($handler); -Returns a hash of user attributes, used when WebExternalAuto is set. +} +# }}} -=cut -sub WebExternalAutoInfo { - my $user = shift; +# {{{ EscapeUTF8 - my %user_info; +=head2 EscapeUTF8 SCALARREF - $user_info{'Privileged'} = 1; +does a css-busting but minimalist escaping of whatever html you're passing in. - if ($^O !~ /^(?:riscos|MacOS|MSWin32|dos|os2)$/) { - # Populate fields with information from Unix /etc/passwd +=cut - my ($comments, $realname) = (getpwnam($user))[5, 6]; - $user_info{'Comments'} = $comments if defined $comments; - $user_info{'RealName'} = $realname if defined $realname; - } - elsif ($^O eq 'MSWin32' and eval 'use Net::AdminMisc; 1') { - # Populate fields with information from NT domain controller - } +sub EscapeUTF8 { + my $ref = shift; + my $val = $$ref; + use bytes; + $val =~ s/&/&/g; + $val =~ s/</</g; + $val =~ s/>/>/g; + $val =~ s/\(/(/g; + $val =~ s/\)/)/g; + $val =~ s/"/"/g; + $val =~ s/'/'/g; + $$ref = $val; + Encode::_utf8_on($$ref); - # and return the wad of stuff - return {%user_info}; } # }}} @@ -171,13 +160,10 @@ sub loc { UNIVERSAL::can($session{'CurrentUser'}, 'loc')){ return($session{'CurrentUser'}->loc(@_)); } - elsif ( my $u = eval { RT::CurrentUser->new($RT::SystemUser->Id) } ) { + else { + my $u = RT::CurrentUser->new($RT::SystemUser); return ($u->loc(@_)); } - else { - # pathetic case -- SystemUser is gone. - return $_[0]; - } } # }}} @@ -203,7 +189,7 @@ sub loc_fuzzy { return($session{'CurrentUser'}->loc_fuzzy($msg)); } else { - my $u = RT::CurrentUser->new($RT::SystemUser->Id); + my $u = RT::CurrentUser->new($RT::SystemUser); return ($u->loc_fuzzy($msg)); } } @@ -275,7 +261,6 @@ sub CreateTicket { } my %create_args = ( - Type => $ARGS{'Type'} || 'ticket', Queue => $ARGS{'Queue'}, Owner => $ARGS{'Owner'}, InitialPriority => $ARGS{'InitialPriority'}, @@ -292,54 +277,36 @@ sub CreateTicket { Starts => $starts->ISO, MIMEObj => $MIMEObj ); - foreach my $arg (%ARGS) { + foreach my $arg (%ARGS) { if ($arg =~ /^CustomField-(\d+)(.*?)$/) { next if ($arg =~ /-Magic$/); $create_args{"CustomField-".$1} = $ARGS{"$arg"}; } } - - # turn new link lists into arrays, and pass in the proper arguments - my (@dependson, @dependedonby, - @parents, @children, - @refersto, @referredtoby); - - foreach my $luri ( split ( / /, $ARGS{"new-DependsOn"} ) ) { - $luri =~ s/\s*$//; # Strip trailing whitespace - push @dependson, $luri; - } - $create_args{'DependsOn'} = \@dependson; - - foreach my $luri ( split ( / /, $ARGS{"DependsOn-new"} ) ) { - push @dependedonby, $luri; - } - $create_args{'DependedOnBy'} = \@dependedonby; - - foreach my $luri ( split ( / /, $ARGS{"new-MemberOf"} ) ) { - $luri =~ s/\s*$//; # Strip trailing whitespace - push @parents, $luri; - } - $create_args{'Parents'} = \@parents; - - foreach my $luri ( split ( / /, $ARGS{"MemberOf-new"} ) ) { - push @children, $luri; + my ( $id, $Trans, $ErrMsg ) = $Ticket->Create(%create_args); + unless ( $id && $Trans ) { + Abort($ErrMsg); } - $create_args{'Children'} = \@children; + my @linktypes = qw( DependsOn MemberOf RefersTo ); - foreach my $luri ( split ( / /, $ARGS{"new-RefersTo"} ) ) { - $luri =~ s/\s*$//; # Strip trailing whitespace - push @refersto, $luri; - } - $create_args{'RefersTo'} = \@refersto; + foreach my $linktype (@linktypes) { + foreach my $luri ( split ( / /, $ARGS{"new-$linktype"} ) ) { + $luri =~ s/\s*$//; # Strip trailing whitespace + my ( $val, $msg ) = $Ticket->AddLink( + Target => $luri, + Type => $linktype + ); + push ( @Actions, $msg ) unless ($val); + } - foreach my $luri ( split ( / /, $ARGS{"RefersTo-new"} ) ) { - push @referredtoby, $luri; - } - $create_args{'ReferredToBy'} = \@referredtoby; + foreach my $luri ( split ( / /, $ARGS{"$linktype-new"} ) ) { + my ( $val, $msg ) = $Ticket->AddLink( + Base => $luri, + Type => $linktype + ); - my ( $id, $Trans, $ErrMsg ) = $Ticket->Create(%create_args); - unless ( $id && $Trans ) { - Abort($ErrMsg); + push ( @Actions, $msg ) unless ($val); + } } push ( @Actions, split("\n", $ErrMsg) ); @@ -398,9 +365,7 @@ sub ProcessUpdateMessage { ); #Make the update content have no 'weird' newlines in it - if ( $args{ARGSRef}->{'UpdateTimeWorked'} || - $args{ARGSRef}->{'UpdateContent'} || - $args{ARGSRef}->{'UpdateAttachments'}) { + if ( $args{ARGSRef}->{'UpdateContent'} ) { if ( $args{ARGSRef}->{'UpdateSubject'} eq $args{'TicketObj'}->Subject() ) @@ -420,7 +385,7 @@ sub ProcessUpdateMessage { ## TODO: Implement public comments if ( $args{ARGSRef}->{'UpdateType'} =~ /^(private|public)$/ ) { - my ( $Transaction, $Description, $Object ) = $args{TicketObj}->Comment( + my ( $Transaction, $Description ) = $args{TicketObj}->Comment( CcMessageTo => $args{ARGSRef}->{'UpdateCc'}, BccMessageTo => $args{ARGSRef}->{'UpdateBcc'}, MIMEObj => $Message, @@ -429,7 +394,7 @@ sub ProcessUpdateMessage { push ( @{ $args{Actions} }, $Description ); } elsif ( $args{ARGSRef}->{'UpdateType'} eq 'response' ) { - my ( $Transaction, $Description, $Object ) = $args{TicketObj}->Correspond( + my ( $Transaction, $Description ) = $args{TicketObj}->Correspond( CcMessageTo => $args{ARGSRef}->{'UpdateCc'}, BccMessageTo => $args{ARGSRef}->{'UpdateBcc'}, MIMEObj => $Message, @@ -468,8 +433,7 @@ sub MakeMIMEEntity { Cc => undef, Body => undef, AttachmentFieldName => undef, -# map Encode::encode_utf8($_), @_, - @_, + map Encode::encode_utf8($_), @_, ); #Make the update content have no 'weird' newlines in it @@ -485,7 +449,6 @@ sub MakeMIMEEntity { Subject => $args{'Subject'} || "", From => $args{'From'}, Cc => $args{'Cc'}, - Charset => 'utf8', Data => [ $args{'Body'} ] ); } @@ -500,14 +463,7 @@ sub MakeMIMEEntity { #foreach my $filehandle (@filenames) { - my ( $fh, $temp_file ); - for ( 1 .. 10 ) { - # on NFS and NTFS, it is possible that tempfile() conflicts - # with other processes, causing a race condition. we try to - # accommodate this by pausing and retrying. - last if ($fh, $temp_file) = eval { tempfile( UNLINK => 1) }; - sleep 1; - } + my ( $fh, $temp_file ) = tempfile(); binmode $fh; #thank you, windows my ($buffer); @@ -525,7 +481,7 @@ sub MakeMIMEEntity { $Message->attach( Path => $temp_file, - Filename => Encode::decode_utf8($filename), + Filename => $filename, Type => $uploadinfo->{'Content-Type'}, ); close($fh); @@ -638,13 +594,13 @@ sub ProcessSearchQuery { # }}} # {{{ Limit requestor email - if ( $args{ARGS}->{'ValueOfWatcherRole'} ne '' ) { - $session{'tickets'}->LimitWatcher( - TYPE => $args{ARGS}->{'WatcherRole'}, - VALUE => $args{ARGS}->{'ValueOfWatcherRole'}, - OPERATOR => $args{ARGS}->{'WatcherRoleOp'}, + if ( $args{ARGS}->{'ValueOfRequestor'} ne '' ) { + my $alias = $session{'tickets'}->LimitRequestor( + VALUE => $args{ARGS}->{'ValueOfRequestor'}, + OPERATOR => $args{ARGS}->{'RequestorOp'}, ); + } # }}} @@ -824,13 +780,17 @@ sub ProcessACLChanges { my $obj; - if ($object_type eq 'RT::System') { - $obj = $RT::System; - } elsif ($RT::ACE::OBJECT_TYPES{$object_type}) { - $obj = $object_type->new($session{'CurrentUser'}); + if ($object_type eq 'RT::Queue') { + $obj = RT::Queue->new($session{'CurrentUser'}); + $obj->Load($object_id); + } elsif ($object_type eq 'RT::Group') { + $obj = RT::Group->new($session{'CurrentUser'}); $obj->Load($object_id); + + } elsif ($object_type eq 'RT::System') { + $obj = $RT::System; } else { - push (@results, loc("System Error"). ': '. + push (@results, loc("System Error"). loc("Rights could not be granted for [_1]", $object_type)); next; } @@ -853,14 +813,17 @@ sub ProcessACLChanges { next unless ($right); my $obj; - if ($object_type eq 'RT::System') { - $obj = $RT::System; - } elsif ($RT::ACE::OBJECT_TYPES{$object_type}) { - $obj = $object_type->new($session{'CurrentUser'}); + if ($object_type eq 'RT::Queue') { + $obj = RT::Queue->new($session{'CurrentUser'}); $obj->Load($object_id); + } elsif ($object_type eq 'RT::Group') { + $obj = RT::Group->new($session{'CurrentUser'}); + $obj->Load($object_id); + + } elsif ($object_type eq 'RT::System') { + $obj = $RT::System; } else { - die; - push (@results, loc("System Error"). ': '. + push (@results, loc("System Error"). loc("Rights could not be revoked for [_1]", $object_type)); next; } @@ -896,12 +859,52 @@ sub UpdateRecordObject { @_ ); - my $Object = $args{'Object'}; - my @results = $Object->Update(AttributesRef => $args{'AttributesRef'}, - ARGSRef => $args{'ARGSRef'}, - AttributePrefix => $args{'AttributePrefix'} - ); + my (@results); + my $object = $args{'Object'}; + my $attributes = $args{'AttributesRef'}; + my $ARGSRef = $args{'ARGSRef'}; + foreach my $attribute (@$attributes) { + my $value; + if ( defined $ARGSRef->{$attribute} ) { + $value = $ARGSRef->{$attribute}; + } + elsif ( + defined( $args{'AttributePrefix'} ) + && defined( + $ARGSRef->{ $args{'AttributePrefix'} . "-" . $attribute } + ) + ) { + $value = $ARGSRef->{ $args{'AttributePrefix'} . "-" . $attribute }; + + } else { + next; + } + + $value =~ s/\r\n/\n/gs; + + if ($value ne $object->$attribute()){ + + my $method = "Set$attribute"; + my ( $code, $msg ) = $object->$method($value); + + push @results, loc($attribute) . ': ' . loc_fuzzy($msg); +=for loc + "[_1] could not be set to [_2].", # loc + "That is already the current value", # loc + "No value sent to _Set!\n", # loc + "Illegal value for [_1]", # loc + "The new value has been set.", # loc + "No column specified", # loc + "Immutable field", # loc + "Nonexistant field?", # loc + "Invalid data", # loc + "Couldn't find row", # loc + "Missing a primary key?: [_1]", # loc + "Found Object", # loc +=cut + }; + } return (@results); } @@ -950,17 +953,6 @@ sub ProcessCustomFieldUpdates { my ( $err, $msg ) = $Object->DeleteValue($id); push ( @results, $msg ); } - - my $vals = $Object->Values(); - while (my $cfv = $vals->Next()) { - if (my $so = $ARGSRef->{ 'CustomField-' . $Object->Id . '-SortOrder' . $cfv->Id }) { - if ($cfv->SortOrder != $so) { - my ( $err, $msg ) = $cfv->SetSortOrder($so); - push ( @results, $msg ); - } - } - } - return (@results); } @@ -993,7 +985,6 @@ sub ProcessTicketBasics { TimeEstimated TimeWorked TimeLeft - Type Status Queue ); @@ -1006,8 +997,6 @@ sub ProcessTicketBasics { } } - $ARGSRef->{'Status'} ||= $TicketObj->Status; - my @results = UpdateRecordObject( AttributesRef => \@attribs, Object => $TicketObj, @@ -1061,11 +1050,8 @@ sub ProcessTicketCustomFieldUpdates { # For each of those tickets foreach my $tick ( keys %custom_fields_to_mod ) { - my $Ticket = $args{'TicketObj'}; - if (!$Ticket or $Ticket->id != $tick) { - $Ticket = RT::Ticket->new( $session{'CurrentUser'} ); - $Ticket->Load($tick); - } + my $Ticket = RT::Ticket->new( $session{'CurrentUser'} ); + $Ticket->Load($tick); # For each custom field foreach my $cf ( keys %{ $custom_fields_to_mod{$tick} } ) { @@ -1088,15 +1074,10 @@ sub ProcessTicketCustomFieldUpdates { my @values = ( ref( $ARGSRef->{$arg} ) eq 'ARRAY' ) ? @{ $ARGSRef->{$arg} } - : split /\n/, $ARGSRef->{$arg} ; - - #for poor windows boxen that pass in "\r\n" - local $/ = "\r"; - chomp @values; - + : ( $ARGSRef->{$arg} ); if ( ( $arg =~ /-AddValue$/ ) || ( $arg =~ /-Value$/ ) ) { foreach my $value (@values) { - next unless length($value); + next unless ($value); my ( $val, $msg ) = $Ticket->AddCustomFieldValue( Field => $cf, Value => $value @@ -1106,7 +1087,7 @@ sub ProcessTicketCustomFieldUpdates { } elsif ( $arg =~ /-DeleteValues$/ ) { foreach my $value (@values) { - next unless length($value); + next unless ($value); my ( $val, $msg ) = $Ticket->DeleteCustomFieldValue( Field => $cf, Value => $value @@ -1119,7 +1100,7 @@ sub ProcessTicketCustomFieldUpdates { my %values_hash; foreach my $value (@values) { - next unless length($value); + next unless ($value); # build up a hash of values that the new set has $values_hash{$value} = 1; @@ -1204,7 +1185,7 @@ sub ProcessTicketWatchers { foreach my $key ( keys %$ARGSRef ) { # {{{ Delete deletable watchers - if ( ( $key =~ /^Ticket-DeleteWatcher-Type-(.*)-Principal-(\d+)$/ ) ) { + if ( ( $key =~ /^Ticket-DelWatcher-Type-(.*)-Principal-(\d+)$/ ) ) { my ( $code, $msg ) = $Ticket->DeleteWatcher(PrincipalId => $2, Type => $1); @@ -1212,8 +1193,8 @@ sub ProcessTicketWatchers { } # Delete watchers in the simple style demanded by the bulk manipulator - elsif ( $key =~ /^Delete(Requestor|Cc|AdminCc)$/ ) { - my ( $code, $msg ) = $Ticket->DeleteWatcher( Email => $ARGSRef->{$key}, Type => $1 ); + elsif ( $key =~ /^Delete(Requestor|Cc|AdminCc)$/ ) { + my ( $code, $msg ) = $Ticket->DeleteWatcher( Type => $ARGSRef->{$key}, PrincipalId => $1 ); push @results, $msg; } @@ -1333,29 +1314,6 @@ sub ProcessTicketLinks { my $Ticket = $args{'TicketObj'}; my $ARGSRef = $args{'ARGSRef'}; - my (@results) = ProcessRecordLinks(RecordObj => $Ticket, - ARGSRef => $ARGSRef); - - #Merge if we need to - if ( $ARGSRef->{ $Ticket->Id . "-MergeInto" } ) { - my ( $val, $msg ) = - $Ticket->MergeInto( $ARGSRef->{ $Ticket->Id . "-MergeInto" } ); - push @results, $msg; - } - - return (@results); -} - -# }}} - -sub ProcessRecordLinks { - my %args = ( RecordObj => undef, - ARGSRef => undef, - @_ ); - - my $Record = $args{'RecordObj'}; - my $ARGSRef = $args{'ARGSRef'}; - my (@results); # Delete links that are gone gone gone. @@ -1367,7 +1325,7 @@ sub ProcessRecordLinks { push @results, "Trying to delete: Base: $base Target: $target Type $type"; - my ( $val, $msg ) = $Record->DeleteLink( Base => $base, + my ( $val, $msg ) = $Ticket->DeleteLink( Base => $base, Type => $type, Target => $target ); @@ -1380,18 +1338,18 @@ sub ProcessRecordLinks { my @linktypes = qw( DependsOn MemberOf RefersTo ); foreach my $linktype (@linktypes) { - if ( $ARGSRef->{ $Record->Id . "-$linktype" } ) { - for my $luri ( split ( / /, $ARGSRef->{ $Record->Id . "-$linktype" } ) ) { + if ( $ARGSRef->{ $Ticket->Id . "-$linktype" } ) { + for my $luri ( split ( / /, $ARGSRef->{ $Ticket->Id . "-$linktype" } ) ) { $luri =~ s/\s*$//; # Strip trailing whitespace - my ( $val, $msg ) = $Record->AddLink( Target => $luri, + my ( $val, $msg ) = $Ticket->AddLink( Target => $luri, Type => $linktype ); push @results, $msg; } } - if ( $ARGSRef->{ "$linktype-" . $Record->Id } ) { + if ( $ARGSRef->{ "$linktype-" . $Ticket->Id } ) { - for my $luri ( split ( / /, $ARGSRef->{ "$linktype-" . $Record->Id } ) ) { - my ( $val, $msg ) = $Record->AddLink( Base => $luri, + for my $luri ( split ( / /, $ARGSRef->{ "$linktype-" . $Ticket->Id } ) ) { + my ( $val, $msg ) = $Ticket->AddLink( Base => $luri, Type => $linktype ); push @results, $msg; @@ -1399,9 +1357,18 @@ sub ProcessRecordLinks { } } + #Merge if we need to + if ( $ARGSRef->{ $Ticket->Id . "-MergeInto" } ) { + my ( $val, $msg ) = + $Ticket->MergeInto( $ARGSRef->{ $Ticket->Id . "-MergeInto" } ); + push @results, $msg; + } + return (@results); } +# }}} + eval "require RT::Interface::Web_Vendor"; die $@ if ($@ && $@ !~ qr{^Can't locate RT/Interface/Web_Vendor.pm}); eval "require RT::Interface::Web_Local"; diff --git a/rt/lib/RT/Interface/Web_Vendor.pm b/rt/lib/RT/Interface/Web_Vendor.pm new file mode 100644 index 000000000..5be20e6b9 --- /dev/null +++ b/rt/lib/RT/Interface/Web_Vendor.pm @@ -0,0 +1,95 @@ +# Copyright (c) 2004 Ivan Kohler <ivan-rt@420.am> +# +# This work is made available to you under the terms of Version 2 of +# the GNU General Public License. A copy of that license should have +# been provided with this software, but in any event can be snarfed +# from www.gnu.org. +# +# This work is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. + +=head1 NAME + +RT::Interface::Web_Vendor + +=head1 SYNOPSIS + +=head1 DESCRIPTION + +Freeside vendor overlay for RT::Interface::Web. + +=begin testing + +use_ok(RT::Interface::Web_Vendor); + +=end testing + +=cut + +#package RT::Interface::Web; +#use strict; + +package HTML::Mason::Commands; +use strict; + +=head2 ProcessTicketCustomers + +=cut + +sub ProcessTicketCustomers { + my %args = ( + TicketObj => undef, + ARGSRef => undef, + @_ + ); + my @results = (); + + my $Ticket = $args{'TicketObj'}; + my $ARGSRef = $args{'ARGSRef'}; + + ### false laziness w/RT::Interface::Web::ProcessTicketLinks + # Delete links that are gone gone gone. + foreach my $arg ( keys %$ARGSRef ) { + if ( $arg =~ /DeleteLink-(.*?)-(DependsOn|MemberOf|RefersTo)-(.*)$/ ) { + my $base = $1; + my $type = $2; + my $target = $3; + + push @results, + "Trying to delete: Base: $base Target: $target Type $type"; + my ( $val, $msg ) = $Ticket->DeleteLink( Base => $base, + Type => $type, + Target => $target ); + + push @results, $msg; + + } + + } + ### + + my @delete_custnums = + map { /^Ticket-AddCustomer-(\d+)$/; $1 } + grep { /^Ticket-AddCustomer-(\d+)$/ && $ARGSRef->{$_} } + keys %$ARGSRef; + + my @custnums = map { /^Ticket-AddCustomer-(\d+)$/; $1 } + grep { /^Ticket-AddCustomer-(\d+)$/ && $ARGSRef->{$_} } + keys %$ARGSRef; + + foreach my $custnum ( @custnums ) { + my( $val, $msg ) = + $Ticket->AddLink( 'Type' => 'MemberOf', + 'Target' => "freeside://freeside/cust_main/$custnum", + ); + push @results, $msg; + } + + return @results; + +} + +1; + diff --git a/rt/lib/RT/Link.pm b/rt/lib/RT/Link.pm index d9595fbf7..962c378a8 100644 --- a/rt/lib/RT/Link.pm +++ b/rt/lib/RT/Link.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # Autogenerated by DBIx::SearchBuilder factory (by <jesse@bestpractical.com>) # WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST. # @@ -83,7 +61,7 @@ sub _Init { -=head2 Create PARAMHASH +=item Create PARAMHASH Create takes a hash of values and creates a row in the database: @@ -120,7 +98,7 @@ sub Create { -=head2 id +=item id Returns the current value of id. (In the database, id is stored as int(11).) @@ -129,14 +107,14 @@ Returns the current value of id. =cut -=head2 Base +=item Base Returns the current value of Base. (In the database, Base is stored as varchar(240).) -=head2 SetBase VALUE +=item SetBase VALUE Set Base to VALUE. @@ -147,14 +125,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Target +=item Target Returns the current value of Target. (In the database, Target is stored as varchar(240).) -=head2 SetTarget VALUE +=item SetTarget VALUE Set Target to VALUE. @@ -165,14 +143,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Type +=item Type Returns the current value of Type. (In the database, Type is stored as varchar(20).) -=head2 SetType VALUE +=item SetType VALUE Set Type to VALUE. @@ -183,14 +161,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 LocalTarget +=item LocalTarget Returns the current value of LocalTarget. (In the database, LocalTarget is stored as int(11).) -=head2 SetLocalTarget VALUE +=item SetLocalTarget VALUE Set LocalTarget to VALUE. @@ -201,14 +179,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 LocalBase +=item LocalBase Returns the current value of LocalBase. (In the database, LocalBase is stored as int(11).) -=head2 SetLocalBase VALUE +=item SetLocalBase VALUE Set LocalBase to VALUE. @@ -219,7 +197,7 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 LastUpdatedBy +=item LastUpdatedBy Returns the current value of LastUpdatedBy. (In the database, LastUpdatedBy is stored as int(11).) @@ -228,7 +206,7 @@ Returns the current value of LastUpdatedBy. =cut -=head2 LastUpdated +=item LastUpdated Returns the current value of LastUpdated. (In the database, LastUpdated is stored as datetime.) @@ -237,7 +215,7 @@ Returns the current value of LastUpdated. =cut -=head2 Creator +=item Creator Returns the current value of Creator. (In the database, Creator is stored as int(11).) @@ -246,7 +224,7 @@ Returns the current value of Creator. =cut -=head2 Created +=item Created Returns the current value of Created. (In the database, Created is stored as datetime.) @@ -256,7 +234,7 @@ Returns the current value of Created. -sub _CoreAccessible { +sub _ClassAccessible { { id => diff --git a/rt/lib/RT/Links.pm b/rt/lib/RT/Links.pm index 07dcae718..7a1773af9 100644 --- a/rt/lib/RT/Links.pm +++ b/rt/lib/RT/Links.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # Autogenerated by DBIx::SearchBuilder factory (by <jesse@bestpractical.com>) # WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST. # @@ -86,7 +64,7 @@ sub _Init { } -=head2 NewItem +=item NewItem Returns an empty new RT::Link item diff --git a/rt/lib/RT/Queue.pm b/rt/lib/RT/Queue.pm index 03bb2def2..b362c9f0d 100755 --- a/rt/lib/RT/Queue.pm +++ b/rt/lib/RT/Queue.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # Autogenerated by DBIx::SearchBuilder factory (by <jesse@bestpractical.com>) # WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST. # @@ -83,7 +61,7 @@ sub _Init { -=head2 Create PARAMHASH +=item Create PARAMHASH Create takes a hash of values and creates a row in the database: @@ -129,7 +107,7 @@ sub Create { -=head2 id +=item id Returns the current value of id. (In the database, id is stored as int(11).) @@ -138,14 +116,14 @@ Returns the current value of id. =cut -=head2 Name +=item Name Returns the current value of Name. (In the database, Name is stored as varchar(200).) -=head2 SetName VALUE +=item SetName VALUE Set Name to VALUE. @@ -156,14 +134,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Description +=item Description Returns the current value of Description. (In the database, Description is stored as varchar(255).) -=head2 SetDescription VALUE +=item SetDescription VALUE Set Description to VALUE. @@ -174,14 +152,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 CorrespondAddress +=item CorrespondAddress Returns the current value of CorrespondAddress. (In the database, CorrespondAddress is stored as varchar(120).) -=head2 SetCorrespondAddress VALUE +=item SetCorrespondAddress VALUE Set CorrespondAddress to VALUE. @@ -192,14 +170,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 CommentAddress +=item CommentAddress Returns the current value of CommentAddress. (In the database, CommentAddress is stored as varchar(120).) -=head2 SetCommentAddress VALUE +=item SetCommentAddress VALUE Set CommentAddress to VALUE. @@ -210,14 +188,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 InitialPriority +=item InitialPriority Returns the current value of InitialPriority. (In the database, InitialPriority is stored as int(11).) -=head2 SetInitialPriority VALUE +=item SetInitialPriority VALUE Set InitialPriority to VALUE. @@ -228,14 +206,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 FinalPriority +=item FinalPriority Returns the current value of FinalPriority. (In the database, FinalPriority is stored as int(11).) -=head2 SetFinalPriority VALUE +=item SetFinalPriority VALUE Set FinalPriority to VALUE. @@ -246,14 +224,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 DefaultDueIn +=item DefaultDueIn Returns the current value of DefaultDueIn. (In the database, DefaultDueIn is stored as int(11).) -=head2 SetDefaultDueIn VALUE +=item SetDefaultDueIn VALUE Set DefaultDueIn to VALUE. @@ -264,7 +242,7 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Creator +=item Creator Returns the current value of Creator. (In the database, Creator is stored as int(11).) @@ -273,7 +251,7 @@ Returns the current value of Creator. =cut -=head2 Created +=item Created Returns the current value of Created. (In the database, Created is stored as datetime.) @@ -282,7 +260,7 @@ Returns the current value of Created. =cut -=head2 LastUpdatedBy +=item LastUpdatedBy Returns the current value of LastUpdatedBy. (In the database, LastUpdatedBy is stored as int(11).) @@ -291,7 +269,7 @@ Returns the current value of LastUpdatedBy. =cut -=head2 LastUpdated +=item LastUpdated Returns the current value of LastUpdated. (In the database, LastUpdated is stored as datetime.) @@ -300,14 +278,14 @@ Returns the current value of LastUpdated. =cut -=head2 Disabled +=item Disabled Returns the current value of Disabled. (In the database, Disabled is stored as smallint(6).) -=head2 SetDisabled VALUE +=item SetDisabled VALUE Set Disabled to VALUE. @@ -319,7 +297,7 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. -sub _CoreAccessible { +sub _ClassAccessible { { id => diff --git a/rt/lib/RT/Queues.pm b/rt/lib/RT/Queues.pm index e1be35374..60aec9086 100755 --- a/rt/lib/RT/Queues.pm +++ b/rt/lib/RT/Queues.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # Autogenerated by DBIx::SearchBuilder factory (by <jesse@bestpractical.com>) # WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST. # @@ -86,7 +64,7 @@ sub _Init { } -=head2 NewItem +=item NewItem Returns an empty new RT::Queue item diff --git a/rt/lib/RT/Record.pm b/rt/lib/RT/Record.pm index 57a5ea7fc..6962221ea 100755 --- a/rt/lib/RT/Record.pm +++ b/rt/lib/RT/Record.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# CONTRIBUTION SUBMISSION POLICY: # -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) -# -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. -# -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK =head1 NAME RT::Record - Base class for RT record objects @@ -66,12 +44,12 @@ ok (require RT::Record); package RT::Record; use RT::Date; use RT::User; -use RT::Attributes; + use RT::Base; use DBIx::SearchBuilder::Record::Cachable; use strict; -use vars qw/@ISA $_TABLE_ATTR/; +use vars qw/@ISA/; @ISA = qw(RT::Base); @@ -86,8 +64,8 @@ if ($RT::DontCacheSearchBuilderRecords ) { sub _Init { my $self = shift; - $self->_BuildTableAttributes unless ($_TABLE_ATTR->{ref($self)}); $self->CurrentUser(@_); + } # }}} @@ -107,102 +85,6 @@ sub _PrimaryKeys { # }}} -=head2 Attributes - -Return this object's attributes as an RT::Attributes object - -=cut - -sub Attributes { - my $self = shift; - - unless ($self->{'attributes'}) { - $self->{'attributes'} = RT::Attributes->new($self->CurrentUser); - $self->{'attributes'}->LimitToObject($self); - } - return ($self->{'attributes'}); - -} - - -=head2 AddAttribute { Name, Description, Content } - -Adds a new attribute for this object. - -=cut - -sub AddAttribute { - my $self = shift; - my %args = ( Name => undef, - Description => undef, - Content => undef, - @_ ); - - my $attr = RT::Attribute->new( $self->CurrentUser ); - my ( $id, $msg ) = $attr->Create( - Object => $self, - Name => $args{'Name'}, - Description => $args{'Description'}, - Content => $args{'Content'} ); - - $self->Attributes->RedoSearch; - - return ($id, $msg); -} - - -=head2 SetAttribute { Name, Description, Content } - -Like AddAttribute, but replaces all existing attributes with the same Name. - -=cut - -sub SetAttribute { - my $self = shift; - my %args = ( Name => undef, - Description => undef, - Content => undef, - @_ ); - - my @AttributeObjs = $self->Attributes->Named( $args{'Name'} ) - or return $self->AddAttribute( %args ); - - my $AttributeObj = pop( @AttributeObjs ); - $_->Delete foreach @AttributeObjs; - - $AttributeObj->SetDescription( $args{'Description'} ); - $AttributeObj->SetContent( $args{'Content'} ); - - $self->Attributes->RedoSearch; - return 1; -} - -=head2 DeleteAttribute NAME - -Deletes all attributes with the matching name for this object. - -=cut - -sub DeleteAttribute { - my $self = shift; - my $name = shift; - return $self->Attributes->DeleteEntry( Name => $name ); -} - -=head2 FirstAttribute NAME - -Returns the value of the first attribute with the matching name -for this object, or C<undef> if no such attributes exist. - -=cut - -sub FirstAttribute { - my $self = shift; - my $name = shift; - return ($self->Attributes->Named( $name ))[0]; -} - - # {{{ sub _Handle sub _Handle { my $self = shift; @@ -313,9 +195,6 @@ sub LoadByCols { my $self = shift; my %hash = (@_); - # We don't want to hang onto this - delete $self->{'attributes'}; - # If this database is case sensitive we need to uncase objects for # explicit loading if ( $self->_Handle->CaseSensitive ) { @@ -332,10 +211,7 @@ sub LoadByCols { $newhash{$key} = $hash{$key}; } else { - my ($op, $val); - ($key, $op, $val) = $self->_Handle->_MakeClauseCaseInsensitive($key, '=', $hash{$key}); - $newhash{$key}->{operator} = $op; - $newhash{$key}->{value} = $val; + $newhash{ "lower(" . $key . ")" } = lc( $hash{$key} ); } } @@ -534,47 +410,10 @@ sub LastUpdatedByObj { # }}} -# {{{ sub URI - -=head2 URI - -Returns this record's URI - -=cut - -sub URI { - my $self = shift; - my $uri = RT::URI::fsck_com_rt->new($self->CurrentUser); - return($uri->URIForObject($self)); -} - -# }}} - - - - - -=head2 SQLType attribute - -return the SQL type for the attribute 'attribute' as stored in _ClassAccessible - -=cut - -sub SQLType { - my $self = shift; - my $field = shift; - - return ($self->_Accessible($field, 'type')); - - -} require Encode::compat if $] < 5.007001; require Encode; - - - sub __Value { my $self = shift; my $field = shift; @@ -597,674 +436,17 @@ sub __Value { sub _CacheConfig { { 'cache_p' => 1, + 'fast_update_p' => 1, 'cache_for_sec' => 30, } } +=head2 _DecodeUTF8 - -sub _BuildTableAttributes { - my $self = shift; - - my $attributes; - if ( UNIVERSAL::can( $self, '_CoreAccessible' ) ) { - $attributes = $self->_CoreAccessible(); - } elsif ( UNIVERSAL::can( $self, '_ClassAccessible' ) ) { - $attributes = $self->_ClassAccessible(); - - } - - foreach my $column (%$attributes) { - foreach my $attr ( %{ $attributes->{$column} } ) { - $_TABLE_ATTR->{ref($self)}->{$column}->{$attr} = $attributes->{$column}->{$attr}; - } - } - if ( UNIVERSAL::can( $self, '_OverlayAccessible' ) ) { - $attributes = $self->_OverlayAccessible(); - - foreach my $column (%$attributes) { - foreach my $attr ( %{ $attributes->{$column} } ) { - $_TABLE_ATTR->{ref($self)}->{$column}->{$attr} = $attributes->{$column}->{$attr}; - } - } - } - if ( UNIVERSAL::can( $self, '_VendorAccessible' ) ) { - $attributes = $self->_VendorAccessible(); - - foreach my $column (%$attributes) { - foreach my $attr ( %{ $attributes->{$column} } ) { - $_TABLE_ATTR->{ref($self)}->{$column}->{$attr} = $attributes->{$column}->{$attr}; - } - } - } - if ( UNIVERSAL::can( $self, '_LocalAccessible' ) ) { - $attributes = $self->_LocalAccessible(); - - foreach my $column (%$attributes) { - foreach my $attr ( %{ $attributes->{$column} } ) { - $_TABLE_ATTR->{ref($self)}->{$column}->{$attr} = $attributes->{$column}->{$attr}; - } - } - } - -} - - -=head2 _ClassAccessible - -Overrides the "core" _ClassAccessible using $_TABLE_ATTR. Behaves identical to the version in -DBIx::SearchBuilder::Record - -=cut - -sub _ClassAccessible { - my $self = shift; - return $_TABLE_ATTR->{ref($self)}; -} - -=head2 _Accessible COLUMN ATTRIBUTE - -returns the value of ATTRIBUTE for COLUMN - - -=cut - -sub _Accessible { - my $self = shift; - my $column = shift; - my $attribute = lc(shift); - return 0 unless defined ($_TABLE_ATTR->{ref($self)}->{$column}); - return $_TABLE_ATTR->{ref($self)}->{$column}->{$attribute} || 0; - -} - -=head2 _EncodeLOB BODY MIME_TYPE - -Takes a potentially large attachment. Returns (ContentEncoding, EncodedBody) based on system configuration and selected database - -=cut - -sub _EncodeLOB { - my $self = shift; - my $Body = shift; - my $MIMEType = shift; - - my $ContentEncoding = 'none'; - - #get the max attachment length from RT - my $MaxSize = $RT::MaxAttachmentSize; - - #if the current attachment contains nulls and the - #database doesn't support embedded nulls - - if ( $RT::AlwaysUseBase64 or - ( !$RT::Handle->BinarySafeBLOBs ) && ( $Body =~ /\x00/ ) ) { - - # set a flag telling us to mimencode the attachment - $ContentEncoding = 'base64'; - - #cut the max attchment size by 25% (for mime-encoding overhead. - $RT::Logger->debug("Max size is $MaxSize\n"); - $MaxSize = $MaxSize * 3 / 4; - # Some databases (postgres) can't handle non-utf8 data - } elsif ( !$RT::Handle->BinarySafeBLOBs - && $MIMEType !~ /text\/plain/gi - && !Encode::is_utf8( $Body, 1 ) ) { - $ContentEncoding = 'quoted-printable'; - } - - #if the attachment is larger than the maximum size - if ( ($MaxSize) and ( $MaxSize < length($Body) ) ) { - - # if we're supposed to truncate large attachments - if ($RT::TruncateLongAttachments) { - - # truncate the attachment to that length. - $Body = substr( $Body, 0, $MaxSize ); - - } - - # elsif we're supposed to drop large attachments on the floor, - elsif ($RT::DropLongAttachments) { - - # drop the attachment on the floor - $RT::Logger->info( "$self: Dropped an attachment of size " . length($Body) . "\n" . "It started: " . substr( $Body, 0, 60 ) . "\n" ); - return ("none", "Large attachment dropped" ); - } - } - - # if we need to mimencode the attachment - if ( $ContentEncoding eq 'base64' ) { - - # base64 encode the attachment - Encode::_utf8_off($Body); - $Body = MIME::Base64::encode_base64($Body); - - } elsif ($ContentEncoding eq 'quoted-printable') { - Encode::_utf8_off($Body); - $Body = MIME::QuotedPrint::encode($Body); - } - - - return ($ContentEncoding, $Body); - -} - - -# {{{ LINKDIRMAP -# A helper table for links mapping to make it easier -# to build and parse links between tickets - -use vars '%LINKDIRMAP'; - -%LINKDIRMAP = ( - MemberOf => { Base => 'MemberOf', - Target => 'HasMember', }, - RefersTo => { Base => 'RefersTo', - Target => 'ReferredToBy', }, - DependsOn => { Base => 'DependsOn', - Target => 'DependedOnBy', }, - MergedInto => { Base => 'MergedInto', - Target => 'MergedInto', }, - -); - -sub Update { - my $self = shift; - - my %args = ( - ARGSRef => undef, - AttributesRef => undef, - AttributePrefix => undef, - @_ - ); - - my $attributes = $args{'AttributesRef'}; - my $ARGSRef = $args{'ARGSRef'}; - my @results; - - foreach my $attribute (@$attributes) { - my $value; - if ( defined $ARGSRef->{$attribute} ) { - $value = $ARGSRef->{$attribute}; - } - elsif ( - defined( $args{'AttributePrefix'} ) - && defined( - $ARGSRef->{ $args{'AttributePrefix'} . "-" . $attribute } - ) - ) - { - $value = $ARGSRef->{ $args{'AttributePrefix'} . "-" . $attribute }; - - } - else { - next; - } - - $value =~ s/\r\n/\n/gs; - - - # If Queue is 'General', we want to resolve the queue name for - # the object. - - # This is in an eval block because $object might not exist. - # and might not have a Name method. But "can" won't find autoloaded - # items. If it fails, we don't care - eval { - my $object = $attribute . "Obj"; - next if ($self->$object->Name eq $value); - }; - next if ( $value eq $self->$attribute() ); - my $method = "Set$attribute"; - my ( $code, $msg ) = $self->$method($value); - - my ($prefix) = ref($self) =~ /RT::(\w+)/; - push @results, - $self->loc( "$prefix [_1]", $self->id ) . ': ' - . $self->loc($attribute) . ': ' - . $self->CurrentUser->loc_fuzzy($msg); - -=for loc - "[_1] could not be set to [_2].", # loc - "That is already the current value", # loc - "No value sent to _Set!\n", # loc - "Illegal value for [_1]", # loc - "The new value has been set.", # loc - "No column specified", # loc - "Immutable field", # loc - "Nonexistant field?", # loc - "Invalid data", # loc - "Couldn't find row", # loc - "Missing a primary key?: [_1]", # loc - "Found Object", # loc -=cut - - } - - return @results; -} - -# {{{ Routines dealing with Links between tickets - -# {{{ Link Collections - -# {{{ sub Members - -=head2 Members - - This returns an RT::Links object which references all the tickets -which are 'MembersOf' this ticket + When passed a string will "decode" it int a proper UTF-8 string =cut -sub Members { - my $self = shift; - return ( $self->_Links( 'Target', 'MemberOf' ) ); -} - -# }}} - -# {{{ sub MemberOf - -=head2 MemberOf - - This returns an RT::Links object which references all the tickets that this -ticket is a 'MemberOf' - -=cut - -sub MemberOf { - my $self = shift; - return ( $self->_Links( 'Base', 'MemberOf' ) ); -} - -# }}} - -# {{{ RefersTo - -=head2 RefersTo - - This returns an RT::Links object which shows all references for which this ticket is a base - -=cut - -sub RefersTo { - my $self = shift; - return ( $self->_Links( 'Base', 'RefersTo' ) ); -} - -# }}} - -# {{{ ReferredToBy - -=head2 ReferredToBy - - This returns an RT::Links object which shows all references for which this ticket is a target - -=cut - -sub ReferredToBy { - my $self = shift; - return ( $self->_Links( 'Target', 'RefersTo' ) ); -} - -# }}} - -# {{{ DependedOnBy - -=head2 DependedOnBy - - This returns an RT::Links object which references all the tickets that depend on this one - -=cut - -sub DependedOnBy { - my $self = shift; - return ( $self->_Links( 'Target', 'DependsOn' ) ); -} - -# }}} - - - -=head2 HasUnresolvedDependencies - - Takes a paramhash of Type (default to '__any'). Returns true if -$self->UnresolvedDependencies returns an object with one or more members -of that type. Returns false otherwise - - -=begin testing - -my $t1 = RT::Ticket->new($RT::SystemUser); -my ($id, $trans, $msg) = $t1->Create(Subject => 'DepTest1', Queue => 'general'); -ok($id, "Created dep test 1 - $msg"); - -my $t2 = RT::Ticket->new($RT::SystemUser); -my ($id2, $trans, $msg2) = $t2->Create(Subject => 'DepTest2', Queue => 'general'); -ok($id2, "Created dep test 2 - $msg2"); -my $t3 = RT::Ticket->new($RT::SystemUser); -my ($id3, $trans, $msg3) = $t3->Create(Subject => 'DepTest3', Queue => 'general', Type => 'approval'); -ok($id3, "Created dep test 3 - $msg3"); -my ($addid, $addmsg); -ok (($addid, $addmsg) =$t1->AddLink( Type => 'DependsOn', Target => $t2->id)); -ok ($addid, $addmsg); -ok (($addid, $addmsg) =$t1->AddLink( Type => 'DependsOn', Target => $t3->id)); - -ok ($addid, $addmsg); -ok ($t1->HasUnresolvedDependencies, "Ticket ".$t1->Id." has unresolved deps"); -ok (!$t1->HasUnresolvedDependencies( Type => 'blah' ), "Ticket ".$t1->Id." has no unresolved blahs"); -ok ($t1->HasUnresolvedDependencies( Type => 'approval' ), "Ticket ".$t1->Id." has unresolved approvals"); -ok (!$t2->HasUnresolvedDependencies, "Ticket ".$t2->Id." has no unresolved deps"); -; - -my ($rid, $rmsg)= $t1->Resolve(); -ok(!$rid, $rmsg); -ok($t2->Resolve); -($rid, $rmsg)= $t1->Resolve(); -ok(!$rid, $rmsg); -ok($t3->Resolve); -($rid, $rmsg)= $t1->Resolve(); -ok($rid, $rmsg); - - -=end testing - -=cut - -sub HasUnresolvedDependencies { - my $self = shift; - my %args = ( - Type => undef, - @_ - ); - - my $deps = $self->UnresolvedDependencies; - - if ($args{Type}) { - $deps->Limit( FIELD => 'Type', - OPERATOR => '=', - VALUE => $args{Type}); - } - else { - $deps->IgnoreType; - } - - if ($deps->Count > 0) { - return 1; - } - else { - return (undef); - } -} - - -# {{{ UnresolvedDependencies - -=head2 UnresolvedDependencies - -Returns an RT::Tickets object of tickets which this ticket depends on -and which have a status of new, open or stalled. (That list comes from -RT::Queue->ActiveStatusArray - -=cut - - -sub UnresolvedDependencies { - my $self = shift; - my $deps = RT::Tickets->new($self->CurrentUser); - - my @live_statuses = RT::Queue->ActiveStatusArray(); - foreach my $status (@live_statuses) { - $deps->LimitStatus(VALUE => $status); - } - $deps->LimitDependedOnBy($self->Id); - - return($deps); - -} - -# }}} - -# {{{ AllDependedOnBy - -=head2 AllDependedOnBy - -Returns an array of RT::Ticket objects which (directly or indirectly) -depends on this ticket; takes an optional 'Type' argument in the param -hash, which will limit returned tickets to that type, as well as cause -tickets with that type to serve as 'leaf' nodes that stops the recursive -dependency search. - -=cut - -sub AllDependedOnBy { - my $self = shift; - my $dep = $self->DependedOnBy; - my %args = ( - Type => undef, - _found => {}, - _top => 1, - @_ - ); - - while (my $link = $dep->Next()) { - next unless ($link->BaseURI->IsLocal()); - next if $args{_found}{$link->BaseObj->Id}; - - if (!$args{Type}) { - $args{_found}{$link->BaseObj->Id} = $link->BaseObj; - $link->BaseObj->AllDependedOnBy( %args, _top => 0 ); - } - elsif ($link->BaseObj->Type eq $args{Type}) { - $args{_found}{$link->BaseObj->Id} = $link->BaseObj; - } - else { - $link->BaseObj->AllDependedOnBy( %args, _top => 0 ); - } - } - - if ($args{_top}) { - return map { $args{_found}{$_} } sort keys %{$args{_found}}; - } - else { - return 1; - } -} - -# }}} - -# {{{ DependsOn - -=head2 DependsOn - - This returns an RT::Links object which references all the tickets that this ticket depends on - -=cut - -sub DependsOn { - my $self = shift; - return ( $self->_Links( 'Base', 'DependsOn' ) ); -} - -# }}} - - - - -# {{{ sub _Links - -sub _Links { - my $self = shift; - - #TODO: Field isn't the right thing here. but I ahave no idea what mnemonic --- - #tobias meant by $f - my $field = shift; - my $type = shift || ""; - - unless ( $self->{"$field$type"} ) { - $self->{"$field$type"} = new RT::Links( $self->CurrentUser ); - # at least to myself - $self->{"$field$type"}->Limit( FIELD => $field, - VALUE => $self->URI, - ENTRYAGGREGATOR => 'OR' ); - $self->{"$field$type"}->Limit( FIELD => 'Type', - VALUE => $type ) - if ($type); - } - return ( $self->{"$field$type"} ); -} - -# }}} - -# }}} - -# {{{ sub _AddLink - -=head2 _AddLink - -Takes a paramhash of Type and one of Base or Target. Adds that link to this ticket. - - -=cut - - -sub _AddLink { - my $self = shift; - my %args = ( Target => '', - Base => '', - Type => '', - Silent => undef, - @_ ); - - - # Remote_link is the URI of the object that is not this ticket - my $remote_link; - my $direction; - - if ( $args{'Base'} and $args{'Target'} ) { - $RT::Logger->debug( -"$self tried to delete a link. both base and target were specified\n" ); - return ( 0, $self->loc("Can't specifiy both base and target") ); - } - elsif ( $args{'Base'} ) { - $args{'Target'} = $self->URI(); - my $class = ref($self); - $remote_link = $args{'Base'}; - $direction = 'Target'; - } - elsif ( $args{'Target'} ) { - $args{'Base'} = $self->URI(); - my $class = ref($self); - $remote_link = $args{'Target'}; - $direction = 'Base'; - } - else { - return ( 0, $self->loc('Either base or target must be specified') ); - } - - # {{{ Check if the link already exists - we don't want duplicates - use RT::Link; - my $old_link = RT::Link->new( $self->CurrentUser ); - $old_link->LoadByParams( Base => $args{'Base'}, - Type => $args{'Type'}, - Target => $args{'Target'} ); - if ( $old_link->Id ) { - $RT::Logger->debug("$self Somebody tried to duplicate a link"); - return ( $old_link->id, $self->loc("Link already exists"), 0 ); - } - - # }}} - - - # Storing the link in the DB. - my $link = RT::Link->new( $self->CurrentUser ); - my ($linkid, $linkmsg) = $link->Create( Target => $args{Target}, - Base => $args{Base}, - Type => $args{Type} ); - - unless ($linkid) { - $RT::Logger->error("Link could not be created: ".$linkmsg); - return ( 0, $self->loc("Link could not be created") ); - } - - my $TransString = - "Record $args{'Base'} $args{Type} record $args{'Target'}."; - - return ( 1, $self->loc( "Link created ([_1])", $TransString ) ); -} - -# }}} - -# {{{ sub _DeleteLink - -=head2 _DeleteLink - -Delete a link. takes a paramhash of Base, Target and Type. -Either Base or Target must be null. The null value will -be replaced with this ticket\'s id - -=cut - -sub _DeleteLink { - my $self = shift; - my %args = ( - Base => undef, - Target => undef, - Type => undef, - @_ - ); - - #we want one of base and target. we don't care which - #but we only want _one_ - - my $direction; - my $remote_link; - - if ( $args{'Base'} and $args{'Target'} ) { - $RT::Logger->debug("$self ->_DeleteLink. got both Base and Target\n"); - return ( 0, $self->loc("Can't specifiy both base and target") ); - } - elsif ( $args{'Base'} ) { - $args{'Target'} = $self->URI(); - $remote_link = $args{'Base'}; - $direction = 'Target'; - } - elsif ( $args{'Target'} ) { - $args{'Base'} = $self->URI(); - $remote_link = $args{'Target'}; - $direction='Base'; - } - else { - $RT::Logger->debug("$self: Base or Target must be specified\n"); - return ( 0, $self->loc('Either base or target must be specified') ); - } - - my $link = new RT::Link( $self->CurrentUser ); - $RT::Logger->debug( "Trying to load link: " . $args{'Base'} . " " . $args{'Type'} . " " . $args{'Target'} . "\n" ); - - - $link->LoadByParams( Base=> $args{'Base'}, Type=> $args{'Type'}, Target=> $args{'Target'} ); - #it's a real link. - if ( $link->id ) { - - my $linkid = $link->id; - $link->Delete(); - - my $TransString = "Record $args{'Base'} no longer $args{Type} record $args{'Target'}."; - return ( 1, $self->loc("Link deleted ([_1])", $TransString)); - } - - #if it's not a link we can find - else { - $RT::Logger->debug("Couldn't find that link\n"); - return ( 0, $self->loc("Link not found") ); - } -} - -# }}} - eval "require RT::Record_Vendor"; die $@ if ($@ && $@ !~ qr{^Can't locate RT/Record_Vendor.pm}); eval "require RT::Record_Local"; diff --git a/rt/lib/RT/Scrip.pm b/rt/lib/RT/Scrip.pm index 1c414d8f2..a69dde04e 100755 --- a/rt/lib/RT/Scrip.pm +++ b/rt/lib/RT/Scrip.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # Autogenerated by DBIx::SearchBuilder factory (by <jesse@bestpractical.com>) # WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST. # @@ -87,7 +65,7 @@ sub _Init { -=head2 Create PARAMHASH +=item Create PARAMHASH Create takes a hash of values and creates a row in the database: @@ -142,7 +120,7 @@ sub Create { -=head2 id +=item id Returns the current value of id. (In the database, id is stored as int(11).) @@ -151,14 +129,14 @@ Returns the current value of id. =cut -=head2 Description +=item Description Returns the current value of Description. (In the database, Description is stored as varchar(255).) -=head2 SetDescription VALUE +=item SetDescription VALUE Set Description to VALUE. @@ -169,14 +147,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 ScripCondition +=item ScripCondition Returns the current value of ScripCondition. (In the database, ScripCondition is stored as int(11).) -=head2 SetScripCondition VALUE +=item SetScripCondition VALUE Set ScripCondition to VALUE. @@ -187,7 +165,7 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 ScripConditionObj +=item ScripConditionObj Returns the ScripCondition Object which has the id returned by ScripCondition @@ -201,14 +179,14 @@ sub ScripConditionObj { return($ScripCondition); } -=head2 ScripAction +=item ScripAction Returns the current value of ScripAction. (In the database, ScripAction is stored as int(11).) -=head2 SetScripAction VALUE +=item SetScripAction VALUE Set ScripAction to VALUE. @@ -219,7 +197,7 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 ScripActionObj +=item ScripActionObj Returns the ScripAction Object which has the id returned by ScripAction @@ -233,14 +211,14 @@ sub ScripActionObj { return($ScripAction); } -=head2 ConditionRules +=item ConditionRules Returns the current value of ConditionRules. (In the database, ConditionRules is stored as text.) -=head2 SetConditionRules VALUE +=item SetConditionRules VALUE Set ConditionRules to VALUE. @@ -251,14 +229,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 ActionRules +=item ActionRules Returns the current value of ActionRules. (In the database, ActionRules is stored as text.) -=head2 SetActionRules VALUE +=item SetActionRules VALUE Set ActionRules to VALUE. @@ -269,14 +247,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 CustomIsApplicableCode +=item CustomIsApplicableCode Returns the current value of CustomIsApplicableCode. (In the database, CustomIsApplicableCode is stored as text.) -=head2 SetCustomIsApplicableCode VALUE +=item SetCustomIsApplicableCode VALUE Set CustomIsApplicableCode to VALUE. @@ -287,14 +265,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 CustomPrepareCode +=item CustomPrepareCode Returns the current value of CustomPrepareCode. (In the database, CustomPrepareCode is stored as text.) -=head2 SetCustomPrepareCode VALUE +=item SetCustomPrepareCode VALUE Set CustomPrepareCode to VALUE. @@ -305,14 +283,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 CustomCommitCode +=item CustomCommitCode Returns the current value of CustomCommitCode. (In the database, CustomCommitCode is stored as text.) -=head2 SetCustomCommitCode VALUE +=item SetCustomCommitCode VALUE Set CustomCommitCode to VALUE. @@ -323,14 +301,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Stage +=item Stage Returns the current value of Stage. (In the database, Stage is stored as varchar(32).) -=head2 SetStage VALUE +=item SetStage VALUE Set Stage to VALUE. @@ -341,14 +319,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Queue +=item Queue Returns the current value of Queue. (In the database, Queue is stored as int(11).) -=head2 SetQueue VALUE +=item SetQueue VALUE Set Queue to VALUE. @@ -359,7 +337,7 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 QueueObj +=item QueueObj Returns the Queue Object which has the id returned by Queue @@ -373,14 +351,14 @@ sub QueueObj { return($Queue); } -=head2 Template +=item Template Returns the current value of Template. (In the database, Template is stored as int(11).) -=head2 SetTemplate VALUE +=item SetTemplate VALUE Set Template to VALUE. @@ -391,7 +369,7 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 TemplateObj +=item TemplateObj Returns the Template Object which has the id returned by Template @@ -405,7 +383,7 @@ sub TemplateObj { return($Template); } -=head2 Creator +=item Creator Returns the current value of Creator. (In the database, Creator is stored as int(11).) @@ -414,7 +392,7 @@ Returns the current value of Creator. =cut -=head2 Created +=item Created Returns the current value of Created. (In the database, Created is stored as datetime.) @@ -423,7 +401,7 @@ Returns the current value of Created. =cut -=head2 LastUpdatedBy +=item LastUpdatedBy Returns the current value of LastUpdatedBy. (In the database, LastUpdatedBy is stored as int(11).) @@ -432,7 +410,7 @@ Returns the current value of LastUpdatedBy. =cut -=head2 LastUpdated +=item LastUpdated Returns the current value of LastUpdated. (In the database, LastUpdated is stored as datetime.) @@ -442,7 +420,7 @@ Returns the current value of LastUpdated. -sub _CoreAccessible { +sub _ClassAccessible { { id => diff --git a/rt/lib/RT/ScripAction.pm b/rt/lib/RT/ScripAction.pm index e3d2a902a..26824df5d 100755 --- a/rt/lib/RT/ScripAction.pm +++ b/rt/lib/RT/ScripAction.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # Autogenerated by DBIx::SearchBuilder factory (by <jesse@bestpractical.com>) # WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST. # @@ -83,7 +61,7 @@ sub _Init { -=head2 Create PARAMHASH +=item Create PARAMHASH Create takes a hash of values and creates a row in the database: @@ -117,7 +95,7 @@ sub Create { -=head2 id +=item id Returns the current value of id. (In the database, id is stored as int(11).) @@ -126,14 +104,14 @@ Returns the current value of id. =cut -=head2 Name +=item Name Returns the current value of Name. (In the database, Name is stored as varchar(200).) -=head2 SetName VALUE +=item SetName VALUE Set Name to VALUE. @@ -144,14 +122,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Description +=item Description Returns the current value of Description. (In the database, Description is stored as varchar(255).) -=head2 SetDescription VALUE +=item SetDescription VALUE Set Description to VALUE. @@ -162,14 +140,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 ExecModule +=item ExecModule Returns the current value of ExecModule. (In the database, ExecModule is stored as varchar(60).) -=head2 SetExecModule VALUE +=item SetExecModule VALUE Set ExecModule to VALUE. @@ -180,14 +158,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Argument +=item Argument Returns the current value of Argument. (In the database, Argument is stored as varchar(255).) -=head2 SetArgument VALUE +=item SetArgument VALUE Set Argument to VALUE. @@ -198,7 +176,7 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Creator +=item Creator Returns the current value of Creator. (In the database, Creator is stored as int(11).) @@ -207,7 +185,7 @@ Returns the current value of Creator. =cut -=head2 Created +=item Created Returns the current value of Created. (In the database, Created is stored as datetime.) @@ -216,7 +194,7 @@ Returns the current value of Created. =cut -=head2 LastUpdatedBy +=item LastUpdatedBy Returns the current value of LastUpdatedBy. (In the database, LastUpdatedBy is stored as int(11).) @@ -225,7 +203,7 @@ Returns the current value of LastUpdatedBy. =cut -=head2 LastUpdated +=item LastUpdated Returns the current value of LastUpdated. (In the database, LastUpdated is stored as datetime.) @@ -235,7 +213,7 @@ Returns the current value of LastUpdated. -sub _CoreAccessible { +sub _ClassAccessible { { id => diff --git a/rt/lib/RT/ScripActions.pm b/rt/lib/RT/ScripActions.pm index 677fd85b8..614ff374f 100755 --- a/rt/lib/RT/ScripActions.pm +++ b/rt/lib/RT/ScripActions.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # Autogenerated by DBIx::SearchBuilder factory (by <jesse@bestpractical.com>) # WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST. # @@ -86,7 +64,7 @@ sub _Init { } -=head2 NewItem +=item NewItem Returns an empty new RT::ScripAction item diff --git a/rt/lib/RT/ScripCondition.pm b/rt/lib/RT/ScripCondition.pm index 4e0398c7c..fe0aa2d5a 100755 --- a/rt/lib/RT/ScripCondition.pm +++ b/rt/lib/RT/ScripCondition.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # Autogenerated by DBIx::SearchBuilder factory (by <jesse@bestpractical.com>) # WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST. # @@ -83,7 +61,7 @@ sub _Init { -=head2 Create PARAMHASH +=item Create PARAMHASH Create takes a hash of values and creates a row in the database: @@ -120,7 +98,7 @@ sub Create { -=head2 id +=item id Returns the current value of id. (In the database, id is stored as int(11).) @@ -129,14 +107,14 @@ Returns the current value of id. =cut -=head2 Name +=item Name Returns the current value of Name. (In the database, Name is stored as varchar(200).) -=head2 SetName VALUE +=item SetName VALUE Set Name to VALUE. @@ -147,14 +125,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Description +=item Description Returns the current value of Description. (In the database, Description is stored as varchar(255).) -=head2 SetDescription VALUE +=item SetDescription VALUE Set Description to VALUE. @@ -165,14 +143,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 ExecModule +=item ExecModule Returns the current value of ExecModule. (In the database, ExecModule is stored as varchar(60).) -=head2 SetExecModule VALUE +=item SetExecModule VALUE Set ExecModule to VALUE. @@ -183,14 +161,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Argument +=item Argument Returns the current value of Argument. (In the database, Argument is stored as varchar(255).) -=head2 SetArgument VALUE +=item SetArgument VALUE Set Argument to VALUE. @@ -201,14 +179,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 ApplicableTransTypes +=item ApplicableTransTypes Returns the current value of ApplicableTransTypes. (In the database, ApplicableTransTypes is stored as varchar(60).) -=head2 SetApplicableTransTypes VALUE +=item SetApplicableTransTypes VALUE Set ApplicableTransTypes to VALUE. @@ -219,7 +197,7 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Creator +=item Creator Returns the current value of Creator. (In the database, Creator is stored as int(11).) @@ -228,7 +206,7 @@ Returns the current value of Creator. =cut -=head2 Created +=item Created Returns the current value of Created. (In the database, Created is stored as datetime.) @@ -237,7 +215,7 @@ Returns the current value of Created. =cut -=head2 LastUpdatedBy +=item LastUpdatedBy Returns the current value of LastUpdatedBy. (In the database, LastUpdatedBy is stored as int(11).) @@ -246,7 +224,7 @@ Returns the current value of LastUpdatedBy. =cut -=head2 LastUpdated +=item LastUpdated Returns the current value of LastUpdated. (In the database, LastUpdated is stored as datetime.) @@ -256,7 +234,7 @@ Returns the current value of LastUpdated. -sub _CoreAccessible { +sub _ClassAccessible { { id => diff --git a/rt/lib/RT/ScripConditions.pm b/rt/lib/RT/ScripConditions.pm index 8daaea92c..34f788d9c 100755 --- a/rt/lib/RT/ScripConditions.pm +++ b/rt/lib/RT/ScripConditions.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # Autogenerated by DBIx::SearchBuilder factory (by <jesse@bestpractical.com>) # WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST. # @@ -86,7 +64,7 @@ sub _Init { } -=head2 NewItem +=item NewItem Returns an empty new RT::ScripCondition item diff --git a/rt/lib/RT/Scrips.pm b/rt/lib/RT/Scrips.pm index 0ec2ad7ee..a39443136 100755 --- a/rt/lib/RT/Scrips.pm +++ b/rt/lib/RT/Scrips.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # Autogenerated by DBIx::SearchBuilder factory (by <jesse@bestpractical.com>) # WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST. # @@ -86,7 +64,7 @@ sub _Init { } -=head2 NewItem +=item NewItem Returns an empty new RT::Scrip item diff --git a/rt/lib/RT/Template.pm b/rt/lib/RT/Template.pm index c18a7505f..f73ea3ed6 100755 --- a/rt/lib/RT/Template.pm +++ b/rt/lib/RT/Template.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # Autogenerated by DBIx::SearchBuilder factory (by <jesse@bestpractical.com>) # WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST. # @@ -84,7 +62,7 @@ sub _Init { -=head2 Create PARAMHASH +=item Create PARAMHASH Create takes a hash of values and creates a row in the database: @@ -127,7 +105,7 @@ sub Create { -=head2 id +=item id Returns the current value of id. (In the database, id is stored as int(11).) @@ -136,14 +114,14 @@ Returns the current value of id. =cut -=head2 Queue +=item Queue Returns the current value of Queue. (In the database, Queue is stored as int(11).) -=head2 SetQueue VALUE +=item SetQueue VALUE Set Queue to VALUE. @@ -154,7 +132,7 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 QueueObj +=item QueueObj Returns the Queue Object which has the id returned by Queue @@ -168,14 +146,14 @@ sub QueueObj { return($Queue); } -=head2 Name +=item Name Returns the current value of Name. (In the database, Name is stored as varchar(200).) -=head2 SetName VALUE +=item SetName VALUE Set Name to VALUE. @@ -186,14 +164,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Description +=item Description Returns the current value of Description. (In the database, Description is stored as varchar(255).) -=head2 SetDescription VALUE +=item SetDescription VALUE Set Description to VALUE. @@ -204,14 +182,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Type +=item Type Returns the current value of Type. (In the database, Type is stored as varchar(16).) -=head2 SetType VALUE +=item SetType VALUE Set Type to VALUE. @@ -222,14 +200,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Language +=item Language Returns the current value of Language. (In the database, Language is stored as varchar(16).) -=head2 SetLanguage VALUE +=item SetLanguage VALUE Set Language to VALUE. @@ -240,14 +218,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 TranslationOf +=item TranslationOf Returns the current value of TranslationOf. (In the database, TranslationOf is stored as int(11).) -=head2 SetTranslationOf VALUE +=item SetTranslationOf VALUE Set TranslationOf to VALUE. @@ -258,14 +236,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Content +=item Content Returns the current value of Content. (In the database, Content is stored as blob.) -=head2 SetContent VALUE +=item SetContent VALUE Set Content to VALUE. @@ -276,7 +254,7 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 LastUpdated +=item LastUpdated Returns the current value of LastUpdated. (In the database, LastUpdated is stored as datetime.) @@ -285,7 +263,7 @@ Returns the current value of LastUpdated. =cut -=head2 LastUpdatedBy +=item LastUpdatedBy Returns the current value of LastUpdatedBy. (In the database, LastUpdatedBy is stored as int(11).) @@ -294,7 +272,7 @@ Returns the current value of LastUpdatedBy. =cut -=head2 Creator +=item Creator Returns the current value of Creator. (In the database, Creator is stored as int(11).) @@ -303,7 +281,7 @@ Returns the current value of Creator. =cut -=head2 Created +=item Created Returns the current value of Created. (In the database, Created is stored as datetime.) @@ -313,7 +291,7 @@ Returns the current value of Created. -sub _CoreAccessible { +sub _ClassAccessible { { id => diff --git a/rt/lib/RT/Templates.pm b/rt/lib/RT/Templates.pm index 925107ebf..37db84086 100755 --- a/rt/lib/RT/Templates.pm +++ b/rt/lib/RT/Templates.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # Autogenerated by DBIx::SearchBuilder factory (by <jesse@bestpractical.com>) # WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST. # @@ -86,7 +64,7 @@ sub _Init { } -=head2 NewItem +=item NewItem Returns an empty new RT::Template item diff --git a/rt/lib/RT/Ticket.pm b/rt/lib/RT/Ticket.pm index 0d3c787ea..2f075a20c 100755 --- a/rt/lib/RT/Ticket.pm +++ b/rt/lib/RT/Ticket.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # Autogenerated by DBIx::SearchBuilder factory (by <jesse@bestpractical.com>) # WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST. # @@ -84,7 +62,7 @@ sub _Init { -=head2 Create PARAMHASH +=item Create PARAMHASH Create takes a hash of values and creates a row in the database: @@ -166,7 +144,7 @@ sub Create { -=head2 id +=item id Returns the current value of id. (In the database, id is stored as int(11).) @@ -175,14 +153,14 @@ Returns the current value of id. =cut -=head2 EffectiveId +=item EffectiveId Returns the current value of EffectiveId. (In the database, EffectiveId is stored as int(11).) -=head2 SetEffectiveId VALUE +=item SetEffectiveId VALUE Set EffectiveId to VALUE. @@ -193,14 +171,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Queue +=item Queue Returns the current value of Queue. (In the database, Queue is stored as int(11).) -=head2 SetQueue VALUE +=item SetQueue VALUE Set Queue to VALUE. @@ -211,7 +189,7 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 QueueObj +=item QueueObj Returns the Queue Object which has the id returned by Queue @@ -225,14 +203,14 @@ sub QueueObj { return($Queue); } -=head2 Type +=item Type Returns the current value of Type. (In the database, Type is stored as varchar(16).) -=head2 SetType VALUE +=item SetType VALUE Set Type to VALUE. @@ -243,14 +221,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 IssueStatement +=item IssueStatement Returns the current value of IssueStatement. (In the database, IssueStatement is stored as int(11).) -=head2 SetIssueStatement VALUE +=item SetIssueStatement VALUE Set IssueStatement to VALUE. @@ -261,14 +239,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Resolution +=item Resolution Returns the current value of Resolution. (In the database, Resolution is stored as int(11).) -=head2 SetResolution VALUE +=item SetResolution VALUE Set Resolution to VALUE. @@ -279,14 +257,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Owner +=item Owner Returns the current value of Owner. (In the database, Owner is stored as int(11).) -=head2 SetOwner VALUE +=item SetOwner VALUE Set Owner to VALUE. @@ -297,14 +275,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Subject +=item Subject Returns the current value of Subject. (In the database, Subject is stored as varchar(200).) -=head2 SetSubject VALUE +=item SetSubject VALUE Set Subject to VALUE. @@ -315,14 +293,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 InitialPriority +=item InitialPriority Returns the current value of InitialPriority. (In the database, InitialPriority is stored as int(11).) -=head2 SetInitialPriority VALUE +=item SetInitialPriority VALUE Set InitialPriority to VALUE. @@ -333,14 +311,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 FinalPriority +=item FinalPriority Returns the current value of FinalPriority. (In the database, FinalPriority is stored as int(11).) -=head2 SetFinalPriority VALUE +=item SetFinalPriority VALUE Set FinalPriority to VALUE. @@ -351,14 +329,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Priority +=item Priority Returns the current value of Priority. (In the database, Priority is stored as int(11).) -=head2 SetPriority VALUE +=item SetPriority VALUE Set Priority to VALUE. @@ -369,14 +347,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 TimeEstimated +=item TimeEstimated Returns the current value of TimeEstimated. (In the database, TimeEstimated is stored as int(11).) -=head2 SetTimeEstimated VALUE +=item SetTimeEstimated VALUE Set TimeEstimated to VALUE. @@ -387,14 +365,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 TimeWorked +=item TimeWorked Returns the current value of TimeWorked. (In the database, TimeWorked is stored as int(11).) -=head2 SetTimeWorked VALUE +=item SetTimeWorked VALUE Set TimeWorked to VALUE. @@ -405,14 +383,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Status +=item Status Returns the current value of Status. (In the database, Status is stored as varchar(10).) -=head2 SetStatus VALUE +=item SetStatus VALUE Set Status to VALUE. @@ -423,14 +401,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 TimeLeft +=item TimeLeft Returns the current value of TimeLeft. (In the database, TimeLeft is stored as int(11).) -=head2 SetTimeLeft VALUE +=item SetTimeLeft VALUE Set TimeLeft to VALUE. @@ -441,14 +419,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Told +=item Told Returns the current value of Told. (In the database, Told is stored as datetime.) -=head2 SetTold VALUE +=item SetTold VALUE Set Told to VALUE. @@ -459,14 +437,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Starts +=item Starts Returns the current value of Starts. (In the database, Starts is stored as datetime.) -=head2 SetStarts VALUE +=item SetStarts VALUE Set Starts to VALUE. @@ -477,14 +455,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Started +=item Started Returns the current value of Started. (In the database, Started is stored as datetime.) -=head2 SetStarted VALUE +=item SetStarted VALUE Set Started to VALUE. @@ -495,14 +473,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Due +=item Due Returns the current value of Due. (In the database, Due is stored as datetime.) -=head2 SetDue VALUE +=item SetDue VALUE Set Due to VALUE. @@ -513,14 +491,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Resolved +=item Resolved Returns the current value of Resolved. (In the database, Resolved is stored as datetime.) -=head2 SetResolved VALUE +=item SetResolved VALUE Set Resolved to VALUE. @@ -531,7 +509,7 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 LastUpdatedBy +=item LastUpdatedBy Returns the current value of LastUpdatedBy. (In the database, LastUpdatedBy is stored as int(11).) @@ -540,7 +518,7 @@ Returns the current value of LastUpdatedBy. =cut -=head2 LastUpdated +=item LastUpdated Returns the current value of LastUpdated. (In the database, LastUpdated is stored as datetime.) @@ -549,7 +527,7 @@ Returns the current value of LastUpdated. =cut -=head2 Creator +=item Creator Returns the current value of Creator. (In the database, Creator is stored as int(11).) @@ -558,7 +536,7 @@ Returns the current value of Creator. =cut -=head2 Created +=item Created Returns the current value of Created. (In the database, Created is stored as datetime.) @@ -567,14 +545,14 @@ Returns the current value of Created. =cut -=head2 Disabled +=item Disabled Returns the current value of Disabled. (In the database, Disabled is stored as smallint(6).) -=head2 SetDisabled VALUE +=item SetDisabled VALUE Set Disabled to VALUE. @@ -586,7 +564,7 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. -sub _CoreAccessible { +sub _ClassAccessible { { id => diff --git a/rt/lib/RT/Tickets.pm b/rt/lib/RT/Tickets.pm index 7bf452d9a..b6b349144 100755 --- a/rt/lib/RT/Tickets.pm +++ b/rt/lib/RT/Tickets.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # Autogenerated by DBIx::SearchBuilder factory (by <jesse@bestpractical.com>) # WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST. # @@ -86,7 +64,7 @@ sub _Init { } -=head2 NewItem +=item NewItem Returns an empty new RT::Ticket item diff --git a/rt/lib/RT/Transaction.pm b/rt/lib/RT/Transaction.pm index 431d39adb..ca491a6c7 100755 --- a/rt/lib/RT/Transaction.pm +++ b/rt/lib/RT/Transaction.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# CONTRIBUTION SUBMISSION POLICY: # -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) -# -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. -# -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # Autogenerated by DBIx::SearchBuilder factory (by <jesse@bestpractical.com>) # WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST. # @@ -84,7 +62,7 @@ sub _Init { -=head2 Create PARAMHASH +=item Create PARAMHASH Create takes a hash of values and creates a row in the database: @@ -95,7 +73,7 @@ Create takes a hash of values and creates a row in the database: varchar(40) 'Field'. varchar(255) 'OldValue'. varchar(255) 'NewValue'. - varchar(255) 'Data'. + varchar(100) 'Data'. =cut @@ -130,7 +108,7 @@ sub Create { -=head2 id +=item id Returns the current value of id. (In the database, id is stored as int(11).) @@ -139,14 +117,14 @@ Returns the current value of id. =cut -=head2 EffectiveTicket +=item EffectiveTicket Returns the current value of EffectiveTicket. (In the database, EffectiveTicket is stored as int(11).) -=head2 SetEffectiveTicket VALUE +=item SetEffectiveTicket VALUE Set EffectiveTicket to VALUE. @@ -157,14 +135,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Ticket +=item Ticket Returns the current value of Ticket. (In the database, Ticket is stored as int(11).) -=head2 SetTicket VALUE +=item SetTicket VALUE Set Ticket to VALUE. @@ -175,7 +153,7 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 TicketObj +=item TicketObj Returns the Ticket Object which has the id returned by Ticket @@ -189,14 +167,14 @@ sub TicketObj { return($Ticket); } -=head2 TimeTaken +=item TimeTaken Returns the current value of TimeTaken. (In the database, TimeTaken is stored as int(11).) -=head2 SetTimeTaken VALUE +=item SetTimeTaken VALUE Set TimeTaken to VALUE. @@ -207,14 +185,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Type +=item Type Returns the current value of Type. (In the database, Type is stored as varchar(20).) -=head2 SetType VALUE +=item SetType VALUE Set Type to VALUE. @@ -225,14 +203,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Field +=item Field Returns the current value of Field. (In the database, Field is stored as varchar(40).) -=head2 SetField VALUE +=item SetField VALUE Set Field to VALUE. @@ -243,14 +221,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 OldValue +=item OldValue Returns the current value of OldValue. (In the database, OldValue is stored as varchar(255).) -=head2 SetOldValue VALUE +=item SetOldValue VALUE Set OldValue to VALUE. @@ -261,14 +239,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 NewValue +=item NewValue Returns the current value of NewValue. (In the database, NewValue is stored as varchar(255).) -=head2 SetNewValue VALUE +=item SetNewValue VALUE Set NewValue to VALUE. @@ -279,25 +257,25 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Data +=item Data Returns the current value of Data. -(In the database, Data is stored as varchar(255).) +(In the database, Data is stored as varchar(100).) -=head2 SetData VALUE +=item SetData VALUE Set Data to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. -(In the database, Data will be stored as a varchar(255).) +(In the database, Data will be stored as a varchar(100).) =cut -=head2 Creator +=item Creator Returns the current value of Creator. (In the database, Creator is stored as int(11).) @@ -306,7 +284,7 @@ Returns the current value of Creator. =cut -=head2 Created +=item Created Returns the current value of Created. (In the database, Created is stored as datetime.) @@ -316,7 +294,7 @@ Returns the current value of Created. -sub _CoreAccessible { +sub _ClassAccessible { { id => @@ -336,7 +314,7 @@ sub _CoreAccessible { NewValue => {read => 1, write => 1, type => 'varchar(255)', default => ''}, Data => - {read => 1, write => 1, type => 'varchar(255)', default => ''}, + {read => 1, write => 1, type => 'varchar(100)', default => ''}, Creator => {read => 1, auto => 1, type => 'int(11)', default => '0'}, Created => diff --git a/rt/lib/RT/Transactions.pm b/rt/lib/RT/Transactions.pm index 1e8a97bd0..23a475ac6 100755 --- a/rt/lib/RT/Transactions.pm +++ b/rt/lib/RT/Transactions.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # Autogenerated by DBIx::SearchBuilder factory (by <jesse@bestpractical.com>) # WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST. # @@ -86,7 +64,7 @@ sub _Init { } -=head2 NewItem +=item NewItem Returns an empty new RT::Transaction item diff --git a/rt/lib/RT/URI/freeside.pm b/rt/lib/RT/URI/freeside.pm new file mode 100644 index 000000000..ebd24ad60 --- /dev/null +++ b/rt/lib/RT/URI/freeside.pm @@ -0,0 +1,260 @@ +# BEGIN LICENSE BLOCK +# +# Copyright (c) 2004 Kristian Hoffmann <khoff@fire2wire.com> +# Based on the original RT::URI::base and RT::URI::fsck_com_rt. +# +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> +# +# (Except where explictly superceded by other copyright notices) +# +# This work is made available to you under the terms of Version 2 of +# the GNU General Public License. A copy of that license should have +# been provided with this software, but in any event can be snarfed +# from www.gnu.org. +# +# This work is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. +# +# +# END LICENSE BLOCK +package RT::URI::freeside; + +use RT::URI::base; +use strict; +use vars qw(@ISA); + +@ISA = qw/RT::URI::base/; + + +=head1 NAME + +RT::URI::base + +=head1 DESCRIPTION + +URI handler for freeside URIs. See http://www.sisd.com/freeside/ for +more information on freeside. + +=cut + + +sub FreesideURIPrefix { + + my $self = shift; + return($self->Scheme . '://freeside'); + +} + +sub FreesideURILabel { + + my $self = shift; + + return(undef) unless (exists($self->{'fstable'}) and + exists($self->{'fspkey'})); + + my $label; + my ($table, $pkey) = ($self->{'fstable'}, $self->{'fspkey'}); + + eval { + use FS::UID qw(dbh); + use FS::Record qw(qsearchs qsearch dbdef); + eval "use FS::$table;"; + use FS::cust_svc; + + my $dbdef = dbdef or die "No dbdef"; + my $pkeyfield = $dbdef->table($table)->primary_key + or die "No primary key for table $table"; + + my $rec = qsearchs($table, { $pkeyfield => $pkey }) + or die "Record with $pkeyfield == $pkey does not exist in table $table"; + + if ($table =~ /^svc_/) { + if ($rec->can('cust_svc')) { + my $cust_svc = $rec->cust_svc or die '$rec->cust_svc failed'; + my ($svc, $tag, $svcdb) = $cust_svc->label; + $label = "Freeside service ${svc}: ${tag}"; + } + } elsif ($table eq 'cust_main') { + #my ($last, $first, $company) = map { $rec->getfield($_) } + # qw(last first company); + #$label = "Freeside customer ${last}, ${first}"; + #$label .= ($company ne '') ? " with ${company}" : ''; + $label = "$pkey: ". $rec->name; + } else { + $label = "Freeside ${table}, ${pkeyfield} == ${pkey}"; + } + + #... other cases + + }; + + if ($label and !$@) { + return($label); + } else { + return(undef); + } + + +} + +sub FreesideURILabelLong { + + my $self = shift; + + return(undef) unless (exists($self->{'fstable'}) and + exists($self->{'fspkey'})); + + my $label; + my ($table, $pkey) = ($self->{'fstable'}, $self->{'fspkey'}); + + eval { + use FS::UID qw(dbh); + use FS::Record qw(qsearchs qsearch dbdef); + eval "use FS::$table;"; + use FS::cust_svc; + + my $dbdef = dbdef or die "No dbdef"; + my $pkeyfield = $dbdef->table($table)->primary_key + or die "No primary key for table $table"; + + my $rec = qsearchs($table, { $pkeyfield => $pkey }) + or die "Record with $pkeyfield == $pkey does not exist in table $table"; + + if ($table =~ /^svc_/) { + #if ($rec->can('cust_svc')) { + # my $cust_svc = $rec->cust_svc or die '$rec->cust_svc failed'; + # my ($svc, $tag, $svcdb) = $cust_svc->label; + # $label = "Freeside service ${svc}: ${tag}"; + #} + $label = ''; + } elsif ($table eq 'cust_main') { + use FS::CGI qw(small_custview); + $label = small_custview( $rec, + scalar(FS::Conf->new->config('countrydefault')), + 1 #nobalance + ); + } else { + #$label = "Freeside ${table}, ${pkeyfield} == ${pkey}"; + $label = ''; + } + + #... other cases + + }; + + if ($label and !$@) { + return($label); + } else { + warn $@; + return(undef); + } + + +} + +sub ParseURI { + my $self = shift; + my $uri = shift; + my ($table, $pkey); + + my $uriprefix = $self->FreesideURIPrefix; + if ($uri =~ /^$uriprefix\/(\w+)\/(\d+)$/) { + $table = $1; + $pkey = $2; + $self->{'scheme'} = $self->Scheme; + } else { + return(undef); + } + + $self->{'uri'} = "${uriprefix}/${table}/${pkey}"; + $self->{'fstable'} = $table; + $self->{'fspkey'} = $pkey; + + my $p; + + eval { + use FS::UID qw(dbh); + use FS::CGI qw(popurl); + + if (dbh) { + $p = popurl(3); + } + + }; + + if ($@ or (!$p)) { + $self->{'href'} = $self->{'uri'}; + } else { + $self->{'href'} = "${p}view/${table}.cgi?${pkey}"; + } + + $self->{'uri'}; + +} + +sub Scheme { + my $self = shift; + return('freeside'); + +} + +sub HREF { + my $self = shift; + return($self->{'href'} || $self->{'uri'}); +} + +sub IsLocal { + my $self = shift; + return undef; +} + +=head2 AsString + +Return a "pretty" string representing the URI object. + +This is meant to be used like this: + + % $re = $uri->Resolver; + <A HREF="<% $re->HREF %>"><% $re->AsString %></A> + +=cut + +sub AsString { + my $self = shift; + my $prettystring; + if ($prettystring = $self->FreesideURILabel) { + return $prettystring; + } else { + return $self->URI; + } +} + +=head2 AsStringLong + +Return a longer (HTML) string representing the URI object. + +=cut + +sub AsStringLong { + my $self = shift; + my $prettystring; + if ($prettystring = $self->FreesideURILabelLong || $self->FreesideURILabel){ + return $prettystring; + } else { + return $self->URI; + } +} + +eval "require RT::URI::base_Vendor"; +die $@ if ($@ && $@ !~ qr{^Can't locate RT/URI/base_Vendor.pm}); +eval "require RT::URI::base_Local"; +die $@ if ($@ && $@ !~ qr{^Can't locate RT/URI/base_Local.pm}); + +1; diff --git a/rt/lib/RT/User.pm b/rt/lib/RT/User.pm index 10e7e84d5..cbc10f5b4 100755 --- a/rt/lib/RT/User.pm +++ b/rt/lib/RT/User.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # Autogenerated by DBIx::SearchBuilder factory (by <jesse@bestpractical.com>) # WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST. # @@ -83,7 +61,7 @@ sub _Init { -=head2 Create PARAMHASH +=item Create PARAMHASH Create takes a hash of values and creates a row in the database: @@ -192,7 +170,7 @@ sub Create { -=head2 id +=item id Returns the current value of id. (In the database, id is stored as int(11).) @@ -201,14 +179,14 @@ Returns the current value of id. =cut -=head2 Name +=item Name Returns the current value of Name. (In the database, Name is stored as varchar(200).) -=head2 SetName VALUE +=item SetName VALUE Set Name to VALUE. @@ -219,14 +197,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Password +=item Password Returns the current value of Password. (In the database, Password is stored as varchar(40).) -=head2 SetPassword VALUE +=item SetPassword VALUE Set Password to VALUE. @@ -237,14 +215,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Comments +=item Comments Returns the current value of Comments. (In the database, Comments is stored as blob.) -=head2 SetComments VALUE +=item SetComments VALUE Set Comments to VALUE. @@ -255,14 +233,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Signature +=item Signature Returns the current value of Signature. (In the database, Signature is stored as blob.) -=head2 SetSignature VALUE +=item SetSignature VALUE Set Signature to VALUE. @@ -273,14 +251,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 EmailAddress +=item EmailAddress Returns the current value of EmailAddress. (In the database, EmailAddress is stored as varchar(120).) -=head2 SetEmailAddress VALUE +=item SetEmailAddress VALUE Set EmailAddress to VALUE. @@ -291,14 +269,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 FreeformContactInfo +=item FreeformContactInfo Returns the current value of FreeformContactInfo. (In the database, FreeformContactInfo is stored as blob.) -=head2 SetFreeformContactInfo VALUE +=item SetFreeformContactInfo VALUE Set FreeformContactInfo to VALUE. @@ -309,14 +287,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Organization +=item Organization Returns the current value of Organization. (In the database, Organization is stored as varchar(200).) -=head2 SetOrganization VALUE +=item SetOrganization VALUE Set Organization to VALUE. @@ -327,14 +305,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 RealName +=item RealName Returns the current value of RealName. (In the database, RealName is stored as varchar(120).) -=head2 SetRealName VALUE +=item SetRealName VALUE Set RealName to VALUE. @@ -345,14 +323,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 NickName +=item NickName Returns the current value of NickName. (In the database, NickName is stored as varchar(16).) -=head2 SetNickName VALUE +=item SetNickName VALUE Set NickName to VALUE. @@ -363,14 +341,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Lang +=item Lang Returns the current value of Lang. (In the database, Lang is stored as varchar(16).) -=head2 SetLang VALUE +=item SetLang VALUE Set Lang to VALUE. @@ -381,14 +359,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 EmailEncoding +=item EmailEncoding Returns the current value of EmailEncoding. (In the database, EmailEncoding is stored as varchar(16).) -=head2 SetEmailEncoding VALUE +=item SetEmailEncoding VALUE Set EmailEncoding to VALUE. @@ -399,14 +377,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 WebEncoding +=item WebEncoding Returns the current value of WebEncoding. (In the database, WebEncoding is stored as varchar(16).) -=head2 SetWebEncoding VALUE +=item SetWebEncoding VALUE Set WebEncoding to VALUE. @@ -417,14 +395,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 ExternalContactInfoId +=item ExternalContactInfoId Returns the current value of ExternalContactInfoId. (In the database, ExternalContactInfoId is stored as varchar(100).) -=head2 SetExternalContactInfoId VALUE +=item SetExternalContactInfoId VALUE Set ExternalContactInfoId to VALUE. @@ -435,14 +413,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 ContactInfoSystem +=item ContactInfoSystem Returns the current value of ContactInfoSystem. (In the database, ContactInfoSystem is stored as varchar(30).) -=head2 SetContactInfoSystem VALUE +=item SetContactInfoSystem VALUE Set ContactInfoSystem to VALUE. @@ -453,14 +431,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 ExternalAuthId +=item ExternalAuthId Returns the current value of ExternalAuthId. (In the database, ExternalAuthId is stored as varchar(100).) -=head2 SetExternalAuthId VALUE +=item SetExternalAuthId VALUE Set ExternalAuthId to VALUE. @@ -471,14 +449,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 AuthSystem +=item AuthSystem Returns the current value of AuthSystem. (In the database, AuthSystem is stored as varchar(30).) -=head2 SetAuthSystem VALUE +=item SetAuthSystem VALUE Set AuthSystem to VALUE. @@ -489,14 +467,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Gecos +=item Gecos Returns the current value of Gecos. (In the database, Gecos is stored as varchar(16).) -=head2 SetGecos VALUE +=item SetGecos VALUE Set Gecos to VALUE. @@ -507,14 +485,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 HomePhone +=item HomePhone Returns the current value of HomePhone. (In the database, HomePhone is stored as varchar(30).) -=head2 SetHomePhone VALUE +=item SetHomePhone VALUE Set HomePhone to VALUE. @@ -525,14 +503,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 WorkPhone +=item WorkPhone Returns the current value of WorkPhone. (In the database, WorkPhone is stored as varchar(30).) -=head2 SetWorkPhone VALUE +=item SetWorkPhone VALUE Set WorkPhone to VALUE. @@ -543,14 +521,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 MobilePhone +=item MobilePhone Returns the current value of MobilePhone. (In the database, MobilePhone is stored as varchar(30).) -=head2 SetMobilePhone VALUE +=item SetMobilePhone VALUE Set MobilePhone to VALUE. @@ -561,14 +539,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 PagerPhone +=item PagerPhone Returns the current value of PagerPhone. (In the database, PagerPhone is stored as varchar(30).) -=head2 SetPagerPhone VALUE +=item SetPagerPhone VALUE Set PagerPhone to VALUE. @@ -579,14 +557,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Address1 +=item Address1 Returns the current value of Address1. (In the database, Address1 is stored as varchar(200).) -=head2 SetAddress1 VALUE +=item SetAddress1 VALUE Set Address1 to VALUE. @@ -597,14 +575,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Address2 +=item Address2 Returns the current value of Address2. (In the database, Address2 is stored as varchar(200).) -=head2 SetAddress2 VALUE +=item SetAddress2 VALUE Set Address2 to VALUE. @@ -615,14 +593,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 City +=item City Returns the current value of City. (In the database, City is stored as varchar(100).) -=head2 SetCity VALUE +=item SetCity VALUE Set City to VALUE. @@ -633,14 +611,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 State +=item State Returns the current value of State. (In the database, State is stored as varchar(100).) -=head2 SetState VALUE +=item SetState VALUE Set State to VALUE. @@ -651,14 +629,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Zip +=item Zip Returns the current value of Zip. (In the database, Zip is stored as varchar(16).) -=head2 SetZip VALUE +=item SetZip VALUE Set Zip to VALUE. @@ -669,14 +647,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Country +=item Country Returns the current value of Country. (In the database, Country is stored as varchar(50).) -=head2 SetCountry VALUE +=item SetCountry VALUE Set Country to VALUE. @@ -687,14 +665,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Timezone +=item Timezone Returns the current value of Timezone. (In the database, Timezone is stored as varchar(50).) -=head2 SetTimezone VALUE +=item SetTimezone VALUE Set Timezone to VALUE. @@ -705,14 +683,14 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 PGPKey +=item PGPKey Returns the current value of PGPKey. (In the database, PGPKey is stored as text.) -=head2 SetPGPKey VALUE +=item SetPGPKey VALUE Set PGPKey to VALUE. @@ -723,7 +701,7 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. =cut -=head2 Creator +=item Creator Returns the current value of Creator. (In the database, Creator is stored as int(11).) @@ -732,7 +710,7 @@ Returns the current value of Creator. =cut -=head2 Created +=item Created Returns the current value of Created. (In the database, Created is stored as datetime.) @@ -741,7 +719,7 @@ Returns the current value of Created. =cut -=head2 LastUpdatedBy +=item LastUpdatedBy Returns the current value of LastUpdatedBy. (In the database, LastUpdatedBy is stored as int(11).) @@ -750,7 +728,7 @@ Returns the current value of LastUpdatedBy. =cut -=head2 LastUpdated +=item LastUpdated Returns the current value of LastUpdated. (In the database, LastUpdated is stored as datetime.) @@ -760,7 +738,7 @@ Returns the current value of LastUpdated. -sub _CoreAccessible { +sub _ClassAccessible { { id => diff --git a/rt/lib/RT/Users.pm b/rt/lib/RT/Users.pm index 95aec3b22..d58f69653 100755 --- a/rt/lib/RT/Users.pm +++ b/rt/lib/RT/Users.pm @@ -1,14 +1,8 @@ -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN LICENSE BLOCK # -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC -# <jesse@bestpractical.com> +# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com> # -# (Except where explicitly superseded by other copyright notices) -# -# -# LICENSE: +# (Except where explictly superceded by other copyright notices) # # This work is made available to you under the terms of Version 2 of # the GNU General Public License. A copy of that license should have @@ -20,29 +14,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# CONTRIBUTION SUBMISSION POLICY: -# -# (The following paragraph is not intended to limit the rights granted -# to you to modify and distribute this software under the terms of -# the GNU General Public License and is only of importance to you if -# you choose to contribute your changes and enhancements to the -# community by submitting them to Best Practical Solutions, LLC.) +# Unless otherwise specified, all modifications, corrections or +# extensions to this work which alter its source code become the +# property of Best Practical Solutions, LLC when submitted for +# inclusion in the work. # -# By intentionally submitting any modifications, corrections or -# derivatives to this work, or any other work intended for use with -# Request Tracker, to Best Practical Solutions, LLC, you confirm that -# you are the copyright holder for those contributions and you grant -# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -# royalty-free, perpetual, license to use, copy, create derivative -# works based on those contributions, and sublicense and distribute -# those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END LICENSE BLOCK # Autogenerated by DBIx::SearchBuilder factory (by <jesse@bestpractical.com>) # WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST. # @@ -86,7 +64,7 @@ sub _Init { } -=head2 NewItem +=item NewItem Returns an empty new RT::User item |