1 # BEGIN BPS TAGGED BLOCK {{{
5 # This software is Copyright (c) 1996-2017 Best Practical Solutions, LLC
6 # <sales@bestpractical.com>
8 # (Except where explicitly superseded by other copyright notices)
13 # This work is made available to you under the terms of Version 2 of
14 # the GNU General Public License. A copy of that license should have
15 # been provided with this software, but in any event can be snarfed
18 # This work is distributed in the hope that it will be useful, but
19 # WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 # General Public License for more details.
23 # You should have received a copy of the GNU General Public License
24 # along with this program; if not, write to the Free Software
25 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 # 02110-1301 or visit their web page on the internet at
27 # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
30 # CONTRIBUTION SUBMISSION POLICY:
32 # (The following paragraph is not intended to limit the rights granted
33 # to you to modify and distribute this software under the terms of
34 # the GNU General Public License and is only of importance to you if
35 # you choose to contribute your changes and enhancements to the
36 # community by submitting them to Best Practical Solutions, LLC.)
38 # By intentionally submitting any modifications, corrections or
39 # derivatives to this work, or any other work intended for use with
40 # Request Tracker, to Best Practical Solutions, LLC, you confirm that
41 # you are the copyright holder for those contributions and you grant
42 # Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
43 # royalty-free, perpetual, license to use, copy, create derivative
44 # works based on those contributions, and sublicense and distribute
45 # those contributions and any derivatives thereof.
47 # END BPS TAGGED BLOCK }}}
52 package RT::ObjectClass;
53 use base 'RT::Record';
55 sub Table {'ObjectClasses'}
68 unless ( $self->CurrentUser->HasRight( Right => 'AdminClass',
69 Object => $RT::System ) ) {
70 return ( 0, $self->loc('Permission Denied') );
74 Class => $args{'Class'},
75 ObjectType => $args{'ObjectType'},
76 ObjectId => $args{'ObjectId'},
84 Returns the current value of id.
85 (In the database, id is stored as int(11).)
93 Returns the current value of Class.
94 (In the database, Class is stored as int(11).)
102 Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
103 (In the database, Class will be stored as a int(11).)
111 Returns the Class Object which has the id returned by Class
118 my $Class = RT::Class->new($self->CurrentUser);
119 $Class->Load($self->Class());
125 Returns the current value of ObjectType.
126 (In the database, ObjectType is stored as varchar(255).)
130 =head2 SetObjectType VALUE
133 Set ObjectType to VALUE.
134 Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
135 (In the database, ObjectType will be stored as a varchar(255).)
143 Returns the current value of ObjectId.
144 (In the database, ObjectId is stored as int(11).)
148 =head2 SetObjectId VALUE
151 Set ObjectId to VALUE.
152 Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
153 (In the database, ObjectId will be stored as a int(11).)
161 Returns the current value of Creator.
162 (In the database, Creator is stored as int(11).)
170 Returns the current value of Created.
171 (In the database, Created is stored as datetime.)
179 Returns the current value of LastUpdatedBy.
180 (In the database, LastUpdatedBy is stored as int(11).)
188 Returns the current value of LastUpdated.
189 (In the database, LastUpdated is stored as datetime.)
196 sub _CoreAccessible {
200 {read => 1, type => 'int(11)', default => ''},
202 {read => 1, write => 1, type => 'int(11)', default => '0'},
204 {read => 1, write => 1, type => 'varchar(255)', default => ''},
206 {read => 1, write => 1, type => 'int(11)', default => '0'},
208 {read => 1, auto => 1, type => 'int(11)', default => '0'},
210 {read => 1, auto => 1, type => 'datetime', default => ''},
212 {read => 1, auto => 1, type => 'int(11)', default => '0'},
214 {read => 1, auto => 1, type => 'datetime', default => ''},
219 sub FindDependencies {
221 my ($walker, $deps) = @_;
223 $self->SUPER::FindDependencies($walker, $deps);
225 $deps->Add( out => $self->ClassObj );
227 my $obj = $self->ObjectType->new( $self->CurrentUser );
228 $obj->Load( $self->ObjectId );
229 $deps->Add( out => $obj );
235 my %store = $self->SUPER::Serialize(@_);
237 if ($store{ObjectId}) {
238 my $obj = $self->ObjectType->new( RT->SystemUser );
239 $obj->Load( $store{ObjectId} );
240 $store{ObjectId} = \($obj->UID);
245 RT::Base->_ImportOverlays();