fixed civilint

This commit is contained in:
CiviWare Solutions 2018-08-12 05:13:25 +05:30
parent 61ae4f80ea
commit 133a71f70b
4 changed files with 28 additions and 18 deletions

View File

@ -2,12 +2,23 @@
class CRM_Grant_BAO_GrantBudget extends CRM_Grant_DAO_GrantBudget { class CRM_Grant_BAO_GrantBudget extends CRM_Grant_DAO_GrantBudget {
/**
* Build Fiscal year option list.
*
*/
public static function getFiscalyear() { public static function getFiscalyear() {
$from = date("Y", strtotime(date('Y') . ' - ' . GRANT_SCHOLARSHIP_YEAR_DIFF . ' years')); $from = date("Y", strtotime(date('Y') . ' - ' . GRANT_SCHOLARSHIP_YEAR_DIFF . ' years'));
$to = 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)); return array_combine(range($to, $from), range($to, $from));
} }
/**
* Build Fiscal year option list.
*
* @param $params array
*
* @return array
*/
public static function getGrantBudget($params) { public static function getGrantBudget($params) {
$fiscalYear = $params['fiscal_year']; $fiscalYear = $params['fiscal_year'];
if (empty($fiscalYear)) { if (empty($fiscalYear)) {
@ -21,7 +32,7 @@ class CRM_Grant_BAO_GrantBudget extends CRM_Grant_DAO_GrantBudget {
); );
$config = CRM_Core_Config::singleton(); $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); $fiscalStartDate = date('Y-m-d', $mkTime);
$fiscalEndDate = date('Y-m-d', strtotime($fiscalStartDate . '+ 1 year')); $fiscalEndDate = date('Y-m-d', strtotime($fiscalStartDate . '+ 1 year'));

View File

@ -23,7 +23,7 @@
| GNU Affero General Public License or the licensing of CiviCRM, | | GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing | | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+ +--------------------------------------------------------------------+
*/ */
/** /**
* @package CRM * @package CRM
* @copyright CiviCRM LLC (c) 2004-2017 * @copyright CiviCRM LLC (c) 2004-2017
@ -48,7 +48,7 @@ class CRM_Grant_DAO_GrantBudget extends CRM_Core_DAO {
* *
* @var boolean * @var boolean
*/ */
static $_log = true; static $_log = TRUE;
/** /**
* *
* @var int unsigned * @var int unsigned
@ -58,7 +58,7 @@ class CRM_Grant_DAO_GrantBudget extends CRM_Core_DAO {
public $fiscal_year; public $fiscal_year;
public $budget; public $budget;
function __construct() { public function __construct() {
$this->__table = 'civicrm_grant_budget'; $this->__table = 'civicrm_grant_budget';
parent::__construct(); parent::__construct();
} }
@ -68,10 +68,10 @@ class CRM_Grant_DAO_GrantBudget extends CRM_Core_DAO {
* @return array * @return array
* [CRM_Core_Reference_Interface] * [CRM_Core_Reference_Interface]
*/ */
static function getReferenceColumns() { public static function getReferenceColumns() {
if (!isset(Civi::$statics[__CLASS__]['links'])) { if (!isset(Civi::$statics[__CLASS__]['links'])) {
Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); 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']); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
} }
return Civi::$statics[__CLASS__]['links']; return Civi::$statics[__CLASS__]['links'];
@ -81,13 +81,13 @@ class CRM_Grant_DAO_GrantBudget extends CRM_Core_DAO {
* *
* @return array * @return array
*/ */
static function &fields() { public static function &fields() {
if (!isset(Civi::$statics[__CLASS__]['fields'])) { if (!isset(Civi::$statics[__CLASS__]['fields'])) {
Civi::$statics[__CLASS__]['fields'] = [ Civi::$statics[__CLASS__]['fields'] = [
'id' => [ 'id' => [
'name' => 'id', 'name' => 'id',
'type' => CRM_Utils_Type::T_INT, 'type' => CRM_Utils_Type::T_INT,
'required' => true, 'required' => TRUE,
'table_name' => 'civicrm_grant_budget', 'table_name' => 'civicrm_grant_budget',
'entity' => 'GrantBudget', 'entity' => 'GrantBudget',
'bao' => 'CRM_Grant_BAO_GrantBudget', 'bao' => 'CRM_Grant_BAO_GrantBudget',
@ -165,7 +165,7 @@ class CRM_Grant_DAO_GrantBudget extends CRM_Core_DAO {
* @return array * @return array
* Array(string $name => string $uniqueName). * Array(string $name => string $uniqueName).
*/ */
static function &fieldKeys() { public static function &fieldKeys() {
if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); 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 * @return string
*/ */
static function getTableName() { public static function getTableName() {
return self::$_tableName; return self::$_tableName;
} }
/** /**
* Returns if this table needs to be logged * Returns if this table needs to be logged
* *
* @return boolean * @return bool
*/ */
function getLog() { public function getLog() {
return self::$_log; return self::$_log;
} }
/** /**
@ -194,7 +194,7 @@ class CRM_Grant_DAO_GrantBudget extends CRM_Core_DAO {
* *
* @return array * @return array
*/ */
static function &import($prefix = false) { public static function &import($prefix = FALSE) {
$r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'grant_budget', $prefix, []); $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'grant_budget', $prefix, []);
return $r; return $r;
} }
@ -205,7 +205,7 @@ class CRM_Grant_DAO_GrantBudget extends CRM_Core_DAO {
* *
* @return array * @return array
*/ */
static function &export($prefix = false) { public static function &export($prefix = FALSE) {
$r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'grant_budget', $prefix, []); $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'grant_budget', $prefix, []);
return $r; return $r;
} }
@ -216,4 +216,5 @@ class CRM_Grant_DAO_GrantBudget extends CRM_Core_DAO {
$indices = []; $indices = [];
return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
} }
} }

View File

@ -29,7 +29,7 @@ class CRM_Grant_Page_AnnualBudgets extends CRM_Core_Page_Basic {
//check permission //check permission
if (!(CRM_Core_Permission::check('administer CiviCRM') 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') && CRM_Core_Permission::check('edit grants')
) )
)) { )) {

View File

@ -453,8 +453,6 @@ function _annualgrantbudgets_civix_civicrm_alterSettingsFolders(&$metaDataFolder
* *
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_entityTypes * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_entityTypes
*/ */
function _annualgrantbudgets_civix_civicrm_entityTypes(&$entityTypes) { function _annualgrantbudgets_civix_civicrm_entityTypes(&$entityTypes) {
$entityTypes = array_merge($entityTypes, array ( $entityTypes = array_merge($entityTypes, []);
));
} }