summaryrefslogtreecommitdiff
path: root/FS/FS/cust_location.pm
diff options
context:
space:
mode:
authorJonathan Prykop <jonathan@freeside.biz>2016-04-18 14:33:02 -0500
committerJonathan Prykop <jonathan@freeside.biz>2016-04-22 12:09:18 -0500
commitfd0483007b898b9944cc31fd5d6e90932fe2c8c0 (patch)
treebfdc5f36e40d9a2e1b13af2ab5767f91deef5f15 /FS/FS/cust_location.pm
parent401aff3ec100c05c64f9eb0d003494758a3e74ee (diff)
RT#29296: API stuff: Add new locations [package location export]
Diffstat (limited to 'FS/FS/cust_location.pm')
-rw-r--r--FS/FS/cust_location.pm48
1 files changed, 26 insertions, 22 deletions
diff --git a/FS/FS/cust_location.pm b/FS/FS/cust_location.pm
index 2b8a5c8..3588cee 100644
--- a/FS/FS/cust_location.pm
+++ b/FS/FS/cust_location.pm
@@ -249,20 +249,22 @@ sub insert {
# cust_location exports
#my $export_args = $options{'export_args'} || [];
- my @part_export =
- map qsearch( 'part_export', {exportnum=>$_} ),
- $conf->config('cust_location-exports'); #, $agentnum
-
- foreach my $part_export ( @part_export ) {
- my $error = $part_export->export_insert($self); #, @$export_args);
- if ( $error ) {
- $dbh->rollback if $oldAutoCommit;
- return "exporting to ". $part_export->exporttype.
- " (transaction rolled back): $error";
+ # don't export custnum_pending cases, let follow-up replace handle that
+ if ($self->custnum || $self->prospectnum) {
+ my @part_export =
+ map qsearch( 'part_export', {exportnum=>$_} ),
+ $conf->config('cust_location-exports'); #, $agentnum
+
+ foreach my $part_export ( @part_export ) {
+ my $error = $part_export->export_insert($self); #, @$export_args);
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return "exporting to ". $part_export->exporttype.
+ " (transaction rolled back): $error";
+ }
}
}
-
$dbh->commit or die $dbh->errstr if $oldAutoCommit;
'';
}
@@ -311,20 +313,22 @@ sub replace {
# cust_location exports
#my $export_args = $options{'export_args'} || [];
- my @part_export =
- map qsearch( 'part_export', {exportnum=>$_} ),
- $conf->config('cust_location-exports'); #, $agentnum
-
- foreach my $part_export ( @part_export ) {
- my $error = $part_export->export_replace($self, $old); #, @$export_args);
- if ( $error ) {
- $dbh->rollback if $oldAutoCommit;
- return "exporting to ". $part_export->exporttype.
- " (transaction rolled back): $error";
+ # don't export custnum_pending cases, let follow-up replace handle that
+ if ($self->custnum || $self->prospectnum) {
+ my @part_export =
+ map qsearch( 'part_export', {exportnum=>$_} ),
+ $conf->config('cust_location-exports'); #, $agentnum
+
+ foreach my $part_export ( @part_export ) {
+ my $error = $part_export->export_replace($self, $old); #, @$export_args);
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return "exporting to ". $part_export->exporttype.
+ " (transaction rolled back): $error";
+ }
}
}
-
$dbh->commit or die $dbh->errstr if $oldAutoCommit;
'';
}