locationnum, (other fields?). Attempts to re-provision cancelled services
using history information (errors at this stage are not fatal).
-cust_pkg: pass a scalar reference, will be filled in with
+cust_pkg: pass a scalar reference, will be filled in with the new cust_pkg object
+
+svc_fatal: service provisioning errors are fatal
svc_errors: pass an array reference, will be filled in with any provisioning errors
}
my $svc_error = $svc_x->insert;
- if ( $svc_error ) { #&& $options{svc_fatal} ) {
+ if ( $svc_error && $options{svc_fatal} ) {
$dbh->rollback if $oldAutoCommit;
- return $error;
+ 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;
+ }
+ }
}
push @svc_errors, $svc_error if $svc_error;
}
}
if ( $opt{'svcdb'} ) {
$search{addl_from} = ' LEFT JOIN part_svc USING ( svcpart ) ';
- $search{hashref}->{svcdb} = $opt{'svcdb'};
+ $search{extra_sql} = ' AND svcdb = '. dbh->quote( $opt{'svcdb'} );
}
cluck "cust_pkg->cust_svc called" if $DEBUG > 2;
# ( $table.${prefix}city = ? $or_empty_city $ornull )
"
- ( $table.${prefix}district = ? OR ? = '' OR CAST(? AS text) IS NULL )
+ ( $table.district = ? OR ? = '' OR CAST(? AS text) IS NULL )
AND ( $table.${prefix}city = ? OR ? = '' OR CAST(? AS text) IS NULL )
AND ( $table.${prefix}county = ? $or_empty_county $ornull )
AND ( $table.${prefix}state = ? $or_empty_state $ornull )