[Smarty variables] remove isset from Mail accounts
authorEileen McNaughton <emcnaughton@wikimedia.org>
Tue, 30 Nov 2021 22:13:56 +0000 (11:13 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Wed, 1 Dec 2021 19:31:41 +0000 (08:31 +1300)
civicrm/admin/mailSettings?reset=1

CRM/Admin/Page/MailSettings.php
templates/CRM/Admin/Page/MailSettings.tpl

index c3dca8c85342c505c791ecfcda0eff51039243dc..28844d60782df6af6553fe40d79f9edcaa2eda8f 100644 (file)
@@ -105,7 +105,11 @@ class CRM_Admin_Page_MailSettings extends CRM_Core_Page_Basic {
         $mailSetting->id
       );
     }
-
+    $expectedKeys = ['server', 'username', 'localpart', 'domain', 'return_path', 'protocol', 'source', 'port', 'is_ssl'];
+    foreach ($allMailSettings as $key => $allMailSetting) {
+      // make sure they are there to prevent smarty notices.
+      $allMailSettings[$key] = array_merge(array_fill_keys($expectedKeys, NULL), $allMailSetting);
+    }
     $this->assign('rows', $allMailSettings);
 
     $setupActions = CRM_Core_BAO_MailSettings::getSetupActions();
index c2ef4b9983c93cddbf4bcbdd972f4ec7d8e4d6c8..fa655f76362de0da4086b05fdeff7abbad34f8da 100644 (file)
         {foreach from=$rows item=row}
           <tr id='rowid{$row.id}' class="crm-mailSettings {cycle values="odd-row,even-row"}">
               <td class="crm-mailSettings-name">{$row.name}</td>
-              <td class="crm-mailSettings-server">{if !empty($row.server)}{$row.server}{/if}</td>
-              <td class="crm-mailSettings-username">{if !empty($row.username)}{$row.username}{/if}</td>
-              <td class="crm-mailSettings-localpart">{if !empty($row.localpart)}{$row.localpart}{/if}</td>
-              <td class="crm-mailSettings-domain">{if !empty($row.domain)}{$row.domain}{/if}</td>
-              <td class="crm-mailSettings-return_path">{if !empty($row.return_path)}{$row.return_path}{/if}</td>
-              <td class="crm-mailSettings-protocol">{if !empty($row.protocol)}{$row.protocol}{/if}</td>
-              <td class="crm-mailSettings-source">{if !empty($row.source)}{$row.source}{/if}</td>
-              <!--<td>{if !empty($row.port)}{$row.port}{/if}</td>-->
-              <td class="crm-mailSettings-is_ssl">{if isset($row.is_ssl) and $row.is_ssl eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
+              <td class="crm-mailSettings-server">{$row.server}</td>
+              <td class="crm-mailSettings-username">{$row.username}</td>
+              <td class="crm-mailSettings-localpart">{$row.localpart}</td>
+              <td class="crm-mailSettings-domain">{$row.domain}</td>
+              <td class="crm-mailSettings-return_path">{$row.return_path}</td>
+              <td class="crm-mailSettings-protocol">{$row.protocol}</td>
+              <td class="crm-mailSettings-source">{$row.source}</td>
+              <!--<td>{$row.port}</td>-->
+              <td class="crm-mailSettings-is_ssl">{if $row.is_ssl eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
               <td class="crm-mailSettings-is_default">{if $row.is_default eq 1}{ts}Bounce Processing <strong>(Default)</strong>{/ts}{else}{ts}Email-to-Activity{/ts}{/if}&nbsp;</td>
               <td>{$row.action|replace:'xx':$row.id}</td>
           </tr>