Commit f367e245 authored by Edsel's avatar Edsel

4.3 merged code after removing NEI specific changes

parent 3069cda7
......@@ -100,18 +100,6 @@ class CRM_Grant_BAO_Query {
$query->_tables['grant_note'] = 1;
}
if (CRM_Utils_Array::value(COURSE_CONFERENCE_TYPE_COLUMN, $query->_returnProperties)) {
$query->_select['course_type'] = COURSE_CONFERENCE_DETAILS.'.'.COURSE_CONFERENCE_TYPE_COLUMN.' as course_type';
$query->_element['course_type'] = 1;
$query->_tables['course_type'] = 1;
}
if (CRM_Utils_Array::value(COURSE_CONFERENCE_NAME_COLUMN, $query->_returnProperties)) {
$query->_select['course_name'] = COURSE_CONFERENCE_DETAILS.'.'.COURSE_CONFERENCE_NAME_COLUMN.' as course_name';
$query->_element['course_name'] = 1;
$query->_tables['course_name'] = 1;
}
$query->_select['grant_amount_requested'] = 'civicrm_grant.amount_requested as grant_amount_requested';
$query->_select['grant_amount_granted'] = 'civicrm_grant.amount_granted as grant_amount_granted';
$query->_select['grant_amount_total'] = 'civicrm_grant.amount_total as grant_amount_total';
......@@ -316,10 +304,6 @@ $side JOIN civicrm_payment ON (temp2.payment_id = civicrm_payment.id)";
$from .= " $side JOIN civicrm_option_value v ON (civicrm_grant.status_id = v.value AND v.option_group_id=21)";
break;
case 'course_name':
$from .= ' '.$side.' JOIN '.COURSE_CONFERENCE_DETAILS.' ON ( civicrm_grant.id = '.COURSE_CONFERENCE_DETAILS.'.entity_id )';
break;
case 'grant_program':
$from .= " $side JOIN civicrm_grant_program gp ON (civicrm_grant.grant_program_id = gp.id)";
break;
......@@ -353,8 +337,6 @@ $side JOIN civicrm_payment ON (temp2.payment_id = civicrm_payment.id)";
'grant_amount_requested' => 1,
'grant_application_received_date' => 1,
'grant_payment_created' => 1,
COURSE_CONFERENCE_TYPE_COLUMN => 1,
COURSE_CONFERENCE_NAME_COLUMN => 1,
'grant_report_received' => 1,
'grant_money_transfer_date' => 1,
'grant_note' => 1,
......
......@@ -76,8 +76,6 @@ class CRM_Grant_Selector_Search extends CRM_Core_Selector_Base implements CRM_Co
'grant_amount_granted',
'grant_application_received_date',
'grant_payment_created',
'course_type',
'course_name',
'program_name',
'program_id',
'grant_report_received',
......@@ -345,16 +343,6 @@ class CRM_Grant_Selector_Search extends CRM_Core_Selector_Base implements CRM_Co
if(empty($prev)) {
$prev = end($contactGrants);
}
if (isset($result->course_type)) {
if (!empty($result->course_type)) {
if ($result->course_type != 'select_or_other') {
$result->course_type = CRM_Core_DAO::singleValueQuery("SELECT civicrm_option_value.label as course_type FROM civicrm_option_value LEFT JOIN civicrm_option_group ON civicrm_option_group.id = civicrm_option_value.option_group_id WHERE civicrm_option_value.value = {$result->course_type} AND civicrm_option_group.name = 'course_conference_type_20120720143907'");
}
else {
$result->course_type = 'Other';
}
}
}
// the columns we are interested in
foreach (self::$_properties as $property) {
......@@ -446,16 +434,6 @@ class CRM_Grant_Selector_Search extends CRM_Core_Selector_Base implements CRM_Co
'sort' => 'grant_payment_created',
'direction' => CRM_Utils_Sort::DONTCARE,
),
array(
'name' => ts('Course Name'),
'sort' => 'course_conference_name_77',
'direction' => CRM_Utils_Sort::DONTCARE,
),
array(
'name' => ts('Course Type'),
'sort' => 'course_conference_type_74',
'direction' => CRM_Utils_Sort::DONTCARE,
),
array('desc' => ts('Actions')),
);
......
<?php
require_once 'grantprograms.civix.php';
require_once 'grantprograms_data_define.php';
define('PAY_GRANTS', 5);
define('DELETE_GRANTS', 1);
/**
* Implementation of hook_civicrm_config
*/
......@@ -25,7 +25,6 @@ function grantprograms_civicrm_install() {
_grantprograms_civix_civicrm_install();
$smarty = CRM_Core_Smarty::singleton();
$config = CRM_Core_Config::singleton();
grantprograms_define($config->extensionsDir);
$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");
......@@ -38,9 +37,6 @@ function grantprograms_civicrm_install() {
*/
function grantprograms_civicrm_uninstall() {
$config = CRM_Core_Config::singleton();
$file = fopen($config->extensionsDir .'biz.jmaconsulting.grantprograms/grantprograms_data_define.php', 'w');
fwrite($file, "<?php\n// placeholder which ensures custom group and custom fields and custom tables.\n?>");
fclose($file);
return _grantprograms_civix_civicrm_uninstall();
}
......@@ -266,29 +262,6 @@ function grantprograms_civicrm_buildForm($formName, &$form) {
)
);
}
$empId = $genId = $ccId = '-1';
if ($form->getVar('_id')) {
$tableName1 = CRM_Core_DAO::getFieldValue('CRM_Core_BAO_CustomGroup', NEI_EMPLOYMENT, 'table_name', 'name');
$query1 = "SELECT id FROM {$tableName1} WHERE entity_id = {$form->getVar('_id')}";
$empId = CRM_Core_DAO::singleValueQuery($query1);
$tableName2 = CRM_Core_DAO::getFieldValue('CRM_Core_BAO_CustomGroup', NEI_GENERAL, 'table_name', 'name');
$query2 = "SELECT id FROM {$tableName2} WHERE entity_id = {$form->getVar('_id')}";
$genId = CRM_Core_DAO::singleValueQuery($query2);
$tableName3 = CRM_Core_DAO::getFieldValue('CRM_Core_BAO_CustomGroup', NEI_CONFERENCE, 'table_name', 'name');
$query3 = "SELECT id FROM {$tableName3} WHERE entity_id = {$form->getVar('_id')}";
$ccId = CRM_Core_DAO::singleValueQuery($query3);
}
$form->assign('employment', 'custom_'.EMPLOYED_INDICATE.'_'.$empId);
$form->assign('employment_other', 'custom_'.EMPLOYMENT_OTHER.'_'.$empId);
$form->assign('position', 'custom_'.POSITION.'_'.$empId);
$form->assign('position_other', 'custom_'.POSITION_OTHER.'_'.$empId);
$form->assign('employment_setting', 'custom_'.EMPLOYMENT_SETTING.'_'.$empId);
$form->assign('employment_setting_other', 'custom_'.EMPLOYMENT_SETTING_OTHER.'_'.$empId);
$form->assign('init', 'custom_'.NEI_HEAR_ABOUT.'_'.$genId);
$form->assign('init_other', 'custom_'.INITIATIVE_OTHER.'_'.$genId);
$form->assign('course', 'custom_'.COURSE_CONFERENCE_TYPE.'_'.$ccId);
$form->assign('course_other', 'custom_'.COURSE_CONFERENCE_TYPE_OTHER.'_'.$ccId);
CRM_Core_Region::instance('page-body')->add(array(
'template' => 'CRM/Grant/Form/GrantExtra.tpl',
));
......@@ -631,7 +604,6 @@ function grantprograms_civicrm_pre($op, $objectName, $id, &$params) {
elseif ($objectName == 'Grant' && $op == "edit") {
$params['adjustment_value'] = FALSE;
}
if ($objectName == 'Grant' && $op == "edit") {
if (!empty($previousGrant->amount_granted) && array_key_exists('amount_granted', $params) && CRM_Utils_Money::format($previousGrant->amount_granted) != CRM_Utils_Money::format($params['amount_granted']) && !CRM_Utils_Array::value('allocation', $params)) {
$programParams = array('id' => $previousGrant->grant_program_id);
......@@ -959,63 +931,6 @@ function grantprograms_getCustomFieldData($id) {
return $customFieldData;
}
function grantprograms_define($extensionsDir) {
$file = fopen($extensionsDir .'biz.jmaconsulting.grantprograms/grantprograms_data_define.php', 'w');
fwrite($file, "<?php\n\n//define custom table Names.\ndefine('COURSE_CONFERENCE_DETAILS', 'civicrm_value_nei_course_conference_details');\ndefine('EMPLOYMENT_INFORMATION', 'civicrm_value_nei_employment_information');\ndefine('GENERAL_INFORMATION', 'civicrm_value_nei_general_information');\ndefine('NEI_ID_TABLE', 'civicrm_value_nei_id');\n\n");
fwrite($file, "//define custom group Names.\ndefine('NEI_EMPLOYMENT', 'NEI_Employment_Information');\ndefine('NEI_GENERAL', 'NEI_General_information');\ndefine('NEI_CONFERENCE', 'NEI_Course_conference_details');\n\n");
fwrite($file, "//define custom groups Ids.\n");
$tables = array(
'civicrm_value_nei_employment_information' => 'COURSE_CONFERENCE_DETAILS_ID',
'civicrm_value_nei_general_information' => 'EMPLOYMENT_INFORMATION_ID',
'civicrm_value_nei_course_conference_details' => 'GENERAL_INFORMATION_ID',
'civicrm_value_nei_id' => 'NEI_ID',
);
foreach ($tables as $tableKey => $tableValue) {
fwrite($file, "define('".$tableValue."', '".CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $tableKey, 'id' ,'table_name')."');\n");
}
fwrite($file, "\n//define custom field Ids and Columns.\n");
$customFields = array(
'predominant_clinical_area_of_pra' => 'NEI_PRACTICE_AREA',
'nei_employment_status' => 'NEI_EMPLOYMENT_STATUS',
'if_you_are_not_employed_indicate' => 'EMPLOYED_INDICATE',
'other' => 'EMPLOYMENT_OTHER',
'employer_name' => 'EMPLOYER_NAME',
'province_of_employment' => 'PROVINCES_OF_EMPLOYMENT',
'position' => 'POSITION',
'select_or_other' => 'POSITION_OTHER',
'employment_setting' => 'EMPLOYMENT_SETTING',
'employment_setting_other' => 'EMPLOYMENT_SETTING_OTHER',
'work_phone' => 'WORK_PHONE',
'work_phone_extension' => 'WORK_PHONE_EXTENSION',
'how_did_you_hear_about_this_init' => 'NEI_HEAR_ABOUT',
'other_initiative' => 'INITIATIVE_OTHER',
'course_conference_type' => 'COURSE_CONFERENCE_TYPE',
'course_conference_type_other' => 'COURSE_CONFERENCE_TYPE_OTHER',
'course_conference_code' => 'COURSE_CONFERENCE_CODE',
'course_conference_name' => 'COURSE_CONFERENCE_NAME',
'course_conference_provider' => 'COURSE_CONFERENCE_PROVDER',
'how_will_this_course_enhance_the' => 'NEI_COURSE_ENHANCEMENT',
'proof_of_completion' => 'PROOF_OF_COMPELTION',
'proof_of_payment' => 'PROOF_OF_PAYMENT',
'type_of_course_provider' => 'COURSE_PROVIDER_TYPE',
'start_date' => 'START_DATE',
'end_date' => 'END_DATE',
'college_of_nurses_of_ontario_reg' => 'NEI_CNO_REGISTRATION_ID',
'social_insurance_number' => 'NEI_CIN',
);
foreach ($customFields as $tableKey => $tableValue) {
fwrite($file, "define('".$tableValue."', '".CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $tableKey, 'id' ,'column_name')."');\n");
fwrite($file, "define('".$tableValue."_COLUMN', '".$tableKey."');\n");
}
fwrite($file, "\ndefine('PAY_GRANTS', 5);\ndefine('DELETE_GRANTS', 1);\n\n?>");
fclose($file);
return;
}
function grantprograms_addRemoveMenu($enable) {
$config_backend = unserialize(CRM_Core_DAO::singleValueQuery('SELECT config_backend FROM civicrm_domain WHERE id = 1'));
$params['enableComponents'] = $config_backend['enableComponents'];
......
......@@ -125,79 +125,6 @@ cj(document).ready( function(){
{/literal}{if $hideAttachments}{literal}
cj('div.crm-grant-form-block-attachment').hide();
{/literal}{/if}{literal}
// RG-116 hide other fields unless selected
var emp = "{/literal}{$employment}{literal}";
var emp_other = "{/literal}{$employment_other}{literal}";
var pos = "{/literal}{$position}{literal}";
var pos_other = "{/literal}{$position_other}{literal}";
var emp_setting = "{/literal}{$employment_setting}{literal}";
var emp_setting_other = "{/literal}{$employment_setting_other}{literal}";
var init = "{/literal}{$init}{literal}";
var init_other = "{/literal}{$init_other}{literal}";
var course = "{/literal}{$course}{literal}";
var course_other = "{/literal}{$course_other}{literal}";
if (!cj('#'+emp_other).val()) {
cj('tr.'+emp_other+'-row').hide();
}
if (!cj('#'+pos_other).val()) {
cj('tr.'+pos_other+'-row').hide();
}
if (!cj('#'+emp_setting_other).val()) {
cj('tr.'+emp_setting_other+'-row').hide();
}
if (!cj('#'+init_other).val()) {
cj('tr.'+init_other+'-row').hide();
}
if (!cj('#'+course_other).val()) {
cj('tr.'+course_other+'-row').hide();
}
cj('#'+emp).change( function() {
if (cj("option:selected", this).html() == "Other Counselling Service") {
cj('tr.'+emp_other+'-row').show();
}
else {
cj('tr.'+emp_other+'-row').hide();
}
});
cj('#'+pos).change( function() {
if (cj("option:selected", this).html() == "Other") {
cj('tr.'+pos_other+'-row').show();
}
else {
cj('tr.'+pos_other+'-row').hide();
}
});
cj('#'+emp_setting).change( function() {
if (cj("option:selected", this).html() == "Other") {
cj('tr.'+emp_setting_other+'-row').show();
}
else {
cj('tr.'+emp_setting_other+'-row').hide();
}
});
cj('#'+init).change( function() {
if (cj("option:selected", this).html() == "Other") {
cj('tr.'+init_other+'-row').show();
}
else {
cj('tr.'+init_other+'-row').hide();
}
});
cj('#'+course).change( function() {
if (cj("option:selected", this).html() == "Other") {
cj('tr.'+course_other+'-row').show();
}
else {
cj('tr.'+course_other+'-row').hide();
}
});
var total = 0;
cj(".form-select").change(function(){
cj(".form-select").each(function(){
......
......@@ -65,8 +65,6 @@
<td class="right crm-grant-grant_amount_granted">{$row.grant_amount_granted|crmMoney}</td>
<td class="right crm-grant-grant_application_received_date">{$row.grant_application_received_date|truncate:10:''|crmDate}</td>
<td class="right crm-grant-grant_application_payment_created">{$row.grant_payment_created|truncate:10:''|crmDate}</td>
<td class="right crm-grant-grant_course_name">{$row.course_name}</td>
<td class="crm-grant-grant_course_type">{$row.course_type}</td>
<td>{$row.action|replace:'xx':$row.grant_id}</td>
</tr>
{/foreach}
......
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