Commit c5943e54 authored by Monish Deb's avatar Monish Deb

cleanup and remove overriden core files

parent d96f1357
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -72,11 +72,8 @@ class CRM_Grant_Selector_Search extends CRM_Core_Selector_Base implements CRM_Co
'grant_amount_requested',
'grant_amount_granted',
'grant_application_received_date',
<<<<<<< f38d014fc2c8a69496dc2881bc60ad4759f04353
=======
'grant_report_received',
'grant_money_transfer_date',
>>>>>>> Initial changes to make it 5.* compatible
'grant_payment_created',
'program_name',
'program_id',
......@@ -315,7 +312,6 @@ class CRM_Grant_Selector_Search extends CRM_Core_Selector_Base implements CRM_Co
false,
$this->_grantClause );
while ($grant->fetch()) {
CRM_Core_Error::Debug_var('as', $grant);
$grants[$grant->grant_id] = $grant->grant_id;
$grantContacts[$grant->grant_id] = $grant->contact_id;
}
......@@ -333,11 +329,7 @@ class CRM_Grant_Selector_Search extends CRM_Core_Selector_Base implements CRM_Co
$next = $gKey;
break;
}
<<<<<<< f38d014fc2c8a69496dc2881bc60ad4759f04353
if ($gKey == $result->id) {
=======
if ($gKey == $result->grant_id) {
>>>>>>> Initial changes to make it 5.* compatible
$next = $gKey;
if($gKey == end($contactGrants)) {
reset($contactGrants);
......@@ -411,21 +403,12 @@ class CRM_Grant_Selector_Search extends CRM_Core_Selector_Base implements CRM_Co
public function &getColumnHeaders($action = NULL, $output = NULL) {
$statusHeader = array();
if (!isset(self::$_columnHeaders)) {
<<<<<<< f38d014fc2c8a69496dc2881bc60ad4759f04353
if (CRM_Core_DAO::singleValueQuery("SELECT is_active FROM civicrm_extension WHERE full_name = 'biz.jmaconsulting.grantapplications'") != 1) {
$statusHeader[] = array('name' => ts('Status'),
'sort' => 'status_weight',
'direction' => CRM_Utils_Sort::ASCENDING,
);
}
=======
$statusHeader = array(
array('name' => ts('Status'),
'sort' => 'status_weight',
'direction' => CRM_Utils_Sort::ASCENDING,
),
);
>>>>>>> Initial changes to make it 5.* compatible
self::$_columnHeaders = array(
array(
'name' => ts('Program Name'),
......@@ -492,10 +475,6 @@ class CRM_Grant_Selector_Search extends CRM_Core_Selector_Base implements CRM_Co
public function getExportFileName($output = 'csv') {
return ts('CiviCRM Grant Search');
}
<<<<<<< f38d014fc2c8a69496dc2881bc60ad4759f04353
}
//end of class
=======
}
>>>>>>> Initial changes to make it 5.* compatible
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.4 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM 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 and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2013
* $Id$
*
*/
class CRM_Grantprograms_Query extends CRM_Contact_BAO_Query_Interface {
function select(&$query) {
if (($query->_mode &CRM_Contact_BAO_Query::MODE_GRANT)) {
foreach(['status_weight', 'grant_program', 'grant_program_id', 'grant_payment_created'] as $attr) {
$query->_returnProperties[$attr] = 1;
if ($attr == 'status_weight') {
$query->_select['status_weight'] = 'v.weight as status_weight';
$query->_element['status_weight'] = 1;
$query->_tables['status_weight'] = 1;
}
elseif ($attr = 'grant_program') {
$query->_select['grant_program'] = 'gp.name as program_name';
$query->_element['grant_program'] = 1;
$query->_tables['grant_program'] = 1;
}
elseif ($attr = 'grant_program_id') {
$query->_select['grant_program_id'] = 'gp.id as program_id';
$query->_element['grant_program'] = 1;
$query->_tables['grant_program'] = 1;
}
else {
$query->_select['grant_payment_created'] = 'civicrm_payment.payment_created_date as grant_payment_created';
$query->_tables['civicrm_payment'] = 1;
}
}
}
}
function where(&$query) {
foreach ($query->_params as $id => $values) {
if (!is_array($values) || count($values) != 5) {
continue;
}
if (substr($values[0], 0, 6) == 'grant_') {
self::whereClauseSingle($values, $query);
}
}
}
public static function whereClauseSingle(&$values, &$query) {
$strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
list($name, $op, $value, $grouping, $wildcard) = $values;
switch ($name) {
case 'grant_program_id':
$value = $strtolower(CRM_Core_DAO::escapeString(trim($value)));
$query->_where[$grouping][] = "civicrm_grant.grant_program_id $op '{$value}'";
$grantPrograms = CRM_Grant_BAO_GrantProgram::getGrantPrograms();
$value = $grantPrograms[$value];
$query->_qill[$grouping ][] = ts('Grant Type %2 %1', array(1 => $value, 2 => $op));
$query->_tables['civicrm_grant'] = $query->_whereTables['civicrm_grant'] = 1;
return;
case 'grant_assessment':
case 'grant_assessment_low':
case 'grant_assessment_high':
$query->numberRangeBuilder($values,
'civicrm_grant', 'grant_assessment', 'assessment', 'Assessment'
);
return;
}
}
function &getFields() {
$fields = array();
return $fields;
}
function from($name, $mode, $side) {
if ($name == 'grant_program') {
return " $side JOIN civicrm_grant_program gp ON (civicrm_grant.grant_program_id = gp.id)";
}
elseif ($name == 'status_weight') {
return " $side JOIN civicrm_option_value v ON (civicrm_grant.status_id = v.value AND v.option_group_id=21)";
}
elseif ($name == 'civicrm_payment') {
return " $side JOIN civicrm_entity_payment ep ON (civicrm_grant.id = ep.entity_id AND ep.entity_table = 'civicrm_grant')" .
" $side JOIN civicrm_payment civicrm_payment ON (ep.payment_id = civicrm_payment.id) ";
}
}
public function getPanesMapper(&$panes) {
}
}
......@@ -48,7 +48,7 @@ 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');
CRM_Utils_File::sourceSQLFile(CIVICRM_DSN, $config->extensionsDir . 'biz.jmaconsulting.grantprograms/sql/grantprograms_enable.sql');
grantprograms_addRemoveMenu(TRUE);
return _grantprograms_civix_civicrm_enable();
}
......@@ -58,7 +58,7 @@ 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');
CRM_Utils_File::sourceSQLFile(CIVICRM_DSN, $config->extensionsDir . 'biz.jmaconsulting.grantprograms/sql/grantprograms_disable.sql');
grantprograms_addRemoveMenu(FALSE);
return _grantprograms_civix_civicrm_disable();
}
......@@ -264,9 +264,12 @@ function grantprograms_civicrm_preProcess($formName, &$form) {
$form->_formValues['grant_program_id'] = $programID;
$form->defaults['grant_program_id'] = $programID;
}
else {
}
}
}
/*
* hook_civicrm_buildForm civicrm hook
*
......@@ -579,7 +582,24 @@ function grantprograms_civicrm_pageRun( &$page ) {
'template' => 'CRM/Grant/Form/CustomFieldsView.tpl',
));
}
if ($page->getVar('_name') == "CRM_Grant_Page_DashBoard") {
$page->assign('grantSummary', CRM_Grant_BAO_GrantPayment::getGrantSummary(CRM_Core_Permission::check('administer CiviCRM')));
}
}
function grantprograms_civicrm_alterTemplateFile($formName, &$form, $context, &$tplName) {
if ($tplName == 'CRM/Grant/Page/DashBoard.tpl') {
$tplName = 'CRM/Grant/Page/DashBoardExtra.tpl';
}
}
function grantprograms_civicrm_queryObjects(&$queryObjects, $type) {
if ($type == 'Contact') {
$queryObjects[] = new CRM_Grantprograms_Query();
}
}
/*
* hook_civicrm_validate
*
......@@ -1037,23 +1057,21 @@ function grantprograms_getCustomFieldData($id) {
}
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'];
$params['enableComponentIDs'] = $config_backend['enableComponentIDs'];
$config = CRM_Core_Config::singleton();
$params['enableComponents'] = $config->enableComponents;
if ($enable) {
if (array_search('CiviGrant', $config->enableComponents)) {
return NULL;
}
$params['enableComponents'][] = 'CiviGrant';
$params['enableComponentIDs'][] = CRM_Core_DAO::singleValueQuery("SELECT id FROM civicrm_component WHERE name = 'CiviGrant'");
}
else {
foreach (array_keys($params['enableComponents'], 'CiviGrant', TRUE) as $key) {
$key = array_search('CiviGrant', $params['enableComponents']);
if ($key) {
unset($params['enableComponents'][$key]);
}
foreach (array_keys($params['enableComponentIDs'], (int)CRM_Core_DAO::singleValueQuery("SELECT id FROM civicrm_component WHERE name = 'CiviGrant'"), TRUE) as $key) {
unset($params['enableComponentIDs'][$key]);
}
}
CRM_Core_BAO_ConfigSetting::create($params);
return;
CRM_Core_BAO_Setting::setItem($params['enableComponents'], CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,'enable_components');
}
function getCustomFields($params, &$values) {
......
......@@ -65,7 +65,7 @@ You have {$grantSummary.no_of_grants} grant(s) registered in your database.
<tr>
<td style="font-size: 1.1em; font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; font-weight: bold;">{ts}TOTAL{/ts}:</td>
{foreach from=$grantSummary.total_grants item=values key=indexes }
<td style="font-size: 1.1em; font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; font-weight: bold;">{$values}</td>
<td style="font-size: 1.1em; font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; font-weight: bold;">{$values}</td>
{/foreach}
</tr>
</table>
......@@ -80,7 +80,7 @@ You have {$grantSummary.no_of_grants} grant(s) registered in your database.
</div>
{if $pager->_totalItems}
{if $pager->_totalItems}
<h3>{ts}Recent Grants{/ts}</h3>
<div class="form-item">
{include file="CRM/Grant/Form/Selector.tpl" context="DashBoard"}
......
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