1 # Copyright 1999-2000 Jesse Vincent <jesse@fsck.com>
2 # Released under the terms of the GNU Public License
3 # $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/ScripCondition.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
7 RT::ScripCondition - RT scrip conditional
11 use RT::ScripCondition;
16 This module should never be called directly by client code. it's an internal module which
17 should only be accessed through exported APIs in other modules.
22 ok (require RT::TestHarness);
23 ok (require RT::ScripCondition);
31 package RT::ScripCondition;
38 $self->{'table'} = "ScripConditions";
39 return ($self->SUPER::_Init(@_));
46 my %Cols = ( Name => 'read',
47 Description => 'read',
48 ApplicableTransTypes => 'read',
51 Creator => 'read/auto',
52 Created => 'read/auto',
53 LastUpdatedBy => 'read/auto',
54 LastUpdated => 'read/auto'
56 return($self->SUPER::_Accessible(@_, %Cols));
64 Takes a hash. Creates a new Condition entry.
65 should be better documented.
71 return($self->SUPER::Create(@_));
79 No API available for deleting things just yet.
85 return(0,'Unimplemented');
91 =head2 Load IDENTIFIER
93 Loads a condition takes a name or ScripCondition id.
99 my $identifier = shift;
101 unless (defined $identifier) {
105 if ($identifier !~ /\D/) {
106 return ($self->SUPER::LoadById($identifier));
109 return ($self->LoadByCol('Name', $identifier));
114 # {{{ sub LoadCondition
116 =head2 LoadCondition HASH
118 takes a hash which has the following elements: TransactionObj and TicketObj.
119 Loads the Condition module in question.
126 my %args = ( TransactionObj => undef,
130 #TODO: Put this in an eval
131 $self->ExecModule =~ /^(\w+)$/;
133 my $type = "RT::Condition::". $module;
135 $RT::Logger->debug("now requiring $type\n");
136 eval "require $type" || die "Require of $type failed.\n$@\n";
138 $self->{'Condition'} = $type->new ( 'ScripConditionObj' => $self,
139 'TicketObj' => $args{'TicketObj'},
140 'TransactionObj' => $args{'TransactionObj'},
141 'Argument' => $self->Argument,
142 'ApplicableTransTypes' => $self->ApplicableTransTypes,
147 # {{{ The following methods call the Condition object
154 Helper method to call the condition module\'s Describe method.
160 return ($self->{'Condition'}->Describe());
165 # {{{ sub IsApplicable
169 Helper method to call the condition module\'s IsApplicable method.
175 return ($self->{'Condition'}->IsApplicable());
185 $self->{'Condition'} = undef;