# BEGIN BPS TAGGED BLOCK {{{
#
# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+#
+# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
# <jesse@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 or visit their web page on the internet at
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
#
#
# CONTRIBUTION SUBMISSION POLICY:
=head1 METHODS
-=begin testing
-
-ok (require RT::CustomFields);
-
-=end testing
=cut
sub Next {
my $self = shift;
-
my $CF = $self->SUPER::Next();
- if ((defined($CF)) and (ref($CF))) {
-
- if ($CF->CurrentUserHasRight('SeeCustomField')) {
- return($CF);
- }
-
- #If the user doesn't have the right to show this queue
- else {
- return($self->Next());
- }
- }
- #if there never was any queue
- else {
- return(undef);
- }
-
+ return $CF unless $CF;
+
+ $CF->SetContextOject( $self->ContextObject );
+
+ return $self->Next unless $CF->CurrentUserHasRight('SeeCustomField');
+ return $CF;
+}
+
+sub SetContextObject {
+ my $self = shift;
+ return $self->{'context_object'} = shift;
+}
+
+sub ContextObject {
+ my $self = shift;
+ return $self->{'context_object'};
+}
+
+sub NewItem {
+ my $self = shift;
+ my $res = RT::CustomField->new($self->CurrentUser);
+ $res->SetContextObject($self->ContextObject);
+ return $res;
}
+
# }}}
sub LimitToLookupType {
ENTRYAGGREGATOR => 'OR' ) unless $global_only;
$self->OrderByCols(
- { ALIAS => $self->_OCFAlias, FIELD => 'ObjectId' },
+ { ALIAS => $self->_OCFAlias, FIELD => 'ObjectId', ORDER => 'DESC' },
{ ALIAS => $self->_OCFAlias, FIELD => 'SortOrder' },
);
#$self->OrderBy( ALIAS => $class_cfs , FIELD => "SortOrder", ORDER => 'ASC');
}
-
+
1;