$isRecalculatePledgePayment = self::isPaymentsRequireRecalculation($params);
$transaction = new CRM_Core_Transaction();
- $paymentParams = array();
+ $paymentParams = [];
if (!empty($params['installment_amount'])) {
$params['amount'] = $params['installment_amount'] * $params['installments'];
}
}
}
}
- $paymentParams['status_id'] = CRM_Utils_Array::value('status_id', $params);
+ $paymentParams['status_id'] = $params['status_id'] ?? NULL;
$pledge = self::add($params);
if (is_a($pledge, 'CRM_Core_Error')) {
'actual_amount',
);
foreach ($paymentKeys as $key) {
- $paymentParams[$key] = CRM_Utils_Array::value($key, $params, NULL);
+ $paymentParams[$key] = $params[$key] ?? NULL;
}
CRM_Pledge_BAO_PledgePayment::create($paymentParams);
}
"action=view&reset=1&id={$pledge->id}&cid={$pledge->contact_id}&context=home"
);
- $recentOther = array();
+ $recentOther = [];
if (CRM_Core_Permission::checkActionPermission('CiviPledge', CRM_Core_Action::UPDATE)) {
$recentOther['editUrl'] = CRM_Utils_System::url('civicrm/contact/view/pledge',
"action=update&reset=1&id={$pledge->id}&cid={$pledge->contact_id}&context=home"
* @return array|null
*/
public static function getTotalAmountAndCount($status = NULL, $startDate = NULL, $endDate = NULL) {
- $where = array();
+ $where = [];
$select = $from = $queryDate = NULL;
$statusId = CRM_Core_PseudoConstant::getKey('CRM_Pledge_BAO_Pledge', 'status_id', $status);
$start = substr($startDate, 0, 8);
$end = substr($endDate, 0, 8);
$pCount = 0;
- $pamount = array();
+ $pamount = [];
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
$pCount += $dao->pledge_count;
),
);
- $where = array();
+ $where = [];
switch ($status) {
case 'Completed':
$select = 'sum( total_amount ) as received_pledge , count( cd.id ) as received_count';
";
if ($select) {
$dao = CRM_Core_DAO::executeQuery($query);
- $amount = array();
+ $amount = [];
$count = 0;
while ($dao->fetch()) {
* return the list of pledge fields
*/
public static function getHonorContacts($honorId) {
- $params = array();
+ $params = [];
$honorDAO = new CRM_Contribute_DAO_ContributionSoft();
$honorDAO->contact_id = $honorId;
$honorDAO->find();
*/
public static function sendAcknowledgment(&$form, $params) {
//handle Acknowledgment.
- $allPayments = $payments = array();
+ $allPayments = $payments = [];
// get All Payments status types.
$paymentStatusTypes = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
if (!empty($allPayments)) {
foreach ($allPayments as $payID => $values) {
- $contributionValue = $contributionStatus = array();
+ $contributionValue = $contributionStatus = [];
if (isset($values['contribution_id'])) {
$contributionParams = array('id' => $values['contribution_id']);
$returnProperties = array('contribution_status_id', 'receive_date');
'domain' => array('name', 'phone', 'address', 'email'),
'contact' => CRM_Core_SelectValues::contactTokens(),
);
- $domainValues = array();
+ $domainValues = [];
foreach ($tokens['domain'] as $token) {
$domainValues[$token] = CRM_Utils_Token::getDomainTokenReplacement($token, $domain);
}
if (!empty($params['hidden_custom'])) {
$groupTree = CRM_Core_BAO_CustomGroup::getTree('Pledge', NULL, $params['id']);
$pledgeParams = array(array('pledge_id', '=', $params['id'], 0, 0));
- $customGroup = array();
+ $customGroup = [];
// retrieve custom data
foreach ($groupTree as $groupID => $group) {
- $customFields = $customValues = array();
+ $customFields = $customValues = [];
if ($groupID == 'info') {
continue;
}
// check for online pledge.
if (!empty($params['receipt_from_email'])) {
- $userName = CRM_Utils_Array::value('receipt_from_name', $params);
- $userEmail = CRM_Utils_Array::value('receipt_from_email', $params);
+ $userName = $params['receipt_from_name'] ?? NULL;
+ $userEmail = $params['receipt_from_email'] ?? NULL;
}
elseif (!empty($params['from_email_id'])) {
$receiptFrom = $params['from_email_id'];
}
else {
// set the domain values.
- $userName = CRM_Utils_Array::value('name', $domainValues);
- $userEmail = CRM_Utils_Array::value('email', $domainValues);
+ $userName = $domainValues['name'] ?? NULL;
+ $userEmail = $domainValues['email'] ?? NULL;
}
if (!isset($receiptFrom)) {
public static function exportableFields($checkPermission = TRUE) {
if (!self::$_exportableFields) {
if (!self::$_exportableFields) {
- self::$_exportableFields = array();
+ self::$_exportableFields = [];
}
$fields = CRM_Pledge_DAO_Pledge::export();
* associated array of pledge id(s)
*/
public static function getContactPledges($contactID) {
- $pledgeDetails = array();
+ $pledgeDetails = [];
$pledgeStatuses = CRM_Core_OptionGroup::values('pledge_status',
FALSE, FALSE, FALSE, NULL, 'name'
);
- $status = array();
+ $status = [];
// get pending and in progress status
foreach (array(
*/
public static function updatePledgeStatus($params) {
- $returnMessages = array();
+ $returnMessages = [];
$sendReminders = CRM_Utils_Array::value('send_reminders', $params, FALSE);
$dao = CRM_Core_DAO::executeQuery($query);
$now = date('Ymd');
- $pledgeDetails = $contactIds = $pledgePayments = $pledgeStatus = array();
+ $pledgeDetails = $contactIds = $pledgePayments = $pledgeStatus = [];
while ($dao->fetch()) {
$checksumValue = CRM_Contact_BAO_Contact_Utils::generateChecksum($dao->contact_id);
'contact' => CRM_Core_SelectValues::contactTokens(),
);
- $domainValues = array();
+ $domainValues = [];
foreach ($tokens['domain'] as $token) {
$domainValues[$token] = CRM_Utils_Token::getDomainTokenReplacement($token, $domain);
}
));
$paymentDAO->find();
- $paymentIDs = array();
+ $paymentIDs = [];
while ($paymentDAO->fetch()) {
$paymentIDs[] = $paymentDAO->id;
}
*
* @return array|bool
*/
- public static function buildOptions($fieldName, $context = NULL, $props = array()) {
+ public static function buildOptions($fieldName, $context = NULL, $props = []) {
$result = parent::buildOptions($fieldName, $context, $props);
if ($fieldName == 'status_id') {
$result = array_diff($result, array('Failed'));