Allow profile.submit api to remove all tags from a contact
authorColeman Watts <coleman@civicrm.org>
Mon, 17 Sep 2018 12:55:40 +0000 (08:55 -0400)
committerColeman Watts <coleman@civicrm.org>
Tue, 18 Sep 2018 14:06:13 +0000 (10:06 -0400)
api/v3/EntityTag.php
tests/phpunit/api/v3/ProfileTest.php

index 6b0bd7033e1db81c51ddbaae92c5e99429dcb938..16b7890ab5cb4475fee491109d97d6681420045f 100644 (file)
@@ -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']);
 
index 1ceee078b704e5fc9bcdfdc1cc4e7792b774f24c..486d10a10920d5bd200f145d7b022fa5904bc8b3 100644 (file)
@@ -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']);
   }
 
   /**