From: Jonathan Prykop Date: Thu, 5 Feb 2015 23:05:03 +0000 (-0600) Subject: RT#30248: Unable to remove phone number from contact (added whitespace stripping X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;h=795a733714d398d4a3d427de1448b7daaf92399d;p=freeside.git RT#30248: Unable to remove phone number from contact (added whitespace stripping --- diff --git a/FS/FS/contact.pm b/FS/FS/contact.pm index 589fc7c19..89bfb745b 100644 --- a/FS/FS/contact.pm +++ b/FS/FS/contact.pm @@ -452,8 +452,11 @@ sub replace { ); my $contact_phone = qsearchs('contact_phone', \%cp); + my $pv = $self->get($pf); + $pv =~ s/\s//g; + #if new value is empty, delete old entry - if (!$self->get($pf)) { + if (!$pv) { if ($contact_phone) { $error = $contact_phone->delete; if ( $error ) { @@ -466,7 +469,7 @@ sub replace { $contact_phone ||= new FS::contact_phone \%cp; - my %cpd = _parse_phonestring( $self->get($pf) ); + my %cpd = _parse_phonestring( $pv ); $contact_phone->set( $_ => $cpd{$_} ) foreach keys %cpd; my $method = $contact_phone->contactphonenum ? 'replace' : 'insert';