diff --git a/CRM/Grant/BAO/Grant.php b/CRM/Grant/BAO/Grant.php index 1f13b7498896e322bbbbf3687fd30de6768c4cef..fa4576f505c4d4aa1973011048310a9e689d160a 100644 --- a/CRM/Grant/BAO/Grant.php +++ b/CRM/Grant/BAO/Grant.php @@ -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); diff --git a/CRM/Grant/Form/Task/GrantPayment.php b/CRM/Grant/Form/Task/GrantPayment.php index fca8364b2fbfa650f2718742749ef3d1524711eb..52502dc5761b8962d73ef0c5a58007193787527d 100755 --- a/CRM/Grant/Form/Task/GrantPayment.php +++ b/CRM/Grant/Form/Task/GrantPayment.php @@ -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 ); diff --git a/CRM/Grant/Form/Task/Update.php b/CRM/Grant/Form/Task/Update.php index e7ac9490fd510d358bb2ce7c224d5bb2ab67370d..7533e6d523039faf648edc933100898e6e15801d 100644 --- a/CRM/Grant/Form/Task/Update.php +++ b/CRM/Grant/Form/Task/Update.php @@ -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' ); diff --git a/CRM/Grant/Info.php b/CRM/Grant/Info.php deleted file mode 100755 index ff055fc5480263d4362c2edfe726fadf68f99a1d..0000000000000000000000000000000000000000 --- a/CRM/Grant/Info.php +++ /dev/null @@ -1,125 +0,0 @@ -<?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')) - ) - ); - } - } -} diff --git a/CRM/Grant/Page/GrantProgram.php b/CRM/Grant/Page/GrantProgram.php index 770ee9f4ea9686dfffe7e6f855f00b9ab7839954..11f3c323899890b88535684c6ffbe0ba6b3f05c1 100755 --- a/CRM/Grant/Page/GrantProgram.php +++ b/CRM/Grant/Page/GrantProgram.php @@ -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']]; diff --git a/api/v3/Grant/ChangeStatus.php b/api/v3/Grant/ChangeStatus.php index 04b2c87a0bda5bfa5c5652207a9398b6fed5de0b..921f842998966febc3792f397cec82c2498c0abd 100644 --- a/api/v3/Grant/ChangeStatus.php +++ b/api/v3/Grant/ChangeStatus.php @@ -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'); diff --git a/grantprograms.php b/grantprograms.php index 55749ab86df8db54cfdc64be1fc531e81835e83d..7cf109f293094c9ca68037770df710abf1d40791 100644 --- a/grantprograms.php +++ b/grantprograms.php @@ -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' => CRM_Utils_System::url('civicrm/grant_program', 'reset=1&action=browse', FALSE), + 'title' => ts('Grant Program'), + 'ref' => 'new-grant program'); + } } \ No newline at end of file