}
my $svc_error = $svc_x->insert;
- if ( $svc_error && $options{svc_fatal} ) {
- $dbh->rollback if $oldAutoCommit;
- return $svc_error;
- } else {
- my $cust_svc = qsearchs('cust_svc', { 'svcnum' => $svc_x->svcnum });
- if ( $cust_svc ) {
- my $cs_error = $cust_svc->delete;
- if ( $cs_error ) {
- $dbh->rollback if $oldAutoCommit;
- return $cs_error;
+ if ( $svc_error ) {
+ if ( $options{svc_fatal} ) {
+ $dbh->rollback if $oldAutoCommit;
+ return $svc_error;
+ } else {
+ push @svc_errors, $svc_error;
+ # is this necessary? svc_Common::insert already deletes the
+ # cust_svc if inserting svc_x fails.
+ my $cust_svc = qsearchs('cust_svc', { 'svcnum' => $svc_x->svcnum });
+ if ( $cust_svc ) {
+ my $cs_error = $cust_svc->delete;
+ if ( $cs_error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return $cs_error;
+ }
}
- }
- }
- push @svc_errors, $svc_error if $svc_error;
- }
+ } # svc_fatal
+ } # svc_error
+ } #foreach $h_cust_svc
#these are pretty rare, but should handle them
# - dsl_device (mac addresses)
$hash{'resume'} = $resume_date;
}
+ $options{options} ||= {};
+
my $new = new FS::cust_pkg ( \%hash );
- $error = $new->replace( $self, options => { $self->options } );
+ $error = $new->replace( $self, options => { $self->options,
+ %{ $options{options} },
+ }
+ );
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
return $error;
grep {
my $part_svc = $_->part_svc;
$part_svc->svcdb eq 'svc_acct'
- && scalar($part_svc->part_export('sqlradius'));
+ && scalar($part_svc->part_export_usage);
} $self->cust_svc
) {
$seconds += $cust_svc->seconds_since_sqlradacct($start, $end);
grep {
my $part_svc = $_->part_svc;
$part_svc->svcdb eq 'svc_acct'
- && scalar($part_svc->part_export('sqlradius'));
+ && scalar($part_svc->part_export_usage);
} $self->cust_svc
) {
$sum += $cust_svc->attribute_since_sqlradacct($start, $end, $attrib);