]>
Commit | Line | Data |
---|---|---|
af59614d MKG |
1 | # BEGIN BPS TAGGED BLOCK {{{ |
2 | # | |
3 | # COPYRIGHT: | |
4 | # | |
320f0092 | 5 | # This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC |
af59614d MKG |
6 | # <sales@bestpractical.com> |
7 | # | |
8 | # (Except where explicitly superseded by other copyright notices) | |
9 | # | |
10 | # | |
11 | # LICENSE: | |
12 | # | |
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 | |
16 | # from www.gnu.org. | |
17 | # | |
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. | |
22 | # | |
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. | |
28 | # | |
29 | # | |
30 | # CONTRIBUTION SUBMISSION POLICY: | |
31 | # | |
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.) | |
37 | # | |
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. | |
46 | # | |
47 | # END BPS TAGGED BLOCK }}} | |
48 | ||
49 | use strict; | |
50 | use warnings; | |
51 | ||
52 | package RT::ObjectScrip; | |
53 | use base 'RT::Record::AddAndSort'; | |
54 | ||
55 | use RT::Scrip; | |
56 | use RT::ObjectScrips; | |
57 | ||
58 | =head1 NAME | |
59 | ||
60 | RT::ObjectScrip - record representing addition of a scrip to a queue | |
61 | ||
62 | =head1 DESCRIPTION | |
63 | ||
64 | This record is created if you want to add a scrip to a queue or globally. | |
65 | ||
66 | Inherits methods from L<RT::Record::AddAndSort>. | |
67 | ||
68 | For most operations it's better to use methods in L<RT::Scrip>. | |
69 | ||
70 | =head1 METHODS | |
71 | ||
72 | =head2 Table | |
73 | ||
74 | Returns table name for records of this class. | |
75 | ||
76 | =cut | |
77 | ||
78 | sub Table {'ObjectScrips'} | |
79 | ||
80 | =head2 ObjectCollectionClass | |
81 | ||
82 | Returns class name of collection of records scrips can be added to. | |
83 | Now it's only L<RT::Queue>, so 'RT::Queues' is returned. | |
84 | ||
85 | =cut | |
86 | ||
87 | sub ObjectCollectionClass {'RT::Queues'} | |
88 | ||
89 | =head2 ScripObj | |
90 | ||
91 | Returns the Scrip Object which has the id returned by Scrip | |
92 | ||
93 | =cut | |
94 | ||
95 | sub ScripObj { | |
96 | my $self = shift; | |
97 | my $id = shift || $self->Scrip; | |
98 | my $obj = RT::Scrip->new( $self->CurrentUser ); | |
99 | $obj->Load( $id ); | |
100 | return $obj; | |
101 | } | |
102 | ||
103 | =head2 Neighbors | |
104 | ||
105 | Stage splits scrips into neighborhoods. See L<RT::Record::AddAndSort/Neighbors and Siblings>. | |
106 | ||
107 | =cut | |
108 | ||
109 | sub Neighbors { | |
110 | my $self = shift; | |
111 | my %args = @_; | |
112 | ||
113 | my $res = $self->CollectionClass->new( $self->CurrentUser ); | |
114 | $res->Limit( FIELD => 'Stage', VALUE => $args{'Stage'} || $self->Stage ); | |
115 | return $res; | |
116 | } | |
117 | ||
118 | =head2 id | |
119 | ||
120 | Returns the current value of id. | |
121 | (In the database, id is stored as int(11).) | |
122 | ||
123 | ||
124 | =cut | |
125 | ||
126 | ||
127 | =head2 Scrip | |
128 | ||
129 | Returns the current value of Scrip. | |
130 | (In the database, Scrip is stored as int(11).) | |
131 | ||
132 | ||
133 | ||
134 | =head2 SetScrip VALUE | |
135 | ||
136 | ||
137 | Set Scrip to VALUE. | |
138 | Returns (1, 'Status message') on success and (0, 'Error Message') on failure. | |
139 | (In the database, Scrip will be stored as a int(11).) | |
140 | ||
141 | =head2 Stage | |
142 | ||
143 | Returns the current value of Stage. | |
144 | (In the database, Stage is stored as varchar(32).) | |
145 | ||
146 | =head2 SetStage VALUE | |
147 | ||
148 | Set Stage to VALUE. | |
149 | Returns (1, 'Status message') on success and (0, 'Error Message') on failure. | |
150 | (In the database, Stage will be stored as a varchar(32).) | |
151 | ||
152 | =head2 ObjectId | |
153 | ||
154 | Returns the current value of ObjectId. | |
155 | (In the database, ObjectId is stored as int(11).) | |
156 | ||
157 | ||
158 | ||
159 | =head2 SetObjectId VALUE | |
160 | ||
161 | ||
162 | Set ObjectId to VALUE. | |
163 | Returns (1, 'Status message') on success and (0, 'Error Message') on failure. | |
164 | (In the database, ObjectId will be stored as a int(11).) | |
165 | ||
166 | ||
167 | =cut | |
168 | ||
169 | ||
170 | =head2 SortOrder | |
171 | ||
172 | Returns the current value of SortOrder. | |
173 | (In the database, SortOrder is stored as int(11).) | |
174 | ||
175 | ||
176 | ||
177 | =head2 SetSortOrder VALUE | |
178 | ||
179 | ||
180 | Set SortOrder to VALUE. | |
181 | Returns (1, 'Status message') on success and (0, 'Error Message') on failure. | |
182 | (In the database, SortOrder will be stored as a int(11).) | |
183 | ||
184 | ||
185 | =cut | |
186 | ||
187 | ||
188 | =head2 Creator | |
189 | ||
190 | Returns the current value of Creator. | |
191 | (In the database, Creator is stored as int(11).) | |
192 | ||
193 | ||
194 | =cut | |
195 | ||
196 | ||
197 | =head2 Created | |
198 | ||
199 | Returns the current value of Created. | |
200 | (In the database, Created is stored as datetime.) | |
201 | ||
202 | ||
203 | =cut | |
204 | ||
205 | ||
206 | =head2 LastUpdatedBy | |
207 | ||
208 | Returns the current value of LastUpdatedBy. | |
209 | (In the database, LastUpdatedBy is stored as int(11).) | |
210 | ||
211 | ||
212 | =cut | |
213 | ||
214 | ||
215 | =head2 LastUpdated | |
216 | ||
217 | Returns the current value of LastUpdated. | |
218 | (In the database, LastUpdated is stored as datetime.) | |
219 | ||
220 | ||
221 | =cut | |
222 | ||
223 | ||
224 | ||
225 | sub _CoreAccessible { | |
226 | { | |
227 | ||
228 | id => | |
229 | {read => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => ''}, | |
230 | Scrip => | |
231 | {read => 1, write => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => ''}, | |
232 | Stage => | |
233 | {read => 1, write => 1, sql_type => 12, length => 32, is_blob => 0, is_numeric => 0, type => 'varchar(32)', default => 'TransactionCreate'}, | |
234 | ObjectId => | |
235 | {read => 1, write => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => ''}, | |
236 | SortOrder => | |
237 | {read => 1, write => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => '0'}, | |
238 | Creator => | |
239 | {read => 1, auto => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => '0'}, | |
240 | Created => | |
241 | {read => 1, auto => 1, sql_type => 11, length => 0, is_blob => 0, is_numeric => 0, type => 'datetime', default => ''}, | |
242 | LastUpdatedBy => | |
243 | {read => 1, auto => 1, sql_type => 4, length => 11, is_blob => 0, is_numeric => 1, type => 'int(11)', default => '0'}, | |
244 | LastUpdated => | |
245 | {read => 1, auto => 1, sql_type => 11, length => 0, is_blob => 0, is_numeric => 0, type => 'datetime', default => ''}, | |
246 | ||
247 | } | |
248 | }; | |
249 | ||
250 | RT::Base->_ImportOverlays(); | |
251 | ||
252 | 1; |