* @return array|null
*/
public static function entityTable() {
+ CRM_Core_Error::deprecatedFunctionWarning('unused function to be removed');
if (!self::$_entityTable) {
self::$_entityTable = [
'civicrm_contact' => ts('Contact'),
* @return array|null
*/
public static function objectTable() {
+ CRM_Core_Error::deprecatedFunctionWarning('unused function to be removed');
if (!self::$_objectTable) {
self::$_objectTable = [
'civicrm_contact' => ts('Contact'),
}
/**
- * @return array|null
+ * Available operations for pseudoconstant.
+ *
+ * @return array
*/
public static function operation() {
if (!self::$_operation) {
* @throws \CRM_Core_Exception
*/
public static function getClause($table, $id, &$tables) {
+ CRM_Core_Error::deprecatedFunctionWarning('unused function to be removed');
$table = CRM_Utils_Type::escape($table, 'String');
$id = CRM_Utils_Type::escape($id, 'Integer');
$whereTables = [];
*
* @throws \CRM_Core_Exception
*/
- public static function getACLs($contact_id = NULL) {
+ protected static function getACLs($contact_id = NULL) {
$results = [];
if (empty($contact_id)) {
*
* @throws \CRM_Core_Exception
*/
- public static function getACLRoles($contact_id = NULL) {
+ protected static function getACLRoles($contact_id = NULL) {
$contact_id = CRM_Utils_Type::escape($contact_id, 'Integer');
$rule = new CRM_ACL_BAO_ACL();
* Assoc array of ACL rules
* @throws \CRM_Core_Exception
*/
- public static function getGroupACLs($contact_id, $aclRoles = FALSE) {
+ protected static function getGroupACLs($contact_id, $aclRoles = FALSE) {
$contact_id = CRM_Utils_Type::escape($contact_id, 'Integer');
$rule = new CRM_ACL_BAO_ACL();
* Array of assoc. arrays of ACL rules
* @throws \CRM_Core_Exception
*/
- public static function getGroupACLRoles($contact_id) {
+ protected static function getGroupACLRoles($contact_id) {
$contact_id = CRM_Utils_Type::escape($contact_id, 'Integer');
$rule = new CRM_ACL_BAO_ACL();
*
* @return bool
*/
- public static function matchType($type, $operation) {
+ protected static function matchType($type, $operation) {
$typeCheck = FALSE;
switch ($operation) {
case 'All':
return $this->_caseId;
}
- /**
- * Get the entity subtype ID being edited
- *
- * @param $subTypeId
- *
- * @return int|null
- */
- public function getEntitySubTypeId($subTypeId) {
- if ($subTypeId) {
- return $subTypeId;
- }
- return $this->_caseTypeId;
- }
-
/**
* Build the form object.
*/
* @param int $id
* Relationship id.
*
- * $returns returns the contact ids in the realtionship
+ * $returns returns the contact ids in the relationship
*
* @return \CRM_Contact_DAO_Relationship
*/
}
/**
- * Get memberships realted to the contribution.
+ * Get memberships related to the contribution.
*
* @param int $contributionID
*
*
* @var int
*/
- protected $_entitySubTypeId;
+ protected $_entitySubTypeId = NULL;
/**
* Get entity fields for the entity to be added to the form.
/**
* Get the entity subtype ID being edited
*
- * @param $subTypeId
- *
* @return int|null
*/
- public function getEntitySubTypeId($subTypeId) {
- if ($subTypeId) {
- return $subTypeId;
- }
+ public function getEntitySubTypeId() {
return $this->_entitySubTypeId;
}
+ /**
+ * Set the entity subtype ID being edited
+ *
+ * @param $subTypeId
+ */
+ public function setEntitySubTypeId($subTypeId) {
+ $this->_entitySubTypeId = $subTypeId;
+ }
+
/**
* If the custom data is in the submitted data (eg. added via ajax loaded form) add to form.
*/
}
$customisableEntities = CRM_Core_SelectValues::customGroupExtends();
if (isset($customisableEntities[$this->getDefaultEntity()])) {
- CRM_Custom_Form_CustomData::addToForm($this);
+ CRM_Custom_Form_CustomData::addToForm($this, $this->getEntitySubTypeId());
}
}
* $params['custom'] = CRM_Core_BAO_CustomField::postProcess($submitted, $this->_id, $this->getDefaultEntity());
*
* @param CRM_Core_Form $form
- * @param null|string $subType values stored in civicrm_custom_group.extends_entity_column_value
+ * @param null|string $entitySubType values stored in civicrm_custom_group.extends_entity_column_value
* e.g Student for contact type
* @param null|string $subName value in civicrm_custom_group.extends_entity_column_id
* @param null|int $groupCount number of entities that could have custom data
*
* @throws \CRM_Core_Exception
*/
- public static function addToForm(&$form, $subType = NULL, $subName = NULL, $groupCount = 1, $contact_id = NULL) {
+ public static function addToForm(&$form, $entitySubType = NULL, $subName = NULL, $groupCount = 1, $contact_id = NULL) {
$entityName = $form->getDefaultEntity();
$entityID = $form->getEntityId();
- // FIXME: If the form has been converted to use entityFormTrait then getEntitySubTypeId() will exist.
- // However, if it is only partially converted (ie. we've switched customdata to use CRM_Custom_Form_CustomData)
- // it won't, so we check if we have a subtype before calling the function.
- $entitySubType = NULL;
- if ($subType) {
- $entitySubType = $form->getEntitySubTypeId($subType);
+ // If the form has been converted to use entityFormTrait then getEntitySubTypeId() will exist.
+ if (method_exists($form, 'getEntitySubTypeId') && empty($entitySubType)) {
+ $entitySubType = $form->getEntitySubTypeId();
}
if ($form->getAction() == CRM_Core_Action::VIEW) {
* @return array
*/
private function _gettingStarted() {
- $value = Civi::cache('community_messages')->get('dashboard_gettingStarted');
+ $tsLocale = CRM_Core_I18n::getLocale();
+ $key = 'dashboard_gettingStarted_' . $tsLocale;
+ $value = Civi::cache('community_messages')->get($key);
if (!$value) {
$value = $this->_getHtml($this->gettingStartedUrl());
if ($value) {
- Civi::cache('community_messages')->set('dashboard_gettingStarted', $value, (60 * 60 * 24 * self::CACHE_DAYS));
+ Civi::cache('community_messages')->set($key, $value, (60 * 60 * 24 * self::CACHE_DAYS));
}
}
$contributionParams['partial_payment_total'] = $amountOwed;
// the actual amount paid
$contributionParams['partial_amount_to_pay'] = $params['total_amount'];
+ $this->assign('balanceAmount', $contributionParams['partial_payment_total'] - $contributionParams['partial_amount_to_pay']);
}
}
}
$this->assign('totalAmount', $contributionParams['total_amount']);
- if (isset($contributionParams['partial_payment_total'])) {
- // balance amount
- $balanceAmount = $contributionParams['partial_payment_total'] - $contributionParams['partial_amount_to_pay'];
- $this->assign('balanceAmount', $balanceAmount);
- }
$this->assign('isPrimary', 1);
$this->assign('checkNumber', CRM_Utils_Array::value('check_number', $params));
}
}
else {
$config = CRM_Core_Config::singleton();
+ $tsLocale = CRM_Core_I18n::getLocale();
$vars = [
'{ver}' => CRM_Utils_System::version(),
'{uf}' => $config->userFramework,
'{php}' => phpversion(),
'{sid}' => self::getSiteID(),
'{baseUrl}' => $config->userFrameworkBaseURL,
- '{lang}' => $config->lcMessages,
+ '{lang}' => $tsLocale,
'{co}' => $config->defaultContactCountry,
];
return strtr($url, array_map('urlencode', $vars));
public function build() {
$this->buildRelFirstPass();
- if ($this->prepareAddlFilter('c.id')) {
+ if ($this->prepareAddlFilter('c.id') && $this->notTemplate()) {
$this->buildAddlFirstPass();
}
return $this->mapping->resetOnTriggerDateChange($this->actionSchedule);
}
+ /**
+ * Confirm this object isn't attached to a template.
+ * Returns TRUE if this action schedule isn't attached to a template.
+ * Templates are (currently) unique to events, so we only evaluate those.
+ *
+ * @return bool;
+ */
+ private function notTemplate() {
+ if ($this->mapping->getEntity() === 'civicrm_participant') {
+ $entityId = $this->actionSchedule->entity_value;
+ $query = new \CRM_Utils_SQL_Select('civicrm_event e');
+ $sql = $query
+ ->select('is_template')
+ ->where("e.id = {$entityId}")
+ ->toSQL();
+ $dao = \CRM_Core_DAO::executeQuery($sql);
+ return !(bool) $dao->fetchValue();
+ }
+ return TRUE;
+ }
+
}
{if $action eq 4}
{include file="CRM/Custom/Page/CustomDataView.tpl"}
{else}
- <div id="customData"></div>
{include file="CRM/common/customDataBlock.tpl"}
{/if}
</td>
$this->_params = [
[
'title' => 'Annual CiviCRM meet',
- 'summary' => 'If you have any CiviCRM realted issues or want to track where CiviCRM is heading, Sign up now',
+ 'summary' => 'If you have any CiviCRM related issues or want to track where CiviCRM is heading, Sign up now',
'description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues',
'event_type_id' => 1,
'is_public' => 1,
],
[
'title' => 'Annual CiviCRM meet 2',
- 'summary' => 'If you have any CiviCRM realted issues or want to track where CiviCRM is heading, Sign up now',
+ 'summary' => 'If you have any CiviCRM related issues or want to track where CiviCRM is heading, Sign up now',
'description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues',
'event_type_id' => 1,
'is_public' => 1,
$this->contactDelete($orgID);
}
+ /**
+ * Event templates should not send reminders to additional contacts.
+ */
+ public function testTemplateRemindAddlContacts() {
+ $contactId = $this->individualCreate();
+ $groupId = $this->groupCreate(['name' => 'Additional Contacts', 'title' => 'Additional Contacts']);
+ $this->callAPISuccess('GroupContact', 'create', [
+ 'contact_id' => $contactId,
+ 'group_id' => $groupId,
+ ]);
+ $event = $this->eventCreate(['is_template' => 1, 'template_title' => "I'm a template", 'title' => NULL]);
+ $eventId = $event['id'];
+
+ $actionSchedule = $this->callAPISuccess('action_schedule', 'create', [
+ 'title' => "Do not send me",
+ 'subject' => "I am a reminder attached to a template.",
+ 'entity_value' => $eventId,
+ 'mapping_id' => 5,
+ 'start_action_date' => 'start_date',
+ 'start_action_offset' => 1,
+ 'start_action_condition' => 'before',
+ 'start_action_unit' => 'day',
+ 'group_id' => $groupId,
+ 'limit_to' => FALSE,
+ 'mode' => 'Email',
+ ]);
+
+ $this->callAPISuccess('job', 'send_reminder', []);
+ $successfulCronCount = CRM_Core_DAO::singleValueQuery("SELECT count(*) FROM civicrm_action_log");
+ $this->assertEquals(0, $successfulCronCount);
+ }
+
/**
* Test scheduled reminders respect limit to (since above identified addition_to handling issue).
*