add skip_dcontext_suffix to skip CDRs with dcontext ending in a definable string...
[freeside.git] / FS / FS / cacti_page.pm
1 package FS::cacti_page;
2 use base qw( FS::Record );
3
4 use strict;
5 use FS::Record qw( qsearch qsearchs );
6
7 =head1 NAME
8
9 FS::cacti_page - Object methods for cacti_page records
10
11 =head1 SYNOPSIS
12
13   use FS::cacti_page;
14
15   $record = new FS::cacti_page \%hash;
16   $record = new FS::table_name {
17               'exportnum' => 3,           #part_export associated with this page
18               'svcnum'   => 123,          #svc_broadband associated with this page
19               'graphnum' => 45,           #blank for svcnum index
20               'imported' => 1428358699,   #date of import
21               'content'  => $htmlcontent, #html containing base64-encoded images
22   };
23
24   $error = $record->insert;
25
26   $error = $new_record->replace($old_record);
27
28   $error = $record->delete;
29
30   $error = $record->check;
31
32 =head1 DESCRIPTION
33
34 An FS::cacti_page object represents an html page for viewing cacti graphs.
35 FS::cacti_page inherits from FS::Record.  The following fields are currently supported:
36
37 =over 4
38
39 =item cacti_pagenum - primary key
40
41 =item exportnum - part_export exportnum for this page
42
43 =item svcnum - svc_broadband svcnum for this page
44
45 =item graphnum - cacti graphnum for this page (blank for overview page)
46
47 =item imported - date this page was imported
48
49 =item content - text/html content of page, should not include newlines
50
51 =back
52
53 =head1 METHODS
54
55 =over 4
56
57 =item new HASHREF
58
59 Creates a new object.  To add the object to the database, see L<"insert">.
60
61 Note that this stores the hash reference, not a distinct copy of the hash it
62 points to.  You can ask the object for a copy with the I<hash> method.
63
64 =cut
65
66 # the new method can be inherited from FS::Record, if a table method is defined
67
68 sub table { 'cacti_page'; }
69
70 =item insert
71
72 Adds this record to the database.  If there is an error, returns the error,
73 otherwise returns false.
74
75 =cut
76
77 # the insert method can be inherited from FS::Record
78
79 =item delete
80
81 Delete this record from the database.
82
83 =cut
84
85 # the delete method can be inherited from FS::Record
86
87 =item replace OLD_RECORD
88
89 Replaces the OLD_RECORD with this one in the database.  If there is an error,
90 returns the error, otherwise returns false.
91
92 =cut
93
94 # the replace method can be inherited from FS::Record
95
96 =item check
97
98 Checks all fields to make sure this is a valid example.  If there is
99 an error, returns the error, otherwise returns false.  Called by the insert
100 and replace methods.
101
102 =cut
103
104 # the check method should currently be supplied - FS::Record contains some
105 # data checking routines
106
107 sub check {
108   my $self = shift;
109
110   my $error = 
111     $self->ut_numbern('cacti_pagenum', 'graphnum')
112     || $self->ut_foreign_key('exportnum','part_export','exportnum')
113     || $self->ut_foreign_key('svcnum','cust_svc','svcnum')
114     || $self->ut_number('imported')
115     || $self->ut_text('content')
116   ;
117   return $error if $error;
118
119   $self->SUPER::check;
120 }
121
122 =back
123
124 =head1 BUGS
125
126 Will be described here once found.
127
128 =head1 SEE ALSO
129
130 L<FS::Record>
131
132 =cut
133
134 1;
135