From: Coleman Watts Date: Mon, 17 Sep 2018 12:55:40 +0000 (-0400) Subject: Allow profile.submit api to remove all tags from a contact X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ab1a5ce2db6accfa3aa00a2e04749857f86e81da;p=civicrm-core.git Allow profile.submit api to remove all tags from a contact --- diff --git a/api/v3/EntityTag.php b/api/v3/EntityTag.php index 6b0bd7033e..16b7890ab5 100644 --- a/api/v3/EntityTag.php +++ b/api/v3/EntityTag.php @@ -168,8 +168,6 @@ function _civicrm_api3_entity_tag_common($params, $op = 'add') { function civicrm_api3_entity_tag_replace($params) { $transaction = new CRM_Core_Transaction(); try { - civicrm_api3_verify_one_mandatory($params, NULL, ['values', 'tag_id']); - $baseParams = _civicrm_api3_generic_replace_base_params($params); unset($baseParams['tag_id']); diff --git a/tests/phpunit/api/v3/ProfileTest.php b/tests/phpunit/api/v3/ProfileTest.php index 1ceee078b7..486d10a109 100644 --- a/tests/phpunit/api/v3/ProfileTest.php +++ b/tests/phpunit/api/v3/ProfileTest.php @@ -735,6 +735,12 @@ class api_v3_ProfileTest extends CiviUnitTestCase { $tags = $this->callAPISuccess('entityTag', 'get', ['entity_id' => $contactId]); $this->assertEquals(1, $tags['count']); + + $params['tag'] = ''; + $result = $this->callAPISuccess('profile', 'submit', $params); + + $tags = $this->callAPISuccess('entityTag', 'get', ['entity_id' => $contactId]); + $this->assertEquals(0, $tags['count']); } /**