#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
# <jesse@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/copyleft/gpl.html.
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
# CONTRIBUTION SUBMISSION POLICY:
# those contributions and any derivatives thereof.
#
# END BPS TAGGED BLOCK }}}
+
=head1 NAME
RT::Record - Base class for RT record objects
=cut
package RT::Record;
-
-use strict;
-use warnings;
-
-our @ISA;
-use base qw(RT::Base);
-
use RT::Date;
use RT::User;
use RT::Attributes;
+use RT::Base;
use DBIx::SearchBuilder::Record::Cachable;
-use Encode qw();
-our $_TABLE_ATTR = { };
+use strict;
+use vars qw/@ISA $_TABLE_ATTR/;
+@ISA = qw(RT::Base);
-if ( $RT::DontCacheSearchBuilderRecords ) {
+if ($RT::DontCacheSearchBuilderRecords ) {
push (@ISA, 'DBIx::SearchBuilder::Record');
} else {
push (@ISA, 'DBIx::SearchBuilder::Record::Cachable');
Description => $args{'Description'},
Content => $args{'Content'} );
-
+
# XXX TODO: Why won't RedoSearch work here?
$self->Attributes->_DoSearch;
=head2 FirstAttribute NAME
-Returns the first attribute with the matching name for this object (as an
-L<RT::Attribute> object), or C<undef> if no such attributes exist.
-
-Note that if there is more than one attribute with the matching name on the
-object, the choice of which one to return is basically arbitrary. This may be
-made well-defined in the future.
+Returns the value of the first attribute with the matching name
+for this object, or C<undef> if no such attributes exist.
=cut
}
+require Encode::compat if $] < 5.007001;
+require Encode;
+
+
+
sub __Value {
my $self = shift;
sub _ClassAccessible {
my $self = shift;
- return $_TABLE_ATTR->{ref($self)};
+ return $_TABLE_ATTR->{ ref($self) || $self };
}
=head2 _Accessible COLUMN ATTRIBUTE
next if ( $value eq $self->$attribute() );
my $method = "Set$attribute";
my ( $code, $msg ) = $self->$method($value);
- my ($prefix) = ref($self) =~ /RT(?:.*)::(\w+)/;
+ my ($prefix) = ref($self) =~ /RT::(\w+)/;
# Default to $id, but use name if we can get it.
my $label = $self->id;
=head2 _AddLink
-Takes a paramhash of Type and one of Base or Target. Adds that link to this object.
-
-Returns C<link id>, C<message> and C<exist> flag.
+Takes a paramhash of Type and one of Base or Target. Adds that link to this ticket.
=cut
}
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';
}
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"), 1 );
+ return ( $old_link->id, $self->loc("Link already exists") );
}
# }}}
$direction='Base';
}
else {
- $RT::Logger->error("Base or Target must be specified\n");
+ $RT::Logger->debug("$self: Base or Target must be specified\n");
return ( 0, $self->loc('Either base or target must be specified') );
}
$self->_UpdateTimeTaken( $args{'TimeTaken'} );
}
if ( $RT::UseTransactionBatch and $transaction ) {
- push @{$self->{_TransactionBatch}}, $trans if $args{'CommitScrips'};
+ push @{$self->{_TransactionBatch}}, $trans;
}
return ( $transaction, $msg, $trans );
}
);
unless ($new_value_id) {
- return ( 0, $self->loc( "Could not add new custom field value: [_1]", $value_msg) );
+ return ( 0, $self->loc( "Could not add new custom field value. [_1] ",, $value_msg));
}
my $new_value = RT::ObjectCustomFieldValue->new( $self->CurrentUser );
# otherwise, just add a new value and record "new value added"
else {
- my ($new_value_id, $value_msg) = $cf->AddValueForObject(
+ my ($new_value_id) = $cf->AddValueForObject(
Object => $self,
Content => $args{'Value'},
LargeContent => $args{'LargeContent'},
);
unless ($new_value_id) {
- return ( 0, $self->loc( "Could not add new custom field value: [_1]", $value_msg) );
+ return ( 0, $self->loc("Could not add new custom field value. ") );
}
if ( $args{'RecordTransaction'} ) {
my ( $TransactionId, $Msg, $TransactionObj ) =
sub BasicColumns {
}
-sub WikiBase {
- return $RT::WebPath. "/index.html?q=";
-}
-
eval "require RT::Record_Vendor";
die $@ if ($@ && $@ !~ qr{^Can't locate RT/Record_Vendor.pm});
eval "require RT::Record_Local";