X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=rt%2Flib%2FRT%2FObjectTopic.pm;h=b9859998e22f08515496ec4505d5fcc5005be030;hb=187086c479a09629b7d180eec513fb7657f4e291;hp=8ca01ae9d94187cebfa1ced81fccd094b296b110;hpb=3d0a1bb06b895c5be6e3f0517d355442a6b1e125;p=freeside.git diff --git a/rt/lib/RT/ObjectTopic.pm b/rt/lib/RT/ObjectTopic.pm index 8ca01ae9d..b9859998e 100644 --- a/rt/lib/RT/ObjectTopic.pm +++ b/rt/lib/RT/ObjectTopic.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -63,12 +63,10 @@ use strict; use warnings; no warnings 'redefine'; -use RT::Record; -use RT::Topic; - - use base qw( RT::Record ); +use RT::Topic; + sub _Init { my $self = shift; @@ -95,18 +93,16 @@ Create takes a hash of values and creates a row in the database: 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'}, -); - + ); } @@ -146,10 +142,10 @@ Returns the Topic Object which has the id returned by Topic =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 @@ -191,19 +187,44 @@ Returns (1, 'Status message') on success and (0, 'Error Message') on failure. 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;