Skip to content

Commit

Permalink
PCHR-3546: Made all currencies available for new installations
Browse files Browse the repository at this point in the history
  • Loading branch information
backstageel committed Jun 20, 2018
1 parent b054784 commit 58f5af7
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions uk.co.compucorp.civicrm.hrcore/CRM/HRCore/Upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public function install() {
$this->deleteLocationTypes();
$this->deleteUnneededCustomGroups();
$this->createDefaultRelationshipTypes();
$this->makeAllCurrenciesAvailable();
$this->runAllUpgraders();
}

Expand Down Expand Up @@ -188,6 +189,28 @@ private function createDefaultRelationshipTypes() {
}
}

private function makeAllCurrenciesAvailable() {

$dao = CRM_Core_DAO::executeQuery('SELECT * from civicrm_currency');
while ($dao->fetch()) {
$currencyExists = civicrm_api3('OptionValue', 'get', [
'value' => $dao->name,
]);
if (empty($currencyExists['values'])) {
civicrm_api3('OptionValue', 'create', [
'option_group_id' => 'currencies_enabled',
'label' => $dao->name . ' (' . $dao->symbol . ')',
'value' => $dao->name,
'name' => $dao->name,
'is_active' => 1,
'is_reserved' => 0,
'is_optgroup' => 0,
'is_default' => 0,
]);
}
}
}

/**
* Removes default relationship types
*/
Expand Down

0 comments on commit 58f5af7

Please sign in to comment.