* Are we operating in "single mode", i.e. updating the task of only
* one specific contribution?
*
- * @var boolean
+ * @var bool
*/
public $_single = FALSE;
);
if ($id) {
- $this->_contributionIds = array($id);
+ $this->_contributionIds = [$id];
$this->_componentClause = " civicrm_contribution.id IN ( $id ) ";
$this->_single = TRUE;
$this->assign('totalSelectedContributions', 1);
);
// build a row for each contribution id
- $this->_rows = array();
+ $this->_rows = [];
$attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution');
- $defaults = array();
+ $defaults = [];
$now = date("Y-m-d");
- $paidByOptions = array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument();
+ $paidByOptions = ['' => ts('- select -')] + CRM_Contribute_PseudoConstant::paymentInstrument();
while ($dao->fetch()) {
$row['contact_id'] = $dao->contact_id;
$this->addRule("trxn_id_{$row['contribution_id']}",
ts('This Transaction ID already exists in the database. Include the account number for checks.'),
'objectExists',
- array('CRM_Contribute_DAO_Contribution', $dao->contribution_id, 'trxn_id')
+ ['CRM_Contribute_DAO_Contribution', $dao->contribution_id, 'trxn_id']
);
$row['fee_amount'] = &$this->add('text', "fee_amount_{$row['contribution_id']}", ts('Fee Amount'),
$this->addRule("fee_amount_{$row['contribution_id']}", ts('Please enter a valid amount.'), 'money');
$defaults["fee_amount_{$row['contribution_id']}"] = 0.0;
- $row['trxn_date'] = $this->add('datepicker', "trxn_date_{$row['contribution_id']}", [], FALSE,
- ts('Receipt Date'), array('time' => FALSE)
- );
+ $row['trxn_date'] = $this->add('datepicker', "trxn_date_{$row['contribution_id']}", ts('Transaction Date'), [], FALSE, ['time' => FALSE]);
$defaults["trxn_date_{$row['contribution_id']}"] = $now;
$this->add("text", "check_number_{$row['contribution_id']}", ts('Check Number'));
$this->assign_by_ref('rows', $this->_rows);
$this->setDefaults($defaults);
- $this->addButtons(array(
- array(
- 'type' => 'next',
- 'name' => ts('Update Pending Status'),
- 'isDefault' => TRUE,
- ),
- array(
- 'type' => 'back',
- 'name' => ts('Cancel'),
- ),
- )
- );
-
- $this->addFormRule(array('CRM_Contribute_Form_Task_Status', 'formRule'));
+ $this->addButtons([
+ [
+ 'type' => 'next',
+ 'name' => ts('Update Pending Status'),
+ 'isDefault' => TRUE,
+ ],
+ [
+ 'type' => 'back',
+ 'name' => ts('Cancel'),
+ ],
+ ]);
+
+ $this->addFormRule(['CRM_Contribute_Form_Task_Status', 'formRule']);
}
/**
* list of errors to be posted back to the form
*/
public static function formRule($fields) {
- $seen = $errors = array();
+ $seen = $errors = [];
foreach ($fields as $name => $value) {
if (strpos($name, 'trxn_id_') !== FALSE) {
if ($fields[$name]) {
// for each contribution id, we just call the baseIPN stuff
foreach ($form->_rows as $row) {
- $input = $ids = $objects = array();
+ $input = $ids = $objects = [];
$input['component'] = $details[$row['contribution_id']]['component'];
$ids['contact'] = $row['contact_id'];
else {
$input['trxn_id'] = $contribution->invoice_id;
}
- $input['trxn_date'] = CRM_Utils_Date::processDate($params["trxn_date_{$row['contribution_id']}"], date('H:i:s'));
+ $input['trxn_date'] = $params["trxn_date_{$row['contribution_id']}"] . ' ' . date('H:i:s');
// @todo calling baseIPN like this is a pattern in it's last gasps. Call contribute.completetransaction api.
$baseIPN->completeTransaction($input, $ids, $objects, $transaction, FALSE);
LEFT JOIN civicrm_participant p ON pp.participant_id = p.id
WHERE c.id IN ( $contributionIDs )";
- $rows = array();
+ $rows = [];
$dao = CRM_Core_DAO::executeQuery($query,
CRM_Core_DAO::$_nullArray
);
$rows[$dao->contribution_id]['contact'] = $dao->contact_id;
if ($dao->membership_id) {
if (!array_key_exists('membership', $rows[$dao->contribution_id])) {
- $rows[$dao->contribution_id]['membership'] = array();
+ $rows[$dao->contribution_id]['membership'] = [];
}
$rows[$dao->contribution_id]['membership'][] = $dao->membership_id;
}