Details
-
Type: New Feature
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.7
-
Fix Version/s: 4.7
-
Component/s: CiviCRM API
-
Labels:
-
Documentation Required?:None
-
Funding Source:Contributed Code
Description
If we do not define a tag_id, all entitytags related to a contact_id should be removed, eg.:
$result = civicrm_api3('EntityTag', 'delete', array(
'contact_id' => -contact-id-,
));
This needs the following changes:
In getContactTags() of CRM/COre/BAO/EntityTag.php two changes:
$select = "SELECT name ";
becomes:
$select = "SELECT ct.id, ct.name ";
while ($dao->fetch())
{ $contactTags[] = $dao->name; }becomes:
while ($dao->fetch())
{ $contactTags[$dao->id] = $dao->name; }In _civicrm_api3_entity_tag_common of api/v3/EntityTag.php:
if (empty($tagIDs))
{ return civicrm_api3_create_error('tag_id is a required field'); }becomes:
if (empty($tagIDs)) {
if ($op == 'remove')
else
{ return civicrm_api3_create_error('tag_id is a required field'); }}