Skip to content
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

Convert deprecated OptionGroup::getLabel to PseudoConstant::getLabel for cases #13460

Merged
merged 1 commit into from
Jan 25, 2019

Conversation

mattwire
Copy link
Contributor

Overview

Convert a deprecated function for cases

Before

Uses the deprecated CRM_Core_OptionGroup::getLabel function which logs a deprecated warning.

After

Use the replacement CRM_Core_PseudoConstant::getLabel function.

Technical Details

Default context for getLabel is "get" which means we get translated labels and disabled values. So it matches previous behaviour.

Comments

@civibot
Copy link

civibot bot commented Jan 15, 2019

(Standard links)

@civibot civibot bot added the master label Jan 15, 2019
@colemanw
Copy link
Member

@mattwire can you please rebase out the note commit, as #13457 has already been merged.

@mattwire mattwire force-pushed the case_getlabel_pseudoconstant branch 2 times, most recently from 5b721e8 to 6283dd6 Compare January 20, 2019 22:05
@mattwire
Copy link
Contributor Author

@colemanw I think they both work but I agree your suggestions are more consistent with what would be expected. I'll re-test in the next couple of days.

@colemanw colemanw changed the title REF Convert deprecated OptionGroup::getLabel to PseudoConstant::getLabel for cases WIP Convert deprecated OptionGroup::getLabel to PseudoConstant::getLabel for cases Jan 23, 2019
@colemanw
Copy link
Member

Ok @mattwire I'm adding WIP to the title until you're ready.

@mattwire mattwire force-pushed the case_getlabel_pseudoconstant branch from 6283dd6 to cedb74c Compare January 25, 2019 15:33
@@ -726,7 +726,7 @@ public static function getCases($allCases = TRUE, $params = array(), $context =
);
}
}
if (self::checkPermission($actId, 'edit', $case['activity_type_id'], $userID)) {
if (isset($case['activity_type_id']) && self::checkPermission($actId, 'edit', $case['activity_type_id'], $userID)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This resolves a php notice

$this->_encounterMedium = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $this->_activityId, 'medium_id');
if (!array_key_exists($this->_encounterMedium, $encounterMediums)) {
$encounterMediums[$this->_encounterMedium] = CRM_Core_OptionGroup::getLabel('encounter_medium', $this->_encounterMedium, FALSE);
if ($this->_activityId) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And another php notice

$caseTypeIDs = explode(CRM_Core_DAO::VALUE_SEPARATOR,
$dao->case_type_id
);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$caseTypeID and $caseTypeIDs are never used...

@mattwire mattwire changed the title WIP Convert deprecated OptionGroup::getLabel to PseudoConstant::getLabel for cases Convert deprecated OptionGroup::getLabel to PseudoConstant::getLabel for cases Jan 25, 2019
@mattwire
Copy link
Contributor Author

@colemanw you were correct... all now updated and tested.

@colemanw
Copy link
Member

I've just tested it as well. Works great.

@colemanw colemanw merged commit cfdc04c into civicrm:master Jan 25, 2019
@mattwire mattwire deleted the case_getlabel_pseudoconstant branch March 1, 2019 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants