Commit b221eb3e authored by Monish Deb's avatar Monish Deb

add upgrade code to update FT with 'Grant Expense Account is' relationship

parent 6010c961
......@@ -19,6 +19,12 @@ class CRM_Grantprograms_Upgrader extends CRM_Grantprograms_Upgrader_Base {
return TRUE;
}
public function upgrade_5100() {
$this->ctx->log->info('Applying update 5100');
CRM_Grantfinancialsupport_Util::updateFinancialAccountRelationship('civicrm_grant_program');
return TRUE;
}
/**
* Example: Run an external SQL script when the module is installed
*
......
......@@ -31,7 +31,6 @@ function grantprograms_civicrm_install() {
$data = $smarty->fetch($config->extensionsDir . DIRECTORY_SEPARATOR . 'biz.jmaconsulting.grantprograms/sql/civicrm_msg_template.tpl');
file_put_contents($config->uploadDir . "civicrm_data.sql", $data);
CRM_Utils_File::sourceSQLFile(CIVICRM_DSN, $config->uploadDir . "civicrm_data.sql");
grantprograms_addRemoveMenu(TRUE);
return TRUE;
}
......@@ -49,7 +48,6 @@ function grantprograms_civicrm_uninstall() {
function grantprograms_civicrm_enable() {
$config = CRM_Core_Config::singleton();
CRM_Utils_File::sourceSQLFile(CIVICRM_DSN, $config->extensionsDir . 'biz.jmaconsulting.grantprograms/sql/grantprograms_enable.sql');
grantprograms_addRemoveMenu(TRUE);
manageNavigationLinks('enable');
return _grantprograms_civix_civicrm_enable();
}
......@@ -60,7 +58,6 @@ function grantprograms_civicrm_enable() {
function grantprograms_civicrm_disable() {
$config = CRM_Core_Config::singleton();
CRM_Utils_File::sourceSQLFile(CIVICRM_DSN, $config->extensionsDir . 'biz.jmaconsulting.grantprograms/sql/grantprograms_disable.sql');
grantprograms_addRemoveMenu(FALSE);
manageNavigationLinks('disable');
return _grantprograms_civix_civicrm_disable();
}
......@@ -878,24 +875,6 @@ function grantprograms_getCustomFieldData($id) {
return $customFieldData;
}
function grantprograms_addRemoveMenu($enable) {
$config = CRM_Core_Config::singleton();
$params['enableComponents'] = $config->enableComponents;
if ($enable) {
if (array_search('CiviGrant', $config->enableComponents)) {
return NULL;
}
$params['enableComponents'][] = 'CiviGrant';
}
else {
$key = array_search('CiviGrant', $params['enableComponents']);
if ($key) {
unset($params['enableComponents'][$key]);
}
}
CRM_Core_BAO_Setting::setItem($params['enableComponents'], CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,'enable_components');
}
function manageNavigationLinks($action) {
$menus = [
'Grant Programs',
......
......@@ -19,7 +19,7 @@ Grants which have been allocated and approved for payment can be selected and pa
<releaseDate>2018-08-21</releaseDate>
<version>1.0</version>
<compatibility>
<ver>5.0</ver>
<ver>5.10</ver>
</compatibility>
<requires>
<ext>biz.jmaconsulting.grantfinancialsupport</ext>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment