add skip_dcontext_suffix to skip CDRs with dcontext ending in a definable string...
[freeside.git] / FS / FS / queue_depend.pm
1 package FS::queue_depend;
2 use base qw(FS::Record);
3
4 use strict;
5
6 =head1 NAME
7
8 FS::queue_depend - Object methods for queue_depend records
9
10 =head1 SYNOPSIS
11
12   use FS::queue_depend;
13
14   $record = new FS::queue_depend \%hash;
15   $record = new FS::queue_depend { 'column' => 'value' };
16
17   $error = $record->insert;
18
19   $error = $new_record->replace($old_record);
20
21   $error = $record->delete;
22
23   $error = $record->check;
24
25 =head1 DESCRIPTION
26
27 An FS::queue_depend object represents an job dependancy.  FS::queue_depend
28 inherits from FS::Record.  The following fields are currently supported:
29
30 =over 4
31
32 =item dependnum - primary key
33
34 =item jobnum - source jobnum (see L<FS::queue>).
35
36 =item depend_jobnum - dependancy jobnum (see L<FS::queue>)
37
38 =back
39
40 The job specified by B<jobnum> depends on the job specified B<depend_jobnum> -
41 the B<jobnum> job will not be run until the B<depend_jobnum> job has completed
42 successfully (or manually removed).
43
44 =head1 METHODS
45
46 =over 4
47
48 =item new HASHREF
49
50 Creates a new dependancy.  To add the dependancy to the database, see
51 L<"insert">.
52
53 Note that this stores the hash reference, not a distinct copy of the hash it
54 points to.  You can ask the object for a copy with the I<hash> method.
55
56 =cut
57
58 # the new method can be inherited from FS::Record, if a table method is defined
59
60 sub table { 'queue_depend'; }
61
62 =item insert
63
64 Adds this record to the database.  If there is an error, returns the error,
65 otherwise returns false.
66
67 =cut
68
69 # the insert method can be inherited from FS::Record
70
71 =item delete
72
73 Delete this record from the database.
74
75 =cut
76
77 # the delete method can be inherited from FS::Record
78
79 =item replace OLD_RECORD
80
81 Replaces the OLD_RECORD with this one in the database.  If there is an error,
82 returns the error, otherwise returns false.
83
84 =cut
85
86 # the replace method can be inherited from FS::Record
87
88 =item check
89
90 Checks all fields to make sure this is a valid dependancy.  If there is
91 an error, returns the error, otherwise returns false.  Called by the insert
92 and replace methods.
93
94 =cut
95
96 sub check {
97   my $self = shift;
98
99   $self->ut_numbern('dependnum')
100     || $self->ut_foreign_key('jobnum',        'queue', 'jobnum')
101     || $self->ut_foreign_key('depend_jobnum', 'queue', 'jobnum')
102     || $self->SUPER::check
103   ;
104 }
105
106 =back
107
108 =head1 BUGS
109
110 =head1 SEE ALSO
111
112 L<FS::queue>, L<FS::Record>, schema.html from the base documentation.
113
114 =cut
115
116 1;
117