-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRM-20459: Actively deprecate CRM_Core_OptionGroup::getValue[Sub PR 1] #12049
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,7 +92,7 @@ public static function create(&$params) { | |
$params['is_default'] = CRM_Utils_Array::value('is_default', $params, FALSE); | ||
$params['is_reserved'] = CRM_Utils_Array::value('is_reserved', $params, FALSE); | ||
|
||
$params['label_type_id'] = CRM_Core_OptionGroup::getValue('label_type', 'Event Badge', 'name'); | ||
$params['label_type_id'] = CRM_Core_PseudoConstant::getKey('CRM_Core_DAO_PrintLabel', 'label_type_id', 'Event Badge'); | ||
|
||
// check if new layout is create, if so set the created_id (if not set) | ||
if (empty($params['id'])) { | ||
|
@@ -162,7 +162,8 @@ public static function buildLayout(&$params) { | |
$layoutParams = array('id' => $params['badge_id']); | ||
CRM_Badge_BAO_Layout::retrieve($layoutParams, $layoutInfo); | ||
|
||
$formatProperties = CRM_Core_OptionGroup::getValue('name_badge', $layoutInfo['label_format_name'], 'name'); | ||
$formatProperties = CRM_Core_PseudoConstant::getKey('CRM_Core_DAO_PrintLabel', 'label_format_name', $layoutInfo['label_format_name']); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tested this via the 'Save and Preview' on the badge layout page |
||
|
||
$layoutInfo['format'] = json_decode($formatProperties, TRUE); | ||
$layoutInfo['data'] = CRM_Badge_BAO_Layout::getDecodedData($layoutInfo['data']); | ||
return $layoutInfo; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,7 +94,7 @@ public static function getPetitionSummary($params = array(), $onlyCount = FALSE) | |
|
||
//we only have activity type as a | ||
//difference between survey and petition. | ||
$petitionTypeID = CRM_Core_OptionGroup::getValue('activity_type', 'petition', 'name'); | ||
$petitionTypeID = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Petition'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok this activity type pattern is really common & familiar so I have just checked that the the value is the value in the relevant 'name' field & it is |
||
if ($petitionTypeID) { | ||
$where[] = "( petition.activity_type_id = %1 )"; | ||
$queryParams[1] = array($petitionTypeID, 'Positive'); | ||
|
@@ -160,7 +160,7 @@ public static function getPetitionSummary($params = array(), $onlyCount = FALSE) | |
public static function getPetitionCount() { | ||
$whereClause = 'WHERE ( 1 )'; | ||
$queryParams = array(); | ||
$petitionTypeID = CRM_Core_OptionGroup::getValue('activity_type', 'petition', 'name'); | ||
$petitionTypeID = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Petition'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this one looks the same as above & fine |
||
if ($petitionTypeID) { | ||
$whereClause = "WHERE ( petition.activity_type_id = %1 )"; | ||
$queryParams[1] = array($petitionTypeID, 'Positive'); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -167,7 +167,7 @@ public static function getSurveySummary($params = array(), $onlyCount = FALSE) { | |
|
||
//we only have activity type as a | ||
//difference between survey and petition. | ||
$petitionTypeID = CRM_Core_OptionGroup::getValue('activity_type', 'petition', 'name'); | ||
$petitionTypeID = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Petition'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
if ($petitionTypeID) { | ||
$where[] = "( survey.activity_type_id != %1 )"; | ||
$queryParams[1] = array($petitionTypeID, 'Positive'); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -434,7 +434,7 @@ public function postProcess() { | |
'street_unit', | ||
'survey_response', | ||
); | ||
if (CRM_Core_OptionGroup::getValue('activity_type', 'WalkList') == | ||
if (CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'WalkList') == | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok - although it would make more sense to be if (CRM_Core_PseudoConstant::getName.... ==== ) |
||
$this->_values['activity_type_id'] | ||
) { | ||
$this->_params['order_bys'] = array( | ||
|
@@ -456,14 +456,14 @@ public function postProcess() { | |
), | ||
); | ||
} | ||
elseif (CRM_Core_OptionGroup::getValue('activity_type', 'PhoneBank') == | ||
elseif (CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'PhoneBank') == | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
$this->_values['activity_type_id'] | ||
) { | ||
array_push($displayFields, 'phone'); | ||
} | ||
elseif ((CRM_Core_OptionGroup::getValue('activity_type', 'Survey') == | ||
elseif ((CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Survey') == | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
$this->_values['activity_type_id']) || | ||
(CRM_Core_OptionGroup::getValue('activity_type', 'Canvass') == | ||
(CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Canvass') == | ||
$this->_values['activity_type_id']) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
) { | ||
array_push($displayFields, 'phone', 'city', 'state_province_id', 'postal_code', 'email'); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1127,10 +1127,10 @@ public static function getCaseActivity($caseID, &$params, $contactID, $context = | |
} | ||
|
||
if (!empty($dao->priority)) { | ||
if ($dao->priority == CRM_Core_OptionGroup::getValue('priority', 'Urgent', 'name')) { | ||
if ($dao->priority == CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'priority_id', 'Urgent')) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
$caseActivity['DT_RowClass'] .= " priority-urgent "; | ||
} | ||
elseif ($dao->priority == CRM_Core_OptionGroup::getValue('priority', 'Low', 'name')) { | ||
elseif ($dao->priority == CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'priority_id', 'Low')) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok tested |
||
$caseActivity['DT_RowClass'] .= " priority-low "; | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -155,7 +155,7 @@ public static function endPostProcess(&$form, &$params, $activity) { | |
|
||
$params['status_id'] = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_status_id', 'Completed'); | ||
$activity->status_id = $params['status_id']; | ||
$params['priority_id'] = CRM_Core_OptionGroup::getValue('priority', 'Normal', 'name'); | ||
$params['priority_id'] = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'priority_id', 'Normal'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK - Checked against checked pattern & checked option value |
||
$activity->priority_id = $params['priority_id']; | ||
|
||
// 1. save activity subject with new start date | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -205,7 +205,7 @@ public static function endPostProcess(&$form, &$params, $activity) { | |
} | ||
$params['status_id'] = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_status_id', 'Completed'); | ||
$activity->status_id = $params['status_id']; | ||
$params['priority_id'] = CRM_Core_OptionGroup::getValue('priority', 'Normal', 'name'); | ||
$params['priority_id'] = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'priority_id', 'Normal'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK - Checked against checked pattern & checked option value |
||
$activity->priority_id = $params['priority_id']; | ||
|
||
foreach ($form->_oldCaseStatus as $statuskey => $statusval) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,7 +160,7 @@ public static function endPostProcess(&$form, &$params, $activity) { | |
|
||
$params['status_id'] = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_status_id', 'Completed'); | ||
$activity->status_id = $params['status_id']; | ||
$params['priority_id'] = CRM_Core_OptionGroup::getValue('priority', 'Normal', 'name'); | ||
$params['priority_id'] = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'priority_id', 'Normal'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK - Checked against checked pattern & checked option value |
||
$activity->priority_id = $params['priority_id']; | ||
|
||
if ($activity->subject == 'null') { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,7 +85,7 @@ public static function processSoftContribution($params, $contribution) { | |
$softParams['pcp_display_in_roll'] = CRM_Utils_Array::value('pcp_display_in_roll', $pcp); | ||
$softParams['pcp_roll_nickname'] = CRM_Utils_Array::value('pcp_roll_nickname', $pcp); | ||
$softParams['pcp_personal_note'] = CRM_Utils_Array::value('pcp_personal_note', $pcp); | ||
$softParams['soft_credit_type_id'] = CRM_Core_OptionGroup::getValue('soft_credit_type', 'pcp', 'name'); | ||
$softParams['soft_credit_type_id'] = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_ContributionSoft', 'soft_credit_type_id', 'pcp'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK - checked this in the course of doing a reviewer's commit on #12044 |
||
$contributionSoft = self::add($softParams); | ||
//Send notification to owner for PCP | ||
if ($contributionSoft->pcp_id && empty($pcpId)) { | ||
|
@@ -149,7 +149,7 @@ public static function formatSoftCreditParams(&$params, &$form) { | |
$honorId = NULL; | ||
|
||
// @todo fix use of deprecated function. | ||
$contributionSoftParams['soft_credit_type_id'] = CRM_Core_OptionGroup::getValue('soft_credit_type', 'pcp', 'name'); | ||
$contributionSoftParams['soft_credit_type_id'] = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_ContributionSoft', 'soft_credit_type_id', 'pcp'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK - based on this being identical to checked change above |
||
//check if there is any duplicate contact | ||
// honoree should never be the donor | ||
$exceptKeys = array( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot be changed to
CRM_Core_DAO_PrintLabel
as the class don't existThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK - I have tested this line through the civicrm/admin/badgelayout?action=add&reset=1 screen