X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FMember%2FForm%2FMembership.php;h=4af96fa0febb60d00824f99bfe5e196624b298a4;hb=1b9976cbf762dbf6513df8a4141626d2e5584171;hp=7a46b74d10c0e83c198f483b9305febbafe86994;hpb=0db6c3e15a8324d7f2d73c43c9b219a829351157;p=civicrm-core.git diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index 7a46b74d10..4af96fa0fe 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -51,44 +51,56 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { 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(); @@ -374,7 +386,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { $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)){ + if (isset($invoicing)) { $this->assign('taxTerm', CRM_Utils_Array::value('tax_term', $invoiceSettings)); } // build price set form. @@ -426,7 +438,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { 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 );") ); @@ -457,7 +469,10 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { } 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 -'); @@ -553,7 +568,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; 'id', 'auto_renew', 'duration_unit', - 'duration_interval' + 'duration_interval', ) as $fld) { $this->_recurMembershipTypes[$recurMembershipTypes->id][$fld] = $recurMembershipTypes->$fld; } @@ -580,7 +595,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; 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 @@ -652,7 +667,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; foreach ($statusNames as $val => $name) { if (in_array($name, array( 'In Progress', - 'Overdue' + 'Overdue', )) ) { continue; @@ -744,8 +759,8 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; * @param $self * * @throws CiviCRM_API3_Exception - * @return mixed true or array of errors - * @static + * @return bool|array + * mixed true or array of errors */ public static function formRule($params, $files, $self) { $errors = array(); @@ -884,12 +899,12 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; )); $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 { @@ -948,7 +963,8 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; } 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.'); } @@ -1202,7 +1218,10 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; 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']; @@ -1645,7 +1664,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; 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]; @@ -1703,8 +1722,8 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; * @param object $membership * Object. * - * @return boolean true if mail was sent successfully - * @static + * @return bool + * true if mail was sent successfully */ public static function emailReceipt(&$form, &$formValues, &$membership) { // retrieve 'from email id' for acknowledgement @@ -1836,7 +1855,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; $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'); @@ -1856,10 +1875,10 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; '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), ) );