summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2010-10-31 23:39:17 +0000
committerivan <ivan>2010-10-31 23:39:17 +0000
commitd73482a717fb51861ca7c27e8d5f509c5b20875c (patch)
tree3c970a5a8772643dfa2bd9c831afd422ecf6bd39
parenteb5ca274dd4f5d76e71e295dcb55fcccae060fa5 (diff)
on merge, add customer (ship) name to svc_phone.phone_name if blank, RT#10247
-rw-r--r--FS/FS/cust_main.pm18
1 files changed, 18 insertions, 0 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 15bbdc372..b25efcf85 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -1246,6 +1246,8 @@ sub merge {
}
+ my $name = $self->ship_name;
+
my $locationnum = '';
foreach my $cust_pkg ( $self->all_pkgs ) {
$cust_pkg->custnum($new_custnum);
@@ -1271,6 +1273,22 @@ sub merge {
$dbh->rollback if $oldAutoCommit;
return $error;
}
+
+ # add customer (ship) name to svc_phone.phone_name if blank
+ my @cust_svc = $cust_pkg->cust_svc;
+ foreach my $cust_svc (@cust_svc) {
+ my($label, $value, $svcdb) = $cust_svc->label;
+ next unless $svcdb eq 'svc_phone';
+ my $svc_phone = $cust_svc->svc_x;
+ next if $svc_phone->phone_name;
+ $svc_phone->phone_name($name);
+ my $error = $svc_phone->replace;
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return $error;
+ }
+ }
+
}
#not considered: