1 package FS::part_export_machine;
4 use base qw( FS::Record );
5 use FS::Record qw( dbh qsearch ); #qsearchs );
7 use FS::svc_export_machine;
11 FS::part_export_machine - Object methods for part_export_machine records
15 use FS::part_export_machine;
17 $record = new FS::part_export_machine \%hash;
18 $record = new FS::part_export_machine { 'column' => 'value' };
20 $error = $record->insert;
22 $error = $new_record->replace($old_record);
24 $error = $record->delete;
26 $error = $record->check;
30 An FS::part_export_machine object represents an export hostname choice.
31 FS::part_export_machine inherits from FS::Record. The following fields are
42 Export, see L<FS::part_export>
46 Hostname or IP address
56 Creates a new record. To add the record to the database, see L<"insert">.
58 Note that this stores the hash reference, not a distinct copy of the hash it
59 points to. You can ask the object for a copy with the I<hash> method.
63 sub table { 'part_export_machine'; }
67 Adds this record to the database. If there is an error, returns the error,
68 otherwise returns false.
72 Delete this record from the database.
79 local $SIG{HUP} = 'IGNORE';
80 local $SIG{INT} = 'IGNORE';
81 local $SIG{QUIT} = 'IGNORE';
82 local $SIG{TERM} = 'IGNORE';
83 local $SIG{TSTP} = 'IGNORE';
84 local $SIG{PIPE} = 'IGNORE';
85 my $oldAutoCommit = $FS::UID::AutoCommit;
86 local $FS::UID::AutoCommit = 0;
89 my $error = $self->SUPER::delete;
91 $dbh->rollback if $oldAutoCommit;
95 foreach my $svc_export_machine ( $self->svc_export_machine ) {
96 my $error = $svc_export_machine->delete;
98 $dbh->rollback if $oldAutoCommit;
103 $dbh->commit or die $dbh->errstr if $oldAutoCommit;
108 =item replace OLD_RECORD
110 Replaces the OLD_RECORD with this one in the database. If there is an error,
111 returns the error, otherwise returns false.
115 Checks all fields to make sure this is a valid record. If there is
116 an error, returns the error, otherwise returns false. Called by the insert
125 $self->ut_numbern('machinenum')
126 || $self->ut_foreign_key('exportnum', 'part_export', 'exportnum')
127 || $self->ut_domain('machine')
128 || $self->ut_enum('disabled', [ '', 'Y' ])
130 return $error if $error;
135 =item svc_export_machine
139 sub svc_export_machine {
141 qsearch( 'svc_export_machine', { 'machinenum' => $self->machinenum } );
150 L<FS::part_export>, L<FS::Record>