default to a session cookie instead of setting an explicit timeout, weird timezone...
[freeside.git] / FS / FS / export_nas.pm
1 package FS::export_nas;
2 use base qw( FS::Record );
3
4 use strict;
5 use vars qw($noexport_hack);
6
7 $noexport_hack = '';
8
9 =head1 NAME
10
11 FS::export_nas - Object methods for export_nas records
12
13 =head1 SYNOPSIS
14
15   use FS::export_nas;
16
17   $record = new FS::export_nas \%hash;
18   $record = new FS::export_nas { 'column' => 'value' };
19
20   $error = $record->insert;
21
22   $error = $new_record->replace($old_record);
23
24   $error = $record->delete;
25
26   $error = $record->check;
27
28 =head1 DESCRIPTION
29
30 An FS::export_nas object links RADIUS exports (in the part_export table)
31 to RADIUS clients (in the nas table).  FS::export_nas inherits from
32 FS::Record.  The following fields are currently supported:
33
34 =over 4
35
36 =item exportnasnum
37
38 primary key
39
40 =item exportnum
41
42 exportnum
43
44 =item nasnum
45
46 nasnum
47
48
49 =back
50
51 =head1 METHODS
52
53 =over 4
54
55 =item new HASHREF
56
57 Creates a new record.  To add the record to the database, see L<"insert">.
58
59 Note that this stores the hash reference, not a distinct copy of the hash it
60 points to.  You can ask the object for a copy with the I<hash> method.
61
62 =cut
63
64 # the new method can be inherited from FS::Record, if a table method is defined
65
66 sub table { 'export_nas'; }
67
68 =item insert
69
70 Adds this record to the database.  If there is an error, returns the error,
71 otherwise returns false.
72
73 =cut
74
75 sub insert {
76   my $self = shift;
77   $self->SUPER::insert || 
78   ($noexport_hack ? '' : $self->part_export->export_nas_insert($self->nas));
79 }
80
81 =item delete
82
83 Delete this record from the database.
84
85 =cut
86
87 sub delete {
88   my $self = shift;
89   ($noexport_hack ? '' : $self->part_export->export_nas_delete($self->nas))
90   || $self->SUPER::delete;
91 }
92
93 =item replace OLD_RECORD
94
95 Unavailable.  Delete the record and create a new one.
96
97 =cut
98
99 sub replace {
100   die "replace not implemented for export_nas records";
101 }
102
103 =item check
104
105 Checks all fields to make sure this is a valid record.  If there is
106 an error, returns the error, otherwise returns false.  Called by the insert
107 and replace methods.
108
109 =cut
110
111 # the check method should currently be supplied - FS::Record contains some
112 # data checking routines
113
114 sub check {
115   my $self = shift;
116
117   my $error = 
118     $self->ut_numbern('exportnasnum')
119     || $self->ut_foreign_key('exportnum', 'part_export', 'exportnum' )
120     || $self->ut_foreign_key('nasnum', 'nas', 'nasnum')
121   ;
122   return $error if $error;
123
124   $self->SUPER::check;
125 }
126
127 =back
128
129 =head1 BUGS
130
131 =head1 SEE ALSO
132
133 L<FS::Record>, schema.html from the base documentation.
134
135 =cut
136
137 1;
138