Skip to content

Commit

Permalink
Merge pull request #25815 from civicrm/5.60
Browse files Browse the repository at this point in the history
Merge 5.60 to master
  • Loading branch information
eileenmcnaughton authored Mar 15, 2023
2 parents b7b8374 + d8a2574 commit a188f51
Show file tree
Hide file tree
Showing 9 changed files with 466 additions and 19 deletions.
2 changes: 1 addition & 1 deletion CRM/Core/BAO/CustomField.php
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ public static function addQuickFormElement(
);

}
if ($field->data_type == 'EntityReference') {
elseif ($field->data_type == 'EntityReference') {
$fieldAttributes['entity'] = $field->fk_entity;
$element = $qf->addAutocomplete($elementName, $label, $fieldAttributes, $useRequired && !$search);
}
Expand Down
3 changes: 1 addition & 2 deletions CRM/Core/Payment/PayPalImpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ public function doDirectPayment(&$params) {
public function doPaymentPayPalButton(&$params) {
$args = [];

$result = $this->setStatusPaymentPending([]);
$result = [];

$this->initialize($args, 'DoDirectPayment');

Expand Down Expand Up @@ -606,7 +606,6 @@ public function doPaymentPayPalButton(&$params) {
}

/* Success */
$result = $this->setStatusPaymentCompleted($result);
$doQueryParams = [
'gross_amount' => $apiResult['amt'] ?? NULL,
'trxn_id' => $apiResult['transactionid'] ?? NULL,
Expand Down
19 changes: 13 additions & 6 deletions CRM/Dedupe/Merger.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
+--------------------------------------------------------------------+
*/

use Civi\Api4\Contact;
use Civi\Api4\CustomGroup;

/**
Expand Down Expand Up @@ -685,7 +686,18 @@ protected static function updateContact(int $contactID, $params): void {
// This parameter causes blank fields to be be emptied out.
// We can probably remove.
$params['updateBlankLocInfo'] = TRUE;
if (empty($params['contact_type']) || ($params['contact_type'] === 'Organization' && empty($params['organization_name']))) {
// Ensuring this is set addresses https://lab.civicrm.org/dev/core/-/issues/4156
// but not that RM_Dedupe_MergerTest::testMergeWithEmployer covers this scenario
// so refactoring of this is safe.
$contact = Contact::get(FALSE)->addWhere('id', '=', $contactID)->addSelect('organization_name', 'contact_type')->execute()->first();
$params['contact_type'] = $contact['contact_type'];
if (empty($params['organization_name']) && $params['contact_type'] === 'Organization') {
$params['organization_name'] = $contact['organization_name'];
}
}
$data = self::formatProfileContactParams($params, $contactID);

CRM_Contact_BAO_Contact::create($data);
}

Expand All @@ -707,13 +719,12 @@ private static function formatProfileContactParams(
int $contactID
) {

$data = $contactDetails = [];
$data = ['contact_type' => $params['contact_type']];

// get the contact details (hier)
$details = CRM_Contact_BAO_Contact::getHierContactDetails($contactID, []);

$contactDetails = $details[$contactID];
$data['contact_type'] = $contactDetails['contact_type'] ?? NULL;
$data['contact_sub_type'] = $contactDetails['contact_sub_type'] ?? NULL;

//fix contact sub type CRM-5125
Expand Down Expand Up @@ -993,10 +1004,6 @@ private static function formatProfileContactParams(
}
}

if (!isset($data['contact_type'])) {
$data['contact_type'] = 'Individual';
}

return $data;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@
}
};

this.getSearchDisplay = function(node) {
var searchKey = $scope.getSearchKey(node);
if (searchKey) {
// Finds a SearchDisplay within this container or within the fieldset containing this container
this.getSearchDisplay = function() {
var searchKey = ctrl.getDataEntity();
if (searchKey && !ctrl.entityName) {
return afGui.getSearchDisplay.apply(null, searchKey.split('.'));
}
};
Expand Down Expand Up @@ -416,8 +417,7 @@
var joinType = ctrl.entityName.split('-join-');
entityType = joinType[1] || (ctrl.editor && ctrl.editor.getEntity(joinType[0]).type);
} else {
var searchKey = ctrl.getDataEntity(),
searchDisplay = afGui.getSearchDisplay.apply(null, searchKey.split('.')),
var searchDisplay = ctrl.getSearchDisplay(),
fieldName = fieldKey.substr(fieldKey.indexOf('.') + 1),
prefix = _.includes(fieldKey, '.') ? fieldKey.split('.')[0] : null;
if (prefix) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@
this.getDefn = function() {
var defn = afGui.getField(ctrl.container.getFieldEntityType(ctrl.node.name), ctrl.node.name);
// Calc fields are specific to a search display, not part of the schema
if (!defn && ctrl.container.getSearchDisplay(ctrl.container.node)) {
var searchDisplay = ctrl.container.getSearchDisplay(ctrl.container.node);
if (!defn && ctrl.container.getSearchDisplay()) {
var searchDisplay = ctrl.container.getSearchDisplay();
defn = _.findWhere(searchDisplay.calc_fields, {name: ctrl.node.name});
}
defn = defn || {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ private function isTableChange(GenericHookEvent $event): bool {
public function onApiAuthorize(AuthorizeEvent $event): void {
$apiRequest = $event->getApiRequest();
$entity = $apiRequest['entity'];
if (strpos($entity, 'Import_') === 0) {
if (strpos($entity, 'Import_') === 0 && !in_array($event->getActionName(), ['getFields', 'getActions', 'checkAccess'], TRUE)) {
$userJobID = (int) (str_replace('Import_', '', $entity));
if (!UserJob::get(TRUE)->addWhere('id', '=', $userJobID)->selectRowCount()->execute()->count()) {
throw new UnauthorizedException('Import access not permitted');
Expand Down
11 changes: 11 additions & 0 deletions release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ Other resources for identifying changes are:
* https://github.com/civicrm/civicrm-joomla
* https://github.com/civicrm/civicrm-wordpress

## CiviCRM 5.60.0

Released April 5, 2023

- **[Synopsis](release-notes/5.60.0.md#synopsis)**
- **[Features](release-notes/5.60.0.md#features)**
- **[Bugs resolved](release-notes/5.60.0.md#bugs)**
- **[Miscellany](release-notes/5.60.0.md#misc)**
- **[Credits](release-notes/5.60.0.md#credits)**
- **[Feedback](release-notes/5.60.0.md#feedback)**

## CiviCRM 5.59.0

Released March 1, 2023
Expand Down
Loading

0 comments on commit a188f51

Please sign in to comment.