diff --git a/CRM/Grant/BAO/GrantBudget.php b/CRM/Grant/BAO/GrantBudget.php index 0f424e8..b100633 100644 --- a/CRM/Grant/BAO/GrantBudget.php +++ b/CRM/Grant/BAO/GrantBudget.php @@ -2,12 +2,23 @@ class CRM_Grant_BAO_GrantBudget extends CRM_Grant_DAO_GrantBudget { + /** + * Build Fiscal year option list. + * + */ public static function getFiscalyear() { $from = date("Y", strtotime(date('Y') . ' - ' . GRANT_SCHOLARSHIP_YEAR_DIFF . ' years')); $to = date("Y", strtotime(date('Y') . ' + ' . GRANT_SCHOLARSHIP_YEAR_DIFF . ' years')); return array_combine(range($to, $from), range($to, $from)); } + /** + * Build Fiscal year option list. + * + * @param $params array + * + * @return array + */ public static function getGrantBudget($params) { $fiscalYear = $params['fiscal_year']; if (empty($fiscalYear)) { @@ -21,7 +32,7 @@ class CRM_Grant_BAO_GrantBudget extends CRM_Grant_DAO_GrantBudget { ); $config = CRM_Core_Config::singleton(); - $mkTime = mktime(0, 0, 0, $config->fiscalYearStart['M'], $config->fiscalYearStart['d'], $fiscalYear); + $mkTime = mktime(0, 0, 0, $config->fiscalYearStart['M'], $config->fiscalYearStart['d'], $fiscalYear); $fiscalStartDate = date('Y-m-d', $mkTime); $fiscalEndDate = date('Y-m-d', strtotime($fiscalStartDate . '+ 1 year')); diff --git a/CRM/Grant/DAO/GrantBudget.php b/CRM/Grant/DAO/GrantBudget.php index 1c4a5d0..314a88c 100644 --- a/CRM/Grant/DAO/GrantBudget.php +++ b/CRM/Grant/DAO/GrantBudget.php @@ -23,7 +23,7 @@ | 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-2017 @@ -48,7 +48,7 @@ class CRM_Grant_DAO_GrantBudget extends CRM_Core_DAO { * * @var boolean */ - static $_log = true; + static $_log = TRUE; /** * * @var int unsigned @@ -58,7 +58,7 @@ class CRM_Grant_DAO_GrantBudget extends CRM_Core_DAO { public $fiscal_year; public $budget; - function __construct() { + public function __construct() { $this->__table = 'civicrm_grant_budget'; parent::__construct(); } @@ -68,10 +68,10 @@ class CRM_Grant_DAO_GrantBudget extends CRM_Core_DAO { * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'financialtypeid', 'civicrm_financial_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financialtypeid', 'civicrm_financial_type', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; @@ -81,13 +81,13 @@ class CRM_Grant_DAO_GrantBudget extends CRM_Core_DAO { * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { Civi::$statics[__CLASS__]['fields'] = [ 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_grant_budget', 'entity' => 'GrantBudget', 'bao' => 'CRM_Grant_BAO_GrantBudget', @@ -165,7 +165,7 @@ class CRM_Grant_DAO_GrantBudget extends CRM_Core_DAO { * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } @@ -176,15 +176,15 @@ class CRM_Grant_DAO_GrantBudget extends CRM_Core_DAO { * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } /** @@ -194,7 +194,7 @@ class CRM_Grant_DAO_GrantBudget extends CRM_Core_DAO { * * @return array */ - static function &import($prefix = false) { + public static function &import($prefix = FALSE) { $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'grant_budget', $prefix, []); return $r; } @@ -205,7 +205,7 @@ class CRM_Grant_DAO_GrantBudget extends CRM_Core_DAO { * * @return array */ - static function &export($prefix = false) { + public static function &export($prefix = FALSE) { $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'grant_budget', $prefix, []); return $r; } @@ -216,4 +216,5 @@ class CRM_Grant_DAO_GrantBudget extends CRM_Core_DAO { $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Grant/Page/AnnualBudgets.php b/CRM/Grant/Page/AnnualBudgets.php index b664153..06693bd 100644 --- a/CRM/Grant/Page/AnnualBudgets.php +++ b/CRM/Grant/Page/AnnualBudgets.php @@ -29,7 +29,7 @@ class CRM_Grant_Page_AnnualBudgets extends CRM_Core_Page_Basic { //check permission if (!(CRM_Core_Permission::check('administer CiviCRM') - || ( CRM_Core_Permission::check('access CiviGrant') + || (CRM_Core_Permission::check('access CiviGrant') && CRM_Core_Permission::check('edit grants') ) )) { diff --git a/annualgrantbudgets.civix.php b/annualgrantbudgets.civix.php index 903be95..b7f8919 100644 --- a/annualgrantbudgets.civix.php +++ b/annualgrantbudgets.civix.php @@ -453,8 +453,6 @@ function _annualgrantbudgets_civix_civicrm_alterSettingsFolders(&$metaDataFolder * * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_entityTypes */ - function _annualgrantbudgets_civix_civicrm_entityTypes(&$entityTypes) { - $entityTypes = array_merge($entityTypes, array ( - )); + $entityTypes = array_merge($entityTypes, []); }