Skip to content

Commit

Permalink
Merge branch 'master' into master-greenwich-ext
Browse files Browse the repository at this point in the history
  • Loading branch information
totten authored Sep 16, 2020
2 parents 96a8571 + b520b57 commit ce8ffd2
Show file tree
Hide file tree
Showing 45 changed files with 411 additions and 975 deletions.
12 changes: 9 additions & 3 deletions CRM/ACL/DAO/ACLCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/ACL/ACLCache.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:cec3d7c7aced95902840b72829550156)
* (GenCodeChecksum:7faa5879056a56b463304bd81829afda)
*/

/**
Expand Down Expand Up @@ -85,7 +85,6 @@ public static function getEntityTitle($plural = FALSE) {
public static function getReferenceColumns() {
if (!isset(Civi::$statics[__CLASS__]['links'])) {
Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'acl_id', 'civicrm_acl', 'id');
CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
}
Expand Down Expand Up @@ -123,7 +122,6 @@ public static function &fields() {
'entity' => 'ACLCache',
'bao' => 'CRM_ACL_DAO_ACLCache',
'localizable' => 0,
'FKClassName' => 'CRM_Contact_DAO_Contact',
'html' => [
'type' => 'EntityRef',
],
Expand Down Expand Up @@ -231,6 +229,14 @@ public static function &export($prefix = FALSE) {
*/
public static function indices($localize = TRUE) {
$indices = [
'index_contact_id' => [
'name' => 'index_contact_id',
'field' => [
0 => 'contact_id',
],
'localizable' => FALSE,
'sig' => 'civicrm_acl_cache::0::contact_id',
],
'index_acl_id' => [
'name' => 'index_acl_id',
'field' => [
Expand Down
16 changes: 5 additions & 11 deletions CRM/Activity/BAO/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -1699,16 +1699,10 @@ public static function addActivity(
$params = []
) {
$date = date('YmdHis');
if ($activity->__table == 'civicrm_membership') {
$component = 'Membership';
if ($activity->__table === 'civicrm_participant' && $activityType !== 'Email') {
$activityType = 'Event Registration';
}
elseif ($activity->__table == 'civicrm_participant') {
if ($activityType != 'Email') {
$activityType = 'Event Registration';
}
$component = 'Event';
}
elseif ($activity->__table == 'civicrm_contribution') {
if ($activity->__table == 'civicrm_contribution') {
// create activity record only for Completed Contributions
$contributionCompletedStatusId = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Completed');
if ($activity->contribution_status_id != $contributionCompletedStatusId) {
Expand All @@ -1718,7 +1712,7 @@ public static function addActivity(
}
$params['status_id'] = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_status_id', 'Scheduled');
}
$activityType = $component = 'Contribution';
$activityType = 'Contribution';

// retrieve existing activity based on source_record_id and activity_type
if (empty($params['id'])) {
Expand Down Expand Up @@ -1772,7 +1766,7 @@ public static function addActivity(
// @todo - use api - remove lots of wrangling above. Remove deprecated fatal & let form layer
// deal with any exceptions.
if (is_a(self::create($activityParams), 'CRM_Core_Error')) {
throw new CRM_Core_Exception("Failed creating Activity for $component of id {$activity->id}");
throw new CRM_Core_Exception("Failed creating Activity of type $activityType for entity id {$activity->id}");
}
}

Expand Down
73 changes: 0 additions & 73 deletions CRM/Activity/Form/Task/SearchTaskHookSample.php

This file was deleted.

2 changes: 1 addition & 1 deletion CRM/Activity/Page/AJAX.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public static function _convertToCaseActivity($params) {
if (!$otherActivity->find(TRUE)) {
return (['error_msg' => 'activity record is missing.']);
}
$actDateTime = CRM_Utils_Date::isoToMysql($otherActivity->activity_date_time);
$actDateTime = $otherActivity->activity_date_time;

// Create new activity record.
$mainActivity = new CRM_Activity_DAO_Activity();
Expand Down
2 changes: 1 addition & 1 deletion CRM/Case/BAO/Case.php
Original file line number Diff line number Diff line change
Expand Up @@ -2070,7 +2070,7 @@ public static function mergeCases(
CRM_Core_DAO::storeValues($otherActivity, $mainActVals);
$mainActivity->copyValues($mainActVals);
$mainActivity->id = NULL;
$mainActivity->activity_date_time = CRM_Utils_Date::isoToMysql($otherActivity->activity_date_time);
$mainActivity->activity_date_time = $otherActivity->activity_date_time;
$mainActivity->source_record_id = CRM_Utils_Array::value($mainActivity->source_record_id,
$activityMappingIds
);
Expand Down
68 changes: 0 additions & 68 deletions CRM/Case/Form/Task/SearchTaskHookSample.php

This file was deleted.

33 changes: 31 additions & 2 deletions CRM/Contact/BAO/SavedSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ public function getAll() {
* @param array $defaults
* (reference ) an assoc array to hold the flattened values.
*
* @return CRM_Contact_BAO_SavedSearch
* @return CRM_Contact_DAO_SavedSearch
*/
public static function retrieve(&$params, &$defaults) {
public static function retrieve($params, &$defaults = []) {
$savedSearch = new CRM_Contact_DAO_SavedSearch();
$savedSearch->copyValues($params);
if ($savedSearch->find(TRUE)) {
Expand Down Expand Up @@ -422,4 +422,33 @@ public static function decodeRelativeFields(&$formValues, $fieldName, $op, $valu
}
}

/**
* Generate a url to the appropriate search form for a given savedSearch
*
* @param int $id
* Saved search id
* @return string
*/
public static function getEditSearchUrl($id) {
$savedSearch = self::retrieve(['id' => $id]);
// APIv4 search
if (!empty($savedSearch->api_entity)) {
$groupName = self::getName($id);
return CRM_Utils_System::url('civicrm/search', NULL, FALSE, "/load/Group/$groupName");
}
// Classic search builder
if (!empty($savedSearch->mapping_id)) {
$path = 'civicrm/contact/search/builder';
}
// Classic custom search
elseif (!empty($savedSearch->search_custom_id)) {
$path = 'civicrm/contact/search/custom';
}
// Classic advanced search
else {
$path = 'civicrm/contact/search/advanced';
}
return CRM_Utils_System::url($path, ['reset' => 1, 'ssID' => $id]);
}

}
18 changes: 1 addition & 17 deletions CRM/Contact/DAO/ACLContactCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Contact/ACLContactCache.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:ff86d1eed99d09ea6768d93b3cc39973)
* (GenCodeChecksum:4eaf1e99ce247c430fc280cc6ce68538)
*/

/**
Expand Down Expand Up @@ -76,21 +76,6 @@ public static function getEntityTitle($plural = FALSE) {
return $plural ? ts('ACLContact Caches') : ts('ACLContact Cache');
}

/**
* Returns foreign keys and entity references.
*
* @return array
* [CRM_Core_Reference_Interface]
*/
public static function getReferenceColumns() {
if (!isset(Civi::$statics[__CLASS__]['links'])) {
Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
}
return Civi::$statics[__CLASS__]['links'];
}

/**
* Returns all the column names of this table
*
Expand Down Expand Up @@ -135,7 +120,6 @@ public static function &fields() {
'entity' => 'ACLContactCache',
'bao' => 'CRM_Contact_DAO_ACLContactCache',
'localizable' => 0,
'FKClassName' => 'CRM_Contact_DAO_Contact',
'add' => '3.1',
],
'operation' => [
Expand Down
5 changes: 2 additions & 3 deletions CRM/Contact/Form/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,10 @@ public function buildQuickForm() {
$ssID = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $this->_groupID, 'saved_search_id');
$this->assign('ssID', $ssID);

//get the saved search mapping id
//get the saved search edit link
if ($ssID) {
$this->_ssID = $ssID;
$ssMappingId = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch', $ssID, 'mapping_id');
$this->assign('ssMappingID', $ssMappingId);
$this->assign('editSmartGroupURL', CRM_Contact_BAO_SavedSearch::getEditSearchUrl($ssID));
}

// Set dynamic page title for 'Show Members of Group'
Expand Down
34 changes: 13 additions & 21 deletions CRM/Contribute/BAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -5230,35 +5230,27 @@ protected static function getContributionPaymentLinks($id, $balance, $contributi
'title' => ts('Record Payment'),
];

if ((int) $balance > 0) {
// @todo - this should be possible even if not > 0 - test & remove this if.
// it is possible to 'overpay' in the real world & we honor that.
if (CRM_Core_Config::isEnabledBackOfficeCreditCardPayments()) {
$actionLinks[] = [
'url' => CRM_Utils_System::url('civicrm/payment', [
'action' => 'add',
'reset' => 1,
'is_refund' => 0,
'id' => $id,
'mode' => 'live',
]),
'title' => ts('Submit Credit Card payment'),
];
}
}
elseif ((int) $balance < 0) {
// @todo - in the future remove this IF - OK to refund money even when not due since
// ... life.
if (CRM_Core_Config::isEnabledBackOfficeCreditCardPayments()) {
$actionLinks[] = [
'url' => CRM_Utils_System::url('civicrm/payment', [
'action' => 'add',
'reset' => 1,
'is_refund' => 0,
'id' => $id,
'is_refund' => 1,
'mode' => 'live',
]),
'title' => ts('Record Refund'),
'title' => ts('Submit Credit Card payment'),
];
}
$actionLinks[] = [
'url' => CRM_Utils_System::url('civicrm/payment', [
'action' => 'add',
'reset' => 1,
'id' => $id,
'is_refund' => 1,
]),
'title' => ts('Record Refund'),
];
return $actionLinks;
}

Expand Down
Loading

0 comments on commit ce8ffd2

Please sign in to comment.