From: ivan Date: Sun, 31 Oct 2010 23:39:17 +0000 (+0000) Subject: on merge, add customer (ship) name to svc_phone.phone_name if blank, RT#10247 X-Git-Tag: TORRUS_1_0_9~162 X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;h=d73482a717fb51861ca7c27e8d5f509c5b20875c;p=freeside.git on merge, add customer (ship) name to svc_phone.phone_name if blank, RT#10247 --- 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: