self-service delete_contact, RT#37375
authorIvan Kohler <ivan@freeside.biz>
Tue, 21 Jul 2015 18:05:17 +0000 (11:05 -0700)
committerIvan Kohler <ivan@freeside.biz>
Tue, 21 Jul 2015 18:05:17 +0000 (11:05 -0700)
FS/FS/ClientAPI/MyAccount/contact.pm
fs_selfservice/FS-SelfService/SelfService.pm

index 72226e2..099da29 100644 (file)
@@ -129,6 +129,9 @@ sub delete_contact {
   my($context, $session, $custnum) = _custoragent_session_custnum($p);
   return { 'error' => $session } if $context eq 'error';
 
+  return { 'error' => 'Cannot delete the currently-logged in contact.' }
+    if $p->{contactnum} == $session->{contactnum};
+
   my $cust_contact = qsearchs('cust_contact', { contactnum => $p->{contactnum},
                                                 custnum    => $custnum,       })
     or return { 'error' => 'Unknown contactnum' };
index 0b65417..1978a88 100644 (file)
@@ -1377,7 +1377,7 @@ error message, or empty on success.
 =item edit_contact
 
 Updates information for the currently-logged in contact, or (optionally) the
-specified contact
+specified contact.
 
 Takes a hash reference as parameter with the following keys:
 
@@ -1402,6 +1402,22 @@ error message, or empty on success.
 
 =item delete_contact
 
+Deletes a contact.  (Note: Cannot at this time delete the currently-logged in
+contact.)
+
+Takes a hash reference as parameter with the following keys:
+
+=over 4
+
+=item session_id
+
+=item contactnum
+
+=back
+
+Returns a hash reference with a single parameter, B<error>, which contains an
+error message, or empty on success.
+
 =head2 "MY ACCOUNT" QUOTATION FUNCTIONS
 
 All of these functions require the user to be logged in, and the 'session_id'