[freeside-commits] branch FREESIDE_3_BRANCH updated. 60713e5d1ac1775194b87486b3c73f27de4eb63d

Jonathan Prykop jonathan at 420.am
Wed Feb 11 11:24:51 PST 2015


The branch, FREESIDE_3_BRANCH has been updated
       via  60713e5d1ac1775194b87486b3c73f27de4eb63d (commit)
       via  9ae64522cb55ec039fa75a7c27416480e392f395 (commit)
      from  c5e009ec434d5421707d9f5b95c378cf11f71ee7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 60713e5d1ac1775194b87486b3c73f27de4eb63d
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Thu Feb 5 17:05:03 2015 -0600

    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 7e474f1..e004cf8 100644
--- a/FS/FS/contact.pm
+++ b/FS/FS/contact.pm
@@ -283,8 +283,11 @@ sub replace {
              );
     my $contact_phone = qsearchs('contact_phone', \%cp);
 
-    # if new value is empty, delete old entry
-    if (!$self->get($pf)) {
+    my $pv = $self->get($pf);
+	$pv =~ s/\s//g;
+
+    #if new value is empty, delete old entry
+    if (!$pv) {
       if ($contact_phone) {
         $error = $contact_phone->delete;
         if ( $error ) {
@@ -297,7 +300,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';

commit 9ae64522cb55ec039fa75a7c27416480e392f395
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Mon Feb 2 18:50:47 2015 -0600

    RT#30248: Unable to remove phone number from contact

diff --git a/FS/FS/contact.pm b/FS/FS/contact.pm
index 5626ca5..7e474f1 100644
--- a/FS/FS/contact.pm
+++ b/FS/FS/contact.pm
@@ -273,7 +273,7 @@ sub replace {
     return $error;
   }
 
-  foreach my $pf ( grep { /^phonetypenum(\d+)$/ && $self->get($_) }
+  foreach my $pf ( grep { /^phonetypenum(\d+)$/ }
                         keys %{ $self->hashref } ) {
     $pf =~ /^phonetypenum(\d+)$/ or die "wtf (daily, the)";
     my $phonetypenum = $1;
@@ -281,8 +281,21 @@ sub replace {
     my %cp = ( 'contactnum'   => $self->contactnum,
                'phonetypenum' => $phonetypenum,
              );
-    my $contact_phone = qsearchs('contact_phone', \%cp)
-                        || new FS::contact_phone   \%cp;
+    my $contact_phone = qsearchs('contact_phone', \%cp);
+
+    # if new value is empty, delete old entry
+    if (!$self->get($pf)) {
+      if ($contact_phone) {
+        $error = $contact_phone->delete;
+        if ( $error ) {
+          $dbh->rollback if $oldAutoCommit;
+          return $error;
+        }
+      }
+      next;
+    }
+
+    $contact_phone ||= new FS::contact_phone \%cp;
 
     my %cpd = _parse_phonestring( $self->get($pf) );
     $contact_phone->set( $_ => $cpd{$_} ) foreach keys %cpd;

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/contact.pm |   24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)




More information about the freeside-commits mailing list