Commit a84f70cf authored by Monish Deb's avatar Monish Deb

AGBU-15: Remove NEI occurence

parent 7c8232a0
......@@ -357,7 +357,7 @@ class CRM_Grant_DAO_GrantProgram extends CRM_Core_DAO
'grant_program_id' => array(
'name' => 'grant_program_id',
'type' => CRM_Utils_Type::T_INT,
'title' => ts("Previous Year's NEI Grant Program") ,
'title' => ts("Previous Year's Grant Program") ,
'required' => true,
'import' => true,
'where' => 'civicrm_grant_program.grant_program_id',
......
......@@ -36,7 +36,7 @@
/**
* This class generates form components for Par Service Fees
*
*
*/
class CRM_Grant_Form_GrantProgram extends CRM_Core_Form {
protected $_id = NULL;
......@@ -47,12 +47,12 @@ class CRM_Grant_Form_GrantProgram extends CRM_Core_Form {
function preProcess() {
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this);
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$title = NULL;
if ($this->_action & CRM_Core_Action::UPDATE) $title = ts('Edit Grant Program');
if ($this->_action & CRM_Core_Action::DELETE) $title = ts('Delete Grant Program');
if ($title) CRM_Utils_System::setTitle($title);
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/grant_program', 'reset=1'));
$this->assign('action', $this->_action);
......@@ -60,7 +60,7 @@ class CRM_Grant_Form_GrantProgram extends CRM_Core_Form {
$this->_values = $this->get('values');
if (!is_array($this->_values)) {
$this->_values = array( );
// if we are editing
if (isset($this->_id) && $this->_id) {
$params = array('id' => $this->_id);
......@@ -70,7 +70,7 @@ class CRM_Grant_Form_GrantProgram extends CRM_Core_Form {
$this->set('values', $this->_values);
}
}
function setDefaultValues() {
$defaults = $this->_values;
if (!empty( $defaults)) {
......@@ -104,11 +104,11 @@ class CRM_Grant_Form_GrantProgram extends CRM_Core_Form {
*/
public function buildQuickForm($check = FALSE) {
parent::buildQuickForm();
if ($this->_action & CRM_Core_Action::DELETE) {
$this->addButtons(array(
array (
array (
'type' => 'next',
'name'=> ts('Delete'),
'isDefault' => TRUE),
......@@ -122,18 +122,18 @@ class CRM_Grant_Form_GrantProgram extends CRM_Core_Form {
$this->applyFilter('__ALL__','trim');
$attributes = CRM_Core_DAO::getAttribute('CRM_Grant_DAO_GrantProgram');
$grantPrograms = CRM_Grant_BAO_GrantProgram::grantPrograms();
$this->add('text', 'label', ts('Label'),
$attributes['label'], TRUE);
$grantType = CRM_Core_OptionGroup::values('grant_type');
$this->add('select', 'grant_type_id', ts('Grant Type'),
array('' => ts('- select -' )) + $grantType , TRUE);
$this->add('text', 'total_amount', ts('Total Amount'),
$attributes['total_amount'], FALSE);
$this->addRule('total_amount', ts('Please enter a valid amount.'), 'money');
$attributes['total_amount'], FALSE);
$this->addRule('total_amount', ts('Please enter a valid amount.'), 'money');
$this->add('text', 'remainder_amount', ts('Remainder Amount'),
$attributes['remainder_amount'], FALSE);
$this->addRule('remainder_amount', ts('Please enter a valid amount.'), 'money');
......@@ -146,34 +146,34 @@ class CRM_Grant_Form_GrantProgram extends CRM_Core_Form {
$contributionTypes = CRM_Grant_BAO_GrantProgram::contributionTypes();
$this->add('select', 'financial_type_id', ts('Financial Types'),
array('' => ts('- select -')) + $contributionTypes, TRUE);
$grantStatus = CRM_Core_OptionGroup::values('grant_program_status');
$this->add('select', 'status_id', ts('Grant Status'),
array('' => ts('- select -')) + $grantStatus, TRUE);
$grantAlgorithm = CRM_Core_OptionGroup::values('allocation_algorithm');
$this->add('select', 'allocation_algorithm', ts('Allocation Algorithm'),
array('' => ts('- select -')) + $grantAlgorithm , TRUE);
$this->add('select', 'grant_program_id', ts("Previous Year's NEI Grant Program"),
array('' => ts('- select -')) + $grantAlgorithm , TRUE);
$this->add('select', 'grant_program_id', ts("Previous Year's Grant Program"),
array('' => ts('- select -')) + $grantPrograms, FALSE);
$this->addDate('allocation_date', ts('Allocation Date'), FALSE, array('formatType' => 'custom'));
$this->add('checkbox', 'is_active', ts('Enabled?'));
$this->add('checkbox', 'is_auto_email', ts('Auto email?'));
$this->addButtons(array(
array (
$this->addButtons(array(
array (
'type' => 'upload',
'name' => ts('Save'),
'name' => ts('Save'),
'isDefault' => TRUE),
array (
'type' => 'cancel',
'name' => ts('Cancel')),
)
);
array (
'type' => 'cancel',
'name' => ts('Cancel')),
)
);
}
/**
......@@ -201,7 +201,7 @@ class CRM_Grant_Form_GrantProgram extends CRM_Core_Form {
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/grant_program', 'reset=1&action=browse&id=' . $result->id));
}
}
function updateGrantProgram(&$values, $domainID) {
......@@ -248,5 +248,3 @@ class CRM_Grant_Form_GrantProgram extends CRM_Core_Form {
return true;
}
}
/**
* Grant Programs extension improves grant allocation
* in CiviGrant
*
* 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
* 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_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'):
UPDATE civicrm_financial_account SET is_active = 0 WHERE name = 'NEI Grant';
UPDATE civicrm_financial_type SET is_active = 0 WHERE name = 'NEI Grant';
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'));
-- RG-212
UPDATE civicrm_option_group cog INNER JOIN civicrm_option_value cov ON cov.option_group_id = cog.id
......
/**
* Grant Programs extension improves grant allocation
* in CiviGrant
*
* 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
* 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_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');
UPDATE civicrm_financial_account SET is_active = 1 WHERE name = 'NEI Grant';
UPDATE civicrm_financial_type SET is_active = 1 WHERE name = 'NEI Grant';
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')
);
-- RG-212
UPDATE civicrm_option_group cog INNER JOIN civicrm_option_value cov ON cov.option_group_id = cog.id
UPDATE civicrm_option_group cog INNER JOIN civicrm_option_value cov ON cov.option_group_id = cog.id
SET cov.is_active = 1
WHERE cog.name = 'activity_type' AND cov.name IN ('grant_status_change', 'grant_payment');
\ No newline at end of file
WHERE cog.name = 'activity_type' AND cov.name IN ('grant_status_change', 'grant_payment');
/**
* Grant Programs extension improves grant allocation
* in CiviGrant
*
* 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
* Toronto, ON
* Canada M5T 2C7
*/
-- create civicrm_payment table.
-- create civicrm_payment table.
CREATE TABLE IF NOT EXISTS `civicrm_payment` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Id',
`payment_batch_number` int(10) unsigned NOT NULL COMMENT 'Payment Batch Nnumber',
......@@ -114,7 +114,7 @@ SELECT @opv3 := id FROM civicrm_option_value WHERE name = 'Stopped' AND option_
SELECT @opv4 := id FROM civicrm_option_value WHERE name = 'Withdrawn' AND option_group_id = @opGId;
SELECT @opv5 := id FROM civicrm_option_value WHERE name = 'Cancelled' AND option_group_id = @opGId;
INSERT IGNORE INTO `civicrm_option_value` (`id`, `option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `domain_id`, `visibility_id`)
INSERT IGNORE INTO `civicrm_option_value` (`id`, `option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `domain_id`, `visibility_id`)
VALUES
(@opv1, @opGId, 'Printed', '1', 'Printed', NULL, 0, 0, 1, 'Payment that has had cheque or other payment created via PDF or csv download. The default status.', 0, 1, 1, NULL, 1, NULL),
(@opv3, @opGId, 'Stopped', '2', 'Stopped', NULL, 0, 0, 2, 'The bank has been told to put a Stop Payment on the cheque or payment. Usually caused by a lost cheque that is being replaced by a newly printed one.', 0, 1, 1, NULL, 1, NULL),
......@@ -137,7 +137,7 @@ SELECT @opv1 := id FROM civicrm_option_value WHERE name = 'Accepting Applicatio
SELECT @opv2 := id FROM civicrm_option_value WHERE name = 'Trial Allocation' AND option_group_id = @opGId;
SELECT @opv3 := id FROM civicrm_option_value WHERE name = 'Allocation Finalized' AND option_group_id = @opGId;
INSERT IGNORE INTO `civicrm_option_value` (`id`, `option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `domain_id`, `visibility_id`)
INSERT IGNORE INTO `civicrm_option_value` (`id`, `option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `domain_id`, `visibility_id`)
VALUES
(@opv1, @opGId, 'Accepting Applications', '1', 'Accepting Applications', NULL, 0, 0, 1, NULL, 0, 0, 1, NULL, NULL, NULL),
(@opv2, @opGId, 'Trial Allocation', '2', 'Trial Allocation', NULL, 0, 0, 2, NULL, 0, 0, 1, NULL, NULL, NULL),
......@@ -156,7 +156,7 @@ SET @opv2 := '';
SELECT @opv1 := id FROM civicrm_option_value WHERE name = 'Best To Worst, Fully Funded' AND option_group_id = @opGId;
SELECT @opv2 := id FROM civicrm_option_value WHERE name = 'Over Threshold, Percentage Of Request Funded' AND option_group_id = @opGId;
INSERT IGNORE INTO `civicrm_option_value` (`id`, `option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `domain_id`, `visibility_id`)
INSERT IGNORE INTO `civicrm_option_value` (`id`, `option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `domain_id`, `visibility_id`)
VALUES
(@opv2, @opGId, 'Over Threshold, Percentage Of Request Funded', '1', 'Over Threshold, Percentage Of Request Funded', 'immediate', 0, 1, 1, NULL, 0, 0, 1, NULL, 1, NULL),
(@opv1, @opGId, 'Best To Worst, Fully Funded', '2', 'Best To Worst, Fully Funded', 'batch', 0, 0, 1, NULL, 0, 0, 1, NULL, 1, NULL);
......@@ -169,7 +169,7 @@ INSERT IGNORE INTO `civicrm_option_group` (`id`, `name`, `title`, `description`,
SELECT @opGId := id FROM civicrm_option_group WHERE name = 'grant_thresholds';
-- option values
SET @opv1 := '';
SET @opv1 := '';
SET @opv2 := '';
SET @opv3 := '';
SET @opv4 := '';
......@@ -179,7 +179,7 @@ SELECT @opv3 := id FROM civicrm_option_value WHERE name = 'Maximum Grant' AND o
SELECT @opv4 := id FROM civicrm_option_value WHERE name = 'Minimum Score For Grant Award' AND option_group_id = @opGId;
SELECT @opv5 := id FROM civicrm_option_value WHERE name = 'Maximum number of checks per pdf file' AND option_group_id = @opGId;
INSERT IGNORE INTO `civicrm_option_value` (`id`, `option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `domain_id`, `visibility_id`)
INSERT IGNORE INTO `civicrm_option_value` (`id`, `option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `domain_id`, `visibility_id`)
VALUES
(@opv1, @opGId, 'Funding factor', '85', NULL, NULL, 0, 0, 4, NULL, 0, 0, 1, NULL, NULL, NULL),
(@opv2, @opGId, 'Fixed Percentage Of Grant', '80', 'Fixed Percentage Of Grant', NULL, 0, 0, 3, NULL, 0, 1, 1, NULL, NULL, NULL),
......@@ -217,15 +217,14 @@ SELECT @opv10 := id FROM civicrm_option_value WHERE name = 'Submitted' AND opti
SELECT @gtype := id FROM civicrm_option_group WHERE name = 'grant_type';
INSERT IGNORE INTO `civicrm_option_value` (`id`, `option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `domain_id`, `visibility_id`)
INSERT IGNORE INTO `civicrm_option_value` (`id`, `option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `domain_id`, `visibility_id`)
VALUES
(@opv7, @opGId, 'Approved for Payment', '7', 'Approved for Payment', NULL, 0, 0, 4, NULL, 0, 1, 1, NULL, NULL, NULL),
(@opv3, @opGId, 'Awaiting Information', 5, 'Awaiting Information', NULL, 0, 0, 2, NULL, 0, 1, 1, NULL, NULL, NULL),
(@opv8, @opGId, 'Ineligible', 3, 'Ineligible', NULL, 0, 0, 4, NULL, 0, 1, 1, NULL, NULL, NULL),
(@opv5, @opGId, 'Paid', 4, 'Paid', NULL, 0, 0, 5, NULL, 0, 1, 1, NULL, NULL, NULL),
(@opv10, @opGId, 'Submitted', 1, 'Submitted', NULL, 0, 0, 1, NULL, 0, 1, 1, NULL, NULL, NULL),
(@opv4, @opGId, 'Withdrawn', 6, 'Withdrawn', NULL, 0, 0, 7, NULL, 0, 1, 1, NULL, NULL, NULL),
('', @gtype, 'NEI Grant', 6, 'NEI Grant', NULL, 0, 0, 7, NULL, 0, 1, 1, NULL, 1, NULL);
(@opv4, @opGId, 'Withdrawn', 6, 'Withdrawn', NULL, 0, 0, 7, NULL, 0, 1, 1, NULL, NULL, NULL);
-- reason_grant_ineligible
SET @opGId := '';
......@@ -235,7 +234,7 @@ INSERT IGNORE INTO `civicrm_option_group` (`id`, `name`, `title`, `description`,
SELECT @opGId := id FROM civicrm_option_group WHERE name = 'reason_grant_ineligible';
-- option values
SET @opv1 := '';
SET @opv1 := '';
SET @opv2 := '';
SET @opv3 := '';
SET @opv4 := '';
......@@ -246,7 +245,7 @@ SELECT @opv3 := id FROM civicrm_option_value WHERE name = 'Information not rece
SELECT @opv4 := id FROM civicrm_option_value WHERE name = 'Insufficient funds in program' AND option_group_id = @opGId;
SELECT @opv5 := id FROM civicrm_option_value WHERE name = 'Applicant has received their annual maximum already' AND option_group_id = @opGId;
INSERT IGNORE INTO `civicrm_option_value` (`id`, `option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `domain_id`, `visibility_id`)
INSERT IGNORE INTO `civicrm_option_value` (`id`, `option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `domain_id`, `visibility_id`)
VALUES
(@opv1, @opGId, 'Outside dates', '1', 'Outside dates', NULL, 0, 1, 1, NULL, 0, 0, 1, NULL, 1, NULL),
(@opv2, @opGId, 'Ineligible', '2', 'Ineligible', NULL, 0, 2, 1, NULL, 0, 0, 1, NULL, 1, NULL),
......@@ -262,7 +261,7 @@ INSERT IGNORE INTO `civicrm_option_group` (`id`, `name`, `title`, `description`,
SELECT @opGId := id FROM civicrm_option_group WHERE name = 'reason_grant_incomplete';
-- option values
SET @opv1 := '';
SET @opv1 := '';
SET @opv2 := '';
SET @opv3 := '';
SET @opv4 := '';
......@@ -271,7 +270,7 @@ SELECT @opv2 := id FROM civicrm_option_value WHERE name = 'Inadequate Receipts'
SELECT @opv3 := id FROM civicrm_option_value WHERE name = 'No Proof of completion' AND option_group_id = @opGId;
SELECT @opv4 := id FROM civicrm_option_value WHERE name = 'Inadaquate Proof of completion' AND option_group_id = @opGId;
INSERT IGNORE INTO `civicrm_option_value` (`id`, `option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `domain_id`, `visibility_id`)
INSERT IGNORE INTO `civicrm_option_value` (`id`, `option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `domain_id`, `visibility_id`)
VALUES
(@opv1, @opGId, 'No Receipts', '1', 'No Receipts', NULL, 0, 0, 1, NULL, 0, 0, 1, NULL, NULL, NULL),
(@opv2, @opGId, 'Inadequate Receipts', '2', 'Inadequate Receipts', NULL, 0, 0, 2, NULL, 0, 0, 1, NULL, NULL, NULL),
......@@ -282,7 +281,7 @@ INSERT IGNORE INTO `civicrm_option_value` (`id`, `option_group_id`, `label`, `va
SELECT @parentId1 := id FROM civicrm_navigation WHERE name = 'CiviGrant';
SELECT @parentId2 := id FROM civicrm_navigation WHERE name = 'Grants';
SELECT @weight := MAX(weight) FROM civicrm_navigation WHERE parent_id = @parentId2;
SELECT @weight := MAX(weight) FROM civicrm_navigation WHERE parent_id = @parentId2;
INSERT INTO `civicrm_navigation` (`domain_id`, `label`, `name`, `url`, `permission`, `permission_operator`, `parent_id`, `is_active`, `has_separator`, `weight`) VALUES
(1, 'Find Grant Payments', 'Find Grant Payments', 'civicrm/grant/payment/search?reset=1', 'access CiviGrant', 'AND', @parentId2, 1, 1, @weight = @weight + 1),
(1, 'New Grant Program', 'New Grant Program', 'civicrm/grant_program?action=add&reset=1', 'access CiviCRM,access CiviGrant,edit grants', 'AND', @parentId2, 1, 0, @weight = @weight + 1),
......@@ -294,7 +293,7 @@ SELECT @contactId := contact_id FROM civicrm_domain WHERE id = 1;
SELECT @option_group_id_arel := max(id) from civicrm_option_group where name = 'account_relationship';
SELECT @weight := max(weight) from civicrm_option_value where option_group_id = @option_group_id_arel;
SELECT @weight := max(weight) from civicrm_option_value where option_group_id = @option_group_id_arel;
SET @weight := @weight + 1;
......@@ -306,26 +305,6 @@ INSERT INTO
VALUES
(@option_group_id_arel, 'Accounts Payable Account is', @weight, 'Accounts Payable Account is', NULL, 0, 0, @weight, 'Accounts Payable Account is', 0, 1, 1, 2, NULL);
SELECT @financialAccount := id FROM civicrm_financial_account WHERE name = 'NEI Grant';
SELECT @depositAccount := id FROM civicrm_financial_account WHERE name = 'Deposit Bank Account';
SELECT @accountPayable := id FROM civicrm_financial_account WHERE name = 'Accounts Payable';
INSERT IGNORE INTO civicrm_financial_account (id, name, contact_id, is_header_account, financial_account_type_id, accounting_code, account_type_code, is_active)
VAlUES (@financialAccount, 'NEI Grant', @contactId, 0, 5, 5555, 'EXP', 1);
SET @financialAccountID := LAST_INSERT_ID();
INSERT INTO civicrm_financial_type (name, is_deductible, is_reserved, is_active)
VALUES ('NEI Grant', 0, 0, 1);
SET @financialTypeID := LAST_INSERT_ID();
INSERT INTO civicrm_entity_financial_account (entity_table, entity_id, account_relationship, financial_account_id)
-- Expense account
VALUES('civicrm_financial_type', @financialTypeID, @option_value_rel_id_exp, IFNULL(@financialAccount, @financialAccountID)),
-- Asset Account of
('civicrm_financial_type', @financialTypeID, @option_value_rel_id_as, @depositAccount),
-- Account Payable
('civicrm_financial_type', @financialTypeID, @weight, @accountPayable);
-- RG-149
INSERT INTO `civicrm_option_group` (`name`, `title`, `description`, `is_reserved`, `is_active`) VALUES
('grant_info_too_late', 'Grant Info Too Late', 'Grant becomes ineligible due to information being provided too late if the information is still being waited for when the course end date is more than this number of days in the past.', 1, 1);
......@@ -340,11 +319,10 @@ VALUES
-- RG-212
SELECT @activityType := cog.id, @value := max(cast(value as unsigned)) + 1 FROM civicrm_option_group cog INNER JOIN civicrm_option_value cov ON cov.option_group_id = cog.id WHERE cog.name = 'activity_type';
INSERT INTO civicrm_option_value(option_group_id, label, value, name, grouping, filter, is_default, weight, description, is_optgroup, is_reserved, is_active, component_id, visibility_id)
INSERT INTO civicrm_option_value(option_group_id, label, value, name, grouping, filter, is_default, weight, description, is_optgroup, is_reserved, is_active, component_id, visibility_id)
VALUES (@activityType, 'Grant Status Change', @value, 'grant_status_change', NULL, 0, 0, @value, 'Grant status change', 0, 1, 1, 5, NULL),
(@activityType, 'Grant Payment', @value + 1, 'grant_payment', NULL, 0, 0, @value + 1, 'Grant payment', 0, 1, 1, 5, NULL);
-- Enter a default grant program
SET @opGId := '';
SET @statusId := '';
......@@ -360,7 +338,7 @@ INSERT INTO `civicrm_grant_program` (`label`, `name`, `grant_type_id`, `total_am
('Default Grant Program', 'Default Grant Program', 1, 1000000.00, 1000000.00, 1, @statusId, NULL, NULL, NULL, 1, 1, @algId, 0);
-- add columns to civicrm_grant
ALTER TABLE `civicrm_grant`
ALTER TABLE `civicrm_grant`
ADD `grant_program_id` INT( 10 ) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Grant Program ID of grant program record given grant belongs to.' AFTER `contact_id`,
ADD `grant_rejected_reason_id` INT( 10 ) UNSIGNED NULL DEFAULT NULL COMMENT 'Id of Grant Rejected Reason.' AFTER `status_id` ,
ADD `grant_incomplete_reason_id` INT( 10 ) UNSIGNED NULL DEFAULT NULL COMMENT 'Id of Grant Incomplete Reason.' AFTER `grant_rejected_reason_id` ,
......@@ -370,4 +348,3 @@ ALTER TABLE `civicrm_grant`
-- Constraints for table `civicrm_grant`
ALTER TABLE `civicrm_grant`
ADD CONSTRAINT `FK_civicrm_grant_grant_program_id` FOREIGN KEY (`grant_program_id`) REFERENCES `civicrm_grant_program` (`id`) ON DELETE CASCADE;
/**
* Grant Programs extension improves grant allocation
* in CiviGrant
*
* 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
* Toronto, ON
* Canada M5T 2C7
*/
......@@ -32,7 +32,7 @@ SELECT @option_group_id_arel := max(id) from civicrm_option_group where name = '
DELETE FROM civicrm_option_value WHERE option_group_id = @option_group_id_arel AND name = 'Accounts Payable Account is';
DELETE ci, ceft, ceft1, cft FROM `civicrm_entity_financial_trxn` ceft
LEFT JOIN civicrm_financial_trxn cft ON cft.id = ceft.financial_trxn_id
LEFT JOIN civicrm_financial_trxn cft ON cft.id = ceft.financial_trxn_id
LEFT JOIN civicrm_entity_financial_trxn ceft1 ON cft.id = ceft1.financial_trxn_id AND ceft1.entity_table = 'civicrm_financial_item'
LEFT JOIN civicrm_financial_item ci ON ci.id = ceft1.entity_id
WHERE ceft.entity_table = 'civicrm_grant';
......@@ -48,7 +48,7 @@ DROP TABLE IF EXISTS civicrm_payment;
ALTER TABLE civicrm_grant_program DROP FOREIGN KEY FK_civicrm_grant_program_status_id, DROP INDEX FK_civicrm_grant_program_status_id;
ALTER TABLE civicrm_grant_program DROP FOREIGN KEY FK_civicrm_grant_program_grant_type_id, DROP INDEX FK_civicrm_grant_program_grant_type_id;
ALTER TABLE civicrm_grant DROP FOREIGN KEY FK_civicrm_grant_grant_program_id, DROP INDEX FK_civicrm_grant_grant_program_id;
ALTER TABLE `civicrm_grant` DROP `grant_program_id`, DROP `grant_rejected_reason_id`, DROP `assessment`;
......@@ -81,10 +81,6 @@ UPDATE civicrm_option_value SET weight = 6 WHERE option_group_id = @grantStatus
DELETE FROM civicrm_option_value WHERE label = 'Approved for Payment' AND option_group_id = @grantStatus;
SELECT @grantType := id FROM civicrm_option_group WHERE name = 'grant_type';
DELETE FROM civicrm_option_value WHERE label = 'NEI Grant' AND option_group_id = @grantType;
SELECT @parentId1 := id FROM civicrm_navigation WHERE name = 'CiviGrant';
SELECT @parentId2 := id FROM civicrm_navigation WHERE name = 'Grants';
......@@ -92,28 +88,6 @@ DELETE FROM civicrm_navigation WHERE parent_id = @parentId2 AND label = 'Find Gr
DELETE FROM civicrm_navigation WHERE parent_id = @parentId2 AND label = 'New Grant Program' AND name = 'New Grant Program' AND url = 'civicrm/grant_program?action=add&reset=1';
DELETE FROM civicrm_navigation WHERE parent_id = @parentId1 AND label = 'Grant Programs' AND name = 'Grant Programs' AND url = 'civicrm/grant_program&reset=1';
-- custom data
DELETE FROM civicrm_custom_group WHERE name = 'NEI_Employment_Information';
DELETE FROM civicrm_custom_group WHERE name = 'NEI_General_information';
DELETE FROM civicrm_custom_group WHERE name = 'NEI_Course_conference_details';
DELETE FROM civicrm_custom_group WHERE name = 'NEI_ID';
DELETE FROM civicrm_option_group WHERE name = 'predominant_clinical_area_of_pra_nei';
DELETE FROM civicrm_option_group WHERE name = 'nei_employment_status_nei';
DELETE FROM civicrm_option_group WHERE name = 'if_you_are_not_employed_indicate_nei';
DELETE FROM civicrm_option_group WHERE name = 'province_of_employment_nei';
DELETE FROM civicrm_option_group WHERE name = 'position_nei';
DELETE FROM civicrm_option_group WHERE name = 'employment_setting_nei';
DELETE FROM civicrm_option_group WHERE name = 'how_did_you_hear_about_this_init_nei';
DELETE FROM civicrm_option_group WHERE name = 'course_conference_type_nei';
DELETE FROM civicrm_option_group WHERE name = 'how_will_this_course_enhance_the_nei';
DELETE FROM civicrm_option_group WHERE name = 'type_of_course_provider_nei';
DROP TABLE IF EXISTS civicrm_value_nei_employment_information;
DROP TABLE IF EXISTS civicrm_value_nei_general_information;
DROP TABLE IF EXISTS civicrm_value_nei_course_conference_details;
DROP TABLE IF EXISTS civicrm_value_nei_id;
DELETE FROM civicrm_msg_template WHERE msg_title = 'Trial Allocation of Funds';
DELETE FROM civicrm_msg_template WHERE msg_title = 'Grants Eligible Receipt';
DELETE FROM civicrm_msg_template WHERE msg_title = 'Grants Awaiting Information Receipt';
......@@ -125,13 +99,7 @@ DELETE FROM civicrm_msg_template WHERE msg_title = 'Grants Withdrawn Receipt';
DELETE FROM civicrm_msg_template WHERE msg_title = 'Grant Payment Check';
DELETE FROM civicrm_msg_template WHERE msg_title = 'Grant Payment Report';
SELECT @financialType := id FROM civicrm_financial_type WHERE name = 'NEI Grant';
DELETE FROM civicrm_entity_financial_account WHERE entity_table = 'civicrm_financial_type' AND entity_id = @financialType;
DELETE FROM civicrm_financial_account WHERE name = 'NEI Grant';
DELETE FROM civicrm_financial_type WHERE name = 'NEI Grant';
ALTER table civicrm_grant DROP column grant_incomplete_reason_id;
-- RG-212
DELETE cov FROM civicrm_option_group cog INNER JOIN civicrm_option_value cov ON cov.option_group_id = cog.id WHERE cog.name = 'activity_type' AND cov.name IN ('grant_status_change', 'grant_payment');
......@@ -23,7 +23,7 @@
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{* this template is used for viewing grants *}
{* this template is used for viewing grants *}
<h3>{ts}View Grant Program{/ts}</h3>