diff --git a/grantprograms.php b/grantprograms.php index d8a6a730b2f7131e8db043e0e9c7c83afd67f495..88bb249338350fc098c9d4f639036e94f78c3134 100644 --- a/grantprograms.php +++ b/grantprograms.php @@ -48,6 +48,8 @@ function grantprograms_civicrm_uninstall() { * Implementation of hook_civicrm_enable */ 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); return _grantprograms_civix_civicrm_enable(); } @@ -56,6 +58,8 @@ function grantprograms_civicrm_enable() { * Implementation of hook_civicrm_disable */ 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); return _grantprograms_civix_civicrm_disable(); } @@ -699,16 +703,16 @@ function grantprograms_civicrm_post($op, $objectName, $objectId, &$objectRef) { $customGroup[$customGroupName] = $customGroupName; $count = 0; foreach ($dataValue as $dataValueKey => $dataValueValue) { - $customField[$customGroupName][$count]['label'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $dataValueKey, 'label'); + $customField[$customGroupName]['custom_'.$dataValueKey]['label'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $dataValueKey, 'label'); $customFieldData = grantprograms_getCustomFieldData($dataValueKey); if (CRM_Utils_Array::value('html_type', $customFieldData) == 'Select') { - $customField[$customGroupName][$count]['value'] = grantprograms_getOptionValueLabel($customFieldData['option_group_id'],$dataValueValue); + $customField[$customGroupName]['custom_'.$dataValueKey]['value'] = grantprograms_getOptionValueLabel($customFieldData['option_group_id'],$dataValueValue); } elseif (CRM_Utils_Array::value('html_type', $customFieldData) == 'Select Date') { - $customField[$customGroupName][$count]['value'] = date('Y-m-d', strtotime($dataValueValue)); + $customField[$customGroupName]['custom_'.$dataValueKey]['value'] = date('Y-m-d', strtotime($dataValueValue)); } else { - $customField[$customGroupName][$count]['value'] = $dataValueValue; + $customField[$customGroupName]['custom_'.$dataValueKey]['value'] = $dataValueValue; } $count++; } @@ -716,7 +720,6 @@ function grantprograms_civicrm_post($op, $objectName, $objectId, &$objectRef) { $page->assign('customGroup', $customGroup); $page->assign('customField', $customField); } - // EOF FIXME $grantStatus = CRM_Core_OptionGroup::values('grant_status'); $grantPrograms = CRM_Grant_BAO_GrantProgram::getGrantPrograms(); diff --git a/sql/grantprograms_custom_data_install.sql b/sql/grantprograms_custom_data_install.sql index ad444a5cb70bb860b53c362c67ab5962cfa84e15..1155b6b2d3feb13ec72bb0d9612b76bd09bab817 100644 --- a/sql/grantprograms_custom_data_install.sql +++ b/sql/grantprograms_custom_data_install.sql @@ -1,3 +1,31 @@ +/** + * Grant Programs extension improves grant allocation + * in CiviGrant + * + * Copyright (C) 2012 JMA Consulting + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * Support: https://github.com/JMAConsulting/biz.jmaconsulting.grantprograms/issues + * + * Contact: info@jmaconsulting.biz + * JMA Consulting + * 215 Spadina Ave, Ste 400 + * Toronto, ON + * Canada M5T 2C7 + */ + -- Create custom groups SELECT @EInfoGId := id FROM civicrm_custom_group WHERE name = 'NEI_Employment_Information'; SELECT @GInfoGId := id FROM civicrm_custom_group WHERE name = 'NEI_General_information'; diff --git a/sql/grantprograms_disable.sql b/sql/grantprograms_disable.sql new file mode 100644 index 0000000000000000000000000000000000000000..d2f0d3e29e2303835352bdcbc10b3deac03b70f9 --- /dev/null +++ b/sql/grantprograms_disable.sql @@ -0,0 +1,42 @@ +/** + * Grant Programs extension improves grant allocation + * in CiviGrant + * + * Copyright (C) 2012 JMA Consulting + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * Support: https://github.com/JMAConsulting/biz.jmaconsulting.grantprograms/issues + * + * Contact: info@jmaconsulting.biz + * JMA Consulting + * 215 Spadina Ave, Ste 400 + * Toronto, ON + * Canada M5T 2C7 + */ + +UPDATE civicrm_option_group SET is_active = 0 WHERE name IN ('grant_payment_status','grant_program_status', 'allocation_algorithm', 'grant_thresholds', 'reason_grant_ineligible', 'reason_grant_incomplete', 'grant_info_too_late', 'msg_tpl_workflow_grant', 'predominant_clinical_area_of_pra_nei', 'nei_employment_status_nei', 'if_you_are_not_employed_indicate_nei', 'province_of_employment_nei', 'position_nei', 'employment_setting_nei', 'how_did_you_hear_about_this_init_nei', 'course_conference_type_nei', 'how_will_this_course_enhance_the_nei', 'type_of_course_provider_nei'); + +UPDATE civicrm_option_value SET is_active = 0 WHERE option_group_id IN (SELECT id FROM civicrm_option_group WHERE name IN ('grant_payment_status','grant_program_status', 'allocation_algorithm', 'grant_thresholds', 'reason_grant_ineligible', 'reason_grant_incomplete', 'grant_info_too_late', 'msg_tpl_workflow_grant', 'predominant_clinical_area_of_pra_nei', 'nei_employment_status_nei', 'if_you_are_not_employed_indicate_nei', 'province_of_employment_nei', 'position_nei', 'employment_setting_nei', 'how_did_you_hear_about_this_init_nei', 'course_conference_type_nei', 'how_will_this_course_enhance_the_nei', 'type_of_course_provider_nei')); + + +UPDATE civicrm_custom_group SET is_active = 0 WHERE name IN ('NEI_Employment_Information','NEI_General_information', 'NEI_Course_conference_details', 'NEI_ID'); + +UPDATE civicrm_custom_field SET is_active = 0 WHERE custom_group_id IN (SELECT id FROM civicrm_custom_group WHERE name IN ('NEI_General_information', 'NEI_Course_conference_details', 'NEI_ID', 'NEI_Employment_Information')); + +SELECT @gtype := id FROM civicrm_option_group WHERE name = 'grant_type'; +UPDATE civicrm_option_value SET is_active = 0 WHERE name = 'NEI Grant' AND option_group_id = @gtype; + +UPDATE civicrm_financial_account SET is_active = 0 WHERE name = 'NEI Grant'; +UPDATE civicrm_financial_type SET is_active = 0 WHERE name = 'NEI Grant'; diff --git a/sql/grantprograms_enable.sql b/sql/grantprograms_enable.sql new file mode 100644 index 0000000000000000000000000000000000000000..8ddfb960bb9d6828ec5e7e9322630c4aeb9880fb --- /dev/null +++ b/sql/grantprograms_enable.sql @@ -0,0 +1,43 @@ +/** + * Grant Programs extension improves grant allocation + * in CiviGrant + * + * Copyright (C) 2012 JMA Consulting + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * Support: https://github.com/JMAConsulting/biz.jmaconsulting.grantprograms/issues + * + * Contact: info@jmaconsulting.biz + * JMA Consulting + * 215 Spadina Ave, Ste 400 + * Toronto, ON + * Canada M5T 2C7 + */ + +UPDATE civicrm_option_group SET is_active = 1 WHERE name IN ('grant_payment_status','grant_program_status', 'allocation_algorithm', 'grant_thresholds', 'reason_grant_ineligible', 'reason_grant_incomplete', 'grant_info_too_late', 'msg_tpl_workflow_grant', 'predominant_clinical_area_of_pra_nei', 'nei_employment_status_nei', 'if_you_are_not_employed_indicate_nei', 'province_of_employment_nei', 'position_nei', 'employment_setting_nei', 'how_did_you_hear_about_this_init_nei', 'course_conference_type_nei', 'how_will_this_course_enhance_the_nei', 'type_of_course_provider_nei'); + +UPDATE civicrm_option_value SET is_active = 1 WHERE option_group_id IN (SELECT id FROM civicrm_option_group WHERE name IN ('grant_payment_status','grant_program_status', 'allocation_algorithm', 'grant_thresholds', 'reason_grant_ineligible', 'reason_grant_incomplete', 'grant_info_too_late', 'msg_tpl_workflow_grant', 'predominant_clinical_area_of_pra_nei', 'nei_employment_status_nei', 'if_you_are_not_employed_indicate_nei', 'province_of_employment_nei', 'position_nei', 'employment_setting_nei', 'how_did_you_hear_about_this_init_nei', 'course_conference_type_nei', 'how_will_this_course_enhance_the_nei', 'type_of_course_provider_nei')); + + +UPDATE civicrm_custom_group SET is_active = 1 WHERE name IN ('NEI_Employment_Information','NEI_General_information', 'NEI_Course_conference_details', 'NEI_ID'); + +UPDATE civicrm_custom_field SET is_active = 1 WHERE custom_group_id IN (SELECT id FROM civicrm_custom_group WHERE name IN ('NEI_General_information', 'NEI_Course_conference_details', 'NEI_ID', 'NEI_Employment_Information')); + +SELECT @gtype := id FROM civicrm_option_group WHERE name = 'grant_type'; +UPDATE civicrm_option_value SET is_active = 1 WHERE name = 'NEI Grant' AND option_group_id = @gtype; + +UPDATE civicrm_financial_account SET is_active = 1 WHERE name = 'NEI Grant'; +UPDATE civicrm_financial_type SET is_active = 1 WHERE name = 'NEI Grant'; +