QA fixes
authordeb.monish <monish.deb@jmaconsulting.biz>
Sat, 17 Jun 2017 20:24:13 +0000 (01:54 +0530)
committerdeb.monish <monish.deb@jmaconsulting.biz>
Sat, 17 Jun 2017 20:38:49 +0000 (02:08 +0530)
CRM/Contact/Form/Contact.php
CRM/Contact/Form/Edit/TagsAndGroups.php
templates/CRM/Contact/Form/Edit/TagsAndGroups.tpl
templates/CRM/Profile/Form/Dynamic.tpl

index 0c9eb8fbc842dec7abab73d1c14673f911e0ca1a..7102c404d9c307b9e16031ba11c7a216c41e5b03 100644 (file)
@@ -992,8 +992,10 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
 
     if (array_key_exists('TagsAndGroups', $this->_editOptions)) {
       //add contact to tags
-      $params['tag'] = array_flip(explode(',', $params['tag']));
-      CRM_Core_BAO_EntityTag::create($params['tag'], 'civicrm_contact', $params['contact_id']);
+      if (isset($params['tag']) && !empty($params['tag'])) {
+        $params['tag'] = array_flip(explode(',', $params['tag']));
+        CRM_Core_BAO_EntityTag::create($params['tag'], 'civicrm_contact', $params['contact_id']);
+      }
 
       //save free tags
       if (isset($params['contact_taglist']) && !empty($params['contact_taglist'])) {
index 87b5d418917d4131fca2bcc6211d0ab78968cd16..1518c2a119e0d07e787c053a2e90f78ae2292bc9 100644 (file)
@@ -128,7 +128,7 @@ class CRM_Contact_Form_Edit_TagsAndGroups {
 
         if ($groupElementType == 'select' && !empty($groupsOptions)) {
           $form->add('select', $fName, $groupName, $groupsOptions, FALSE,
-            array('id' => $fName, 'multiple' => 'multiple', 'class' => 'crm-select2', 'style' => 'width: 310px')
+            array('id' => $fName, 'multiple' => 'multiple', 'class' => 'crm-select2 twenty')
           );
           $form->assign('groupCount', count($groupsOptions));
         }
@@ -150,11 +150,11 @@ class CRM_Contact_Form_Edit_TagsAndGroups {
       if (!empty($tags)) {
         $form->add('select2', 'tag', ts('Tag(s)'), $tags, FALSE, array('class' => 'huge', 'placeholder' => ts('- select -'), 'multiple' => TRUE));
       }
-    }
 
-    // build tag widget
-    $parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_contact');
-    CRM_Core_Form_Tag::buildQuickForm($form, $parentNames, 'civicrm_contact', $contactId, FALSE, TRUE);
+      // build tag widget
+      $parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_contact');
+      CRM_Core_Form_Tag::buildQuickForm($form, $parentNames, 'civicrm_contact', $contactId, FALSE, TRUE);
+    }
     $form->assign('tagGroup', $form->_tagGroup);
   }
 
@@ -195,7 +195,6 @@ class CRM_Contact_Form_Edit_TagsAndGroups {
 
     if ($type & self::TAG) {
       $defaults['tag'] = implode(',', CRM_Core_BAO_EntityTag::getTag($id, 'civicrm_contact'));
-      CRM_Core_Error::debug_var('tag', $defaults['tag']);
     }
   }
 
index 2c14b4ef981ac8fbc9c450bf76f79856e8a41f2b..e13c4c50d23f2839436b903ac302a6b7029d9d81 100644 (file)
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
 *}
-{literal}
-<style>
-  #tagtree .highlighted > span {
-    background-color: #fefca6;
-  }
-  #tagtree .helpicon ins {
-    display: none;
-  }
-  #tagtree ins.jstree-icon {
-    cursor: pointer;
-  }
-</style>
-<script type="text/javascript">
-  (function($, _){{/literal}
-    var entityID='{$entityID}',
-      entityTable='{$entityTable}',
-      $form = $('form.{$form.formClass}');
-    {literal}
-
-    $(function() {
-      function highlightSelected() {
-        $("ul input:not(:checked)", '#tagtree').each(function () {
-          $(this).closest("li").removeClass('highlighted');
-        });
-        $("ul input:checked", '#tagtree').each(function () {
-          $(this).parents("li[id^=tag]").addClass('highlighted');
-        });
-      }
-      highlightSelected();
-
-      $("#tagtree input").change(function(){
-        highlightSelected();
-      });
-
-      var childTag = "{/literal}{$loadjsTree}{literal}";
-      if (childTag) {
-        //load js tree.
-        $("#tagtree").jstree({
-          plugins : ["themes", "html_data"],
-          themes: {
-            "theme": 'classic',
-            "dots": false,
-            "icons": false,
-            "url": CRM.config.resourceBase + 'packages/jquery/plugins/jstree/themes/classic/style.css'
-          }
-        });
-      }
-         {/literal}
-      {if !empty($permission) && $permission neq 'edit'}
-        {literal}
-          $("#tagtree input").prop('disabled', true);
-        {/literal}
-      {/if}
-      {literal}
-    });
-  })(CRM.$, CRM._);
-  {/literal}
-</script>
-
 {if $title}
 <div class="crm-accordion-wrapper crm-tagGroup-accordion collapsed">
   <div class="crm-accordion-header">{$title}</div>
       <tr>
         {if !$type || $type eq 'tag'}
           <td>
-            <span class="label">{if $title}{$form.tag.label}{/if}</span><br />
-            {$form.tag.html}
+            <div class="crm-section tag-section">
+              {if $title}{$form.tag.label}{/if}
+              {$form.tag.html}
+            </div>
+            {if $context NEQ 'profile'}
+              {include file="CRM/common/Tagset.tpl"}
+            {/if}
           </td>
         {/if}
         {if !$type || $type eq 'group'}
           <td>
             {if $groupElementType eq 'select'}
-              <span class="label">{if $title}{$form.group.label}{/if}</span>
+              <div class="crm-section group-section">
+              {if $title}{$form.group.label}{/if}
               {$form.group.html}
+            </div>
             {else}
               {foreach key=key item=item from=$tagGroup.group}
                 <div class="group-wrapper">
           </td>
         {/if}
       </tr>
-      {if !$type || $type eq 'tag'}
-        <tr><td>{include file="CRM/common/Tagset.tpl"}</td></tr>
-      {/if}
     </table>
 {if $title}
   </div>
index 7b7725af99f677912f14511af81265042cd8cef6..dd4782168e81cc12cf18a9cb9e356650abe97268 100644 (file)
               {if $n eq 'email_greeting' or  $n eq 'postal_greeting' or $n eq 'addressee'}
                 {include file="CRM/Profile/Form/GreetingType.tpl"}
               {elseif ( $n eq 'group' && $form.group ) || ( $n eq 'tag' && $form.tag )}
-                {include file="CRM/Contact/Form/Edit/TagsAndGroups.tpl" type=$n context="profile"}
+                {include file="CRM/Contact/Form/Edit/TagsAndGroups.tpl" type=$n context="profile" tableLayout=1}
               {elseif ( $form.$n.name eq 'image_URL' )}
                 {$form.$n.html}
                 {if !empty($imageURL)}