* Form preProcess function.
*
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
*/
public function preProcess() {
// This string makes up part of the class names, differentiating them (not sure why) from the membership fields.
* @param array $files
* @param CRM_Member_Form_Membership $self
*
- * @throws CiviCRM_API3_Exception
* @return bool|array
* mixed true or array of errors
+ *
+ * @throws \CRM_Core_Exception
+ * @throws CiviCRM_API3_Exception
*/
public static function formRule($params, $files, $self) {
$errors = [];
/**
* Process the form submission.
+ *
+ * @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
*/
public function postProcess() {
if ($this->_action & CRM_Core_Action::DELETE) {
/**
* Send email receipt.
*
- * @deprecated
- * This function is shared with Batch_Entry which has limited overlap
- * & needs rationalising.
- *
* @param CRM_Core_Form $form
* Form object.
* @param array $formValues
*
* @return bool
* true if mail was sent successfully
+ * @throws \CRM_Core_Exception
+ *
+ * @deprecated
+ * This function is shared with Batch_Entry which has limited overlap
+ * & needs rationalising.
+ *
*/
public static function emailReceipt(&$form, &$formValues, &$membership, $customValues = NULL) {
// retrieve 'from email id' for acknowledgement
if ($contributionId && !empty($membershipIds)) {
$contributionDetails = CRM_Contribute_BAO_Contribution::getContributionDetails(
CRM_Export_Form_Select::MEMBER_EXPORT, $this->_membershipIDs);
- if ($contributionDetails[$membership->id]['contribution_status'] == 'Completed') {
+ if ($contributionDetails[$membership->id]['contribution_status'] === 'Completed') {
$receiptSend = TRUE;
}
}
* @param CRM_Member_DAO_Membership $membership
* Updated membership object
*
+ * @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
*/
protected function updateContributionOnMembershipTypeChange($inputParams, $membership) {
if (Civi::settings()->get('update_contribution_on_membership_type_change') &&
$buttonName = $this->controller->getButtonName();
$session = CRM_Core_Session::singleton();
- if ($this->_context == 'standalone') {
+ if ($this->_context === 'standalone') {
if ($buttonName == $this->getButtonName('upload', 'new')) {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/member/add',
'reset=1&action=add&context=standalone'
/**
* @return bool
+ * @throws \CRM_Core_Exception
*/
protected function isUpdateToExistingRecurringMembership() {
$isRecur = FALSE;
* @param \CRM_Member_BAO_Membership $membership
*
* @return bool
+ * @throws \CRM_Core_Exception
*/
protected function emailMembershipReceipt($formValues, $membership) {
$customValues = $this->getCustomValuesForReceipt($formValues, $membership);
&& !empty($this->_groupTree)
) {
foreach ($this->_groupTree as $groupID => $group) {
- if ($groupID == 'info') {
+ if ($groupID === 'info') {
continue;
}
foreach ($group['fields'] as $k => $field) {
$members = [['member_id', '=', $membership->id, 0, 0]];
// check whether its a test drive
- if ($this->_mode == 'test') {
+ if ($this->_mode === 'test') {
$members[] = ['member_test', '=', 1, 0, 0];
}
/**
* email of the person paying for the membership (used for receipts)
+ *
* @var string
*/
protected $_memberEmail = NULL;
/**
* email of the person paying for the membership (used for receipts)
+ *
* @var string
*/
protected $_contributorEmail = NULL;
/**
* context would be set to standalone if the contact is use is being selected from
* the form rather than in the URL
+ *
* @var string
*/
public $_context;
/**
* Set entity fields to be assigned to the form.
*/
- protected function setEntityFields() {}
+ protected function setEntityFields() {
+ }
/**
* Set the delete message.
*
* We do this from the constructor in order to do a translation.
*/
- public function setDeleteMessage() {}
+ public function setDeleteMessage() {
+ }
/**
* Set the renewal notification status message.
*/
public function setRenewalMessage() {
- $statusMsg = ts('%1 membership for %2 has been renewed.', array(1 => $this->membershipTypeName, 2 => $this->_memberDisplayName));
+ $statusMsg = ts('%1 membership for %2 has been renewed.', [1 => $this->membershipTypeName, 2 => $this->_memberDisplayName]);
if ($this->isMailSent) {
- $statusMsg .= ' ' . ts('A renewal confirmation and receipt has been sent to %1.', array(
- 1 => $this->_contributorEmail,
- ));
+ $statusMsg .= ' ' . ts('A renewal confirmation and receipt has been sent to %1.', [1 => $this->_contributorEmail]);
}
CRM_Core_Session::setStatus($statusMsg, ts('Complete'), 'success');
}
parent::preProcess();
$this->assign('endDate', CRM_Utils_Date::customFormat(CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership',
- $this->_id, 'end_date'
- )
+ $this->_id, 'end_date'
+ )
));
$this->assign('membershipStatus',
CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipStatus',
*
* @return array
* Default values.
+ * @throws \CRM_Core_Exception
*/
public function setDefaultValues() {
$defaults['send_receipt'] = 0;
//set Soft Credit Type to Gift by default
- $scTypes = CRM_Core_OptionGroup::values("soft_credit_type");
+ $scTypes = CRM_Core_OptionGroup::values('soft_credit_type');
$defaults['soft_credit_type_id'] = CRM_Utils_Array::value(ts('Gift'), array_flip($scTypes));
$renewalDate = $defaults['renewal_date'] ?? NULL;
/**
* Build the form object.
+ *
+ * @throws \CRM_Core_Exception
*/
public function buildQuickForm() {
*
* @return bool|array
* mixed true or array of errors
+ * @throws \CRM_Core_Exception
*/
public static function formRule($params, $files, $self) {
$errors = [];
/**
* Process the renewal form.
+ *
+ * @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
*/
public function postProcess() {
// get the submitted form values.
$this->_params['contribution_status_id'] = $result['payment_status_id'];
$this->_params['trxn_id'] = $result['trxn_id'];
- $this->_params['is_test'] = ($this->_mode == 'live') ? 0 : 1;
+ $this->_params['is_test'] = ($this->_mode === 'live') ? 0 : 1;
$this->set('params', $this->_params);
$this->assign('trxn_id', $result['trxn_id']);
}
// retrieve custom data
$customFields = $customValues = $fo = [];
foreach ($this->_groupTree as $groupID => $group) {
- if ($groupID == 'info') {
+ if ($groupID === 'info') {
continue;
}
foreach ($group['fields'] as $k => $field) {
}
$members = [['member_id', '=', $this->_membershipId, 0, 0]];
// check whether its a test drive
- if ($this->_mode == 'test') {
+ if ($this->_mode === 'test') {
$members[] = ['member_test', '=', 1, 0, 0];
}
CRM_Core_BAO_UFGroup::getValues($this->_contactID, $customFields, $customValues, FALSE, $members);
$this->assign('is_pay_later', 0);
$this->assign('isPrimary', 1);
$this->assign('receipt_text_renewal', $this->_params['receipt_text']);
- if ($this->_mode == 'test') {
+ if ($this->_mode === 'test') {
$this->assign('action', '1024');
}
}
'from' => $receiptFrom,
'toName' => $this->_contributorDisplayName,
'toEmail' => $this->_contributorEmail,
- 'isTest' => $this->_mode == 'test',
+ 'isTest' => $this->_mode === 'test',
]
);
}