Skip to content

Commit

Permalink
Merge pull request #24594 from eileenmcnaughton/group_notice
Browse files Browse the repository at this point in the history
Fix smarty e-notices on group settings form
  • Loading branch information
demeritcowboy authored Sep 30, 2022
2 parents 843958b + 8d6ea0e commit 8965f37
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
21 changes: 8 additions & 13 deletions CRM/Group/Form/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ public function getDefaultEntity() {

/**
* Set up variables to build the form.
*
* @throws \CRM_Core_Exception
*/
public function preProcess() {
$this->addOptionalQuickFormElement('parents');
Expand Down Expand Up @@ -130,31 +132,24 @@ public function preProcess() {
$this->setTitle(ts('Confirm Group Delete'));
}
if ($this->_groupValues['is_reserved'] == 1 && !CRM_Core_Permission::check('administer reserved groups')) {
CRM_Core_Error::statusBounce(ts("You do not have sufficient permission to delete this reserved group."));
CRM_Core_Error::statusBounce(ts('You do not have sufficient permission to delete this reserved group.'));
}
}
else {
if ($this->_id && $this->_groupValues['is_reserved'] == 1 && !CRM_Core_Permission::check('administer reserved groups')) {
CRM_Core_Error::statusBounce(ts("You do not have sufficient permission to change settings for this reserved group."));
CRM_Core_Error::statusBounce(ts('You do not have sufficient permission to change settings for this reserved group.'));
}
if (isset($this->_id)) {
$groupValues = array(
'id' => $this->_id,
'title' => $this->_title,
'saved_search_id' => $this->_groupValues['saved_search_id'] ?? '',
);
if (isset($this->_groupValues['saved_search_id'])) {
$this->assign('editSmartGroupURL', CRM_Contact_BAO_SavedSearch::getEditSearchUrl($this->_groupValues['saved_search_id']));
}
if (!empty($this->_groupValues['created_id'])) {
$groupValues['created_by'] = CRM_Core_DAO::getFieldValue("CRM_Contact_DAO_Contact", $this->_groupValues['created_id'], 'sort_name', 'id');
}

if (!empty($this->_groupValues['modified_id'])) {
$groupValues['modified_by'] = CRM_Core_DAO::getFieldValue("CRM_Contact_DAO_Contact", $this->_groupValues['modified_id'], 'sort_name', 'id');
}
$this->assign('editSmartGroupURL', isset($this->_groupValues['saved_search_id']) ? CRM_Contact_BAO_SavedSearch::getEditSearchUrl($this->_groupValues['saved_search_id']) : NULL);
$groupValues['created_by'] = empty($this->_groupValues['created_id']) ? NULL : CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_groupValues['created_id'], 'sort_name', 'id');
$groupValues['modified_by'] = empty($this->_groupValues['modified_id']) ? NULL : CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_groupValues['modified_id'], 'sort_name', 'id');

$this->assign_by_ref('group', $groupValues);
$this->assign('group', $groupValues);

$this->setTitle(ts('Group Settings: %1', array(1 => $this->_title)));
}
Expand Down
6 changes: 3 additions & 3 deletions templates/CRM/Group/Form/Edit.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<td>{$form.is_active.html}</td>
</tr>

{if !empty($group.created_by)}
{if $group.created_by}
<tr class="crm-group-form-block-created">
<td class="label">{ts}Created By{/ts}</td>
<td>{$group.created_by}</td>
Expand Down Expand Up @@ -105,10 +105,10 @@

{literal}
<script type="text/javascript">
{/literal}{if !empty($freezeMailingList)}{literal}
{/literal}{if $freezeMailingList}{literal}
cj('input[type=checkbox][name="group_type[{/literal}{$freezeMailingList}{literal}]"]').prop('disabled',true);
{/literal}{/if}{literal}
{/literal}{if !empty($hideMailingList)}{literal}
{/literal}{if $hideMailingList}{literal}
cj('input[type=checkbox][name="group_type[{/literal}{$hideMailingList}{literal}]"]').hide();
cj('label[for="group_type[{/literal}{$hideMailingList}{literal}]"]').hide();
{/literal}{/if}{literal}
Expand Down
2 changes: 1 addition & 1 deletion templates/CRM/Group/Form/GroupsCommon.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</tr>
</table>
{/if}
{if !empty($form.organization_id)}
{if array_key_exists('organization_id', $form)}
<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">
Expand Down

0 comments on commit 8965f37

Please sign in to comment.