Exemplo n.º 1
0
 static function mergeTags()
 {
     $tagAId = CRM_Utils_Type::escape($_POST['fromId'], 'Integer');
     $tagBId = CRM_Utils_Type::escape($_POST['toId'], 'Integer');
     $result = CRM_Core_BAO_EntityTag::mergeTags($tagAId, $tagBId);
     if (!empty($result['tagB_used_for'])) {
         $usedFor = CRM_Core_OptionGroup::values('tag_used_for');
         foreach ($result['tagB_used_for'] as &$val) {
             $val = $usedFor[$val];
         }
         $result['tagB_used_for'] = implode(', ', $result['tagB_used_for']);
     }
     CRM_Utils_JSON::output($result);
 }
Exemplo n.º 2
0
 static function mergeTags()
 {
     $tagAId = CRM_Utils_Type::escape($_POST['fromId'], 'Integer');
     $tagBId = CRM_Utils_Type::escape($_POST['toId'], 'Integer');
     $result = CRM_Core_BAO_EntityTag::mergeTags($tagAId, $tagBId);
     if (!empty($result['tagB_used_for'])) {
         $usedFor = CRM_Core_OptionGroup::values('tag_used_for');
         foreach ($result['tagB_used_for'] as &$val) {
             $val = $usedFor[$val];
         }
         $result['tagB_used_for'] = implode(', ', $result['tagB_used_for']);
     }
     $result['message'] = ts('"%1" has been merged with "%2". All records previously tagged "%1" are now tagged "%2".', array(1 => $result['tagA'], 2 => $result['tagB']));
     CRM_Utils_JSON::output($result);
 }