$comps = array(
'Event' => 'civicrm_event',
'Contribution' => 'civicrm_contribution_page',
+ 'EventTemplate' => 'civicrm_event_template'
);
$contexts = array();
foreach ($comps as $name => $table) {
switch ($table) {
case 'civicrm_event':
$ids = implode(',', $entities);
- $queryString = "SELECT ce.id as id, ce.title as title, ce.is_public as isPublic, ce.start_date as startDate, ce.end_date as endDate, civicrm_option_value.label as eventType
+ $queryString = "SELECT ce.id as id, ce.title as title, ce.is_public as isPublic, ce.start_date as startDate, ce.end_date as endDate, civicrm_option_value.label as eventType, ce.is_template as isTemplate, ce.template_title as templateTitle
FROM civicrm_event ce
LEFT JOIN civicrm_option_value ON
( ce.event_type_id = civicrm_option_value.value )
( civicrm_option_group.id = civicrm_option_value.option_group_id )
WHERE
civicrm_option_group.name = 'event_type' AND
- ( ce.is_template IS NULL OR ce.is_template = 0) AND
ce.id IN ($ids) AND
ce.is_active = 1;";
$crmDAO = CRM_Core_DAO::executeQuery($queryString);
while ($crmDAO->fetch()) {
- $usedBy[$table][$crmDAO->id]['title'] = $crmDAO->title;
- $usedBy[$table][$crmDAO->id]['eventType'] = $crmDAO->eventType;
- $usedBy[$table][$crmDAO->id]['startDate'] = $crmDAO->startDate;
- $usedBy[$table][$crmDAO->id]['endDate'] = $crmDAO->endDate;
- $usedBy[$table][$crmDAO->id]['isPublic'] = $crmDAO->isPublic;
+ if ($crmDAO->isTemplate) {
+ $usedBy['civicrm_event_template'][$crmDAO->id]['title'] = $crmDAO->templateTitle;
+ $usedBy['civicrm_event_template'][$crmDAO->id]['eventType'] = $crmDAO->eventType;
+ $usedBy['civicrm_event_template'][$crmDAO->id]['isPublic'] = $crmDAO->isPublic;
+ }
+ else {
+ $usedBy[$table][$crmDAO->id]['title'] = $crmDAO->title;
+ $usedBy[$table][$crmDAO->id]['eventType'] = $crmDAO->eventType;
+ $usedBy[$table][$crmDAO->id]['startDate'] = $crmDAO->startDate;
+ $usedBy[$table][$crmDAO->id]['endDate'] = $crmDAO->endDate;
+ $usedBy[$table][$crmDAO->id]['isPublic'] = $crmDAO->isPublic;
+ }
}
break;
$comps = array(
'Event' => 'civicrm_event',
'Contribution' => 'civicrm_contribution_page',
+ 'EventTemplate' => 'civicrm_event_template'
);
$priceSetContexts = array();
foreach ($comps as $name => $table) {
$comps = array(
'Event' => 'civicrm_event',
'Contribution' => 'civicrm_contribution_page',
+ 'EventTemplate' => 'civicrm_event_template'
);
$priceSetContexts = array();
foreach ($comps as $name => $table) {
<div id="price_set_used_by" class="messages status no-popup">
<div class="icon inform-icon"></div>
{if $action eq 8}
- {ts 1=$usedPriceSetTitle}Unable to delete the '%1' Price Field - it is currently in use by one or more active events or contribution pages or contributions.{/ts}
+ {ts 1=$usedPriceSetTitle}Unable to delete the '%1' Price Field - it is currently in use by one or more active events or contribution pages or contributions or event templates.{/ts}
{/if}
- {if $usedBy.civicrm_event or $usedBy.civicrm_contribution_page}
+ {if $usedBy.civicrm_event or $usedBy.civicrm_contribution_page or $usedBy.civicrm_event_template}
{include file="CRM/Price/Page/table.tpl"}
{/if}
</div>
<div id="price_set_used_by" class="messages status no-popup">
<div class="icon inform-icon"></div>
{if $action eq 8}
- {ts 1=$usedPriceSetTitle}Unable to delete the '%1' price set - it is currently in use by one or more active events or contribution pages or contributions.{/ts}
+ {ts 1=$usedPriceSetTitle}Unable to delete the '%1' price set - it is currently in use by one or more active events or contribution pages or contributions or event templates.{/ts}
{/if}
- {if $usedBy.civicrm_event or $usedBy.civicrm_contribution_page}
+ {if $usedBy.civicrm_event or $usedBy.civicrm_contribution_page or $usedBy.civicrm_event_template}
{include file="CRM/Price/Page/table.tpl"}
{/if}
</div>
{/foreach}
</table>
{/if}
-{/foreach}
+{if $context EQ "EventTemplate"}
+ {if $action eq 8}
+ {ts}If you no longer want to use this price set, click the event template title below, and modify the fees for that event.{/ts}
+ {else}
+ {ts}This price set is used by the event template(s) listed below. Click the event template title to change or remove the price set.{/ts}
+ {/if}
+ <br /><br />
+<table class="report">
+ <thead class="sticky">
+ <th scope="col">{ts}Event Template Name{/ts}</th>
+ <th scope="col">{ts}Type{/ts}</th>
+ <th scope="col">{ts}Public{/ts}</th>
+ </thead>
+ {foreach from=$usedBy.civicrm_event_template item=eventTemplate key=id}
+ <tr>
+ <td><a href="{crmURL p="civicrm/event/manage/fee" q="action=update&reset=1&id=`$id`"}" title="{ts}Change or remove the price set used for this event template.{/ts}">{$eventTemplate.title}</a></td>
+ <td>{$eventTemplate.eventType}</td>
+ <td>{if $eventTemplate.isPublic}{ts}Yes{/ts}{else}{ts}No{/ts}{/if}</td>
+ </tr>
+ {/foreach}
+</table>
+{/if}
+{/foreach}
\ No newline at end of file