/** * Function to actually build the form * * @return void * @access public */ public function buildQuickForm() { $this->assignToTemplate(); $params = $this->_params; $honor_block_is_active = $this->get('honor_block_is_active'); // make sure we have values for it if ($honor_block_is_active && !empty($params['soft_credit_type_id'])) { $honorName = null; $softCreditTypes = CRM_Core_OptionGroup::values("soft_credit_type", FALSE); $this->assign('honor_block_is_active', $honor_block_is_active); $this->assign('soft_credit_type', $softCreditTypes[$params['soft_credit_type_id']]); CRM_Contribute_BAO_ContributionSoft::formatHonoreeProfileFields($this, $params['honor'], $params['honoree_profile_id']); $fieldTypes = array('Contact'); $fieldTypes[] = CRM_Core_BAO_UFGroup::getContactType($params['honoree_profile_id']); $this->buildCustom($params['honoree_profile_id'], 'honoreeProfileFields', TRUE, 'honor', $fieldTypes); } $this->assign('receiptFromEmail', CRM_Utils_Array::value('receipt_from_email', $this->_values)); $amount_block_is_active = $this->get('amount_block_is_active'); $this->assign('amount_block_is_active', $amount_block_is_active); if (!empty($params['selectProduct']) && $params['selectProduct'] != 'no_thanks') { $option = CRM_Utils_Array::value('options_' . $params['selectProduct'], $params); $productID = $params['selectProduct']; CRM_Contribute_BAO_Premium::buildPremiumBlock($this, $this->_id, FALSE, $productID, $option); $this->set('productID', $productID); $this->set('option', $option); } $config = CRM_Core_Config::singleton(); if (in_array('CiviMember', $config->enableComponents)) { if (isset($params['selectMembership']) && $params['selectMembership'] != 'no_thanks') { CRM_Member_BAO_Membership::buildMembershipBlock($this, $this->_id, $this->_membershipContactID, FALSE, $params['selectMembership'], FALSE); } else { $this->assign('membershipBlock', FALSE); } } $this->buildCustom($this->_values['custom_pre_id'], 'customPre', TRUE); $this->buildCustom($this->_values['custom_post_id'], 'customPost', TRUE); if (!empty($params['hidden_onbehalf_profile'])) { $ufJoinParams = array('module' => 'onBehalf', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $this->_id); $OnBehalfProfile = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams); $profileId = $OnBehalfProfile[0]; $fieldTypes = array('Contact', 'Organization'); $contactSubType = CRM_Contact_BAO_ContactType::subTypes('Organization'); $fieldTypes = array_merge($fieldTypes, $contactSubType); if (is_array($this->_membershipBlock) && !empty($this->_membershipBlock)) { $fieldTypes = array_merge($fieldTypes, array('Membership')); } else { $fieldTypes = array_merge($fieldTypes, array('Contribution')); } $this->buildCustom($profileId, 'onbehalfProfile', TRUE, 'onbehalf', $fieldTypes); } $this->_separateMembershipPayment = $this->get('separateMembershipPayment'); $this->assign('is_separate_payment', $this->_separateMembershipPayment); if ($this->_priceSetId && !CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config')) { $this->assign('lineItem', $this->_lineItem); } else { $this->assign('is_quick_config', 1); $this->_params['is_quick_config'] = 1; } $this->assign('priceSetID', $this->_priceSetId); $paymentProcessorType = CRM_Core_PseudoConstant::paymentProcessorType(false, null, 'name'); if ($this->_paymentProcessor && $this->_paymentProcessor['payment_processor_type_id'] == CRM_Utils_Array::key('Google_Checkout', $paymentProcessorType) && !$this->_params['is_pay_later'] && !($this->_amount == 0)) { $this->_checkoutButtonName = $this->getButtonName('next', 'checkout'); $this->add('image', $this->_checkoutButtonName, $this->_paymentProcessor['url_button'], array('class' => 'form-submit')); $this->addButtons(array(array('type' => 'back', 'name' => ts('<< Go Back')))); } else { if ($this->_contributeMode == 'notify' || !$this->_values['is_monetary'] || $this->_amount <= 0.0 || $this->_params['is_pay_later'] || $this->_separateMembershipPayment && $this->_amount <= 0.0) { $contribButton = ts('Continue >>'); $this->assign('button', ts('Continue')); } else { $contribButton = ts('Make Contribution'); $this->assign('button', ts('Make Contribution')); } $this->addButtons(array(array('type' => 'next', 'name' => $contribButton, 'spacing' => ' ', 'isDefault' => TRUE, 'js' => array('onclick' => "return submitOnce(this,'" . $this->_name . "','" . ts('Processing') . "');")), array('type' => 'back', 'name' => ts('Go Back')))); } $defaults = array(); $fields = array(); foreach ($this->_fields as $name => $dontCare) { if ($name != 'onbehalf' || $name != 'honor') { $fields[$name] = 1; } } $fields["billing_state_province-{$this->_bltID}"] = $fields["billing_country-{$this->_bltID}"] = $fields["email-{$this->_bltID}"] = 1; $contact = $this->_params; foreach ($fields as $name => $dontCare) { if (isset($contact[$name])) { $defaults[$name] = $contact[$name]; if (substr($name, 0, 7) == 'custom_') { $timeField = "{$name}_time"; if (isset($contact[$timeField])) { $defaults[$timeField] = $contact[$timeField]; } if (isset($contact["{$name}_id"])) { $defaults["{$name}_id"] = $contact["{$name}_id"]; } } elseif (in_array($name, array('addressee', 'email_greeting', 'postal_greeting')) && !empty($contact[$name . '_custom'])) { $defaults[$name . '_custom'] = $contact[$name . '_custom']; } } } $this->assign('useForMember', $this->get('useForMember')); // now fix all state country selectors CRM_Core_BAO_Address::fixAllStateSelects($this, $defaults); $this->setDefaults($defaults); $this->freeze(); }
/** * Build the form object. */ public function buildQuickForm() { // build profiles first so that we can determine address fields etc // and then show copy address checkbox $this->buildCustom($this->_values['custom_pre_id'], 'customPre'); $this->buildCustom($this->_values['custom_post_id'], 'customPost'); if (!empty($this->_fields) && !empty($this->_values['custom_pre_id'])) { $profileAddressFields = array(); foreach ($this->_fields as $key => $value) { CRM_Core_BAO_UFField::assignAddressField($key, $profileAddressFields, array('uf_group_id' => $this->_values['custom_pre_id'])); } $this->set('profileAddressFields', $profileAddressFields); } // Build payment processor form if (empty($_GET['onbehalf'])) { CRM_Core_Payment_ProcessorForm::buildQuickForm($this); // Return if we are in an ajax - this is probably redundant now as // processor does not call this form for a snippet anymore - but unsure about // cdType if ($this->_snippet) { return; } } $config = CRM_Core_Config::singleton(); $contactID = $this->getContactID(); if ($contactID) { $this->assign('contact_id', $contactID); $this->assign('display_name', CRM_Contact_BAO_Contact::displayName($contactID)); } if ($this->_onbehalf) { CRM_Contribute_Form_Contribution_OnBehalfOf::buildQuickForm($this); // Return if we are in an ajax callback if ($this->_snippet) { return; } } $this->applyFilter('__ALL__', 'trim'); $this->add('text', "email-{$this->_bltID}", ts('Email Address'), array('size' => 30, 'maxlength' => 60, 'class' => 'email'), TRUE); $this->addRule("email-{$this->_bltID}", ts('Email is not valid.'), 'email'); $pps = array(); //@todo - this should be replaced by a check as to whether billing fields are set $onlinePaymentProcessorEnabled = FALSE; if (!empty($this->_paymentProcessors)) { foreach ($this->_paymentProcessors as $key => $name) { if ($name['billing_mode'] == 1) { $onlinePaymentProcessorEnabled = TRUE; } $pps[$key] = $name['name']; } } if (!empty($this->_values['is_pay_later'])) { $pps[0] = $this->_values['pay_later_text']; } if (count($pps) > 1) { $this->addRadio('payment_processor_id', ts('Payment Method'), $pps, NULL, " ", TRUE); } elseif (!empty($pps)) { $key = array_keys($pps); $key = array_pop($key); $this->addElement('hidden', 'payment_processor_id', $key); if ($key === 0) { $this->assign('is_pay_later', $this->_values['is_pay_later']); $this->assign('pay_later_text', $this->_values['pay_later_text']); } } $contactID = $this->getContactID(); if ($this->getContactID() === 0) { $this->addCidZeroOptions($onlinePaymentProcessorEnabled); } //build pledge block. $this->_useForMember = 0; //don't build membership block when pledge_id is passed if (empty($this->_values['pledge_id'])) { $this->_separateMembershipPayment = FALSE; if (in_array('CiviMember', $config->enableComponents)) { $isTest = 0; if ($this->_action & CRM_Core_Action::PREVIEW) { $isTest = 1; } if ($this->_priceSetId && CRM_Core_Component::getComponentID('CiviMember') == CRM_Utils_Array::value('extends', $this->_priceSet)) { $this->_useForMember = 1; $this->set('useForMember', $this->_useForMember); } $this->_separateMembershipPayment = CRM_Member_BAO_Membership::buildMembershipBlock($this, $this->_id, $this->_membershipContactID, TRUE, NULL, FALSE, $isTest); } $this->set('separateMembershipPayment', $this->_separateMembershipPayment); } $this->assign('useForMember', $this->_useForMember); // If we configured price set for contribution page // we are not allow membership signup as well as any // other contribution amount field, CRM-5095 if (isset($this->_priceSetId) && $this->_priceSetId) { $this->add('hidden', 'priceSetId', $this->_priceSetId); // build price set form. $this->set('priceSetId', $this->_priceSetId); CRM_Price_BAO_PriceSet::buildPriceSet($this); if ($this->_values['is_monetary'] && $this->_values['is_recur'] && empty($this->_values['pledge_id'])) { self::buildRecur($this); } } if ($this->_priceSetId) { $is_quick_config = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config'); if ($is_quick_config) { $this->_useForMember = 0; $this->set('useForMember', $this->_useForMember); } } if ($this->_values['is_for_organization']) { $this->buildOnBehalfOrganization(); } //we allow premium for pledge during pledge creation only. if (empty($this->_values['pledge_id'])) { CRM_Contribute_BAO_Premium::buildPremiumBlock($this, $this->_id, TRUE); } //add honor block if ($this->_honor_block_is_active) { $this->assign('honor_block_is_active', TRUE); //build soft-credit section CRM_Contribute_Form_SoftCredit::buildQuickForm($this); //build honoree profile section CRM_Contact_Form_ProfileContact::buildQuickForm($this); } //don't build pledge block when mid is passed if (!$this->_mid) { $config = CRM_Core_Config::singleton(); if (in_array('CiviPledge', $config->enableComponents) && !empty($this->_values['pledge_block_id'])) { CRM_Pledge_BAO_PledgeBlock::buildPledgeBlock($this); } } //to create an cms user if (!$this->_contactID) { $createCMSUser = FALSE; if ($this->_values['custom_pre_id']) { $profileID = $this->_values['custom_pre_id']; $createCMSUser = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $profileID, 'is_cms_user'); } if (!$createCMSUser && $this->_values['custom_post_id']) { if (!is_array($this->_values['custom_post_id'])) { $profileIDs = array($this->_values['custom_post_id']); } else { $profileIDs = $this->_values['custom_post_id']; } foreach ($profileIDs as $pid) { if (CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $pid, 'is_cms_user')) { $profileID = $pid; $createCMSUser = TRUE; break; } } } if ($createCMSUser) { CRM_Core_BAO_CMSUser::buildForm($this, $profileID, TRUE); } } if ($this->_pcpId) { if ($pcpSupporter = CRM_PCP_BAO_PCP::displayName($this->_pcpId)) { $pcp_supporter_text = ts('This contribution is being made thanks to the effort of <strong>%1</strong>, who supports our campaign.', array(1 => $pcpSupporter)); // Only tell people that can also create a PCP if the contribution page has a non-empty value in the "Create Personal Campaign Page link" field. $text = CRM_PCP_BAO_PCP::getPcpBlockStatus($this->_id, 'contribute'); if (!empty($text)) { $pcp_supporter_text .= ts("You can support it as well - once you complete the donation, you will be able to create your own Personal Campaign Page!"); } $this->assign('pcpSupporterText', $pcp_supporter_text); } $prms = array('id' => $this->_pcpId); CRM_Core_DAO::commonRetrieve('CRM_PCP_DAO_PCP', $prms, $pcpInfo); if ($pcpInfo['is_honor_roll']) { $this->assign('isHonor', TRUE); $this->add('checkbox', 'pcp_display_in_roll', ts('Show my contribution in the public honor roll'), NULL, NULL, array('onclick' => "showHideByValue('pcp_display_in_roll','','nameID|nickID|personalNoteID','block','radio',false); pcpAnonymous( );")); $extraOption = array('onclick' => "return pcpAnonymous( );"); $elements = array(); $elements[] =& $this->createElement('radio', NULL, '', ts('Include my name and message'), 0, $extraOption); $elements[] =& $this->createElement('radio', NULL, '', ts('List my contribution anonymously'), 1, $extraOption); $this->addGroup($elements, 'pcp_is_anonymous', NULL, ' '); $this->add('text', 'pcp_roll_nickname', ts('Name'), array('maxlength' => 30)); $this->add('textarea', 'pcp_personal_note', ts('Personal Note'), array('style' => 'height: 3em; width: 40em;')); } } //we have to load confirm contribution button in template //when multiple payment processor as the user //can toggle with payment processor selection $billingModePaymentProcessors = 0; if (!empty($this->_paymentProcessors)) { foreach ($this->_paymentProcessors as $key => $values) { if ($values['billing_mode'] == CRM_Core_Payment::BILLING_MODE_BUTTON) { $billingModePaymentProcessors++; } } } if ($billingModePaymentProcessors && count($this->_paymentProcessors) == $billingModePaymentProcessors) { $allAreBillingModeProcessors = TRUE; } else { $allAreBillingModeProcessors = FALSE; } if (!($allAreBillingModeProcessors && !$this->_values['is_pay_later'])) { $submitButton = array('type' => 'upload', 'name' => CRM_Utils_Array::value('is_confirm_enabled', $this->_values) ? ts('Confirm Contribution') : ts('Contribute'), 'spacing' => ' ', 'isDefault' => TRUE); // Add submit-once behavior when confirm page disabled if (empty($this->_values['is_confirm_enabled'])) { $submitButton['js'] = array('onclick' => "return submitOnce(this,'" . $this->_name . "','" . ts('Processing') . "');"); } $this->addButtons(array($submitButton)); } $this->addFormRule(array('CRM_Contribute_Form_Contribution_Main', 'formRule'), $this); }
/** * Function to actually build the form * * @return void * @access public */ public function buildQuickForm() { $this->assignToTemplate(); $productID = $this->get('productID'); $option = $this->get('option'); $membershipTypeID = $this->get('membershipTypeID'); $this->assign('receiptFromEmail', CRM_Utils_Array::value('receipt_from_email', $this->_values)); if ($productID) { CRM_Contribute_BAO_Premium::buildPremiumBlock($this, $this->_id, FALSE, $productID, $option); } if ($this->_priceSetId && !CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $this->_priceSetId, 'is_quick_config')) { $this->assign('lineItem', $this->_lineItem); } else { if (is_array($membershipTypeID)) { $membershipTypeID = current($membershipTypeID); } $this->assign('is_quick_config', 1); $this->_params['is_quick_config'] = 1; } $this->assign('priceSetID', $this->_priceSetId); $this->assign('useForMember', $this->get('useForMember')); $params = $this->_params; $honor_block_is_active = $this->get('honor_block_is_active'); if ($honor_block_is_active && (!empty($params["honor_first_name"]) && !empty($params["honor_last_name"]) || !empty($params["honor_email"]))) { $this->assign('honor_block_is_active', $honor_block_is_active); $this->assign('honor_block_title', CRM_Utils_Array::value('honor_block_title', $this->_values)); $prefix = CRM_Core_PseudoConstant::individualPrefix(); $honor = CRM_Core_PseudoConstant::honor(); $this->assign('honor_type', $honor[$params["honor_type_id"]]); $this->assign('honor_prefix', $params["honor_prefix_id"] ? $prefix[$params["honor_prefix_id"]] : ' '); $this->assign('honor_first_name', $params["honor_first_name"]); $this->assign('honor_last_name', $params["honor_last_name"]); $this->assign('honor_email', $params["honor_email"]); } $qParams = "reset=1&id={$this->_id}"; //pcp elements if ($this->_pcpId) { $qParams .= "&pcpId={$this->_pcpId}"; $this->assign('pcpBlock', TRUE); foreach (array('pcp_display_in_roll', 'pcp_is_anonymous', 'pcp_roll_nickname', 'pcp_personal_note') as $val) { if (CRM_Utils_Array::value($val, $this->_params)) { $this->assign($val, $this->_params[$val]); } } } $this->assign('qParams', $qParams); if ($membershipTypeID) { $transactionID = $this->get('membership_trx_id'); $membershipAmount = $this->get('membership_amount'); $renewalMode = $this->get('renewal_mode'); $this->assign('membership_trx_id', $transactionID); $this->assign('membership_amount', $membershipAmount); $this->assign('renewal_mode', $renewalMode); CRM_Member_BAO_Membership::buildMembershipBlock($this, $this->_id, FALSE, $membershipTypeID, TRUE, NULL, $this->_membershipContactID); } $this->_separateMembershipPayment = $this->get('separateMembershipPayment'); $this->assign("is_separate_payment", $this->_separateMembershipPayment); $this->buildCustom($this->_values['custom_pre_id'], 'customPre', TRUE); $this->buildCustom($this->_values['custom_post_id'], 'customPost', TRUE); if (CRM_Utils_Array::value('hidden_onbehalf_profile', $params)) { $ufJoinParams = array('module' => 'onBehalf', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $this->_id); $OnBehalfProfile = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams); $profileId = $OnBehalfProfile[0]; $fieldTypes = array('Contact', 'Organization'); $contactSubType = CRM_Contact_BAO_ContactType::subTypes('Organization'); $fieldTypes = array_merge($fieldTypes, $contactSubType); if (is_array($this->_membershipBlock) && !empty($this->_membershipBlock)) { $fieldTypes = array_merge($fieldTypes, array('Membership')); } else { $fieldTypes = array_merge($fieldTypes, array('Contribution')); } $this->buildCustom($profileId, 'onbehalfProfile', TRUE, TRUE, $fieldTypes); } $this->assign('trxn_id', CRM_Utils_Array::value('trxn_id', $this->_params)); $this->assign('receive_date', CRM_Utils_Date::mysqlToIso(CRM_Utils_Array::value('receive_date', $this->_params))); $defaults = array(); $options = array(); $fields = array(); $removeCustomFieldTypes = array('Contribution'); foreach ($this->_fields as $name => $dontCare) { if ($name == 'onbehalf') { foreach ($dontCare as $key => $value) { $fields['onbehalf'][$key] = 1; } } else { $fields[$name] = 1; } } $fields['state_province'] = $fields['country'] = $fields['email'] = 1; $contact = $this->_params = $this->controller->exportValues('Main'); foreach ($fields as $name => $dontCare) { if ($name == 'onbehalf') { foreach ($dontCare as $key => $value) { //$defaults[$key] = $contact['onbehalf'][$key]; if (isset($contact['onbehalf'][$key])) { $defaults[$key] = $contact['onbehalf'][$key]; } if (isset($contact['onbehalf']["{$key}_id"])) { $defaults["{$key}_id"] = $contact['onbehalf']["{$key}_id"]; } } } elseif (isset($contact[$name])) { $defaults[$name] = $contact[$name]; if (substr($name, 0, 7) == 'custom_') { $timeField = "{$name}_time"; if (isset($contact[$timeField])) { $defaults[$timeField] = $contact[$timeField]; } } elseif (in_array($name, array('addressee', 'email_greeting', 'postal_greeting')) && CRM_Utils_Array::value($name . '_custom', $contact)) { $defaults[$name . '_custom'] = $contact[$name . '_custom']; } } } // now fix all state country selectors CRM_Core_BAO_Address::fixAllStateSelects($this, $defaults); $this->_submitValues = array_merge($this->_submitValues, $defaults); $this->setDefaults($defaults); $values['entity_id'] = $this->_id; $values['entity_table'] = 'civicrm_contribution_page'; CRM_Friend_BAO_Friend::retrieve($values, $data); $tellAFriend = FALSE; if ($this->_pcpId) { if ($this->_pcpBlock['is_tellfriend_enabled']) { $this->assign('friendText', ts('Tell a Friend')); $subUrl = "eid={$this->_pcpId}&blockId={$this->_pcpBlock['id']}&pcomponent=pcp"; $tellAFriend = TRUE; } } elseif (CRM_Utils_Array::value('is_active', $data)) { $friendText = $data['title']; $this->assign('friendText', $friendText); $subUrl = "eid={$this->_id}&pcomponent=contribute"; $tellAFriend = TRUE; } if ($tellAFriend) { if ($this->_action & CRM_Core_Action::PREVIEW) { $url = CRM_Utils_System::url("civicrm/friend", "reset=1&action=preview&{$subUrl}"); } else { $url = CRM_Utils_System::url("civicrm/friend", "reset=1&{$subUrl}"); } $this->assign('friendURL', $url); } $this->freeze(); // can we blow away the session now to prevent hackery // CRM-9491 $this->controller->reset(); }
/** * Function to actually build the form * * @return void * @access public */ public function buildQuickForm() { $this->assignToTemplate(); require_once 'CRM/Contribute/BAO/Premium.php'; $params = $this->_params; $honor_block_is_active = $this->get('honor_block_is_active'); // make sure we have values for it if ($honor_block_is_active && (!empty($params["honor_first_name"]) && !empty($params["honor_last_name"]) || !empty($params["honor_email"]))) { $this->assign('honor_block_is_active', $honor_block_is_active); $this->assign("honor_block_title", CRM_Utils_Array::value('honor_block_title', $this->_values)); require_once "CRM/Core/PseudoConstant.php"; $prefix = CRM_Core_PseudoConstant::individualPrefix(); $honor = CRM_Core_PseudoConstant::honor(); $this->assign("honor_type", CRM_Utils_Array::value($params["honor_type_id"], $honor)); $this->assign("honor_prefix", CRM_Utils_Array::value($params["honor_prefix_id"], $prefix)); $this->assign("honor_first_name", $params["honor_first_name"]); $this->assign("honor_last_name", $params["honor_last_name"]); $this->assign("honor_email", $params["honor_email"]); } $this->assign('receiptFromEmail', CRM_Utils_Array::value('receipt_from_email', $this->_values)); $amount_block_is_active = $this->get('amount_block_is_active'); $this->assign('amount_block_is_active', $amount_block_is_active); if (CRM_Utils_Array::value('selectProduct', $params) && $params['selectProduct'] != 'no_thanks') { $option = CRM_Utils_Array::value('options_' . $params['selectProduct'], $params); $productID = $params['selectProduct']; CRM_Contribute_BAO_Premium::buildPremiumBlock($this, $this->_id, false, $productID, $option); $this->set('productID', $productID); $this->set('option', $option); } $config =& CRM_Core_Config::singleton(); if (in_array("CiviMember", $config->enableComponents)) { if (isset($params['selectMembership']) && $params['selectMembership'] != 'no_thanks') { CRM_Member_BAO_Membership::buildMembershipBlock($this, $this->_id, false, $params['selectMembership'], false, null, $this->_membershipContactID); } else { $this->assign('membershipBlock', false); } } $this->buildCustom($this->_values['custom_pre_id'], 'customPre', true); $this->buildCustom($this->_values['custom_post_id'], 'customPost', true); $this->_separateMembershipPayment = $this->get('separateMembershipPayment'); $this->assign("is_separate_payment", $this->_separateMembershipPayment); $this->assign('lineItem', $this->_lineItem); $this->assign('priceSetID', $this->_priceSetId); if ($this->_paymentProcessor['payment_processor_type'] == 'Google_Checkout' && !$this->_params['is_pay_later']) { $this->_checkoutButtonName = $this->getButtonName('next', 'checkout'); $this->add('image', $this->_checkoutButtonName, $this->_paymentProcessor['url_button'], array('class' => 'form-submit')); $this->addButtons(array(array('type' => 'back', 'name' => ts('<< Go Back')))); } else { if ($this->_contributeMode == 'notify' || !$this->_values['is_monetary'] || $this->_amount <= 0.0 || $this->_params['is_pay_later'] || $this->_separateMembershipPayment && $this->_amount <= 0.0) { $contribButton = ts('Continue >>'); $this->assign('button', 'Continue'); } else { $contribButton = ts('Make Contribution'); $this->assign('button', 'Make Contribution'); } $this->addButtons(array(array('type' => 'next', 'name' => $contribButton, 'spacing' => ' ', 'isDefault' => true, 'js' => array('onclick' => "return submitOnce(this,'" . $this->_name . "','" . ts('Processing') . "');")), array('type' => 'back', 'name' => ts('<< Go Back')))); } $defaults = array(); $options = array(); $fields = array(); require_once "CRM/Core/BAO/CustomGroup.php"; $removeCustomFieldTypes = array('Contribution'); foreach ($this->_fields as $name => $dontCare) { $fields[$name] = 1; } $fields["billing_state_province-{$this->_bltID}"] = $fields["billing_country-{$this->_bltID}"] = $fields["email-{$this->_bltID}"] = 1; $contact = $this->_params; foreach ($fields as $name => $dontCare) { if (isset($contact[$name])) { $defaults[$name] = $contact[$name]; if (substr($name, 0, 7) == 'custom_') { $timeField = "{$name}_time"; if (isset($contact[$timeField])) { $defaults[$timeField] = $contact[$timeField]; } } else { if (in_array($name, array('addressee', 'email_greeting', 'postal_greeting')) && CRM_Utils_Array::value($name . '_custom', $contact)) { $defaults[$name . '_custom'] = $contact[$name . '_custom']; } } } } // now fix all state country selectors require_once 'CRM/Core/BAO/Address.php'; CRM_Core_BAO_Address::fixAllStateSelects($this, $defaults); $this->setDefaults($defaults); $this->freeze(); }
/** * Build the form object. * * @return void */ public function buildQuickForm() { $this->assignToTemplate(); $productID = $this->get('productID'); $option = $this->get('option'); $membershipTypeID = $this->get('membershipTypeID'); $this->assign('receiptFromEmail', CRM_Utils_Array::value('receipt_from_email', $this->_values)); if ($productID) { CRM_Contribute_BAO_Premium::buildPremiumBlock($this, $this->_id, FALSE, $productID, $option); } if ($this->_priceSetId && !CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config')) { $this->assign('lineItem', $this->_lineItem); } else { if (is_array($membershipTypeID)) { $membershipTypeID = current($membershipTypeID); } $this->assign('is_quick_config', 1); $this->_params['is_quick_config'] = 1; } $this->assign('priceSetID', $this->_priceSetId); $this->assign('useForMember', $this->get('useForMember')); $params = $this->_params; $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); if ($invoicing) { $getTaxDetails = FALSE; $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings); foreach ($this->_lineItem as $key => $value) { foreach ($value as $v) { if (isset($v['tax_rate'])) { if ($v['tax_rate'] != '') { $getTaxDetails = TRUE; } } } } $this->assign('getTaxDetails', $getTaxDetails); $this->assign('taxTerm', $taxTerm); $this->assign('totalTaxAmount', $params['tax_amount']); } if ($this->_honor_block_is_active && !empty($params['soft_credit_type_id'])) { $honorName = NULL; $softCreditTypes = CRM_Core_OptionGroup::values("soft_credit_type", FALSE); $this->assign('honor_block_is_active', $this->_honor_block_is_active); $this->assign('soft_credit_type', $softCreditTypes[$params['soft_credit_type_id']]); CRM_Contribute_BAO_ContributionSoft::formatHonoreeProfileFields($this, $params['honor'], $params['honoree_profile_id']); $fieldTypes = array('Contact'); $fieldTypes[] = CRM_Core_BAO_UFGroup::getContactType($params['honoree_profile_id']); $this->buildCustom($params['honoree_profile_id'], 'honoreeProfileFields', TRUE, 'honor', $fieldTypes); } $qParams = "reset=1&id={$this->_id}"; //pcp elements if ($this->_pcpId) { $qParams .= "&pcpId={$this->_pcpId}"; $this->assign('pcpBlock', TRUE); foreach (array('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]); } } } $this->assign('qParams', $qParams); if ($membershipTypeID) { $transactionID = $this->get('membership_trx_id'); $membershipAmount = $this->get('membership_amount'); $renewalMode = $this->get('renewal_mode'); $this->assign('membership_trx_id', $transactionID); $this->assign('membership_amount', $membershipAmount); $this->assign('renewal_mode', $renewalMode); CRM_Member_BAO_Membership::buildMembershipBlock($this, $this->_id, $this->_membershipContactID, FALSE, $membershipTypeID, TRUE, NULL); if (!empty($params['auto_renew'])) { $this->assign('auto_renew', TRUE); } } $this->_separateMembershipPayment = $this->get('separateMembershipPayment'); $this->assign("is_separate_payment", $this->_separateMembershipPayment); $this->buildCustom($this->_values['custom_pre_id'], 'customPre', TRUE); $this->buildCustom($this->_values['custom_post_id'], 'customPost', TRUE); if (!empty($params['hidden_onbehalf_profile'])) { $ufJoinParams = array('module' => 'onBehalf', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $this->_id); $OnBehalfProfile = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams); $profileId = $OnBehalfProfile[0]; $fieldTypes = array('Contact', 'Organization'); $contactSubType = CRM_Contact_BAO_ContactType::subTypes('Organization'); $fieldTypes = array_merge($fieldTypes, $contactSubType); if (is_array($this->_membershipBlock) && !empty($this->_membershipBlock)) { $fieldTypes = array_merge($fieldTypes, array('Membership')); } else { $fieldTypes = array_merge($fieldTypes, array('Contribution')); } $this->buildCustom($profileId, 'onbehalfProfile', TRUE, 'onbehalf', $fieldTypes); } $this->assign('trxn_id', CRM_Utils_Array::value('trxn_id', $this->_params)); $this->assign('receive_date', CRM_Utils_Date::mysqlToIso(CRM_Utils_Array::value('receive_date', $this->_params))); $defaults = array(); $fields = array(); foreach ($this->_fields as $name => $dontCare) { if ($name != 'onbehalf' || $name != 'honor') { $fields[$name] = 1; } } $fields['state_province'] = $fields['country'] = $fields['email'] = 1; $contact = $this->_params = $this->controller->exportValues('Main'); foreach ($fields as $name => $dontCare) { if (isset($contact[$name])) { $defaults[$name] = $contact[$name]; if (substr($name, 0, 7) == 'custom_') { $timeField = "{$name}_time"; if (isset($contact[$timeField])) { $defaults[$timeField] = $contact[$timeField]; } } elseif (in_array($name, array('addressee', 'email_greeting', 'postal_greeting')) && !empty($contact[$name . '_custom'])) { $defaults[$name . '_custom'] = $contact[$name . '_custom']; } } } $this->_submitValues = array_merge($this->_submitValues, $defaults); $this->setDefaults($defaults); $values['entity_id'] = $this->_id; $values['entity_table'] = 'civicrm_contribution_page'; CRM_Friend_BAO_Friend::retrieve($values, $data); $tellAFriend = FALSE; if ($this->_pcpId) { if ($this->_pcpBlock['is_tellfriend_enabled']) { $this->assign('friendText', ts('Tell a Friend')); $subUrl = "eid={$this->_pcpId}&blockId={$this->_pcpBlock['id']}&pcomponent=pcp"; $tellAFriend = TRUE; } } elseif (!empty($data['is_active'])) { $friendText = $data['title']; $this->assign('friendText', $friendText); $subUrl = "eid={$this->_id}&pcomponent=contribute"; $tellAFriend = TRUE; } if ($tellAFriend) { if ($this->_action & CRM_Core_Action::PREVIEW) { $url = CRM_Utils_System::url("civicrm/friend", "reset=1&action=preview&{$subUrl}"); } else { $url = CRM_Utils_System::url("civicrm/friend", "reset=1&{$subUrl}"); } $this->assign('friendURL', $url); } $this->freeze(); // can we blow away the session now to prevent hackery // CRM-9491 $this->controller->reset(); }
/** * Function to actually build the form * * @return void * @access public */ public function buildQuickForm() { $this->assignToTemplate(); $productID = $this->get('productID'); $option = $this->get('option'); $membershipTypeID = $this->get('membershipTypeID'); $this->assign('receiptFromEmail', CRM_Utils_Array::value('receipt_from_email', $this->_values)); if ($productID) { require_once 'CRM/Contribute/BAO/Premium.php'; CRM_Contribute_BAO_Premium::buildPremiumBlock($this, $this->_id, false, $productID, $option); } $this->assign('lineItem', $this->_lineItem); $this->assign('priceSetID', $this->_priceSetId); $params = $this->_params; $honor_block_is_active = $this->get('honor_block_is_active'); if ($honor_block_is_active && (!empty($params["honor_first_name"]) && !empty($params["honor_last_name"]) || !empty($params["honor_email"]))) { $this->assign('honor_block_is_active', $honor_block_is_active); $this->assign('honor_block_title', CRM_Utils_Array::value('honor_block_title', $this->_values)); require_once "CRM/Core/PseudoConstant.php"; $prefix = CRM_Core_PseudoConstant::individualPrefix(); $honor = CRM_Core_PseudoConstant::honor(); $this->assign('honor_type', $honor[$params["honor_type_id"]]); $this->assign('honor_prefix', $params["honor_prefix_id"] ? $prefix[$params["honor_prefix_id"]] : ' '); $this->assign('honor_first_name', $params["honor_first_name"]); $this->assign('honor_last_name', $params["honor_last_name"]); $this->assign('honor_email', $params["honor_email"]); } //pcp elements if ($this->_pcpId) { $this->assign('pcpBlock', true); foreach (array('pcp_display_in_roll', 'pcp_is_anonymous', 'pcp_roll_nickname', 'pcp_personal_note') as $val) { if (CRM_Utils_Array::value($val, $this->_params)) { $this->assign($val, $this->_params[$val]); } } } if ($membershipTypeID) { $transactionID = $this->get('membership_trx_id'); $membershipAmount = $this->get('membership_amount'); $renewalMode = $this->get('renewal_mode'); $this->assign('membership_trx_id', $transactionID); $this->assign('membership_amount', $membershipAmount); $this->assign('renewal_mode', $renewalMode); CRM_Member_BAO_Membership::buildMembershipBlock($this, $this->_id, false, $membershipTypeID, true, null, $this->_membershipContactID); } $this->_separateMembershipPayment = $this->get('separateMembershipPayment'); $this->assign("is_separate_payment", $this->_separateMembershipPayment); $this->buildCustom($this->_values['custom_pre_id'], 'customPre', true); $this->buildCustom($this->_values['custom_post_id'], 'customPost', true); $this->assign('trxn_id', CRM_Utils_Array::value('trxn_id', $this->_params)); $this->assign('receive_date', CRM_Utils_Date::mysqlToIso(CRM_Utils_Array::value('receive_date', $this->_params))); $defaults = array(); $options = array(); $fields = array(); require_once "CRM/Core/BAO/CustomGroup.php"; $removeCustomFieldTypes = array('Contribution'); foreach ($this->_fields as $name => $dontCare) { $fields[$name] = 1; } $fields['state_province'] = $fields['country'] = $fields['email'] = 1; $contact = $this->_params = $this->controller->exportValues('Main'); foreach ($fields as $name => $dontCare) { if (isset($contact[$name])) { $defaults[$name] = $contact[$name]; if (substr($name, 0, 7) == 'custom_') { $timeField = "{$name}_time"; if (isset($contact[$timeField])) { $defaults[$timeField] = $contact[$timeField]; } } else { if (in_array($name, array('addressee', 'email_greeting', 'postal_greeting')) && CRM_Utils_Array::value($name . '_custom', $contact)) { $defaults[$name . '_custom'] = $contact[$name . '_custom']; } } } } $this->_submitValues = array_merge($this->_submitValues, $defaults); $this->setDefaults($defaults); require_once 'CRM/Friend/BAO/Friend.php'; $values['entity_id'] = $this->_id; $values['entity_table'] = 'civicrm_contribution_page'; CRM_Friend_BAO_Friend::retrieve($values, $data); $tellAFriend = false; if ($this->_pcpId) { if ($this->_pcpBlock['is_tellfriend_enabled']) { $this->assign('friendText', ts('Tell a Friend')); $subUrl = "eid={$this->_pcpId}&blockId={$this->_pcpBlock['id']}&page=pcp"; $tellAFriend = true; } } else { if (CRM_Utils_Array::value('is_active', $data)) { $friendText = $data['title']; $this->assign('friendText', $friendText); $subUrl = "eid={$this->_id}&page=contribution"; $tellAFriend = true; } } if ($tellAFriend) { if ($this->_action & CRM_Core_Action::PREVIEW) { $url = CRM_Utils_System::url("civicrm/friend", "reset=1&action=preview&{$subUrl}"); } else { $url = CRM_Utils_System::url("civicrm/friend", "reset=1&{$subUrl}"); } $this->assign('friendURL', $url); } $this->freeze(); // can we blow away the session now to prevent hackery }
/** * Function to build the form * * @return None * @access public */ public function buildQuickForm() { if ($this->_ppType) { return CRM_Core_Payment_ProcessorForm::buildQuickForm($this); } $config = CRM_Core_Config::singleton(); if (CRM_Utils_Array::value('is_for_organization', $this->_values) == 2) { $this->assign('onBehalfRequired', TRUE); $this->_onBehalfRequired = 1; } if ($this->_onbehalf) { $this->assign('onbehalf', TRUE); return CRM_Contribute_Form_Contribution_OnBehalfOf::buildQuickForm($this); } $this->applyFilter('__ALL__', 'trim'); $this->add('text', "email-{$this->_bltID}", ts('Email Address'), array('size' => 30, 'maxlength' => 60), TRUE); $this->addRule("email-{$this->_bltID}", ts('Email is not valid.'), 'email'); $this->_paymentProcessors = $this->get('paymentProcessors'); $pps = array(); if (!empty($this->_paymentProcessors)) { $pps = $this->_paymentProcessors; foreach ($pps as $key => &$name) { $pps[$key] = $name['name']; } } if (CRM_Utils_Array::value('is_pay_later', $this->_values)) { $pps[0] = $this->_values['pay_later_text']; } if (count($pps) > 1) { $this->addRadio('payment_processor', ts('Payment Method'), $pps, NULL, " ", TRUE); } elseif (!empty($pps)) { $key = array_pop(array_keys($pps)); $this->addElement('hidden', 'payment_processor', $key); if ($key === 0) { $this->assign('is_pay_later', $this->_values['is_pay_later']); $this->assign('pay_later_text', $this->_values['pay_later_text']); } } //build pledge block. $this->_useForMember = 0; //don't build membership block when pledge_id is passed if (!CRM_Utils_Array::value('pledge_id', $this->_values)) { $this->_separateMembershipPayment = FALSE; if (in_array('CiviMember', $config->enableComponents)) { $isTest = 0; if ($this->_action & CRM_Core_Action::PREVIEW) { $isTest = 1; } if ($this->_priceSetId && CRM_Core_Component::getComponentID('CiviMember') == CRM_Utils_Array::value('extends', $this->_priceSet)) { $this->_useForMember = 1; $this->set('useForMember', $this->_useForMember); } $this->_separateMembershipPayment = CRM_Member_BAO_Membership::buildMembershipBlock($this, $this->_id, TRUE, NULL, FALSE, $isTest, $this->_membershipContactID); } $this->set('separateMembershipPayment', $this->_separateMembershipPayment); } $this->assign('useForMember', $this->_useForMember); // If we configured price set for contribution page // we are not allow membership signup as well as any // other contribution amount field, CRM-5095 if (isset($this->_priceSetId) && $this->_priceSetId) { $this->add('hidden', 'priceSetId', $this->_priceSetId); // build price set form. $this->set('priceSetId', $this->_priceSetId); CRM_Price_BAO_Set::buildPriceSet($this); if ($this->_values['is_monetary'] && $this->_values['is_recur'] && !CRM_Utils_Array::value('pledge_id', $this->_values)) { self::buildRecur($this); } } elseif (CRM_Utils_Array::value('amount_block_is_active', $this->_values) && !CRM_Utils_Array::value('pledge_id', $this->_values)) { $this->buildAmount($this->_separateMembershipPayment); } if ($this->_priceSetId) { $is_quick_config = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $this->_priceSetId, 'is_quick_config'); if ($is_quick_config) { $this->_useForMember = 0; $this->set('useForMember', $this->_useForMember); } } if ($this->_values['is_for_organization']) { $this->buildOnBehalfOrganization(); } //we allow premium for pledge during pledge creation only. if (!CRM_Utils_Array::value('pledge_id', $this->_values)) { CRM_Contribute_BAO_Premium::buildPremiumBlock($this, $this->_id, TRUE); } if ($this->_values['honor_block_is_active']) { $this->buildHonorBlock(); } //don't build pledge block when mid is passed if (!$this->_mid) { $config = CRM_Core_Config::singleton(); if (in_array('CiviPledge', $config->enableComponents) && CRM_Utils_Array::value('pledge_block_id', $this->_values)) { CRM_Pledge_BAO_PledgeBlock::buildPledgeBlock($this); } } $this->buildCustom($this->_values['custom_pre_id'], 'customPre'); $this->buildCustom($this->_values['custom_post_id'], 'customPost'); if (!empty($this->_fields)) { $profileAddressFields = array(); foreach ($this->_fields as $key => $value) { CRM_Core_BAO_UFField::assignAddressField($key, $profileAddressFields); } $this->set('profileAddressFields', $profileAddressFields); } //to create an cms user if (!$this->_userID) { $createCMSUser = FALSE; if ($this->_values['custom_pre_id']) { $profileID = $this->_values['custom_pre_id']; $createCMSUser = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $profileID, 'is_cms_user'); } if (!$createCMSUser && $this->_values['custom_post_id']) { if (!is_array($this->_values['custom_post_id'])) { $profileIDs = array($this->_values['custom_post_id']); } else { $profileIDs = $this->_values['custom_post_id']; } foreach ($profileIDs as $pid) { if (CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $pid, 'is_cms_user')) { $profileID = $pid; $createCMSUser = TRUE; break; } } } if ($createCMSUser) { CRM_Core_BAO_CMSUser::buildForm($this, $profileID, TRUE); } } if ($this->_pcpId) { if ($pcpSupporter = CRM_PCP_BAO_PCP::displayName($this->_pcpId)) { $this->assign('pcpSupporterText', ts('This contribution is being made thanks to effort of <strong>%1</strong>, who supports our campaign. You can support it as well - once you complete the donation, you will be able to create your own Personal Campaign Page!', array(1 => $pcpSupporter))); } $this->assign('pcp', TRUE); $this->add('checkbox', 'pcp_display_in_roll', ts('Show my contribution in the public honor roll'), NULL, NULL, array('onclick' => "showHideByValue('pcp_display_in_roll','','nameID|nickID|personalNoteID','block','radio',false); pcpAnonymous( );")); $extraOption = array('onclick' => "return pcpAnonymous( );"); $elements = array(); $elements[] =& $this->createElement('radio', NULL, '', ts('Include my name and message'), 0, $extraOption); $elements[] =& $this->createElement('radio', NULL, '', ts('List my contribution anonymously'), 1, $extraOption); $this->addGroup($elements, 'pcp_is_anonymous', NULL, ' '); $this->_defaults['pcp_is_anonymous'] = 0; $this->add('text', 'pcp_roll_nickname', ts('Name'), array('maxlength' => 30)); $this->add('textarea', 'pcp_personal_note', ts('Personal Note'), array('style' => 'height: 3em; width: 40em;')); } //we have to load confirm contribution button in template //when multiple payment processor as the user //can toggle with payment processor selection $billingModePaymentProcessors = 0; if (!empty($this->_paymentProcessors)) { foreach ($this->_paymentProcessors as $key => $values) { if ($values['billing_mode'] == CRM_Core_Payment::BILLING_MODE_BUTTON) { $billingModePaymentProcessors++; } } } if ($billingModePaymentProcessors && count($this->_paymentProcessors) == $billingModePaymentProcessors) { $allAreBillingModeProcessors = TRUE; } else { $allAreBillingModeProcessors = FALSE; } if (!($allAreBillingModeProcessors && !$this->_values['is_pay_later'])) { $this->addButtons(array(array('type' => 'upload', 'name' => ts('Confirm Contribution'), 'spacing' => ' ', 'isDefault' => TRUE))); } $this->addFormRule(array('CRM_Contribute_Form_Contribution_Main', 'formRule'), $this); }
/** * Function to build the form * * @return None * @access public */ public function buildQuickForm() { $config = CRM_Core_Config::singleton(); if ($this->_values['is_for_organization'] == 2) { $this->assign('onBehalfRequired', true); } if ($this->_onbehalf) { $this->assign('onbehalf', true); return CRM_Contribute_Form_Contribution_OnBehalfOf::buildQuickForm($this); } $this->applyFilter('__ALL__', 'trim'); $this->add('text', "email-{$this->_bltID}", ts('Email Address'), array('size' => 30, 'maxlength' => 60), true); $this->addRule("email-{$this->_bltID}", ts('Email is not valid.'), 'email'); //build pledge block. $this->_useForMember = 0; //don't build membership block when pledge_id is passed if (!CRM_Utils_Array::value('pledge_id', $this->_values)) { $this->_separateMembershipPayment = false; if (in_array('CiviMember', $config->enableComponents)) { $isTest = 0; if ($this->_action & CRM_Core_Action::PREVIEW) { $isTest = 1; } if ($this->_priceSetId && CRM_Core_Component::getComponentID('CiviMember') == CRM_Utils_Array::value('extends', $this->_priceSet)) { $this->_useForMember = 1; $this->set('useForMember', $this->_useForMember); } require_once 'CRM/Member/BAO/Membership.php'; $this->_separateMembershipPayment = CRM_Member_BAO_Membership::buildMembershipBlock($this, $this->_id, true, null, false, $isTest, $this->_membershipContactID); } $this->set('separateMembershipPayment', $this->_separateMembershipPayment); } $this->assign('useForMember', $this->_useForMember); // If we configured price set for contribution page // we are not allow membership signup as well as any // other contribution amount field, CRM-5095 if (isset($this->_priceSetId) && $this->_priceSetId) { $this->add('hidden', 'priceSetId', $this->_priceSetId); // build price set form. $this->set('priceSetId', $this->_priceSetId); require_once 'CRM/Price/BAO/Set.php'; CRM_Price_BAO_Set::buildPriceSet($this); } else { if (CRM_Utils_Array::value('amount_block_is_active', $this->_values) && !CRM_Utils_Array::value('pledge_id', $this->_values)) { $this->buildAmount($this->_separateMembershipPayment); if ($this->_values['is_monetary'] && $this->_values['is_recur'] && $this->_paymentProcessor['is_recur']) { self::buildRecur($this); } } } if (CRM_Utils_Array::value('is_pay_later', $this->_values)) { $this->buildPayLater(); } if ($this->_values['is_for_organization']) { $this->buildOnBehalfOrganization(); } //we allow premium for pledge during pledge creation only. if (!CRM_Utils_Array::value('pledge_id', $this->_values)) { require_once 'CRM/Contribute/BAO/Premium.php'; CRM_Contribute_BAO_Premium::buildPremiumBlock($this, $this->_id, true); } if ($this->_values['honor_block_is_active']) { $this->buildHonorBlock(); } //don't build pledge block when mid is passed if (!$this->_mid) { $config = CRM_Core_Config::singleton(); if (in_array('CiviPledge', $config->enableComponents) && CRM_Utils_Array::value('pledge_block_id', $this->_values)) { require_once 'CRM/Pledge/BAO/PledgeBlock.php'; CRM_Pledge_BAO_PledgeBlock::buildPledgeBlock($this); } } $this->buildCustom($this->_values['custom_pre_id'], 'customPre'); $this->buildCustom($this->_values['custom_post_id'], 'customPost'); // doing this later since the express button type depends if there is an upload or not if ($this->_values['is_monetary']) { require_once 'CRM/Core/Payment/Form.php'; if ($this->_paymentProcessor['payment_type'] & CRM_Core_Payment::PAYMENT_TYPE_DIRECT_DEBIT) { CRM_Core_Payment_Form::buildDirectDebit($this); } else { CRM_Core_Payment_Form::buildCreditCard($this); } } //to create an cms user if (!$this->_userID) { $createCMSUser = false; if ($this->_values['custom_pre_id']) { $profileID = $this->_values['custom_pre_id']; $createCMSUser = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $profileID, 'is_cms_user'); } if (!$createCMSUser && $this->_values['custom_post_id']) { $profileID = $this->_values['custom_post_id']; $createCMSUser = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $profileID, 'is_cms_user'); } if ($createCMSUser) { require_once 'CRM/Core/BAO/CMSUser.php'; CRM_Core_BAO_CMSUser::buildForm($this, $profileID, true); } } if ($this->_pcpId) { require_once 'CRM/Contribute/BAO/PCP.php'; if ($pcpSupporter = CRM_Contribute_BAO_PCP::displayName($this->_pcpId)) { $this->assign('pcpSupporterText', ts('This contribution is being made thanks to effort of <strong>%1</strong>, who supports our campaign. You can support it as well - once you complete the donation, you will be able to create your own Personal Campaign Page!', array(1 => $pcpSupporter))); } $this->assign('pcp', true); $this->add('checkbox', 'pcp_display_in_roll', ts('Show my contribution in the public honor roll'), null, null, array('onclick' => "showHideByValue('pcp_display_in_roll','','nameID|nickID|personalNoteID','block','radio',false); pcpAnonymous( );")); $extraOption = array('onclick' => "return pcpAnonymous( );"); $elements = array(); $elements[] =& $this->createElement('radio', null, '', ts('Include my name and message'), 0, $extraOption); $elements[] =& $this->createElement('radio', null, '', ts('List my contribution anonymously'), 1, $extraOption); $this->addGroup($elements, 'pcp_is_anonymous', null, ' '); $this->_defaults['pcp_is_anonymous'] = 0; $this->add('text', 'pcp_roll_nickname', ts('Name'), array('maxlength' => 30)); $this->add('textarea', 'pcp_personal_note', ts('Personal Note'), array('style' => 'height: 3em; width: 40em;')); } if (!($this->_paymentProcessor['billing_mode'] == CRM_Core_Payment::BILLING_MODE_BUTTON && !$this->_values['is_pay_later'])) { $this->addButtons(array(array('type' => 'upload', 'name' => ts('Confirm Contribution'), 'spacing' => ' ', 'isDefault' => true))); } $this->addFormRule(array('CRM_Contribute_Form_Contribution_Main', 'formRule'), $this); }