}
$this->_single = TRUE;
- $params = ['id' => $this->_id];
- CRM_Event_BAO_Event::retrieve($params, $eventInfo);
+ $eventInfo = \Civi\Api4\Event::get(FALSE)
+ ->addWhere('id', '=', $this->_id)
+ ->execute()
+ ->first();
// its an update mode, do a permission check
if (!CRM_Event_BAO_Event::checkPermission($this->_id, CRM_Core_Permission::EDIT)) {
*/
public function setDefaultValues() {
$defaults = [];
+ $event = \Civi\Api4\Event::get(FALSE);
if (isset($this->_id)) {
- $params = ['id' => $this->_id];
- CRM_Event_BAO_Event::retrieve($params, $defaults);
-
+ $event->addWhere('id', '=', $this->_id);
+ $defaults = $event->execute()->first();
$this->_campaignID = $defaults['campaign_id'] ?? NULL;
}
elseif ($this->_templateId) {
- $params = ['id' => $this->_templateId];
- CRM_Event_BAO_Event::retrieve($params, $defaults);
+ $event->addWhere('id', '=', $this->_templateId);
+ $defaults = $event->execute()->first();
$defaults['is_template'] = $this->_isTemplate;
$defaults['template_id'] = $defaults['id'];
unset($defaults['id']);
}
if ($this->_action & CRM_Core_Action::ADD) {
- $eventTemplates = CRM_Event_PseudoConstant::eventTemplates();
+ $eventTemplates = \Civi\Api4\Event::get(FALSE)
+ ->addWhere('is_template', '=', TRUE)
+ ->addWhere('is_active', '=', TRUE)
+ ->execute()
+ ->indexBy('id')
+ ->column('template_title');
if (CRM_Utils_System::isNull($eventTemplates) && !$this->_isTemplate) {
$url = CRM_Utils_System::url('civicrm/admin/eventTemplate', ['reset' => 1]);
CRM_Core_Session::setStatus(ts('If you find that you are creating multiple events with similar settings, you may want to use the <a href="%1">Event Templates</a> feature to streamline your workflow.', [1 => $url]), ts('Tip'), 'info');
*
* @return array
* Array of event id → template title pairs
+ *
+ * @deprecated Use the API instead
*/
public static function &eventTemplates($id = NULL) {
+ CRM_Core_Error::deprecatedFunctionWarning('Use the api');
if (!self::$eventTemplates) {
CRM_Core_PseudoConstant::populate(self::$eventTemplates,
'CRM_Event_DAO_Event',
* @param \CRM_Contribute_BAO_Contribution|\CRM_Contribute_DAO_Contribution $contribution
*/
public static function updateRecurMembership(CRM_Member_DAO_Membership $membership, CRM_Contribute_BAO_Contribution $contribution) {
- CRM_Core_Error::deprecatedFunctionWarning('Use the API instead');
+ CRM_Core_Error::deprecatedFunctionWarning('Use the api');
if (empty($contribution->contribution_recur_id)) {
return;
$valueLabelMap['event_type'] = \CRM_Event_PseudoConstant::eventType();
$valueLabelMap['civicrm_event'] = \CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )");
$valueLabelMap['civicrm_participant_status_type'] = \CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label');
- $valueLabelMap['event_template'] = \CRM_Event_PseudoConstant::eventTemplates();
+ $valueLabelMap['event_template'] = \Civi\Api4\Event::get(FALSE)
+ ->addWhere('is_template', '=', TRUE)
+ ->addWhere('is_active', '=', TRUE)
+ ->execute()
+ ->indexBy('id')
+ ->column('template_title');
$valueLabelMap['auto_renew_options'] = \CRM_Core_OptionGroup::values('auto_renew_options');
$valueLabelMap['contact_date_reminder_options'] = \CRM_Core_OptionGroup::values('contact_date_reminder_options');
$valueLabelMap['civicrm_membership_type'] = \CRM_Member_PseudoConstant::membershipType();