Remove overriden core files
Created by: monishdeb
This PR contains commit of #185 . In addition remove two files:
- CRM/Core/Page/AJAX/Location.php
diff --git a/Users/monish/src/civicrm-core/CRM/Core/Page/AJAX/Location.php b/CRM/Core/Page/AJAX/Location.php
index b5da745..b929516 100644
--- a/Users/monish/src/civicrm-core/CRM/Core/Page/AJAX/Location.php
+++ b/CRM/Core/Page/AJAX/Location.php
@@ -163,6 +164,13 @@ class CRM_Core_Page_AJAX_Location {
$elements["onbehalf_{$key}"]['type'] = $htmlType;
$elements["onbehalf_{$key}"]['value'] = $defaults[$key];
}
+ elseif ($htmlType == 'File') {
+ $elements["onbehalf_{$key}"]['type'] = $htmlType;
+ $elements["onbehalf_{$key}"]['value'] = '';
+ $cFid = substr($key, strpos($key, "_") + 1);
+ $file = CRM_Core_BAO_CustomField::getFileURL($cid, $cFid, $defaults[$key]);
+ $elements["onbehalf_{$key}"]['fileId'] = $file['file_url'];
+ }
elseif ($htmlType == 'Select Date') {
$elements["onbehalf_{$key}"]['type'] = $htmlType;
//CRM-18349, date value must be ISO formatted before being set as a default value for crmDatepicker custom field
This is the only difference it contains, which defaults the file type field but is no longer used as in here. So its safe to remove this file.
- CRM/UF/Page/ProfileEditor.php
diff --git a/Users/monish/src/civicrm-core/CRM/UF/Page/ProfileEditor.php b/CRM/UF/Page/ProfileEditor.php
index 8222086..4247cf4 100644
--- a/Users/monish/src/civicrm-core/CRM/UF/Page/ProfileEditor.php
+++ b/CRM/UF/Page/ProfileEditor.php
@@ -191,26 +191,21 @@ class CRM_UF_Page_ProfileEditor extends CRM_Core_Page {
);
break;
+ case 'GrantModel':
+ $civiSchema[$entityType] = self::convertCiviModelToBackboneModel(
+ 'Grant',
+ ts('Grant'),
+ $availableFields
+ );
+ break;
+
default:
- if (strpos($entityType, 'Model') !== FALSE) {
- $entity = str_replace('Model', '', $entityType);
- $backboneModel = self::convertCiviModelToBackboneModel(
- $entity,
- ts('%1', [1 => $entity]),
- $availableFields
- );
- if (!empty($backboneModel['schema'])) {
- $civiSchema[$entityType] = $backboneModel;
- }
- }
- if (!isset($civiSchema[$entityType])) {
- throw new CRM_Core_Exception("Unrecognized entity type: $entityType");
- }
+ throw new CRM_Core_Exception("Unrecognized entity type: $entityType");
}
}
// Adding the oddball "formatting" field here because there's no other place to put it
- foreach (CRM_Contact_BAO_ContactType::basicTypes() as $type) {
+ foreach (['Individual', 'Organization', 'Household'] as $type) {
if (isset($civiSchema[$type . 'Model'])) {
$civiSchema[$type . 'Model']['schema'] += [
'formatting' => [
As per the latest code in core, we no longer need to specify 'GrantModel' and thus it is safe to remove the file.
On the other hand, I cannot remove the core file CRM/UF/Page/Group.php
because the core changes cannot be moved in hook:
diff --git a/Users/monish/src/civicrm-core/CRM/UF/Page/Group.php b/CRM/UF/Page/Group.php
index c3b35bc..870d259 100644
--- a/Users/monish/src/civicrm-core/CRM/UF/Page/Group.php
+++ b/CRM/UF/Page/Group.php
@@ -301,7 +303,7 @@ class CRM_UF_Page_Group extends CRM_Core_Page {
CRM_Utils_Hook::aclGroup(CRM_Core_Permission::ADMIN, NULL, 'civicrm_uf_group', $ufGroups, $allUFGroups);
foreach ($allUFGroups as $id => $value) {
- $ufGroup[$id] = ['class' => ''];
+ $ufGroup[$id] = [];
$ufGroup[$id]['id'] = $id;
$ufGroup[$id]['title'] = $value['title'];
$ufGroup[$id]['frontend_title'] = $value['frontend_title'];
@@ -464,11 +466,16 @@ class CRM_UF_Page_Group extends CRM_Core_Page {
$typeName = 'Case';
$valueLabels = CRM_Case_PseudoConstant::caseType();
break;
+
+ case 'GrantType':
+ $typeName = 'Grant';
+ $valueLabels = CRM_Core_OptionGroup::values('grant_type');
+ break;
}
foreach ($valueParts as $val) {
if (CRM_Utils_Rule::integer($val)) {
- $groupTypeValues[$val] = $valueLabels[$val] ?? NULL;
+ $groupTypeValues[$val] = CRM_Utils_Array::value($val, $valueLabels);
}
}