$form->_task = self::$_searchFormValues['task'] ?? NULL;
+ $isSelectedContacts = (self::$_searchFormValues['radio_ts'] ?? NULL) === 'ts_sel';
+ $form->assign('isSelectedContacts', $isSelectedContacts);
// all contacts or action = save a search
if ((CRM_Utils_Array::value('radio_ts', self::$_searchFormValues) == 'ts_all') ||
($form->_task == CRM_Contact_Task::SAVE_SEARCH)
}
}
}
- elseif (CRM_Utils_Array::value('radio_ts', self::$_searchFormValues) == 'ts_sel') {
+ elseif ($isSelectedContacts) {
// selected contacts only
// need to perform action on only selected contacts
$insertString = [];
}
}
- if (CRM_Utils_Array::value('radio_ts', self::$_searchFormValues) == 'ts_sel'
+ if ($isSelectedContacts
&& ($form->_action != CRM_Core_Action::COPY)
) {
- $sel = self::$_searchFormValues['radio_ts'] ?? NULL;
- $form->assign('searchtype', $sel);
$result = self::getSelectedContactNames();
- $form->assign("value", $result);
+ $form->assign('value', $result);
}
if (!empty($form->_contactIds)) {
// Currently only the contact email form is callable outside search context.
parent::preProcess();
}
+ else {
+ // E-notice prevention in Task.tpl
+ $this->assign('isSelectedContacts', FALSE);
+ }
$this->setContactIDs();
$this->assign('single', $this->_single);
$this->assign('isAdmin', CRM_Core_Permission::check('administer CiviCRM'));
$searchFormValues = $form->getSearchFormValues();
$form->_task = $searchFormValues['task'];
-
+ $isSelectedContacts = ($searchFormValues['radio_ts'] ?? NULL) === 'ts_sel';
+ $form->assign('isSelectedContacts', $isSelectedContacts);
$entityIds = [];
- if ($searchFormValues['radio_ts'] == 'ts_sel') {
+ if ($isSelectedContacts) {
foreach ($searchFormValues as $name => $value) {
if (substr($name, 0, CRM_Core_Form::CB_PREFIX_LEN) == CRM_Core_Form::CB_PREFIX) {
$entityIds[] = substr($name, CRM_Core_Form::CB_PREFIX_LEN);
*}
{ts 1=$totalSelectedContacts}Number of selected contacts: %1{/ts}
-{if !empty($searchtype) && $searchtype eq 'ts_sel'}
+{if $isSelectedContacts}
<div id="popupContainer">
<div class="crm-block crm-form-block crm-search-form-block">
<table id="selectedRecords-{if !empty($group)}{$group.id}{/if}" class="display crm-copy-fields crm-sortable">
<a href="#" id="popup-button" title="{ts}View Selected Contacts{/ts}">{ts}View Selected Contacts{/ts}</a>
{/if}
-{if !empty($searchtype) && $searchtype eq 'ts_sel'}
+{if $isSelectedContacts}
{literal}
<script type="text/javascript">
CRM.$(function($) {
*/
class CRM_Case_Form_EmailTest extends CiviCaseTestCase {
- public function testOpeningEmailForm() {
+ public function testOpeningEmailForm(): void {
$clientId = $this->individualCreate();
$caseObj = $this->createCase($clientId, $this->_loggedInUser);
$item = CRM_Core_Invoke::getItem([$_GET['q']]);
ob_start();
CRM_Core_Invoke::runItem($item);
- $contents = ob_get_contents();
- ob_end_clean();
+ $contents = ob_get_clean();
foreach ($parsed as $param => $dontcare) {
unset($_REQUEST[$param]);
$this->assertStringContainsString('CRM_Case_Form_Task_Email', $contents);
}
- public function testCaseTokenForRecipientAddedAfterOpeningForm() {
+ public function testCaseTokenForRecipientAddedAfterOpeningForm(): void {
$clientId = $this->individualCreate();
$caseObj = $this->createCase($clientId, $this->_loggedInUser);