From: larssandergreen Date: Fri, 23 Jun 2023 19:03:53 +0000 (-0600) Subject: Fix group count for delete confirmation X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=3d180bb2e05ca035715b1c434a9e8bdd21e73477;p=civicrm-core.git Fix group count for delete confirmation --- diff --git a/CRM/Group/Form/Edit.php b/CRM/Group/Form/Edit.php index 25416f7151..120af8822d 100644 --- a/CRM/Group/Form/Edit.php +++ b/CRM/Group/Form/Edit.php @@ -124,12 +124,15 @@ class CRM_Group_Form_Edit extends CRM_Core_Form { if ($this->_action == CRM_Core_Action::DELETE) { if (isset($this->_id)) { $this->assign('title', $this->_title); - try { - $this->assign('count', CRM_Contact_BAO_Group::memberCount($this->_id)); - } - catch (CRM_Core_Exception $e) { - // If the group is borked the query might fail but delete should be possible. + if (!($this->_groupValues['saved_search_id'])) { + try { + $count = CRM_Contact_BAO_Group::memberCount($this->_id); + } + catch (CRM_Core_Exception $e) { + // If the group is borked the query might fail but delete should be possible. + } } + $this->assign('count', $count ?? NULL); $this->setTitle(ts('Confirm Group Delete')); } if ($this->_groupValues['is_reserved'] == 1 && !CRM_Core_Permission::check('administer reserved groups')) { diff --git a/templates/CRM/Group/Form/Delete.tpl b/templates/CRM/Group/Form/Delete.tpl index 2c4760768d..4043531fea 100644 --- a/templates/CRM/Group/Form/Delete.tpl +++ b/templates/CRM/Group/Form/Delete.tpl @@ -14,7 +14,7 @@
{ts}status{/ts} {ts 1=$title}Are you sure you want to delete the group %1?{/ts}

- {if $count} + {if $count !== NULL} {ts count=$count plural='This group currently has %count members in it.'}This group currently has one member in it.{/ts} {/if} {ts}Deleting this group will NOT delete the member contact records. However, all contact subscription information and history for this group will be deleted.{/ts} {ts}If this group is used in CiviCRM profiles, those fields will be reset.{/ts} {ts}This action cannot be undone.{/ts}