This commit was generated by cvs2svn to compensate for changes in r2523,
[freeside.git] / rt / lib / RT / Condition / Generic.pm
1 # $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Condition/Generic.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
2 # (c) 1996-2000 Jesse Vincent <jesse@fsck.com>
3 # This software is redistributable under the terms of the GNU GPL
4
5 =head1 NAME
6
7   RT::Condition::Generic - ;
8
9 =head1 SYNOPSIS
10
11     use RT::Condition::Generic;
12     my $foo = new RT::Condition::IsApplicable( 
13                 TransactionObj => $tr, 
14                 TicketObj => $ti, 
15                 ScripObj => $scr, 
16                 Argument => $arg, 
17                 Type => $type);
18
19     if ($foo->IsApplicable) {
20            # do something
21     }
22
23
24 =head1 DESCRIPTION
25
26
27 =head1 METHODS
28
29
30 =begin testing
31
32 ok (require RT::TestHarness);
33 ok (require RT::Condition::Generic);
34
35 =end testing
36
37
38 =cut
39
40 package RT::Condition::Generic;
41
42 # {{{ sub new 
43 sub new  {
44   my $proto = shift;
45   my $class = ref($proto) || $proto;
46   my $self  = {};
47   bless ($self, $class);
48   $self->_Init(@_);
49   return $self;
50 }
51 # }}}
52
53 # {{{ sub _Init 
54 sub _Init  {
55   my $self = shift;
56   my %args = ( TransactionObj => undef,
57                TicketObj => undef,
58                ScripObj => undef,
59                TemplateObj => undef,
60                Argument => undef,
61                ApplicableTransTypes => undef,
62                @_ );
63   
64   
65   $self->{'Argument'} = $args{'Argument'};
66   $self->{'ScripObj'} = $args{'ScripObj'};
67   $self->{'TicketObj'} = $args{'TicketObj'};
68   $self->{'TransactionObj'} = $args{'TransactionObj'};
69   $self->{'ApplicableTransTypes'} = $args{'ApplicableTransTypes'};
70 }
71 # }}}
72
73 # Access Scripwide data
74
75 # {{{ sub Argument 
76
77 =head2 Argument
78
79 Return the optional argument associated with this ScripCondition
80
81 =cut
82
83 sub Argument  {
84   my $self = shift;
85   return($self->{'Argument'});
86 }
87 # }}}
88
89 # {{{ sub TicketObj
90
91 =head2 TicketObj
92
93 Return the ticket object we're talking about
94
95 =cut
96
97 sub TicketObj  {
98   my $self = shift;
99   return($self->{'TicketObj'});
100 }
101 # }}}
102
103 # {{{ sub TransactionObj
104
105 =head2 TransactionObj
106
107 Return the transaction object we're talking about
108
109 =cut
110
111 sub TransactionObj  {
112   my $self = shift;
113   return($self->{'TransactionObj'});
114 }
115 # }}}
116
117 # {{{ sub Type
118
119 =head2 Type 
120
121
122
123 =cut
124
125 sub ApplicableTransTypes  {
126   my $self = shift;
127   return($self->{'ApplicableTransTypes'});
128 }
129 # }}}
130
131
132 # Scrip methods
133
134
135 #What does this type of Action does
136
137 # {{{ sub Describe 
138 sub Describe  {
139   my $self = shift;
140   return ("No description for " . ref $self);
141 }
142 # }}}
143
144
145 #Parse the templates, get things ready to go.
146
147 #If this rule applies to this transaction, return true.
148
149 # {{{ sub IsApplicable 
150 sub IsApplicable  {
151   my $self = shift;
152   return(undef);
153 }
154 # }}}
155
156 # {{{ sub DESTROY
157 sub DESTROY {
158     my $self = shift;
159
160     # We need to clean up all the references that might maybe get
161     # oddly circular
162     $self->{'TemplateObj'} =undef
163     $self->{'TicketObj'} = undef;
164     $self->{'TransactionObj'} = undef;
165     $self->{'ScripObj'} = undef;
166      
167 }
168
169 # }}}
170 1;