X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcontact.pm;h=38b7fd7b72c5d56572ff125ec2c1e676bafbc03a;hb=292ef074d01bb925e9a466ed771bf2ac418bb44f;hp=07458c74286799028eaee1c1405640f698cc1ef4;hpb=167dbdad01e2c1b62fd9be43cc05212e8c874a02;p=freeside.git diff --git a/FS/FS/contact.pm b/FS/FS/contact.pm index 07458c742..38b7fd7b7 100644 --- a/FS/FS/contact.pm +++ b/FS/FS/contact.pm @@ -259,7 +259,10 @@ sub insert { } if ( $link_hash{'selfservice_access'} eq 'R' - or ( $link_hash{'selfservice_access'} && $cust_contact ) + or ( $link_hash{'selfservice_access'} + && $cust_contact + && ! length($self->_password) + ) ) { my $error = $self->send_reset_email( queue=>1 ); @@ -452,8 +455,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 ) { @@ -464,7 +470,9 @@ sub replace { next; } - my %cpd = _parse_phonestring( $self->get($pf) ); + $contact_phone ||= new FS::contact_phone \%cp; + + my %cpd = _parse_phonestring( $pv ); $contact_phone->set( $_ => $cpd{$_} ) foreach keys %cpd; my $method = $contact_phone->contactphonenum ? 'replace' : 'insert';