*
* Generated from xml/schema/CRM/Event/Event.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:a1c6fa263d5a0c98d03e270a5759dd35)
+ * (GenCodeChecksum:fd75d47cd23c3893174a0b55ba831894)
*/
/**
*/
public $is_billing_required;
+ /**
+ * If true then calendar links are shown for this event.
+ *
+ * @var bool|string
+ * (SQL type: tinyint)
+ * Note that values will be retrieved from the database as a string.
+ */
+ public $is_show_calendar_links;
+
/**
* Class constructor.
*/
],
'add' => '4.6',
],
+ 'is_show_calendar_links' => [
+ 'name' => 'is_show_calendar_links',
+ 'type' => CRM_Utils_Type::T_BOOLEAN,
+ 'title' => ts('Are calendar links shown?'),
+ 'description' => ts('If true then calendar links are shown for this event.'),
+ 'required' => TRUE,
+ 'usage' => [
+ 'import' => FALSE,
+ 'export' => FALSE,
+ 'duplicate_matching' => FALSE,
+ 'token' => FALSE,
+ ],
+ 'where' => 'civicrm_event.is_show_calendar_links',
+ 'default' => '1',
+ 'table_name' => 'civicrm_event',
+ 'entity' => 'Event',
+ 'bao' => 'CRM_Event_BAO_Event',
+ 'localizable' => 0,
+ 'html' => [
+ 'type' => 'CheckBox',
+ ],
+ 'add' => '5.68',
+ ],
];
CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
}
$this->addElement('checkbox', 'is_public', ts('Public Event'));
$this->addElement('checkbox', 'is_share', ts('Add footer region with Twitter, Facebook and LinkedIn share buttons and scripts?'));
$this->addElement('checkbox', 'is_map', ts('Include Map to Event Location'));
+ $this->addElement('checkbox', 'is_show_calendar_links', ts('Show Calendar Links'));
$this->add('datepicker', 'start_date', ts('Start'), [], !$this->_isTemplate, ['time' => TRUE]);
$this->add('datepicker', 'end_date', ts('End'), [], FALSE, ['time' => TRUE]);
$params['is_active'] = $params['is_active'] ?? FALSE;
$params['is_public'] = $params['is_public'] ?? FALSE;
$params['is_share'] = $params['is_share'] ?? FALSE;
+ $params['is_show_calendar_links'] = $params['is_show_calendar_links'] ?? FALSE;
$params['default_role_id'] = $params['default_role_id'] ?? FALSE;
$params['id'] = $this->_id;
//merge params with defaults from templates
'pay_later_text',
'pay_later_receipt',
'fee_label',
+ 'is_show_calendar_links:label',
'custom.*',
], $this->getExposedFields()))
->execute()->first();
'confirm_email_text',
'is_monetary',
'fee_label',
+ 'is_show_calendar_links',
];
}
*/
protected function getTokenMetadataOverrides(): array {
return [
+ 'allow_selfcancelxfer' => ['audience' => 'sysadmin'],
+ 'is_monetary' => ['audience' => 'sysadmin'],
'is_public' => ['audience' => 'sysadmin'],
+ 'is_show_calendar_links' => ['audience' => 'sysadmin'],
'is_show_location' => ['audience' => 'sysadmin'],
- 'is_monetary' => ['audience' => 'sysadmin'],
- 'allow_selfcancelxfer' => ['audience' => 'sysadmin'],
'selfcancelxfer_time' => ['audience' => 'sysadmin'],
];
}
*/
public function upgrade_5_69_alpha1($rev): void {
$this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev);
+ $this->addTask('Add is_show_calendar_links column to Event table', 'addColumn', 'civicrm_event', 'is_show_calendar_links',
+ 'tinyint NOT NULL DEFAULT 1 COMMENT "If true, calendar links are shown for this event"');
}
}
<td> </td>
<td>{$form.is_active.html} {$form.is_active.label}</td>
</tr>
+ <tr class="crm-event-manage-eventinfo-form-block-is_show_calendar_links">
+ <td> </td>
+ <td>{$form.is_show_calendar_links.html} {$form.is_show_calendar_links.label}</td>
+ </tr>
{if $eventID AND !$isTemplate}
<tr class="crm-event-manage-eventinfo-form-block-info_link">
<a href="{crmURL p='civicrm/event/info' q="reset=1&id=`$event.id`"}"><i class="crm-i fa-chevron-left" aria-hidden="true"></i> {ts 1=$event.event_title}Back to "%1" event information{/ts}</a>
</div>
- {if $event.is_public}
+ {if $event.is_public and $event.is_show_calendar_links}
<div class="action-link section iCal_links-section">
{include file="CRM/Event/Page/iCalLinks.tpl"}
</div>
{/if}
{if $event.is_share}
- {capture assign=eventUrl}{crmURL p='civicrm/event/info' q="id=`$event.id`&reset=1" a=1 fe=1 h=1}{/capture}
- {include file="CRM/common/SocialNetwork.tpl" url=$eventUrl title=$event.title pageURL=$eventUrl}
+ {capture assign=eventUrl}{crmURL p='civicrm/event/info' q="id=`$event.id`&reset=1" a=1 fe=1 h=1}{/capture}
+ {include file="CRM/common/SocialNetwork.tpl" url=$eventUrl title=$event.title pageURL=$eventUrl}
{/if}
</div>
{/if}
{/crmRegion}
</div>
- {if $event.is_public}
+ {if $event.is_public and $event.is_show_calendar_links}
<div class="action-link section iCal_links-section">
{include file="CRM/Event/Page/iCalLinks.tpl"}
</div>
$this->assertStringContainsString($string, $this->sentMail[0]);
}
+ /**
+ * Test mail does not have calendar links if 'is_show_calendar_links = FALSE'
+ */
+ public function testNoCalendarLinks() : void {
+ $this->submitPaidEvent(['is_show_calendar_links' => FALSE]);
+ $this->assertSentMailNotHasStrings([
+ 'Download iCalendar entry for this event',
+ 'Add event to Google Calendar',
+ 'civicrm/event/ical',
+ ]);
+ }
+
+ public function assertSentMailNotHasStrings(array $strings): void {
+ foreach ($strings as $string) {
+ $this->assertSentMailNotHasString($string);
+ }
+ }
+
+ public function assertSentMailNotHasString(string $string): void {
+ $this->assertStringNotContainsString($string, $this->sentMail[0]);
+ }
+
/**
* Initial test of submit function for paid event.
*
/**
* Submit a paid event with some default values.
*
+ * @param array $eventParams
* @param array $submitValues
*/
- protected function submitPaidEvent(array $submitValues = []): void {
+ protected function submitPaidEvent(array $eventParams = [], array $submitValues = []): void {
$mailUtil = new CiviMailUtils($this, TRUE);
$this->dummyProcessorCreate();
- $event = $this->eventCreatePaid(['payment_processor' => [$this->ids['PaymentProcessor']['dummy_live']], 'confirm_email_text' => '', 'is_pay_later' => FALSE, 'start_date' => '2022-09-16 12:00', 'end_date' => '2022-09-17 12:00']);
+ $event = $this->eventCreatePaid(['payment_processor' => [$this->ids['PaymentProcessor']['dummy_live']], 'confirm_email_text' => '', 'is_pay_later' => FALSE, 'start_date' => '2022-09-16 12:00', 'end_date' => '2022-09-17 12:00'] + $eventParams);
$this->submitForm($event['id'], array_merge([
'email-Primary' => 'demo@example.com',
'credit_card_number' => '4111111111111111',
<type>CheckBox</type>
</html>
</field>
+ <field>
+ <name>is_show_calendar_links</name>
+ <title>Are calendar links shown?</title>
+ <type>boolean</type>
+ <required>true</required>
+ <default>1</default>
+ <comment>If true then calendar links are shown for this event.</comment>
+ <add>5.68</add>
+ <html>
+ <type>CheckBox</type>
+ </html>
+ </field>
</table>
{/if}
{/if}
- {if {event.is_public|boolean}}
+ {if {event.is_public|boolean} and {event.is_show_calendar_links|boolean}}
<tr>
<td colspan="2" {$valueStyle}>
{capture assign=icalFeed}{crmURL p='civicrm/event/ical' q="reset=1&id={event.id}" h=0 a=1 fe=1}{/capture}
{/if}
{/if}
- {if {event.is_public|boolean}}
+ {if {event.is_public|boolean} and {event.is_show_calendar_links|boolean}}
<tr>
<td colspan="2" {$valueStyle}>
{capture assign=icalFeed}{crmURL p='civicrm/event/ical' q="reset=1&id={event.id}" h=0 a=1 fe=1}{/capture}
{if {event.loc_block_id.email_2_id.email|boolean}}
{ts}Email {/ts}{event.loc_block_id.email_2_id.email}{/if}
{/if}
-{if {event.is_public|boolean}}
+{if {event.is_public|boolean} and {event.is_show_calendar_links|boolean}}
{capture assign=icalFeed}{crmURL p='civicrm/event/ical' q="reset=1&id={event.id}" h=0 a=1 fe=1}{/capture}
{ts}Download iCalendar entry for this event.{/ts} {$icalFeed}
{capture assign=gCalendar}{crmURL p='civicrm/event/ical' q="gCalendar=1&reset=1&id={event.id}" h=0 a=1 fe=1}{/capture}