+--------------------------------------------------------------------+
*/
-use Civi\ActionSchedule\RecipientBuilder;
/**
* Class CRM_Contribute_ActionMapping_ByPage
+--------------------------------------------------------------------+
*/
-use Civi\ActionSchedule\RecipientBuilder;
/**
* Class CRM_Contribute_ActionMapping_ByType
*
* @var array
*/
- static $_importableFields = NULL;
+ public static $_importableFields = NULL;
/**
* Static field for all the contribution information that we can potentially export
*
* @var array
*/
- static $_exportableFields = NULL;
+ public static $_exportableFields = NULL;
/**
* Static field to hold financial trxn id's.
*
* @var array
*/
- static $_trxnIDs = NULL;
+ public static $_trxnIDs = NULL;
/**
* Field for all the objects related to this contribution
return $contribution;
}
- $null = NULL; // return by reference
+ // return by reference
+ $null = NULL;
return $null;
}
// as they would then me membership.contact_id, membership.is_test etc
return civicrm_api3('Membership', 'get', [
'id' => ['IN' => $membershipIDs],
- 'return' => ['id', 'contact_id', 'membership_type_id', 'is_test']
+ 'return' => ['id', 'contact_id', 'membership_type_id', 'is_test'],
])['values'];
}
}
else {
$whereClauses['financial_type_id'] = [
- 'IN (' . implode(',', array_keys($types)) . ')'
+ 'IN (' . implode(',', array_keys($types)) . ')',
];
}
return $whereClauses;
'subject' => ts('Payment failed at payment processor'),
'source_record_id' => $contributionID,
'source_contact_id' => CRM_Core_Session::getLoggedInContactID() ? CRM_Core_Session::getLoggedInContactID() :
- $contactID,
+ $contactID,
));
// CRM-20336 Make sure that the contribution status is Failed, not Pending.
return FALSE;
}
-
/**
* Function to record additional payment for partial and refund contributions.
*
* Line items.
* @param bool $isARefund
* Is this a refund / negative transaction.
+ * @param int $previousLineItemTotal
*
* @return float
*/
* @param float $balance
* @param string $contributionStatus
*
- * @return array $actionLinks Links array containing:
- * -url
- * -title
+ * @return array
+ * $actionLinks Links array containing:
+ * -url
+ * -title
*/
protected static function getContributionPaymentLinks($id, $balance, $contributionStatus) {
if ($contributionStatus === 'Failed' || !CRM_Core_Permission::check('edit contributions')) {
$clauses = [];
foreach ($whereClauses as $key => $clause) {
- $clauses[] = 'b.' . $key . " " . implode(' AND b.' . $key, (array) $clause);
+ $clauses[] = 'b.' . $key . " " . implode(' AND b.' . $key, (array) $clause);
}
$whereClauseString = implode(' AND ', $clauses);
1 => $form->_id,
2 => $contributionParams['source'],
]),
- 220 // eventually activity.description append price information to source text so keep it 220 to ensure string length doesn't exceed 255 characters.
+ // eventually activity.description append price information to source text so keep it 220 to ensure string length doesn't exceed 255 characters.
+ 220
);
}
*
* @return bool
*/
- static protected function isPaymentTransaction($form) {
+ protected static function isPaymentTransaction($form) {
return ($form->_amount >= 0.0) ? TRUE : FALSE;
}
* @param int $id
* Contribution ID
*
- * @return array $statuses
+ * @return array
* Array of contribution statuses in array('status id' => 'label') format
*/
public static function getContributionStatuses($usedFor = 'contribution', $id = NULL) {
*/
public static function getIsMembershipPayment($id) {
$membershipBlocks = civicrm_api3('membership_block', 'get', [
- 'entity_table' => 'civicrm_contribution_page',
- 'entity_id' => $id,
- 'sequential' => TRUE,
- ]);
+ 'entity_table' => 'civicrm_contribution_page',
+ 'entity_id' => $id,
+ 'sequential' => TRUE,
+ ]);
if (!$membershipBlocks['count']) {
return FALSE;
}
return CRM_Financial_BAO_PaymentProcessor::getPayment($paymentProcessorID);
}
-
/**
* Get the processor object for the recurring contribution record.
*
public static function getPaymentProcessorID($recurID) {
$recur = civicrm_api3('ContributionRecur', 'getsingle', [
'id' => $recurID,
- 'return' => ['payment_processor_id']
+ 'return' => ['payment_processor_id'],
]);
return (int) CRM_Utils_Array::value('payment_processor_id', $recur, 0);
}
}
else {
$details .= '<br/>' . ts('The recurring contribution of %1, every %2 %3 has been cancelled.', [
- 1 => $dao->amount,
- 2 => $dao->frequency_interval,
- 3 => $dao->frequency_unit,
- ]);
+ 1 => $dao->amount,
+ 2 => $dao->frequency_interval,
+ 3 => $dao->frequency_unit,
+ ]);
}
$activityParams = [
'source_contact_id' => $dao->contact_id,
* @param int $recurId
* @param int $targetContributionId
*/
- static public function copyCustomValues($recurId, $targetContributionId) {
+ public static function copyCustomValues($recurId, $targetContributionId) {
if ($recurId && $targetContributionId) {
// get the initial contribution id of recur id
$sourceContributionId = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $recurId, 'id', 'contribution_recur_id');
* Payment status - this correlates to the machine name of the contribution status ID ie
* - Completed
* - Failed
+ * @param string $effectiveDate
*
* @throws \CiviCRM_API3_Exception
*/
*/
public static function calculateRecurLineItems($recurId, $total_amount, $financial_type_id) {
$originalContribution = civicrm_api3('Contribution', 'getsingle', [
- 'contribution_recur_id' => $recurId,
- 'contribution_test' => '',
- 'options' => ['limit' => 1],
- 'return' => ['id', 'financial_type_id'],
+ 'contribution_recur_id' => $recurId,
+ 'contribution_test' => '',
+ 'options' => ['limit' => 1],
+ 'return' => ['id', 'financial_type_id'],
]);
$lineItems = CRM_Price_BAO_LineItem::getLineItemsByContributionID($originalContribution['id']);
$lineSets = [];
/**
* Static holder for the default LT.
+ * @var int
*/
- static $_defaultContributionType = NULL;
+ public static $_defaultContributionType = NULL;
/**
* Class constructor.
*/
class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query {
- static $_contribOrSoftCredit = "only_contribs";
+ public static $_contribOrSoftCredit = "only_contribs";
- static $_contribRecurPayment = NULL;
+ public static $_contribRecurPayment = NULL;
/**
* Function get the searchable fields for contribution.
FALSE, [
'class' => 'crm-select2',
'multiple' => 'multiple',
- 'placeholder' => ts('- any -')
+ 'placeholder' => ts('- any -'),
]
);
}
$now = time();
if ($dao->start_date) {
$startDate = CRM_Utils_Date::unixTime($dao->start_date);
- if ($startDate &&
- $startDate >= $now
- ) {
+ if ($startDate && $startDate >= $now) {
$data['is_active'] = FALSE;
$data['campaign_start'] = ts('Campaign starts on %1', [
- 1 => CRM_Utils_Date::customFormat($dao->start_date, $config->dateformatFull),
- ]
- );
+ 1 => CRM_Utils_Date::customFormat($dao->start_date, $config->dateformatFull),
+ ]);
}
}
$data['money_raised_percentage'] = (round($percent, 2)) * 100 . "%";
$data['money_target_display'] = CRM_Utils_Money::format($data['money_target']);
$data['money_raised'] = ts('Raised %1 of %2', [
- 1 => CRM_Utils_Money::format($data['money_raised']),
- 2 => $data['money_target_display'],
- ]);
+ 1 => CRM_Utils_Money::format($data['money_raised']),
+ 2 => $data['money_target_display'],
+ ]);
}
else {
$data['money_raised'] = ts('Raised %1', [1 => CRM_Utils_Money::format($data['money_raised'])]);
/**
* The contribution values if an existing contribution
+ * @var array
*/
public $_values;
/**
* The pledge values if this contribution is associated with pledge
+ * @var array
*/
public $_pledgeValues;
/**
* Store the line items if price set used.
+ * @var array
*/
public $_lineItems;
* These should get a standardised format in the beginPostProcess function.
*
* These fields are common to many forms. Some may override this.
+ * @var array
*/
protected $submittableMoneyFields = ['total_amount', 'net_amount', 'non_deductible_amount', 'fee_amount'];
}
}
-
/**
* Assign the values to build the payment info block.
*
- * @return string $title
+ * @return string
* Block title.
*/
protected function assignPaymentInfoBlock() {
/**
* Id of the component entity
+ * @var int
*/
public $_id = NULL;
protected $_refund = NULL;
/**
- * @deprecated - use parent $this->contactID
- *
* @var int
+ * @deprecated - use parent $this->contactID
*/
protected $_contactId = NULL;
* @return array
* reference to the array of default values
*/
+
/**
* @return array
*/
public function buildQuickForm() {
if ($this->_view == 'transaction' && ($this->_action & CRM_Core_Action::BROWSE)) {
$this->addButtons([
- [
- 'type' => 'cancel',
- 'name' => ts('Done'),
- 'spacing' => ' ',
- 'isDefault' => TRUE,
- ],
- ]
- );
+ [
+ 'type' => 'cancel',
+ 'name' => ts('Done'),
+ 'spacing' => ' ',
+ 'isDefault' => TRUE,
+ ],
+ ]);
return;
}
$buttonName = $this->_refund ? 'Record Refund' : 'Record Payment';
$this->addButtons([
- [
- 'type' => 'upload',
- 'name' => ts('%1', [1 => $buttonName]),
- 'js' => $js,
- 'isDefault' => TRUE,
- ],
- [
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ],
- ]
- );
+ [
+ 'type' => 'upload',
+ 'name' => ts('%1', [1 => $buttonName]),
+ 'js' => $js,
+ 'isDefault' => TRUE,
+ ],
+ [
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
+ ],
+ ]);
$mailingInfo = Civi::settings()->get('mailing_backend');
$this->assign('outBound_option', $mailingInfo['outBound_option']);
}
$this->addButtons([
- [
- 'type' => $type,
- 'name' => $cancelButton,
- 'spacing' => ' ',
- 'isDefault' => TRUE,
- ],
- [
- 'type' => 'cancel',
- 'name' => ts('Not Now'),
- ],
- ]
- );
+ [
+ 'type' => $type,
+ 'name' => $cancelButton,
+ 'spacing' => ' ',
+ 'isDefault' => TRUE,
+ ],
+ [
+ 'type' => 'cancel',
+ 'name' => ts('Not Now'),
+ ],
+ ]);
}
/**
/**
* The contribution values if an existing contribution
+ * @var array
*/
public $_values;
/**
* The pledge values if this contribution is associated with pledge
+ * @var array
*/
public $_pledgeValues;
/**
* Parameter with confusing name.
- * @todo what is it?
* @var string
+ * @todo what is it?
*/
public $_compContext;
/**
* Store the line items if price set used.
+ * @var array
*/
public $_lineItems;
/**
* Line item
- * @todo explain why we use lineItem & lineItems
* @var array
+ * @todo explain why we use lineItem & lineItems
*/
public $_lineItem;
public function buildQuickForm() {
if ($this->_action & CRM_Core_Action::DELETE) {
$this->addButtons([
- [
- 'type' => 'next',
- 'name' => ts('Delete'),
- 'spacing' => ' ',
- 'isDefault' => TRUE,
- ],
- [
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ],
- ]
- );
+ [
+ 'type' => 'next',
+ 'name' => ts('Delete'),
+ 'spacing' => ' ',
+ 'isDefault' => TRUE,
+ ],
+ [
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
+ ],
+ ]);
return;
}
if ($this->_context == 'standalone') {
$this->addEntityRef('contact_id', ts('Contact'), [
- 'create' => TRUE,
- 'api' => ['extra' => ['email']],
- ], TRUE);
+ 'create' => TRUE,
+ 'api' => ['extra' => ['email']],
+ ], TRUE);
}
$attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution');
$this->assign('outBound_option', $mailingInfo['outBound_option']);
$this->addButtons([
- [
- 'type' => 'upload',
- 'name' => ts('Save'),
- 'js' => $js,
- 'isDefault' => TRUE,
- ],
- [
- 'type' => 'upload',
- 'name' => ts('Save and New'),
- 'js' => $js,
- 'subName' => 'new',
- ],
- [
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ],
- ]
- );
+ [
+ 'type' => 'upload',
+ 'name' => ts('Save'),
+ 'js' => $js,
+ 'isDefault' => TRUE,
+ ],
+ [
+ 'type' => 'upload',
+ 'name' => ts('Save and New'),
+ 'js' => $js,
+ 'subName' => 'new',
+ ],
+ [
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
+ ],
+ ]);
// if contribution is related to membership or participant freeze Financial Type, Amount
if ($this->_id) {
// no on behalf of an organization, CRM-5519
// so reset loc blocks from main params.
foreach ([
- 'phone',
- 'email',
- 'address',
- ] as $blk) {
+ 'phone',
+ 'email',
+ 'address',
+ ] as $blk) {
if (isset($this->_params[$blk])) {
unset($this->_params[$blk]);
}
$this->getPaymentProcessorObject()->getText('contributionPageContinueText', [
'is_payment_to_existing' => !empty($this->_ccid),
'amount' => $this->_amount,
- ]
- )
+ ])
);
$this->addButtons([
- [
- 'type' => 'next',
- 'name' => $contribButton,
- 'spacing' => ' ',
- 'isDefault' => TRUE,
- 'js' => ['onclick' => "return submitOnce(this,'" . $this->_name . "','" . ts('Processing') . "');"],
- ],
- [
- 'type' => 'back',
- 'name' => ts('Go Back'),
- ],
- ]
- );
+ [
+ 'type' => 'next',
+ 'name' => $contribButton,
+ 'spacing' => ' ',
+ 'isDefault' => TRUE,
+ 'js' => ['onclick' => "return submitOnce(this,'" . $this->_name . "','" . ts('Processing') . "');"],
+ ],
+ [
+ 'type' => 'back',
+ 'name' => ts('Go Back'),
+ ],
+ ]);
$defaults = [];
$fields = array_fill_keys(array_keys($this->_fields), 1);
if (isset($contact[$name]) && is_array($contact[$name]) && ($name == 'onbehalf' || $name == 'honor')) {
foreach ($contact[$name] as $fieldName => $fieldValue) {
if (is_array($fieldValue) && !in_array($this->_fields[$name][$fieldName]['html_type'], [
- 'Multi-Select',
- 'AdvMulti-Select',
- ])
+ 'Multi-Select',
+ 'AdvMulti-Select',
+ ])
) {
foreach ($fieldValue as $key => $value) {
$defaults["{$name}[{$fieldName}][{$key}]"] = $value;
}
}
elseif (in_array($name, [
- 'addressee',
- 'email_greeting',
- 'postal_greeting',
- ]) && !empty($contact[$name . '_custom'])
+ 'addressee',
+ 'email_greeting',
+ 'postal_greeting',
+ ]) && !empty($contact[$name . '_custom'])
) {
$defaults[$name . '_custom'] = $contact[$name . '_custom'];
}
$params['pcp_is_anonymous'] = 0;
}
foreach ([
- 'pcp_display_in_roll',
- 'pcp_is_anonymous',
- 'pcp_roll_nickname',
- 'pcp_personal_note',
- ] as $val) {
+ 'pcp_display_in_roll',
+ 'pcp_is_anonymous',
+ 'pcp_roll_nickname',
+ 'pcp_personal_note',
+ ] as $val) {
if (!empty($params[$val])) {
$page->assign($val, $params[$val]);
}
/**
* Define default MembershipType Id.
+ * @var int
*/
public $_defaultMemTypeId;
CRM_Price_BAO_PriceSet::setDefaultPriceSetField($priceFieldName, $keys, $val['html_type'], $this->_defaults);
$memtypeID = $selectedCurrentMemTypes[] = $values['membership_type_id'];
}
- elseif (!empty($values['is_default']) &&
- !$opMemTypeId &&
- (!isset($this->_defaults[$priceFieldName]) ||
- ($val['html_type'] == 'CheckBox' &&
- !isset($this->_defaults[$priceFieldName][$keys]))
- )) {
- CRM_Price_BAO_PriceSet::setDefaultPriceSetField($priceFieldName, $keys, $val['html_type'], $this->_defaults);
- $memtypeID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $this->_defaults[$priceFieldName], 'membership_type_id');
+ elseif (!empty($values['is_default']) && !$opMemTypeId && (!isset($this->_defaults[$priceFieldName]) ||
+ ($val['html_type'] == 'CheckBox' && !isset($this->_defaults[$priceFieldName][$keys])))) {
+ CRM_Price_BAO_PriceSet::setDefaultPriceSetField($priceFieldName, $keys, $val['html_type'], $this->_defaults);
+ $memtypeID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $this->_defaults[$priceFieldName], 'membership_type_id');
}
}
}
/**
* Membership price set status.
+ * @var bool
*/
public $_useForMember;
/**
* Tranxaaction Id of the current contribution
+ * @var string
*/
public $_trxnId;
$qParams .= "&pcpId={$this->_pcpId}";
$this->assign('pcpBlock', TRUE);
foreach ([
- 'pcp_display_in_roll',
- 'pcp_is_anonymous',
- 'pcp_roll_nickname',
- 'pcp_personal_note',
- ] as $val) {
+ 'pcp_display_in_roll',
+ 'pcp_is_anonymous',
+ 'pcp_roll_nickname',
+ 'pcp_personal_note',
+ ] as $val) {
if (!empty($this->_params[$val])) {
$this->assign($val, $this->_params[$val]);
}
}
}
elseif (in_array($name, [
- 'addressee',
- 'email_greeting',
- 'postal_greeting',
- ]) && !empty($contact[$name . '_custom'])
+ 'addressee',
+ 'email_greeting',
+ 'postal_greeting',
+ ]) && !empty($contact[$name . '_custom'])
) {
$defaults[$name . '_custom'] = $contact[$name . '_custom'];
}
public $_useForMember;
/**
+ * @var bool
* @deprecated
- *
- * @var
*/
public $_isBillingAddressRequiredForPayLater;
}
}
-
/**
* Get the payment processor object for the submission, returning the manual one for offline payments.
*
//p3 = Three dimensional pie chart.
//bvg = Vertical bar chart
$this->addElement('select', 'chart_type', ts('Chart Style'), [
- 'bvg' => ts('Bar'),
- 'p3' => ts('Pie'),
- ]
- );
+ 'bvg' => ts('Bar'),
+ 'p3' => ts('Pie'),
+ ]);
$defaultValues['chart_type'] = $this->_chartType;
$this->setDefaults($defaultValues);
*
* @return string
*/
+
/**
* @return string
*/
$dao->fetch();
$defaults['weight'] = $dao->max_weight + 1;
}
- RETURN $defaults;
+ return $defaults;
}
/**
}
$this->addButtons([
- [
- 'type' => 'next',
- 'name' => ts('Delete'),
- 'spacing' => ' ',
- 'isDefault' => TRUE,
- ],
- [
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ],
- ]
- );
+ [
+ 'type' => 'next',
+ 'name' => ts('Delete'),
+ 'spacing' => ' ',
+ 'isDefault' => TRUE,
+ ],
+ [
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
+ ],
+ ]);
return;
}
if ($this->_action & CRM_Core_Action::PREVIEW) {
CRM_Contribute_BAO_Premium::buildPremiumPreviewBlock($this, NULL, $this->_pid);
$this->addButtons([
- [
- 'type' => 'next',
- 'name' => ts('Done with Preview'),
- 'isDefault' => TRUE,
- ],
- ]
- );
+ [
+ 'type' => 'next',
+ 'name' => ts('Done with Preview'),
+ 'isDefault' => TRUE,
+ ],
+ ]);
return;
}
if ($this->_single) {
$this->addButtons([
- [
- 'type' => 'next',
- 'name' => ts('Save'),
- 'spacing' => ' ',
- 'isDefault' => TRUE,
- ],
- [
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ],
- ]
- );
+ [
+ 'type' => 'next',
+ 'name' => ts('Save'),
+ 'spacing' => ' ',
+ 'isDefault' => TRUE,
+ ],
+ [
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
+ ],
+ ]);
}
else {
parent::buildQuickForm();
$options = $pFIDs = [];
$priceFieldParams = ['price_set_id' => $priceSetId];
$priceFields = CRM_Core_DAO::commonRetrieveAll('CRM_Price_DAO_PriceField', 'price_set_id', $priceSetId, $pFIDs, $return = [
- 'html_type',
- 'name',
- 'is_active',
- 'label',
- ]);
+ 'html_type',
+ 'name',
+ 'is_active',
+ 'label',
+ ]);
foreach ($priceFields as $priceField) {
if ($priceField['id'] && $priceField['html_type'] == 'Radio' && $priceField['name'] == 'contribution_amount') {
$defaults['price_field_id'] = $priceField['id'];
/**
* Check if there are any related contributions.
+ * @var bool
*/
protected $_relatedContributions;
];
$allowCoreTypes = array_merge([
- 'Contact',
- 'Individual',
- 'Organization',
- 'Household',
- ], CRM_Contact_BAO_ContactType::subTypes('Individual'));
+ 'Contact',
+ 'Individual',
+ 'Organization',
+ 'Household',
+ ], CRM_Contact_BAO_ContactType::subTypes('Individual'));
$allowSubTypes = [];
$this->addProfileSelector('honoree_profile', ts('Honoree Profile'), $allowCoreTypes, $allowSubTypes, $entities);
* Helper class to build navigation links.
*/
class CRM_Contribute_Form_ContributionPage_TabHeader {
+
/**
* @param CRM_Core_Form $form
*
*
* @param int $id
*
- * @return string $title
+ * @return string
* Block title.
*/
protected function assignPaymentInfoBlock($id) {
$this->applyFilter('__ALL__', 'trim');
$this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'name'), TRUE);
$this->addRule('name', ts('A product with this name already exists. Please select another name.'), 'objectExists', [
- 'CRM_Contribute_DAO_Product',
- $this->_id,
- ]);
+ 'CRM_Contribute_DAO_Product',
+ $this->_id,
+ ]);
$this->add('text', 'sku', ts('SKU'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'sku'));
$this->add('textarea', 'description', ts('Description'), 'rows=3, cols=60');
$this->add('textarea', 'options', ts('Options'), 'rows=3, cols=60');
$this->add('select', 'period_type', ts('Period Type'), [
- '' => '- select -',
- 'rolling' => 'Rolling',
- 'fixed' => 'Fixed',
- ]);
+ '' => '- select -',
+ 'rolling' => 'Rolling',
+ 'fixed' => 'Fixed',
+ ]);
$this->add('text', 'fixed_period_start_day', ts('Fixed Period Start Day'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'fixed_period_start_day'));
$this->addFormRule(['CRM_Contribute_Form_ManagePremiums', 'formRule']);
$this->addButtons([
- [
- 'type' => 'upload',
- 'name' => ts('Save'),
- 'isDefault' => TRUE,
- ],
- [
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ],
- ]
- );
+ [
+ 'type' => 'upload',
+ 'name' => ts('Save'),
+ 'isDefault' => TRUE,
+ ],
+ [
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
+ ],
+ ]);
$this->assign('productId', $this->_id);
}
/**
* Prefix for the controller.
+ * @var string
*/
protected $_prefix = "contribute_";
-
/**
* Explicitly declare the entity api name.
*/
}
foreach ([
- 'contribution_amount_low',
- 'contribution_amount_high',
- ] as $f) {
+ 'contribution_amount_low',
+ 'contribution_amount_high',
+ ] as $f) {
if (isset($this->_formValues[$f])) {
$this->_formValues[$f] = CRM_Utils_Rule::cleanMoney($this->_formValues[$f]);
}
$form->addMoney("soft_credit_amount[{$rowNumber}]", ts('Amount'), FALSE, NULL, FALSE);
$form->addSelect("soft_credit_type[{$rowNumber}]", [
- 'entity' => 'contribution_soft',
- 'field' => 'soft_credit_type_id',
- 'label' => ts('Type'),
- ]);
+ 'entity' => 'contribution_soft',
+ 'field' => 'soft_credit_type_id',
+ 'label' => ts('Type'),
+ ]);
if (!empty($form->_softCreditInfo['soft_credit'][$rowNumber]['soft_credit_id'])) {
$form->add('hidden', "soft_credit_id[{$rowNumber}]",
$form->_softCreditInfo['soft_credit'][$rowNumber]['soft_credit_id']);
*/
public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
$this->addButtons([
- [
- 'type' => $nextType,
- 'name' => $title,
- 'isDefault' => TRUE,
- ],
- [
- 'type' => $backType,
- 'name' => ts('Cancel'),
- ],
- ]
- );
+ [
+ 'type' => $nextType,
+ 'name' => $title,
+ 'isDefault' => TRUE,
+ ],
+ [
+ 'type' => $backType,
+ 'name' => ts('Cancel'),
+ ],
+ ]);
}
}
/**
* Maximum profile fields that will be displayed
+ * @var int
*/
protected $_maxFields = 9;
/**
* Variable to store redirect path
+ * @var string
*/
protected $_userContext;
$this->_fields = array_slice($this->_fields, 0, $this->_maxFields);
$this->addButtons([
- [
- 'type' => 'submit',
- 'name' => ts('Update Contribution(s)'),
- 'isDefault' => TRUE,
- ],
- [
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ],
- ]
- );
+ [
+ 'type' => 'submit',
+ 'name' => ts('Update Contribution(s)'),
+ 'isDefault' => TRUE,
+ ],
+ [
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
+ ],
+ ]);
$this->assign('profileTitle', $this->_title);
$this->assign('componentIds', $this->_contributionIds);
'type' => 'back',
'name' => ts('Cancel'),
],
- ]
- );
+ ]);
}
elseif ($count && !empty($this->_contributionIds)) {
CRM_Core_Session::setStatus(ts('1 contribution will not be deleted.', ['plural' => '%count contributions will not be deleted.', 'count' => $count]), ts('Warning'), 'warning');
/**
* Gives all the statues for conribution.
+ * @var int
*/
public $_contributionStatusId;
/**
* Gives the HTML template of PDF Invoice.
+ * @var string
*/
public $_messageInvoice;
/**
* This variable is used to assign parameters for HTML template of PDF Invoice.
+ * @var string
*/
public $_invoiceTemplate;
/**
* Selected output.
+ * @var string
*/
public $_selectedOutput;
]);
$this->addButtons([
- [
- 'type' => 'upload',
- 'name' => $this->_selectedOutput == 'email' ? ts('Send Email') : ts('Process Invoice(s)'),
- 'isDefault' => TRUE,
- ],
- [
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ],
- ]
- );
+ [
+ 'type' => 'upload',
+ 'name' => $this->_selectedOutput == 'email' ? ts('Send Email') : ts('Process Invoice(s)'),
+ 'isDefault' => TRUE,
+ ],
+ [
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
+ ],
+ ]);
}
/**
}
$resultPayments = civicrm_api3('Payment', 'get', [
- 'sequential' => 1,
- 'contribution_id' => $contribID,
+ 'sequential' => 1,
+ 'contribution_id' => $contribID,
]);
$amountPaid = 0;
foreach ($resultPayments['values'] as $singlePayment) {
* For invoices.
*
*/
- static public function addActivities($subject, $contactIds, $fileName, $params) {
+ public static function addActivities($subject, $contactIds, $fileName, $params) {
$session = CRM_Core_Session::singleton();
$userID = $session->get('userID');
$config = CRM_Core_Config::singleton();
* @return string
* Name of file which is in pdf format
*/
- static public function putFile($html, $name = 'Invoice.pdf') {
+ public static function putFile($html, $name = 'Invoice.pdf') {
$options = new Options();
$options->set('isRemoteEnabled', TRUE);
$this->addElement('radio', 'output', NULL, ts('Email Receipts'), 'email_receipt',
[
'onClick' => "document.getElementById('selectPdfFormat').style.display = 'none';
- document.getElementById('selectEmailFrom').style.display = 'block';"]
+ document.getElementById('selectEmailFrom').style.display = 'block';",
+ ]
);
$this->addElement('radio', 'output', NULL, ts('PDF Receipts'), 'pdf_receipt',
[
'onClick' => "document.getElementById('selectPdfFormat').style.display = 'block';
- document.getElementById('selectEmailFrom').style.display = 'none';"]
+ document.getElementById('selectEmailFrom').style.display = 'none';",
+ ]
);
$this->addRule('output', ts('Selection required'), 'required');
$this->add('select', 'from_email_address', ts('From Email'), $this->_fromEmails, FALSE);
$this->addButtons([
- [
- 'type' => 'next',
- 'name' => ts('Process Receipt(s)'),
- 'isDefault' => TRUE,
- ],
- [
- 'type' => 'back',
- 'name' => ts('Cancel'),
- ],
- ]
- );
+ [
+ 'type' => 'next',
+ 'name' => ts('Process Receipt(s)'),
+ 'isDefault' => TRUE,
+ ],
+ [
+ 'type' => 'back',
+ 'name' => ts('Cancel'),
+ ],
+ ]);
}
/**
FROM civicrm_financial_trxn
WHERE trxn_id = %1
LIMIT 1", [
- 1 => [$contribution->trxn_id, 'String']]);
+ 1 => [$contribution->trxn_id, 'String'],
+ ]);
// CRM_Contribute_BAO_Contribution::composeMessageArray expects mysql formatted date
$objects['contribution']->receive_date = CRM_Utils_Date::isoToMysql($objects['contribution']->receive_date);
* array of common elements
*
*/
- static public function getElements($contribIds, $params, $contactIds) {
+ public static function getElements($contribIds, $params, $contactIds) {
$pdfElements = [];
$pdfElements['contribIDs'] = implode(',', $contribIds);
* @return array
* reference to the array of default values
*/
+
/**
* @return array
*/
$this->addElement('select', 'email_options', ts('Print and email options'), $emailOptions, [], "<br/>", FALSE);
$this->addButtons([
- [
- 'type' => 'upload',
- 'name' => ts('Make Thank-you Letters'),
- 'isDefault' => TRUE,
- ],
- [
- 'type' => 'cancel',
- 'name' => ts('Done'),
- ],
- ]
- );
+ [
+ 'type' => 'upload',
+ 'name' => ts('Make Thank-you Letters'),
+ 'isDefault' => TRUE,
+ ],
+ [
+ 'type' => 'cancel',
+ 'name' => ts('Done'),
+ ],
+ ]);
}
$realSeparator = "<br />";
}
}
- $separator = '****~~~~';// a placeholder in case the separator is common in the string - e.g ', '
+ // a placeholder in case the separator is common in the string - e.g ', '
+ $separator = '****~~~~';
$groupBy = $formValues['group_by'];
// skip some contacts ?
/**
* Maximum contributions that should be allowed to update
+ * @var int
*/
protected $_maxContributions = 100;
/**
* Variable to store redirect path
+ * @var string
*/
protected $_userContext;
//validations
if (count($this->_contributionIds) > $this->_maxContributions) {
CRM_Core_Session::setStatus(ts("The maximum number of contributions you can select for Update multiple contributions is %1. You have selected %2. Please select fewer contributions from your search results and try again.", [
- 1 => $this->_maxContributions,
- 2 => count($this->_contributionIds),
- ]), ts('Update multiple records error'), 'error');
+ 1 => $this->_maxContributions,
+ 2 => count($this->_contributionIds),
+ ]), ts('Update multiple records error'), 'error');
$validate = TRUE;
}
// just need to add a javascript to popup the window for printing
//
$this->addButtons([
- [
- 'type' => 'next',
- 'name' => ts('Print Contributions'),
- 'js' => ['onclick' => 'window.print()'],
- 'isDefault' => TRUE,
- ],
- [
- 'type' => 'back',
- 'name' => ts('Done'),
- ],
- ]
- );
+ [
+ 'type' => 'next',
+ 'name' => ts('Print Contributions'),
+ 'js' => ['onclick' => 'window.print()'],
+ 'isDefault' => TRUE,
+ ],
+ [
+ 'type' => 'back',
+ 'name' => ts('Done'),
+ ],
+ ]);
}
/**
*/
public function buildQuickForm() {
$this->addButtons([
- [
- 'type' => 'done',
- 'name' => ts('Done'),
- 'isDefault' => TRUE,
- ],
- ]
- );
+ [
+ 'type' => 'done',
+ 'name' => ts('Done'),
+ 'isDefault' => TRUE,
+ ],
+ ]);
}
}
*/
public function buildQuickForm() {
$this->addButtons([
- [
- 'type' => 'done',
- 'name' => ts('Done'),
- 'isDefault' => TRUE,
- ],
- ]
- );
+ [
+ 'type' => 'done',
+ 'name' => ts('Done'),
+ 'isDefault' => TRUE,
+ ],
+ ]);
}
}
$this->assign_by_ref('rows', $this->_rows);
$this->setDefaults($defaults);
$this->addButtons([
- [
- 'type' => 'next',
- 'name' => ts('Update Pending Status'),
- 'isDefault' => TRUE,
- ],
- [
- 'type' => 'back',
- 'name' => ts('Cancel'),
- ],
- ]
- );
+ [
+ 'type' => 'next',
+ 'name' => ts('Update Pending Status'),
+ 'isDefault' => TRUE,
+ ],
+ [
+ 'type' => 'back',
+ 'name' => ts('Cancel'),
+ ],
+ ]);
$this->addFormRule(['CRM_Contribute_Form_Task_Status', 'formRule']);
}
else {
$input['trxn_id'] = $contribution->invoice_id;
}
- $input['trxn_date'] = $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);
}
$this->addButtons(array(
- array(
- 'type' => $type,
- 'name' => ts('Save'),
- 'isDefault' => TRUE,
- ),
- array(
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ),
- )
- );
+ array(
+ 'type' => $type,
+ 'name' => ts('Save'),
+ 'isDefault' => TRUE,
+ ),
+ array(
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
+ ),
+ ));
CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor, TRUE, TRUE);
$this->addFormRule(array('CRM_Contribute_Form_UpdateBilling', 'formRule'), $this);
// define the buttons
$this->addButtons([
- [
- 'type' => $type,
- 'name' => ts('Save'),
- 'isDefault' => TRUE,
- ],
- [
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ],
- ]
- );
+ [
+ 'type' => $type,
+ 'name' => ts('Save'),
+ 'isDefault' => TRUE,
+ ],
+ [
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
+ ],
+ ]);
}
/**
if ($this->_subscriptionDetails->installments != $params['installments']) {
$message .= "<br /> " . ts("Recurring contribution installments have been updated from %1 to %2 for this subscription.", [
- 1 => $this->_subscriptionDetails->installments,
- 2 => $params['installments'],
- ]) . ' ';
+ 1 => $this->_subscriptionDetails->installments,
+ 2 => $params['installments'],
+ ]) . ' ';
}
$activityParams = [
*/
class CRM_Contribute_Import_Field {
- /**#@+
+ /**
+ * #@+
* @var string
*/
/**
* Name of the field
+ * @var string
*/
public $_name;
/**
* Title of the field to be used in display
+ * @var string
*/
public $_title;
*/
class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField {
-
/**
* Set variables up before form is built.
*/
//modify field title only for update mode. CRM-3245
foreach ([
- 'contribution_id',
- 'invoice_id',
- 'trxn_id',
- ] as $key) {
+ 'contribution_id',
+ 'invoice_id',
+ 'trxn_id',
+ ] as $key) {
$this->_mapperFields[$key] .= ' (match to contribution record)';
$highlightedFields[] = $key;
}
$self->_onDuplicate != CRM_Import_Parser::DUPLICATE_UPDATE
) {
$errors['_qf_default'] .= ts('Missing required contact matching fields.') . " $fieldMessage " . ts('(Sum of all weights should be greater than or equal to threshold: %1).', [
- 1 => $threshold,
- ]) . '<br />';
+ 1 => $threshold,
+ ]) . '<br />';
}
elseif ($self->_onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE &&
!(in_array('invoice_id', $importKeys) || in_array('trxn_id', $importKeys) ||
}
else {
$errors['_qf_default'] .= ts('Missing required field: %1', [
- 1 => $title,
- ]) . '<br />';
+ 1 => $title,
+ ]) . '<br />';
}
}
}
*/
const SOFT_CREDIT = 512, SOFT_CREDIT_ERROR = 1024, PLEDGE_PAYMENT = 2048, PLEDGE_PAYMENT_ERROR = 4096;
+ /**
+ * @var string
+ */
protected $_fileName;
/**
* Imported file size
+ * @var int
*/
protected $_fileSize;
/**
* Seperator being used
+ * @var string
*/
protected $_seperator;
/**
* Total number of lines in file
+ * @var int
*/
protected $_lineCount;
/**
* Running total number of valid soft credit rows
+ * @var int
*/
protected $_validSoftCreditRowCount;
/**
* Running total number of invalid soft credit rows
+ * @var int
*/
protected $_invalidSoftCreditRowCount;
/**
* Running total number of valid pledge payment rows
+ * @var int
*/
protected $_validPledgePaymentRowCount;
/**
* Running total number of invalid pledge payment rows
+ * @var int
*/
protected $_invalidPledgePaymentRowCount;
/**
* Array of pledge payment error lines, bounded by MAX_ERROR
+ * @var array
*/
protected $_pledgePaymentErrors;
/**
* Array of pledge payment error lines, bounded by MAX_ERROR
+ * @var array
*/
protected $_softCreditErrors;
* @param int $mode
* @param int $contactType
* @param int $onDuplicate
+ * @param int $statusID
+ * @param int $totalRowCount
*
* @return mixed
* @throws Exception
if ($this->_invalidRowCount) {
// removed view url for invlaid contacts
$headers = array_merge([
- ts('Line Number'),
- ts('Reason'),
- ],
- $customHeaders
- );
+ ts('Line Number'),
+ ts('Reason'),
+ ], $customHeaders);
$this->_errorFileName = self::errorFileName(self::ERROR);
self::exportCSV($this->_errorFileName, $headers, $this->_errors);
}
if ($this->_invalidPledgePaymentRowCount) {
// removed view url for invlaid contacts
$headers = array_merge([
- ts('Line Number'),
- ts('Reason'),
- ],
- $customHeaders
- );
+ ts('Line Number'),
+ ts('Reason'),
+ ], $customHeaders);
$this->_pledgePaymentErrorsFileName = self::errorFileName(self::PLEDGE_PAYMENT_ERROR);
self::exportCSV($this->_pledgePaymentErrorsFileName, $headers, $this->_pledgePaymentErrors);
}
if ($this->_invalidSoftCreditRowCount) {
// removed view url for invlaid contacts
$headers = array_merge([
- ts('Line Number'),
- ts('Reason'),
- ],
- $customHeaders
- );
+ ts('Line Number'),
+ ts('Reason'),
+ ], $customHeaders);
$this->_softCreditErrorsFileName = self::errorFileName(self::SOFT_CREDIT_ERROR);
self::exportCSV($this->_softCreditErrorsFileName, $headers, $this->_softCreditErrors);
}
if ($this->_conflictCount) {
$headers = array_merge([
- ts('Line Number'),
- ts('Reason'),
- ],
- $customHeaders
- );
+ ts('Line Number'),
+ ts('Reason'),
+ ], $customHeaders);
$this->_conflictFileName = self::errorFileName(self::CONFLICT);
self::exportCSV($this->_conflictFileName, $headers, $this->_conflicts);
}
if ($this->_duplicateCount) {
$headers = array_merge([
- ts('Line Number'),
- ts('View Contribution URL'),
- ],
- $customHeaders
- );
+ ts('Line Number'),
+ ts('View Contribution URL'),
+ ], $customHeaders);
$this->_duplicateFileName = self::errorFileName(self::DUPLICATE);
self::exportCSV($this->_duplicateFileName, $headers, $this->_duplicates);
/**
* Array of successfully imported contribution id's
*
- * @array
+ * @var array
*/
protected $_newContributions;
/**
+ * @var string
* @inheritDoc
*/
protected $keyword = 'contribute';
* @return array
* collection of required component settings
*/
+
/**
* @return array
*/
* list of permissions
* @see CRM_Component_Info::getPermissions
*/
+
/**
* @return array
*/
* collection of required dashboard settings,
* null if no element offered
*/
+
/**
* @return array|null
*/
* collection of required dashboard settings,
* null if no element offered
*/
+
/**
* @return array|null
*/
* collection of required pane settings,
* null if no element offered
*/
+
/**
* @return array|null
*/
* @return array|null
* collection of activity types
*/
+
/**
* @return array|null
*/
* This class contains all the function that are called using AJAX (jQuery)
*/
class CRM_Contribute_Page_AJAX {
+
/**
* Get Soft credit to list in DT
*/
'title' => ts('Test-drive'),
'url' => $urlString,
'qs' => $urlParams . '&action=preview',
- 'fe' => TRUE, // Addresses https://lab.civicrm.org/dev/core/issues/658
+ // Addresses https://lab.civicrm.org/dev/core/issues/658
+ 'fe' => TRUE,
'uniqueName' => 'test_drive',
),
);
*/
class CRM_Contribute_Page_ContributionRecur extends CRM_Core_Page {
- static $_links = NULL;
+ public static $_links = NULL;
public $_permission = NULL;
public $_contactId = NULL;
public $_id = NULL;
//get contribution dates.
$dates = CRM_Contribute_BAO_Contribution::getContributionDates();
foreach ([
- 'now',
- 'yearDate',
- 'monthDate',
- ] as $date) {
+ 'now',
+ 'yearDate',
+ 'monthDate',
+ ] as $date) {
$$date = $dates[$date];
}
// fiscal years end date
*
* @var array
*/
- static $_links = NULL;
+ public static $_links = NULL;
/**
* Get BAO Name.
* @copyright CiviCRM LLC (c) 2004-2019
*/
class CRM_Contribute_Page_PaymentInfo extends CRM_Core_Page {
+
public function preProcess() {
$this->_component = CRM_Utils_Request::retrieve('component', 'String', $this, TRUE);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
*
* @var array
*/
- static $_links = NULL;
- static $_recurLinks = NULL;
+ public static $_links = NULL;
+ public static $_recurLinks = NULL;
public $_permission = NULL;
public $_contactId = NULL;
public $_crid = NULL;
$softCreditTotals['cancel']['count'],
$softCreditTotals['amount'],
$softCreditTotals['avg'],
- $softCreditTotals['cancel']['amount'] // to get cancel amount
+ // to get cancel amount
+ $softCreditTotals['cancel']['amount']
) = CRM_Contribute_BAO_ContributionSoft::getSoftContributionTotals($this->_contactId, $isTest);
$this->assign('softCredit', TRUE);
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, empty($this->_id));
if (empty($this->_contactId)) {
$this->_contactId = civicrm_api3('contribution', 'getvalue', [
- 'id' => $this->_id,
- 'return' => 'contact_id',
- ]);
+ 'id' => $this->_id,
+ 'return' => 'contact_id',
+ ]);
}
$this->assign('contactId', $this->_contactId);
*
* @var array
*/
- static $_links = NULL;
+ public static $_links = NULL;
/**
* We use desc to remind us what that column is, name is used in the tpl
*
* @var array
*/
- static $_columnHeaders;
+ public static $_columnHeaders;
/**
* Properties of contact we're interested in displaying
* @var array
*/
- static $_properties = [
+ public static $_properties = [
'contact_id',
'contribution_id',
'contact_type',
*
* @param string $formName
*
- * @return array [ 'class' => task classname, 'result' => TRUE ]
+ * @return array
+ * [ 'class' => task classname, 'result' => TRUE ]
* the name of the form that will handle the task
*/
public function taskName($controller, $formName = 'Search') {
*/
class CRM_Contribute_Task extends CRM_Core_Task {
+ /**
+ * Contribution tasks
+ */
const
- // Contribution tasks
UPDATE_STATUS = 401,
PDF_RECEIPT = 402,
PDF_THANKYOU = 403,
PDF_INVOICE = 404;
- static $objectType = 'contribution';
+ /**
+ * @var string
+ */
+ public static $objectType = 'contribution';
/**
* These tasks are the core set of tasks that the user can perform
* @return bool
*/
public function checkActive(\Civi\Token\TokenProcessor $processor) {
- return
- !empty($processor->context['actionMapping'])
+ return !empty($processor->context['actionMapping'])
&& $processor->context['actionMapping']->getEntity() === 'civicrm_contribution';
}