CRM-13992 coding neccessary property values / configurable options required for tab...
authorPratik Joshi <pratik.joshi@webaccess.co.in>
Tue, 18 Feb 2014 13:13:31 +0000 (18:43 +0530)
committerPratik Joshi <pratik.joshi@webaccess.co.in>
Thu, 27 Feb 2014 06:15:04 +0000 (11:45 +0530)
CRM/Core/SelectValues.php
CRM/Custom/Form/Field.php
CRM/Custom/Form/Group.php
CRM/Upgrade/Incremental/sql/4.5.alpha1.mysql.tpl
templates/CRM/Custom/Form/Field.tpl
templates/CRM/Custom/Form/Group.tpl
xml/schema/Core/CustomField.xml
xml/schema/Core/CustomGroup.xml

index 88372829e1d4871195195fb24a009607b719c4e4..089fd4163fa29336c53c296f3697cad0dfedd2a7 100644 (file)
@@ -277,6 +277,7 @@ class CRM_Core_SelectValues {
       $customGroupStyle = array(
         'Tab' => ts('Tab'),
         'Inline' => ts('Inline'),
+        'Tab with table' => ts('Tab with table')
       );
     }
     return $customGroupStyle;
index 9de5daf9211b1a03f4e9134fc779ed758a5b3bbc..05988af601eb41e799896a01d00cc00bc75c6c2d 100644 (file)
@@ -261,6 +261,10 @@ class CRM_Custom_Form_Field extends CRM_Core_Form {
     if (isset($dontShowLink)) {
       $this->assign('dontShowLink', $dontShowLink);
     }
+    if (CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $this->_gid, 'is_multiple', 'id')) {
+      $defaults['in_selector'] = 1;
+    }
+
     return $defaults;
   }
 
@@ -304,6 +308,11 @@ class CRM_Custom_Form_Field extends CRM_Core_Form {
       '&nbsp;&nbsp;&nbsp;'
     );
     $sel->setOptions(array($dt, $it));
+
+    if (CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $this->_gid, 'is_multiple')) {
+      $this->add('checkbox', 'in_selector', ts('Display in Table?'));
+    }
+
     if ($this->_action == CRM_Core_Action::UPDATE) {
       $this->freeze('data_type');
     }
index 697148dc3b7d1137ed25246cae06acb0869f3927..c18e36da4de27ceac0254f40573a58a96c5b4115 100644 (file)
@@ -421,6 +421,10 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
       $this->assign('showMaxMultiple', FALSE);
     }
 
+    if (($this->_action & CRM_Core_Action::UPDATE) && $defaults['is_multiple']) {
+      $defaults['collapse_display'] = 0;
+    }
+
     if (isset($defaults['extends'])) {
       $extends = $defaults['extends'];
       unset($defaults['extends']);
index 50fdd8588372177e17ecd4765e82495b13074bac..6cdcef9d3d7f3b42cf203d0f398fae2655c3e199 100644 (file)
@@ -242,3 +242,12 @@ ALTER TABLE  `civicrm_contact` CHANGE  `preferred_mail_format`  `preferred_mail_
 -- CRM-14183
 INSERT INTO civicrm_state_province (country_id, abbreviation, name) VALUES (1157, "PL", "Plateau");
 UPDATE civicrm_state_province SET name = "Abuja Federal Capital Territory" WHERE name = "Abuja Capital Territory";
+
+-- CRM-13992
+ALTER TABLE `civicrm_custom_field`
+  ADD COLUMN `in_selector` tinyint(4) DEFAULT '0' COMMENT 'Should the multi-record custom field values be displayed in tab table listing';
+UPDATE civicrm_custom_field cf
+  LEFT JOIN civicrm_custom_group cg
+    ON cf.custom_group_id = cg.id
+  SET cf.in_selector = 1
+  WHERE cg.is_multiple = 1 AND cf.html_type != 'TextArea';
\ No newline at end of file
index 684f97c3f1dd044b03f425a362f370501c27fe12..050bc0b41274b45fdd4bba38ac041b0e6ba25a3e 100644 (file)
@@ -156,7 +156,11 @@ function custom_option_html_type( ) {
     {/if}
             </td>
         </tr>
-        <tr class="crm-custom-field-form-block-text_length"  id="textLength" {if !( $action eq 1 || $action eq 2 ) && ($form.data_type.value.0.0 != 0)}class="hide-block"{/if}>
+       <tr class='crm-custom-field-form-block-in_selector'>
+          <td class='label'>{$form.in_selector.label}</td>
+          <td class='html-adjust'>{$form.in_selector.html}</td>
+       </tr>
+       <tr class="crm-custom-field-form-block-text_length"  id="textLength" {if !( $action eq 1 || $action eq 2 ) && ($form.data_type.value.0.0 != 0)}class="hide-block"{/if}>
             <td class="label">{$form.text_length.label}</td>
             <td class="html-adjust">{$form.text_length.html}</td>
         </tr>
index d11b6e17cb98766b985f517ff08dbcfebf57686e..5ecc5bd2fddfbd541f1f70deabf2acffce872076 100644 (file)
@@ -146,9 +146,11 @@ cj(function($) {
   function showRange(onFormLoad) {
     if(cj("#is_multiple :checked").length) {
       cj("tr#multiple").show();
-      cj("select#style option[value='Tab']").prop("selected", true);
+      cj('#collapse_display').prop('checked', '');
+      cj("select#style option[value='Tab with table']").prop("selected", true);
     }
     else {
+      cj('#collapse_display').prop('checked', 'checked');
       cj("tr#multiple").hide();
       if (!onFormLoad) {
         cj("select#style option[value='Inline']").prop("selected", true);
index 3e0f7a57eafad6df334343f7f5b5c33152eddecb..8b2a5fbd599fa211dfbb98fc74e5b9302e210700 100644 (file)
        <comment>Stores Contact Get API params contact reference custom fields. May be used for other filters in the future.</comment>
        <add>4.1</add>
   </field>
+  <field>
+    <name>in_selector</name>
+    <type>boolean</type>
+    <default>0</default>
+    <comment>Should the multi-record custom field values be displayed in tab table listing</comment>
+    <add>4.5</add>
+  </field>
   <index>
     <name>UI_label_custom_group_id</name>
     <fieldName>label</fieldName>
index 68834bcc13e9f6dcf455a1930b5f183613f05315..24b6aaa7cbf981e3255157b2e25957d3779b1bf2 100644 (file)
@@ -68,7 +68,7 @@
   <field>
      <name>style</name>
      <type>varchar</type>
-     <length>8</length>
+     <length>15</length>
      <comment>Visual relationship between this form and its parent.</comment>
      <pseudoconstant>
        <callback>CRM_Core_SelectValues::customGroupStyle</callback>