'status',
'do_not_email',
'do_not_phone',
+ 'do_not_sms',
'do_not_mail',
];
--- /dev/null
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC. All rights reserved. |
+ | |
+ | This work is published under the GNU AGPLv3 license with some |
+ | permitted exceptions and without any warranty. For full license |
+ | and copyright information, see https://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ *
+ * @package CRM
+ * @author Andrew Hunt, AGH Strategies
+ * $Id$
+ *
+ */
+
+/**
+ * Display a banned icon to flag privacy preferences
+ *
+ * @param $params
+ * - field: the applicable privacy field
+ * (one of CRM_Core_SelectValues::privacy() or `on_hold`)
+ *
+ * @param $smarty
+ *
+ * @return string
+ */
+function smarty_function_privacyFlag($params, &$smarty) {
+ $icons = [
+ 'do_not_phone' => 'fa-phone',
+ 'do_not_email' => 'fa-paper-plane',
+ 'do_not_mail' => 'fa-envelope',
+ 'do_not_sms' => 'fa-mobile',
+ 'do_not_trade' => 'fa-exchange',
+ 'is_opt_out' => 'fa-paper-plane-o',
+ ];
+ $titles = CRM_Core_SelectValues::privacy();
+ $field = $params['field'] ?? 'do_not_mail';
+ if ($field == 'on_hold') {
+ $text = ts('Email on hold - generally due to bouncing.');
+ return <<<HEREDOC
+<span class="privacy-flag email-hold" title="$text"><i class="crm-i fa-exclamation-triangle fa-lg font-red"></i></span><span class="sr-only">$text</span>
+HEREDOC;
+ }
+ $class = str_replace('_', '-', $field);
+ $text = ts('Privacy flag: %1', [1 => $titles[$field]]);
+ return <<<HEREDOC
+<span class="fa-stack privacy-flag $class" title="$text"><i class="crm-i {$icons[$field]} fa-stack-1x"></i><i class="crm-i fa-ban fa-stack-2x font-red"></i></span><span class="sr-only">$text</span>
+HEREDOC;
+}
/* privacy icons */
#crm-container div span.privacy-flag {
- background-repeat: no-repeat;
- background-image: url("../i/stop-icon.png");
float: right;
+ font-size: 80%;
}
/* specific, targeted fixes */
<td><a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=`$row.contact_id`&key=`$qfKey`&context=`$context`"}">{if $row.is_deleted}<del>{/if}{$row.sort_name}{if $row.is_deleted}</del>{/if}</a></td>
{if $action eq 512 or $action eq 256}
{if !empty($columnHeaders.street_address)}
- <td><span title="{$row.street_address|escape}">{$row.street_address|mb_truncate:22:"...":true}{if $row.do_not_mail} <span class="icon privacy-flag do-not-mail"></span>{/if}</span></td>
+ <td><span title="{$row.street_address|escape}">{$row.street_address|mb_truncate:22:"...":true}{if $row.do_not_mail} {privacyFlag field=do_not_mail}{/if}</span></td>
{/if}
{if !empty($columnHeaders.city)}
<td>{$row.city}</td>
<span title="{$row.email|escape}">
{$row.email|mb_truncate:17:"...":true}
{if $row.on_hold}
- (On Hold)<span class="status-hold" title="{ts}This email is on hold (probably due to bouncing).{/ts}"></span>
+ {privacyFlag field=on_hold}
{elseif $row.do_not_email}
- <span class="icon privacy-flag do-not-email" title="{ts}Do Not Email{/ts}"></span>
+ {privacyFlag field=do_not_email}
{/if}
</span>
{/if}
{if $row.phone}
{$row.phone}
{if $row.do_not_phone}
- <span class="icon privacy-flag do-not-phone" title="{ts}Do Not Phone{/ts}" ></span>
+ {privacyFlag field=do_not_phone}
+ {/if}
+ {if $row.do_not_sms}
+ {privacyFlag field=do_not_sms}
{/if}
{/if}
</td>
<div class="crm-summary-row {if $add.is_primary eq 1} primary{/if}">
<div class="crm-label">
{ts 1=$add.location_type}%1 Address{/ts}
- {if $privacy.do_not_mail}<span class="icon privacy-flag do-not-mail" title="{ts}Privacy flag: Do Not Mail{/ts}"></span>{/if}
+ {if $privacy.do_not_mail}{privacyFlag field=do_not_mail}{/if}
{if $config->mapProvider AND
!empty($add.geo_code_1) AND
is_numeric($add.geo_code_1) AND
<div class="crm-summary-row">
<div class="crm-label">
{ts}Email{/ts}
- {if $privacy.do_not_email}<span class="icon privacy-flag do-not-email" title="{ts}Privacy flag: Do Not Email{/ts}"></span>{/if}
+ {if $privacy.do_not_email}{privacyFlag field=do_not_email}{/if}
</div>
<div class="crm-content"></div>
</div>
<div class="crm-summary-row {if $item.is_primary eq 1}primary{/if}">
<div class="crm-label">
{$item.location_type} {ts}Email{/ts}
- {if $privacy.do_not_email}<span class="icon privacy-flag do-not-email" title="{ts}Privacy flag: Do Not Email{/ts}"></span>{elseif $item.on_hold}<span class="icon privacy-flag email-hold" title="{ts}Email on hold - generally due to bouncing.{/ts}"></span>{/if}
+ {if $privacy.do_not_email}{privacyFlag field=do_not_email}{elseif $item.on_hold}{privacyFlag field=on_hold}{/if}
</div>
<div class="crm-content crm-contact_email">
{if !$item.on_hold and !$privacy.do_not_email}
<div class="crm-summary-row">
<div class="crm-label">
{ts}Phone{/ts}
- {if $privacy.do_not_phone}<span class="icon privacy-flag do-not-phone" title="{ts}Privacy flag: Do Not Phone{/ts}"></span>{/if}
+ {if $privacy.do_not_sms}{privacyFlag field=do_not_sms}{/if}
+ {if $privacy.do_not_phone}{privacyFlag field=do_not_phone}{/if}
</div>
<div class="crm-content"></div>
</div>
{if $item.phone || $item.phone_ext}
<div class="crm-summary-row {if $item.is_primary eq 1}primary{/if}">
<div class="crm-label">
- {if $privacy.do_not_phone}<span class="icon privacy-flag do-not-phone" title="{ts}Privacy flag: Do Not Phone{/ts}"></span>{/if}
+ {if $privacy.do_not_sms}{privacyFlag field=do_not_sms}{/if}
+ {if $privacy.do_not_phone}{privacyFlag field=do_not_phone}{/if}
{$item.location_type} {$item.phone_type}
</div>
<div class="crm-content crm-contact_phone">