-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2691 from compucorp/PCHR-3545-Change-Order-For-In…
…dividual-Prefix PCHR-3545: Changed Order For Individual Prefix
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader/Steps/1018.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
trait CRM_HRCore_Upgrader_Steps_1018 { | ||
|
||
/** | ||
* Changes the Order Of Individual Prefix | ||
*/ | ||
public function upgrade_1018() { | ||
$this->up1018_changeOrderOfIndividualPrefix(); | ||
|
||
return TRUE; | ||
} | ||
|
||
/** | ||
* Changes The Order of Individual Prefixes | ||
*/ | ||
private function up1018_changeOrderOfIndividualPrefix() { | ||
$optionValues = civicrm_api3('OptionValue', 'get', [ | ||
'option_group_id' => 'individual_prefix', | ||
]); | ||
|
||
$optionValues = $optionValues['values']; | ||
foreach ($optionValues as $optionValueId => $optionValue) { | ||
switch ($optionValue['name']) { | ||
case 'Mr.': | ||
$newWeight = 1; | ||
break; | ||
|
||
case 'Mrs.': | ||
$newWeight = 2; | ||
break; | ||
|
||
case 'Ms.': | ||
$newWeight = 3; | ||
break; | ||
|
||
case 'Miss': | ||
$newWeight = 4; | ||
break; | ||
|
||
case 'Dr.': | ||
$newWeight = 5; | ||
break; | ||
} | ||
civicrm_api3('OptionValue', 'create', [ | ||
'id' => $optionValueId, | ||
'weight' => $newWeight, | ||
]); | ||
} | ||
} | ||
|
||
} |