<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
protected $_memTypeSelected;
- /*
+ /**
* Display name of the member
+ *
+ * @var string
*/
protected $_memberDisplayName = NULL;
- /*
- * email of the person paying for the membership (used for receipts)
- */
+ /**
+ * email of the person paying for the membership (used for receipts)
+ */
protected $_memberEmail = NULL;
- /*l43
- * Contact ID of the member
- */
+ /**
+ * Contact ID of the member
+ *
+ * @var int
+ */
public $_contactID = NULL;
- /*
- * Display name of the person paying for the membership (used for receipts)
- */
+ /**
+ * Display name of the person paying for the membership (used for receipts)
+ *
+ * @var string
+ */
protected $_contributorDisplayName = NULL;
- /*
+ /**
* email of the person paying for the membership (used for receipts)
*/
protected $_contributorEmail = NULL;
- /*
- * email of the person paying for the membership (used for receipts)
- */
+ /**
+ * email of the person paying for the membership (used for receipts)
+ *
+ * @var int
+ */
protected $_contributorContactID = NULL;
- /*
+ /**
* ID of the person the receipt is to go to
+ *
+ * @var int
*/
protected $_receiptContactId = NULL;
- /*
+ /**
* Keep a class variable for ALL membeshipID's so
* postProcess hook function can do something with it
+ *
+ * @var array
*/
protected $_membershipIDs = array();
$this->set('priceSetId', $this->_priceSetId);
$this->assign('priceSetId', $this->_priceSetId);
-
// check for edit permission
if (!CRM_Core_Permission::checkActionPermission('CiviMember', $this->_action)) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
* Set default values for the form. MobileProvider that in edit/view mode
* the default values are retrieved from the database
*
- * @access public
*
* @return void
*/
* Build the form object
*
* @return void
- * @access public
*/
public function buildQuickForm() {
if ($this->_cdType) {
}
$this->assign('taxRates', json_encode(CRM_Core_PseudoConstant::getTaxRates()));
+ $config = CRM_Core_Config::singleton();
+ $this->assign('currency', $config->defaultCurrencySymbol);
+ $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
+ $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
+ if (isset($invoicing)) {
+ $this->assign('taxTerm', CRM_Utils_Array::value('tax_term', $invoiceSettings));
+ }
// build price set form.
$buildPriceSet = FALSE;
if ($this->_priceSetId || !empty($_POST['price_set_id'])) {
if ($buildPriceSet) {
$this->add('select', 'price_set_id', ts('Choose price set'),
array(
- '' => ts('Choose price set')
+ '' => ts('Choose price set'),
) + $priceSets,
NULL, array('onchange' => "buildAmount( this.value );")
);
}
if ($this->_context == 'standalone') {
- $this->addEntityRef('contact_id', ts('Contact'), array('create' => TRUE, 'api' => array('extra' => array('email'))), TRUE);
+ $this->addEntityRef('contact_id', ts('Contact'), array(
+ 'create' => TRUE,
+ 'api' => array('extra' => array('email')),
+ ), TRUE);
}
$selOrgMemType[0][0] = $selMemTypeOrg[0] = ts('- select -');
'id',
'auto_renew',
'duration_unit',
- 'duration_interval'
+ 'duration_interval',
) as $fld) {
$this->_recurMembershipTypes[$recurMembershipTypes->id][$fld] = $recurMembershipTypes->$fld;
}
CRM_Core_DAO::getAttribute('CRM_Member_DAO_Membership', 'max_related')
);
- $sel = & $this->addElement('hierselect',
+ $sel = &$this->addElement('hierselect',
'membership_type_id',
ts('Membership Organization and Type'),
$memTypeJs
foreach ($statusNames as $val => $name) {
if (in_array($name, array(
'In Progress',
- 'Overdue'
+ 'Overdue',
))
) {
continue;
$this->addSelect('soft_credit_type_id', array('entity' => 'contribution_soft'));
$this->addEntityRef('soft_credit_contact_id', ts('Payment From'), array('create' => TRUE));
-
$this->addElement('checkbox',
'send_receipt',
ts('Send Confirmation and Receipt?'), NULL,
/**
* Validation
*
- * @param array $params (ref.) an assoc array of name/value pairs
+ * @param array $params
+ * (ref.) an assoc array of name/value pairs.
*
* @param $files
* @param $self
*
* @throws CiviCRM_API3_Exception
- * @return mixed true or array of errors
- * @access public
- * @static
+ * @return bool|array
+ * mixed true or array of errors
*/
- static function formRule($params, $files, $self) {
+ public static function formRule($params, $files, $self) {
$errors = array();
$priceSetId = CRM_Utils_Array::value('price_set_id', $params);
));
$tmp_statuses = $result['values'];
$status_ids = array();
- foreach($tmp_statuses as $cur_stat) {
+ foreach ($tmp_statuses as $cur_stat) {
$status_ids[] = $cur_stat['id'];
}
- if (empty($params['status_id']) || in_array( $params['status_id'] , $status_ids) == false) {
+ if (empty($params['status_id']) || in_array($params['status_id'], $status_ids) == FALSE) {
$errors['status_id'] = ts('Please enter a status that does NOT represent a current membership status.');
- $errors['is_override'] = ts('This must be checked because you set an End Date for a lifetime membership');
+ $errors['is_override'] = ts('This must be checked because you set an End Date for a lifetime membership');
}
}
else {
}
if (isset($params['is_override']) &&
- $params['is_override'] && empty($params['status_id'])) {
+ $params['is_override'] && empty($params['status_id'])
+ ) {
$errors['status_id'] = ts('Please enter the status.');
}
/**
* Process the form submission
*
- * @access public
*
* @return void
*/
$$dateVariable = CRM_Utils_Date::processDate($formValues[$dateField]);
}
- $memTypeNumTerms = empty($termsByType) ? CRM_Utils_Array::value('num_terms', $formValues) : NULL;
+ $memTypeNumTerms = empty($termsByType) ? CRM_Utils_Array::value('num_terms', $formValues) : NULL;
$calcDates = array();
foreach ($this->_memTypeSelected as $memType) {
if (!$this->_onlinePendingContributionId) {
if (empty($formValues['source'])) {
- $params['contribution_source'] = ts('%1 Membership: Offline signup (by %2)', array(1 => $membershipType, 2 => $userName));
+ $params['contribution_source'] = ts('%1 Membership: Offline signup (by %2)', array(
+ 1 => $membershipType,
+ 2 => $userName,
+ ));
}
else {
$params['contribution_source'] = $formValues['source'];
//get the payment processor id as per mode.
$params['payment_processor_id'] = $this->_params['payment_processor_id'] = $formValues['payment_processor_id'] = $this->_paymentProcessor['id'];
-
$now = date('YmdHis');
$fields = array();
}
if (!empty($lineItem[$priceSetId])) {
- $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings');
+ $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
$invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
$taxAmount = FALSE;
$totalTaxAmount = 0;
if (isset($value['tax_amount']) && isset($value['tax_rate'])) {
if (isset($dataArray[$value['tax_rate']])) {
$dataArray[$value['tax_rate']] = $dataArray[$value['tax_rate']] + CRM_Utils_Array::value('tax_amount', $value);
- } else {
+ }
+ else {
$dataArray[$value['tax_rate']] = CRM_Utils_Array::value('tax_amount', $value);
}
}
foreach ($membershipTypes as $memType => $membershipType) {
$statusMsg[$memType] = ts('%1 membership for %2 has been added.', array(
1 => $membershipType,
- 2 => $this->_memberDisplayName
+ 2 => $this->_memberDisplayName,
));
$membership = $createdMemberships[$memType];
/**
* Send email receipt
*
- * @param CRM_Core_Form $form form object
+ * @param CRM_Core_Form $form
+ * Form object.
* @param array $formValues
- * @param object $membership object
+ * @param object $membership
+ * Object.
*
- * @return boolean true if mail was sent successfully
- * @static
+ * @return bool
+ * true if mail was sent successfully
*/
- static function emailReceipt(&$form, &$formValues, &$membership) {
+ public static function emailReceipt(&$form, &$formValues, &$membership) {
// retrieve 'from email id' for acknowledgement
$receiptFrom = $formValues['from_email_address'];
if (empty($lineItem)) {
$form->assign('mem_start_date', CRM_Utils_Date::customFormat($membership->start_date, '%B %E%f, %Y'));
- $form->assign('mem_end_date', CRM_Utils_Date::customFormat($membership->end_date, '%B %E%f, %Y'));
+ if (!CRM_Utils_System::isNull($membership->end_date)) {
+ $form->assign('mem_end_date', CRM_Utils_Date::customFormat($membership->end_date, '%B %E%f, %Y'));
+ }
$form->assign('membership_name', CRM_Member_PseudoConstant::membershipType($membership->membership_type_id));
}
$form->_receiptContactId = $formValues['contact_id'];
}
}
- $template = CRM_Core_Smarty::singleton( );
+ $template = CRM_Core_Smarty::singleton();
$taxAmt = $template->get_template_vars('dataArray');
$eventTaxAmt = $template->get_template_vars('totalTaxAmount');
$prefixValue = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
$invoicing = CRM_Utils_Array::value('invoicing', $prefixValue);
if ((!empty($taxAmt) || isset($eventTaxAmt)) && (isset($invoicing) && isset($prefixValue['is_email_pdf']))) {
- $isEmailPdf = True;
+ $isEmailPdf = TRUE;
}
else {
- $isEmailPdf = False;
+ $isEmailPdf = FALSE;
}
list($mailSend, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate(
'from' => $receiptFrom,
'toName' => $form->_contributorDisplayName,
'toEmail' => $form->_contributorEmail,
- 'PDFFilename' => ts('receipt').'.pdf',
+ 'PDFFilename' => ts('receipt') . '.pdf',
'isEmailPdf' => $isEmailPdf,
'contributionId' => $formValues['contribution_id'],
- 'isTest' => (bool) ($form->_action & CRM_Core_Action::PREVIEW)
+ 'isTest' => (bool) ($form->_action & CRM_Core_Action::PREVIEW),
)
);
return TRUE;
}
}
-