Commit 557ce918 authored by Edsel's avatar Edsel

RG-215 Fixed installation error for Grant Programs

parent 0a9296f3
......@@ -259,7 +259,7 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant {
"action=view&reset=1&id={$grant->id}&cid={$grant->contact_id}&context=home"
);
$grantTypes = CRM_Grant_PseudoConstant::grantType();
$grantTypes = CRM_Core_OptionGroup::values('grant_type');
if (!CRM_Utils_Array::value('skipRecentView', $params)) {
if(!isset($grant->contact_id) || !isset($grant->grant_type_id)){
$grant->find(TRUE);
......
......@@ -154,7 +154,7 @@ class CRM_Grant_Form_Task_GrantPayment extends CRM_Core_Form
*/
public function postProcess()
{
$details = $allGrants = $grantPayments = array();
$details = $allGrants = $grantPayments = $grantAmount = array();
$grandTotal = 0;
CRM_Utils_System::flushCache( 'CRM_Grant_DAO_GrantPayment' );
$values = $this->controller->exportValues( $this->_name );
......
......@@ -63,7 +63,7 @@ class CRM_Grant_Form_Task_Update extends CRM_Grant_Form_Task {
* @return void
*/
function buildQuickForm() {
$grantStatus = CRM_Grant_PseudoConstant::grantStatus();
$grantStatus = CRM_Core_OptionGroup::values('grant_status');
CRM_Utils_System::setTitle(ts('Update Grants'));
$this->addElement('select', 'status_id', ts('Grant Status'), array('' => '') + $grantStatus);
$this->addElement('radio', 'radio_ts', NULL, ts(' Do not update'), 'no_update' );
......
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.3 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2011 |
+--------------------------------------------------------------------+
| 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 |
+--------------------------------------------------------------------+
*/
/**
* This class introduces component to the system and provides all the
* information about it. It needs to extend CRM_Core_Component_Info
* abstract class.
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2011
* $Id$
*
*/
class CRM_Grant_Info extends CRM_Core_Component_Info {
// docs inherited from interface
protected $keyword = 'grant';
// docs inherited from interface
public function getInfo() {
return array(
'name' => 'CiviGrant',
'translatedName' => ts('CiviGrant'),
'title' => 'CiviCRM Grant Management Engine',
'path' => 'CRM_Grant_',
'search' => 1,
'showActivitiesInCore' => 1
);
}
// docs inherited from interface
public function getPermissions($getAllUnconditionally = FALSE) {
return array(
'access CiviGrant',
'edit grants',
'edit grant program',
'delete in CiviGrant',
'administer CiviGrant'
);
}
// docs inherited from interface
public function getUserDashboardElement() {
// no dashboard element for this component
return null;
}
// docs inherited from interface
public function getUserDashboardObject() {
// no dashboard element for this component
return null;
}
// docs inherited from interface
public function registerTab() {
return array(
'title' => ts('Grants'),
'url' => 'grant',
'weight' => 50
);
}
// docs inherited from interface
public function registerAdvancedSearchPane() {
return array(
'title' => ts('Grants'),
'weight' => 50
);
}
// docs inherited from interface
public function getActivityTypes() {
return null;
}
// add shortcut to Create New
public function creatNewShortcut(&$shortCuts) {
if (CRM_Core_Permission::check('access CiviGrant') &&
CRM_Core_Permission::check('edit grants')) {
$shortCuts =
array_merge($shortCuts, array(array(
'path' => 'civicrm/grant/add',
'query' => "reset=1&action=add&context=standalone",
'ref' => 'new-grant',
'title' => ts('Grant'))
)
);
}
if (CRM_Core_Permission::check('access CiviGrant') &&
CRM_Core_Permission::check('edit grant program')) {
$shortCuts =
array_merge($shortCuts, array(array(
'path' => 'civicrm/grant_program',
'query' => "reset=1&action=browse&id=1",
'ref' => 'new-grant program',
'title' => ts('Grant Program'))
)
);
}
}
}
......@@ -96,7 +96,7 @@ class CRM_Grant_Page_GrantProgram extends CRM_Core_Page {
array('id' => $dao->id)
);
}
$grantType = CRM_Grant_PseudoConstant::grantType();
$grantType = CRM_Core_OptionGroup::values('grant_type');
$grantStatus = CRM_Grant_BAO_GrantProgram::grantProgramStatus();
foreach ($grantProgram as $key => $value) {
$grantProgram[$key]['grant_type_id'] = $grantType[$value['grant_type_id']];
......
......@@ -22,7 +22,7 @@ function _civicrm_api3_grant_changestatus_spec(&$spec) {
*/
function civicrm_api3_grant_changestatus($params) {
$status = CRM_Grant_PseudoConstant::grantStatus();
$status = CRM_Core_OptionGroup::values('grant_status');
$infoTooLate = key(CRM_Core_PseudoConstant::accountOptionValues('grant_info_too_late'));
$reasonGrantIneligible = CRM_Core_OptionGroup::values('reason_grant_ineligible');
......
......@@ -230,6 +230,7 @@ function &links() {
function grantprograms_civicrm_permission(&$permissions) {
$prefix = ts('CiviCRM Grant Program') . ': '; // name of extension or module
$permissions['edit grant finance'] = $prefix . ts('edit grant finance');
$permissions['edit grant program'] = $prefix . ts('edit grant programs in CiviGrant');
$permissions['cancel payments in CiviGrant'] = $prefix . ts('cancel payments in CiviGrant');
$permissions['edit payments in CiviGrant'] = $prefix . ts('edit payments in CiviGrant');
$permissions['create payments in CiviGrant'] = $prefix . ts('create payments in CiviGrant');
......@@ -469,7 +470,7 @@ function grantprograms_civicrm_buildForm($formName, &$form) {
$grantProgram[$dao->id]['action'] = CRM_Core_Action::formLink(links(), $action,
array('id' => $dao->id));
}
$grantType = CRM_Grant_PseudoConstant::grantType( );
$grantType = CRM_Core_OptionGroup::values('grant_type');
$grantStatus = CRM_Grant_BAO_GrantProgram::grantProgramStatus( );
foreach ( $grantProgram as $key => $value ) {
$grantProgram[$key]['grant_type_id'] = $grantType[$grantProgram[$key]['grant_type_id']];
......@@ -790,7 +791,7 @@ function grantprograms_civicrm_post($op, $objectName, $objectId, &$objectRef) {
if ($previousGrant && $previousGrant->status_id == $objectRef->status_id) {
return FALSE;
}
$status = CRM_Grant_PseudoConstant::grantStatus();
$status = CRM_Core_OptionGroup::values('grant_status');
$contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
$financialItemStatus = CRM_Core_PseudoConstant::accountOptionValues('financial_item_status');
$amount = $objectRef->amount_granted;
......@@ -1073,4 +1074,14 @@ function grantprograms_civicrm_alterMailParams(&$params) {
if (substr($params['valueName'], 0, 6) == 'grant_') {
CRM_Core_Smarty::singleton()->assign('messageBody', $params['html']);
}
}
function grantprograms_civicrm_links( $op, $objectName, $objectId, &$links ) {
if ($op == 'create.new.shorcuts' && (CRM_Core_Permission::check('access CiviGrant') &&
CRM_Core_Permission::check('edit grant program')) ) {
// add link to create new profile
$links[] = array( 'url' => 'grant_program?reset=1&action=browse',
'title' => ts('Grant Program'),
'ref' => 'new-grant program');
}
}
\ No newline at end of file
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