//CRM-14190
CRM_Group_Form_Edit::buildParentGroups($this);
+ CRM_Group_Form_Edit::buildGroupOrganizations($this);
// get the group id for the saved search
$groupID = NULL;
}
}
+ /**
+ * Set form defaults.
+ *
+ * return array
+ */
+ public function setDefaultValues() {
+ $defaults = array();
+ if (empty($defaults['parents'])) {
+ $defaults['parents'] = CRM_Core_BAO_Domain::getGroupId();
+ }
+ return $defaults;
+ }
+
}
//CRM-14190
$parentGroups = self::buildParentGroups($this);
-
- if (CRM_Core_Permission::check('administer Multiple Organizations') && CRM_Core_Permission::isMultisiteEnabled()) {
- //group organization Element
- $props = array('api' => array('params' => array('contact_type' => 'Organization')));
- $this->addEntityRef('organization_id', ts('Organization'), $props);
- }
+ self::buildGroupOrganizations($this);
// is_reserved property CRM-9936
$this->addElement('checkbox', 'is_reserved', ts('Reserved Group?'));
return $parentGroups;
}
+ /**
+ * Add the group organization checkbox to the form.
+ *
+ * Note this was traditionally a multisite thing - there is no particular reason why it is not available
+ * as a general field - it's historical use-case driven.
+ *
+ * @param CRM_Core_Form $form
+ */
+ public static function buildGroupOrganizations(&$form) {
+ if (CRM_Core_Permission::check('administer Multiple Organizations') && CRM_Core_Permission::isMultisiteEnabled()) {
+ //group organization Element
+ $props = array('api' => array('params' => array('contact_type' => 'Organization')));
+ $form->addEntityRef('organization_id', ts('Organization'), $props);
+ }
+ }
+
}
</table>
{*CRM-14190*}
- {include file="CRM/Group/Form/ParentGroups.tpl"}
+ {include file="CRM/Group/Form/GroupsCommon.tpl"}
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
</div>
</table>
{*CRM-14190*}
- {include file="CRM/Group/Form/ParentGroups.tpl"}
-
- {if $form.organization_id}
- <h3>{ts}Associated Organization{/ts} {help id="id-group-organization" file="CRM/Group/Page/Group.hlp"}</h3>
- <table class="form-layout-compressed">
- <tr class="crm-group-form-block-organization">
- <td class="label"> {$form.organization_id.label}</td>
- <td>{$form.organization_id.html|crmAddClass:huge}
- </td>
- </tr>
- </table>
- {/if}
+ {include file="CRM/Group/Form/GroupsCommon.tpl"}
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
{if $action neq 1}
{/if}
</div>
{/if}
-</fieldset>
{literal}
<script type="text/javascript">
</tr>
</table>
{/if}
+{if $form.organization_id}
+ <h3>{ts}Associated Organization{/ts} {help id="id-group-organization" file="CRM/Group/Page/Group.hlp"}</h3>
+ <table class="form-layout-compressed">
+ <tr class="crm-group-form-block-organization">
+ <td class="label"> {$form.organization_id.label}</td>
+ <td>{$form.organization_id.html|crmAddClass:huge}
+ </td>
+ </tr>
+ </table>
+{/if}