Skip to content

Commit

Permalink
Merge pull request #140 from JMAConsulting/master-jma
Browse files Browse the repository at this point in the history
Refresh master
  • Loading branch information
monishdeb authored Nov 1, 2023
2 parents 4bb56fe + 37e142b commit 4565f7d
Show file tree
Hide file tree
Showing 992 changed files with 23,311 additions and 17,066 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
!/ext/civi_pledge
!/ext/civi_report
!/ext/scheduled_communications
!/ext/user_dashboard
backdrop/
bower_components
CRM/Case/xml/configuration
Expand Down
11 changes: 8 additions & 3 deletions CRM/ACL/BAO/ACL.php
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ private static function getGroupClause(array $groupIDs, string $operation): stri
";
$dao = CRM_Core_DAO::executeQuery($query);
$foundGroupIDs = [];
$groupContactCacheClause = FALSE;
$groupContactCacheClause = '';
while ($dao->fetch()) {
$foundGroupIDs[] = $dao->id;
if (($dao->saved_search_id || $dao->children || $dao->parents)) {
Expand All @@ -524,15 +524,20 @@ private static function getGroupClause(array $groupIDs, string $operation): stri
}
}

if ($groupIDs) {
if ($foundGroupIDs) {
return "(
`contact_a`.id $operation (
SELECT contact_id FROM civicrm_group_contact WHERE group_id IN (" . implode(', ', $foundGroupIDs) . ") AND status = 'Added'
$groupContactCacheClause
)
)";
}
return '';
else {
// Edge case avoiding SQL syntax error if no $foundGroupIDs
return "(
`contact_a`.id $operation (0)
)";
}
}

public static function getObjectTableOptions(): array {
Expand Down
6 changes: 4 additions & 2 deletions CRM/ACL/DAO/ACL.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/ACL/ACL.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:56266204b43a487af7bf9963d23e0556)
* (GenCodeChecksum:d49159426e04e1bab16768e2f7ed9551)
*/

/**
Expand Down Expand Up @@ -135,7 +135,7 @@ class CRM_ACL_DAO_ACL extends CRM_Core_DAO {
/**
* Is this property active?
*
* @var bool|string|null
* @var bool|string
* (SQL type: tinyint)
* Note that values will be retrieved from the database as a string.
*/
Expand Down Expand Up @@ -425,13 +425,15 @@ public static function &fields() {
'type' => CRM_Utils_Type::T_BOOLEAN,
'title' => ts('ACL Is Active?'),
'description' => ts('Is this property active?'),
'required' => TRUE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_acl.is_active',
'default' => '1',
'table_name' => 'civicrm_acl',
'entity' => 'ACL',
'bao' => 'CRM_ACL_BAO_ACL',
Expand Down
2 changes: 1 addition & 1 deletion CRM/ACL/Form/ACL.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public function postProcess() {
}
else {
$params = $this->controller->exportValues($this->_name);
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
$params['is_active'] = $params['is_active'] ?? FALSE;
$params['entity_table'] = 'civicrm_acl_role';

// Figure out which type of object we're permissioning on and set object_table and object_id.
Expand Down
4 changes: 2 additions & 2 deletions CRM/Activity/BAO/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -2335,8 +2335,8 @@ public static function getContactActivitySelector(&$params) {
$params['rowCount'] = $params['rp'];
$params['sort'] = $params['sortBy'] ?? NULL;
$params['caseId'] = NULL;
$context = $params['context'] ?? NULL;
$showContactOverlay = !CRM_Utils_String::startsWith($context, "dashlet");
$context = $params['context'] ?? '';
$showContactOverlay = !str_starts_with($context, "dashlet");
$activityTypeInfo = civicrm_api3('OptionValue', 'get', [
'option_group_id' => "activity_type",
'options' => ['limit' => 0],
Expand Down
14 changes: 5 additions & 9 deletions CRM/Activity/Form/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -550,12 +550,8 @@ public function setDefaultValues() {
if (isset($this->_activityId)) {

if ($this->_context !== 'standalone') {
$this->assign('target_contact_value',
CRM_Utils_Array::value('target_contact_value', $defaults)
);
$this->assign('assignee_contact_value',
CRM_Utils_Array::value('assignee_contact_value', $defaults)
);
$this->assign('target_contact_value', $defaults['target_contact_value'] ?? NULL);
$this->assign('assignee_contact_value', $defaults['assignee_contact_value'] ?? NULL);
}

// Fixme: why are we getting the wrong keys from upstream?
Expand Down Expand Up @@ -596,7 +592,7 @@ public function setDefaultValues() {
}

if ($this->_action & (CRM_Core_Action::DELETE | CRM_Core_Action::RENEW)) {
$this->assign('delName', CRM_Utils_Array::value('subject', $defaults));
$this->assign('delName', $defaults['subject'] ?? NULL);
}

if ($this->_activityTypeFile) {
Expand Down Expand Up @@ -679,13 +675,13 @@ public function buildQuickForm() {
$this->addEntityRef($field, $values['label'], $attribute, $required);
}
else {
$this->add($values['type'], $field, $values['label'], $attribute, $required, CRM_Utils_Array::value('extra', $values));
$this->add($values['type'], $field, $values['label'], $attribute, $required, $values['extra'] ?? NULL);
}
}
}

// CRM-7362 --add campaigns.
CRM_Campaign_BAO_Campaign::addCampaign($this, CRM_Utils_Array::value('campaign_id', $this->_values));
CRM_Campaign_BAO_Campaign::addCampaign($this, $this->_values['campaign_id'] ?? NULL);

// Add engagement level CRM-7775
$buildEngagementLevel = FALSE;
Expand Down
6 changes: 3 additions & 3 deletions CRM/Activity/Selector/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,11 +417,11 @@ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL, $ca
$row['engagement_level'] = CRM_Utils_Array::value($engagementLevel, $engagementLevels, $engagementLevel);
}

$actionLinks = $this->actionLinks(CRM_Utils_Array::value('activity_type_id', $row),
CRM_Utils_Array::value('source_record_id', $row),
$actionLinks = $this->actionLinks($row['activity_type_id'],
$row['source_record_id'] ?? NULL,
// CRM-3553
!empty($row['mailingId']),
CRM_Utils_Array::value('activity_id', $row),
$row['activity_id'] ?? NULL,
$this->_key
);

Expand Down
2 changes: 1 addition & 1 deletion CRM/Admin/Form/MailSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public function postProcess() {
'is_contact_creation_disabled_if_no_match',
'is_active',
])) {
$params[$f] = CRM_Utils_Array::value($f, $formValues, FALSE);
$params[$f] = $formValues[$f] ?? FALSE;
}
else {
$params[$f] = $formValues[$f] ?? NULL;
Expand Down
2 changes: 1 addition & 1 deletion CRM/Admin/Form/ParticipantStatusType.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function postProcess() {
}
$params['weight'] = CRM_Utils_Weight::updateOtherWeights('CRM_Event_DAO_ParticipantStatusType', $oldWeight, $params['weight']);

$participantStatus = CRM_Event_BAO_ParticipantStatusType::create($params);
$participantStatus = CRM_Event_BAO_ParticipantStatusType::writeRecord($params);

if ($participantStatus->id) {
if ($this->_action & CRM_Core_Action::UPDATE) {
Expand Down
8 changes: 4 additions & 4 deletions CRM/Admin/Form/PaymentProcessorType.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function buildQuickForm($check = FALSE) {
$attributes = CRM_Core_DAO::getAttribute('CRM_Financial_DAO_PaymentProcessorType');

foreach ($this->_fields as $field) {
$required = CRM_Utils_Array::value('required', $field, FALSE);
$required = $field['required'] ?? FALSE;
$this->add('text', $field['name'],
$field['label'], $attributes['name'], $required
);
Expand Down Expand Up @@ -210,9 +210,9 @@ public function postProcess() {
$dao = new CRM_Financial_DAO_PaymentProcessorType();

$dao->id = $this->_id;
$dao->is_default = CRM_Utils_Array::value('is_default', $values, 0);
$dao->is_active = CRM_Utils_Array::value('is_active', $values, 0);
$dao->is_recur = CRM_Utils_Array::value('is_recur', $values, 0);
$dao->is_default = $values['is_default'] ?? 0;
$dao->is_active = $values['is_active'] ?? 0;
$dao->is_recur = $values['is_recur'] ?? 0;

$dao->name = $values['name'];
$dao->description = $values['description'];
Expand Down
2 changes: 1 addition & 1 deletion CRM/Admin/Form/Preferences/Contribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function postProcess() {
// too. This means that saving from api will not have the desired core effect.
// but we should fix that elsewhere - ie. stop abusing the settings
// and fix the code repetition associated with invoicing
$invoiceParams['invoicing'] = CRM_Utils_Array::value('invoicing', $params, 0);
$invoiceParams['invoicing'] = $params['invoicing'] ?? 0;
Civi::settings()->set('contribution_invoice_settings', $invoiceParams);
parent::postProcess();
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Admin/Form/RelationshipType.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function postProcess() {
else {
// store the submitted values in an array
$params = $this->exportValues();
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
$params['is_active'] = $params['is_active'] ?? FALSE;

if ($this->_action & CRM_Core_Action::UPDATE) {
$params['id'] = $this->_id;
Expand Down
2 changes: 2 additions & 0 deletions CRM/Admin/Form/ScheduleReminders.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
*/
class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form {

protected $retrieveMethod = 'api4';

/**
* @return string
*/
Expand Down
1 change: 0 additions & 1 deletion CRM/Admin/Form/Setting/Miscellaneous.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public function preProcess() {
'recentItemsMaxCount',
'recentItemsProviders',
'dedupe_default_limit',
'esm_loader',
'prevNextBackend',
'import_batch_size',
]);
Expand Down
6 changes: 3 additions & 3 deletions CRM/Admin/Page/AJAX.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public static function getTagTree() {
$result = [];

$whereClauses = ['is_tagset <> 1'];
$orderColumn = 'name';
$orderColumn = 'label';

// fetch all child tags in Array('parent_tag' => array('child_tag_1', 'child_tag_2', ...)) format
$childTagIDs = CRM_Core_BAO_Tag::getChildTags($substring);
Expand All @@ -300,7 +300,7 @@ public static function getTagTree() {
$whereClauses[] = "parent_id = $parent";
}
elseif ($substring) {
$whereClauses['substring'] = " name LIKE '%$substring%' ";
$whereClauses['substring'] = " label LIKE '%$substring%' ";
if (!empty($parentIDs)) {
$whereClauses['substring'] = sprintf(" %s OR id IN (%s) ", $whereClauses['substring'], implode(',', $parentIDs));
}
Expand Down Expand Up @@ -328,7 +328,7 @@ public static function getTagTree() {
$usedFor = (array) explode(',', $dao->used_for);
$tag = [
'id' => $dao->id,
'text' => $dao->name,
'text' => $dao->label,
'a_attr' => [
'class' => 'crm-tag-item',
],
Expand Down
2 changes: 1 addition & 1 deletion CRM/Api4/Page/AJAX.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private function execute(string $entity, string $action, array $params = [], $in
$status = $statusMap[get_class($e)] ?? 500;
// Send error code (but don't overwrite success code if there are multiple calls and one was successful)
$this->httpResponseCode = $this->httpResponseCode ?: $status;
if (CRM_Core_Permission::check('view debug output')) {
if (CRM_Core_Permission::check('view debug output') || ($e->getErrorData()['show_detailed_error'] ?? FALSE)) {
$response['error_code'] = $e->getCode();
$response['error_message'] = $e->getMessage();
if (!empty($params['debug'])) {
Expand Down
6 changes: 3 additions & 3 deletions CRM/Badge/BAO/Layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ public static function setIsActive($id, $is_active) {
* @return object
*/
public static function create(&$params) {
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
$params['is_default'] = CRM_Utils_Array::value('is_default', $params, FALSE);
$params['is_reserved'] = CRM_Utils_Array::value('is_reserved', $params, FALSE);
$params['is_active'] = $params['is_active'] ?? FALSE;
$params['is_default'] = $params['is_default'] ?? FALSE;
$params['is_reserved'] = $params['is_reserved'] ?? FALSE;

$params['label_type_id'] = CRM_Core_PseudoConstant::getKey('CRM_Core_DAO_PrintLabel', 'label_type_id', 'Event Badge');

Expand Down
24 changes: 9 additions & 15 deletions CRM/Badge/Form/Layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
+--------------------------------------------------------------------+
*/

use Civi\Token\TokenProcessor;

/**
*
* @package CRM
Expand Down Expand Up @@ -49,21 +51,13 @@ public function buildQuickForm(): void {
$this->add('text', 'description', ts('Description'),
CRM_Core_DAO::getAttribute('CRM_Core_DAO_PrintLabel', 'title'));

// get the tokens - at the point of rendering the token processor is used so
// the only reason for this cut-down set of tokens is UI on this
// screen and / or historical.
$contactTokens = CRM_Core_SelectValues::contactTokens();
$eventTokens = [
'{event.event_id}' => ts('Event ID'),
'{event.title}' => ts('Event Title'),
// This layout selection is day + month eg October 27th
// obviously someone felt year was not logical for dates.
'{event.start_date|crmDate:"%B %E%f"}' => ts('Event Start Date'),
'{event.end_date|crmDate:"%B %E%f"}' => ts('Event End Date'),
];
$participantTokens = CRM_Core_SelectValues::participantTokens();

$tokens = array_merge($contactTokens, $eventTokens, $participantTokens);
$tokenProcessor = new TokenProcessor(Civi::dispatcher(), ['schema' => ['participantId', 'contactId', 'eventId']]);
$tokens = $tokenProcessor->listTokens();
// This layout selection is day + month eg October 27th
// obviously someone felt year was not logical for dates.
$tokens['{event.start_date|crmDate:"%B %E%f"}'] = ts('Event Start Date - Day & Month');
$tokens[] = ts('Event End Date - Day & Month');

asort($tokens);

$tokens = array_merge(['spacer' => ts('- spacer -')] + $tokens);
Expand Down
Loading

0 comments on commit 4565f7d

Please sign in to comment.