1 # BEGIN BPS TAGGED BLOCK {{{
5 # This software is Copyright (c) 1996-2015 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::ObjectScrip;
53 use base 'RT::Record::AddAndSort';
57 use Scalar::Util 'blessed';
61 RT::ObjectScrip - record representing addition of a scrip to a queue
65 This record is created if you want to add a scrip to a queue or globally.
67 Inherits methods from L<RT::Record::AddAndSort>.
69 For most operations it's better to use methods in L<RT::Scrip>.
75 Returns table name for records of this class.
79 sub Table {'ObjectScrips'}
81 =head2 ObjectCollectionClass
83 Returns class name of collection of records scrips can be added to.
84 Now it's only L<RT::Queue>, so 'RT::Queues' is returned.
88 sub ObjectCollectionClass {'RT::Queues'}
92 Returns the Scrip Object which has the id returned by Scrip
98 my $id = shift || $self->Scrip;
99 my $obj = RT::Scrip->new( $self->CurrentUser );
106 Stage splits scrips into neighborhoods. See L<RT::Record::AddAndSort/Neighbors and Siblings>.
114 my $res = $self->CollectionClass->new( $self->CurrentUser );
115 $res->Limit( FIELD => 'Stage', VALUE => $args{'Stage'} || $self->Stage );
121 Returns the current value of id.
122 (In the database, id is stored as int(11).)
130 Returns the current value of Scrip.
131 (In the database, Scrip is stored as int(11).)
135 Returns a localized human-readable version of the stage.
141 my $scrip_class = blessed($self->ScripObj);
142 return $scrip_class->FriendlyStage($self->Stage);
145 =head2 SetScrip VALUE
149 Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
150 (In the database, Scrip will be stored as a int(11).)
154 Returns the current value of Stage.
155 (In the database, Stage is stored as varchar(32).)
157 =head2 SetStage VALUE
160 Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
161 (In the database, Stage will be stored as a varchar(32).)
165 Returns the current value of ObjectId.
166 (In the database, ObjectId is stored as int(11).)
170 =head2 SetObjectId VALUE
173 Set ObjectId to VALUE.
174 Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
175 (In the database, ObjectId will be stored as a int(11).)
183 Returns the current value of SortOrder.
184 (In the database, SortOrder is stored as int(11).)
188 =head2 SetSortOrder VALUE
191 Set SortOrder to VALUE.
192 Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
193 (In the database, SortOrder will be stored as a int(11).)
201 Returns the current value of Creator.
202 (In the database, Creator is stored as int(11).)
210 Returns the current value of Created.
211 (In the database, Created is stored as datetime.)
219 Returns the current value of LastUpdatedBy.
220 (In the database, LastUpdatedBy is stored as int(11).)
228 Returns the current value of LastUpdated.
229 (In the database, LastUpdated is stored as datetime.)
236 sub _CoreAccessible {
240 {read => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => ''},
242 {read => 1, write => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => ''},
244 {read => 1, write => 1, sql_type => 12, length => 32, is_blob => 0, is_numeric => 0, type => 'varchar(32)', default => 'TransactionCreate'},
246 {read => 1, write => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => ''},
248 {read => 1, write => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => '0'},
250 {read => 1, auto => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => '0'},
252 {read => 1, auto => 1, sql_type => 11, length => 0, is_blob => 0, is_numeric => 0, type => 'datetime', default => ''},
254 {read => 1, auto => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => '0'},
256 {read => 1, auto => 1, sql_type => 11, length => 0, is_blob => 0, is_numeric => 0, type => 'datetime', default => ''},
261 sub FindDependencies {
263 my ($walker, $deps) = @_;
265 $self->SUPER::FindDependencies($walker, $deps);
267 $deps->Add( out => $self->ScripObj );
268 if ($self->ObjectId) {
269 my $obj = RT::Queue->new( $self->CurrentUser );
270 $obj->Load( $self->ObjectId );
271 $deps->Add( out => $obj );
275 RT::Base->_ImportOverlays();