diff options
author | Ivan Kohler <ivan@freeside.biz> | 2013-12-28 16:11:46 -0800 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2013-12-28 16:11:46 -0800 |
commit | 32072dbf59a054529f5304574c0f56f9567d14d0 (patch) | |
tree | eaca19adc8da8daf4b0eaaed1a16c3a8e5a53cb0 /FS/FS/cgp_rule.pm | |
parent | 66c235e33563ccd785ff9e0828398f778a75fb9f (diff) |
autoload methods returning foreign records, RT#13971
Diffstat (limited to 'FS/FS/cgp_rule.pm')
-rw-r--r-- | FS/FS/cgp_rule.pm | 93 |
1 files changed, 32 insertions, 61 deletions
diff --git a/FS/FS/cgp_rule.pm b/FS/FS/cgp_rule.pm index e9c50901a..1029f5a17 100644 --- a/FS/FS/cgp_rule.pm +++ b/FS/FS/cgp_rule.pm @@ -1,11 +1,8 @@ package FS::cgp_rule; +use base qw( FS::o2m_Common FS::Record ); use strict; -use base qw( FS::o2m_Common FS::Record ); -use FS::Record qw( qsearch qsearchs dbh ); -use FS::cust_svc; -use FS::cgp_rule_condition; -use FS::cgp_rule_action; +use FS::Record qw( dbh ); =head1 NAME @@ -80,36 +77,36 @@ otherwise returns false. =cut -sub insert { - my $self = shift; - - local $SIG{HUP} = 'IGNORE'; - local $SIG{INT} = 'IGNORE'; - local $SIG{QUIT} = 'IGNORE'; - local $SIG{TERM} = 'IGNORE'; - local $SIG{TSTP} = 'IGNORE'; - local $SIG{PIPE} = 'IGNORE'; - - my $oldAutoCommit = $FS::UID::AutoCommit; - local $FS::UID::AutoCommit = 0; - my $dbh = dbh; - - my $error = $self->SUPER::insert(@_); - if ( $error ) { - $dbh->rollback if $oldAutoCommit; - return $error; - } - - #conditions and actions not in yet - #$error = $self->svc_export; - #if ( $error ) { - # $dbh->rollback if $oldAutoCommit; - # return $error; - #} - - $dbh->commit or die $dbh->errstr if $oldAutoCommit; - ''; -} +# sub insert { +# my $self = shift; +# +# local $SIG{HUP} = 'IGNORE'; +# local $SIG{INT} = 'IGNORE'; +# local $SIG{QUIT} = 'IGNORE'; +# local $SIG{TERM} = 'IGNORE'; +# local $SIG{TSTP} = 'IGNORE'; +# local $SIG{PIPE} = 'IGNORE'; +# +# my $oldAutoCommit = $FS::UID::AutoCommit; +# local $FS::UID::AutoCommit = 0; +# my $dbh = dbh; +# +# my $error = $self->SUPER::insert(@_); +# if ( $error ) { +# $dbh->rollback if $oldAutoCommit; +# return $error; +# } +# +# #conditions and actions not in yet +# #$error = $self->svc_export; +# #if ( $error ) { +# # $dbh->rollback if $oldAutoCommit; +# # return $error; +# #} +# +# $dbh->commit or die $dbh->errstr if $oldAutoCommit; +# ''; +# } =item delete @@ -291,37 +288,11 @@ sub clone { =item cust_svc -=cut - -sub cust_svc { - my $self = shift; - qsearchs('cust_svc', { 'svcnum' => $self->svcnum } ); -} - =item cgp_rule_condition Returns the conditions associated with this rule, as FS::cgp_rule_condition objects. -=cut - -sub cgp_rule_condition { - my $self = shift; - qsearch('cgp_rule_condition', { 'rulenum' => $self->rulenum } ); -} - -=item cgp_rule_action - -Returns the actions associated with this rule, as FS::cgp_rule_action -objects. - -=cut - -sub cgp_rule_action { - my $self = shift; - qsearch('cgp_rule_action', { 'rulenum' => $self->rulenum } ); -} - =item arrayref Returns an arraref representing this rule, suitable for Communigate Pro API |