summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2015-07-21 11:05:25 -0700
committerIvan Kohler <ivan@freeside.biz>2015-07-21 11:05:25 -0700
commitbcbb8c9845809251bf56e2b12aa59b1019219bb4 (patch)
tree9f8e139e76a583928c6b75c300e9a0b66a3205ea
parent563af91caff09369dc8c042f9e24cc542b010232 (diff)
self-service delete_contact, RT#37375
-rw-r--r--FS/FS/ClientAPI/MyAccount/contact.pm6
-rw-r--r--fs_selfservice/FS-SelfService/SelfService.pm18
2 files changed, 22 insertions, 2 deletions
diff --git a/FS/FS/ClientAPI/MyAccount/contact.pm b/FS/FS/ClientAPI/MyAccount/contact.pm
index 30316c723..099da29e0 100644
--- a/FS/FS/ClientAPI/MyAccount/contact.pm
+++ b/FS/FS/ClientAPI/MyAccount/contact.pm
@@ -129,7 +129,11 @@ sub delete_contact {
my($context, $session, $custnum) = _custoragent_session_custnum($p);
return { 'error' => $session } if $context eq 'error';
- my $cust_contact = qsearchs('cust_contact', { contactnum=>$p->{contactnum} } )
+ 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' };
my $contact = $cust_contact->contact;
diff --git a/fs_selfservice/FS-SelfService/SelfService.pm b/fs_selfservice/FS-SelfService/SelfService.pm
index 0b65417ed..1978a8855 100644
--- a/fs_selfservice/FS-SelfService/SelfService.pm
+++ b/fs_selfservice/FS-SelfService/SelfService.pm
@@ -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'