#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2017 Best Practical Solutions, LLC
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
use warnings;
no warnings 'redefine';
-use RT::Record;
-use RT::Topic;
-
-
use base qw( RT::Record );
+use RT::Topic;
+
sub _Init {
my $self = shift;
sub Create {
my $self = shift;
- my %args = (
+ my %args = (
Topic => '0',
ObjectType => '',
ObjectId => '0',
-
- @_);
+ @_);
$self->SUPER::Create(
Topic => $args{'Topic'},
ObjectType => $args{'ObjectType'},
ObjectId => $args{'ObjectId'},
-);
-
+ );
}
=cut
sub TopicObj {
- my $self = shift;
- my $Topic = RT::Topic->new($self->CurrentUser);
- $Topic->Load($self->Topic());
- return($Topic);
+ my $self = shift;
+ my $Topic = RT::Topic->new($self->CurrentUser);
+ $Topic->Load($self->Topic());
+ return($Topic);
}
=head2 ObjectType
sub _CoreAccessible {
{
-
id =>
- {read => 1, type => 'int(11)', default => ''},
+ {read => 1, type => 'int(11)', default => ''},
Topic =>
- {read => 1, write => 1, type => 'int(11)', default => '0'},
+ {read => 1, write => 1, type => 'int(11)', default => '0'},
ObjectType =>
- {read => 1, write => 1, type => 'varchar(64)', default => ''},
+ {read => 1, write => 1, type => 'varchar(64)', default => ''},
ObjectId =>
- {read => 1, write => 1, type => 'int(11)', default => '0'},
+ {read => 1, write => 1, type => 'int(11)', default => '0'},
}
};
+sub FindDependencies {
+ my $self = shift;
+ my ($walker, $deps) = @_;
+
+ $self->SUPER::FindDependencies($walker, $deps);
+
+ $deps->Add( out => $self->TopicObj );
+
+ my $obj = $self->ObjectType->new( $self->CurrentUser );
+ $obj->Load( $self->ObjectId );
+ $deps->Add( out => $obj );
+}
+
+sub Serialize {
+ my $self = shift;
+ my %args = (@_);
+ my %store = $self->SUPER::Serialize(@_);
+
+ if ($store{ObjectId}) {
+ my $obj = $self->ObjectType->new( RT->SystemUser );
+ $obj->Load( $store{ObjectId} );
+ $store{ObjectId} = \($obj->UID);
+ }
+ return %store;
+}
+
RT::Base->_ImportOverlays();
1;