+--------------------------------------------------------------------+
| CiviCRM version 5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018 |
+ | Copyright CiviCRM LLC (c) 2004-2019 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2018
+ * @copyright CiviCRM LLC (c) 2004-2019
* $Id$
*
*/
$dao = CRM_Core_DAO::executeQuery($query);
- $status = array();
- $summary = array();
+ $status = [];
+ $summary = [];
$summary['total_grants'] = NULL;
$status = CRM_Core_PseudoConstant::get('CRM_Grant_DAO_Grant', 'status_id');
foreach ($status as $id => $name) {
- $stats[$id] = array(
+ $stats[$id] = [
'label' => $name,
'total' => 0,
- );
+ ];
}
while ($dao->fetch()) {
- $stats[$dao->status_id] = array(
+ $stats[$dao->status_id] = [
'label' => $status[$dao->status_id],
'total' => $dao->status_total,
- );
+ ];
$summary['total_grants'] += $dao->status_total;
}
*/
public static function getGrantStatusOptGroup() {
- $params = array();
+ $params = [];
$params['name'] = CRM_Grant_BAO_Grant::$statusGroupName;
- $defaults = array();
+ $defaults = [];
$og = CRM_Core_BAO_OptionGroup::retrieve($params, $defaults);
if (!$og) {
}
// first clean up all the money fields
- $moneyFields = array(
+ $moneyFields = [
'amount_total',
'amount_granted',
'amount_requested',
- );
+ ];
foreach ($moneyFields as $field) {
if (isset($params[$field])) {
$params[$field] = CRM_Utils_Rule::cleanMoney($params[$field]);
}
}
// convert dates to mysql format
- $dates = array(
+ $dates = [
'application_received_date',
'decision_date',
'money_transfer_date',
'grant_due_date',
- );
+ ];
foreach ($dates as $d) {
if (isset($params[$d])) {
}
$title = CRM_Contact_BAO_Contact::displayName($grant->contact_id) . ' - ' . ts('Grant') . ': ' . $grantTypes[$grant->grant_type_id];
- $recentOther = array();
+ $recentOther = [];
if (CRM_Core_Permission::checkActionPermission('CiviGrant', CRM_Core_Action::UPDATE)) {
$recentOther['editUrl'] = CRM_Utils_System::url('civicrm/contact/view/grant',
"action=update&reset=1&id={$grant->id}&cid={$grant->contact_id}&context=home"
$id = CRM_Utils_Array::value('contact_id', $params);
}
if (!empty($params['note']) || CRM_Utils_Array::value('id', CRM_Utils_Array::value('note', $ids))) {
- $noteParams = array(
+ $noteParams = [
'entity_table' => 'civicrm_grant',
'note' => $params['note'] = $params['note'] ? $params['note'] : "null",
'entity_id' => $grant->id,
'contact_id' => $id,
'modified_date' => date('Ymd'),
- );
+ ];
CRM_Core_BAO_Note::add($noteParams, (array) CRM_Utils_Array::value('note', $ids));
}
// Log the information on successful add/edit of Grant
- $logParams = array(
+ $logParams = [
'entity_table' => 'civicrm_grant',
'entity_id' => $grant->id,
'modified_id' => $id,
'modified_date' => date('Ymd'),
- );
+ ];
CRM_Core_BAO_Log::add($logParams);
$grant->find();
// delete the recently created Grant
- $grantRecent = array(
+ $grantRecent = [
'id' => $id,
'type' => 'Grant',
- );
+ ];
CRM_Utils_Recent::del($grantRecent);
if ($grant->fetch()) {
*/
public static function &exportableFields() {
$fields = CRM_Grant_DAO_Grant::export();
- $grantNote = array(
- 'grant_note' => array(
+ $grantNote = [
+ 'grant_note' => [
'title' => ts('Grant Note'),
'name' => 'grant_note',
'data_type' => CRM_Utils_Type::T_TEXT,
- ),
- );
+ ],
+ ];
$fields = array_merge($fields, $grantNote,
CRM_Core_BAO_CustomField::getFieldsForImport('Grant')
);