From 2b2ba6a5cac62f1b3927e7d0856e356316939b05 Mon Sep 17 00:00:00 2001 From: kurund Date: Fri, 10 Jan 2014 12:04:44 -0800 Subject: [PATCH] added more comments for the code, CRM-14052 ---------------------------------------- * CRM-14052: Tagset fixes http://issues.civicrm.org/jira/browse/CRM-14052 --- CRM/Core/Form/Tag.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CRM/Core/Form/Tag.php b/CRM/Core/Form/Tag.php index 5a3b179992..e90ebb1e37 100644 --- a/CRM/Core/Form/Tag.php +++ b/CRM/Core/Form/Tag.php @@ -226,6 +226,7 @@ class CRM_Core_Form_Tag { } if (!empty($tagset)) { + // assign current tagsets which is used in postProcess $form->_tagsetInfo = $tagset; $form->assign("tagsetInfo_$mode", $tagset); $form->assign("isTagset", TRUE); @@ -253,7 +254,9 @@ class CRM_Core_Form_Tag { } if ($form) { - // If the key is missing from the form response then all entity_tags were deleted + // if the key is missing from the form response then all the tags were deleted / cleared + // in that case we create empty tagset params so that below logic works and tagset are + // delete correctly foreach ($form->_tagsetInfo as $tagsetName => $tagsetInfo) { $tagsetId = substr($tagsetName, strlen('parentId_')); if (empty($params[$tagsetId])) { @@ -262,6 +265,8 @@ class CRM_Core_Form_Tag { } } + // when form is submitted with tagset values below logic will work and in the case when all tags in a tagset + // are deleted we will have to set $params[tagset id] = '' which is done by above logic foreach ($params as $parentId => $value) { $newTagIds = array(); $realTagIds = array(); -- 2.25.1