/** * Set variables up before form is built. * * @return void */ public function preProcess() { $this->_eventId = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE); $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE); //CRM-4320 $this->_participantId = CRM_Utils_Request::retrieve('participantId', 'Positive', $this); // current mode $this->_mode = $this->_action == 1024 ? 'test' : 'live'; $this->_values = $this->get('values'); $this->_fields = $this->get('fields'); $this->_bltID = $this->get('bltID'); $this->_paymentProcessor = $this->get('paymentProcessor'); $this->_priceSetId = $this->get('priceSetId'); $this->_priceSet = $this->get('priceSet'); $this->_lineItem = $this->get('lineItem'); $this->_isEventFull = $this->get('isEventFull'); $this->_lineItemParticipantsCount = $this->get('lineItemParticipants'); if (!is_array($this->_lineItem)) { $this->_lineItem = array(); } if (!is_array($this->_lineItemParticipantsCount)) { $this->_lineItemParticipantsCount = array(); } $this->_availableRegistrations = $this->get('availableRegistrations'); $this->_participantIDS = $this->get('participantIDs'); //check if participant allow to walk registration wizard. $this->_allowConfirmation = $this->get('allowConfirmation'); // check for Approval $this->_requireApproval = $this->get('requireApproval'); // check for waitlisting. $this->_allowWaitlist = $this->get('allowWaitlist'); $this->_forcePayement = $this->get('forcePayement'); //get the additional participant ids. $this->_additionalParticipantIds = $this->get('additionalParticipantIds'); $config = CRM_Core_Config::singleton(); if (!$this->_values) { // create redirect URL to send folks back to event info page is registration not available $infoUrl = CRM_Utils_System::url('civicrm/event/info', "reset=1&id={$this->_eventId}", FALSE, NULL, FALSE, TRUE); // this is the first time we are hitting this, so check for permissions here if (!CRM_Core_Permission::event(CRM_Core_Permission::EDIT, $this->_eventId, 'register for events')) { CRM_Core_Error::statusBounce(ts('You do not have permission to register for this event'), $infoUrl); } // get all the values from the dao object $this->_values = $this->_fields = array(); $this->_forcePayement = FALSE; //retrieve event information $params = array('id' => $this->_eventId); CRM_Event_BAO_Event::retrieve($params, $this->_values['event']); $this->checkValidEvent($infoUrl); // get the participant values, CRM-4320 $this->_allowConfirmation = FALSE; if ($this->_participantId) { $this->processFirstParticipant($this->_participantId); } //check for additional participants. if ($this->_allowConfirmation && $this->_values['event']['is_multiple_registrations']) { $additionalParticipantIds = CRM_Event_BAO_Participant::getAdditionalParticipantIds($this->_participantId); $cnt = 1; foreach ($additionalParticipantIds as $additionalParticipantId) { $this->_additionalParticipantIds[$cnt] = $additionalParticipantId; $cnt++; } $this->set('additionalParticipantIds', $this->_additionalParticipantIds); } $eventFull = CRM_Event_BAO_Participant::eventFull($this->_eventId, FALSE, CRM_Utils_Array::value('has_waitlist', $this->_values['event'])); $this->_allowWaitlist = $this->_isEventFull = FALSE; if ($eventFull && !$this->_allowConfirmation) { $this->_isEventFull = TRUE; //lets redirecting to info only when to waiting list. $this->_allowWaitlist = CRM_Utils_Array::value('has_waitlist', $this->_values['event']); if (!$this->_allowWaitlist) { CRM_Utils_System::redirect($infoUrl); } } $this->set('isEventFull', $this->_isEventFull); $this->set('allowWaitlist', $this->_allowWaitlist); //check for require requires approval. $this->_requireApproval = FALSE; if (!empty($this->_values['event']['requires_approval']) && !$this->_allowConfirmation) { $this->_requireApproval = TRUE; } $this->set('requireApproval', $this->_requireApproval); if (isset($this->_values['event']['default_role_id'])) { $participant_role = CRM_Core_OptionGroup::values('participant_role'); $this->_values['event']['participant_role'] = $participant_role["{$this->_values['event']['default_role_id']}"]; } // check for is_monetary status $isMonetary = CRM_Utils_Array::value('is_monetary', $this->_values['event']); $isPayLater = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_eventId, 'is_pay_later'); //check for variour combination for paylater, payment //process with paid event. if ($isMonetary && (!$isPayLater || !empty($this->_values['event']['payment_processor']))) { $ppID = CRM_Utils_Array::value('payment_processor', $this->_values['event']); if (!$ppID) { CRM_Core_Error::statusBounce(ts('A payment processor must be selected for this event registration page, or the event must be configured to give users the option to pay later (contact the site administrator for assistance).'), $infoUrl); } $ppIds = explode(CRM_Core_DAO::VALUE_SEPARATOR, $ppID); $this->_paymentProcessors = CRM_Financial_BAO_PaymentProcessor::getPayments($ppIds, $this->_mode); $this->set('paymentProcessors', $this->_paymentProcessors); //set default payment processor if (!empty($this->_paymentProcessors) && empty($this->_paymentProcessor)) { foreach ($this->_paymentProcessors as $ppId => $values) { if ($values['is_default'] == 1 || count($this->_paymentProcessors) == 1) { $defaultProcessorId = $ppId; break; } } } if (isset($defaultProcessorId)) { $this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($defaultProcessorId, $this->_mode); } // make sure we have a valid payment class, else abort if ($this->_values['event']['is_monetary']) { if (!CRM_Utils_System::isNull($this->_paymentProcessors)) { foreach ($this->_paymentProcessors as $eachPaymentProcessor) { // check selected payment processor is active if (!$eachPaymentProcessor) { CRM_Core_Error::fatal(ts('The site administrator must set a Payment Processor for this event in order to use online registration.')); } // ensure that processor has a valid config $payment = CRM_Core_Payment::singleton($this->_mode, $eachPaymentProcessor, $this); $error = $payment->checkConfig(); if (!empty($error)) { CRM_Core_Error::fatal($error); } } } } } //init event fee. self::initEventFee($this, $this->_eventId); // get the profile ids $ufJoinParams = array('entity_table' => 'civicrm_event', 'module' => 'CiviEvent', 'entity_id' => $this->_eventId); list($this->_values['custom_pre_id'], $this->_values['custom_post_id']) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams); // set profiles for additional participants if ($this->_values['event']['is_multiple_registrations']) { // CRM-4377: CiviEvent for the main participant, CiviEvent_Additional for additional participants $ufJoinParams['module'] = 'CiviEvent_Additional'; list($this->_values['additional_custom_pre_id'], $this->_values['additional_custom_post_id'], $preActive, $postActive) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams); // CRM-4377: we need to maintain backward compatibility, hence if there is profile for main contact // set same profile for additional contacts. if ($this->_values['custom_pre_id'] && !$this->_values['additional_custom_pre_id']) { $this->_values['additional_custom_pre_id'] = $this->_values['custom_pre_id']; } if ($this->_values['custom_post_id'] && !$this->_values['additional_custom_post_id']) { $this->_values['additional_custom_post_id'] = $this->_values['custom_post_id']; } // now check for no profile condition, in that case is_active = 0 if (isset($preActive) && !$preActive) { unset($this->_values['additional_custom_pre_id']); } if (isset($postActive) && !$postActive) { unset($this->_values['additional_custom_post_id']); } } // get the billing location type $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array(), 'validate'); // CRM-8108 remove ts from Billing as the location type can not be translated in CiviCRM! //$this->_bltID = array_search( ts('Billing'), $locationTypes ); $this->_bltID = array_search('Billing', $locationTypes); if (!$this->_bltID) { CRM_Core_Error::fatal(ts('Please set a location type of %1', array(1 => 'Billing'))); } $this->set('bltID', $this->_bltID); if ($this->_values['event']['is_monetary']) { CRM_Core_Payment_Form::setPaymentFieldsByProcessor($this, $this->_paymentProcessor); } $params = array('entity_id' => $this->_eventId, 'entity_table' => 'civicrm_event'); $this->_values['location'] = CRM_Core_BAO_Location::getValues($params, TRUE); $this->set('values', $this->_values); $this->set('fields', $this->_fields); $this->_availableRegistrations = CRM_Event_BAO_Participant::eventFull($this->_values['event']['id'], TRUE, CRM_Utils_Array::value('has_waitlist', $this->_values['event'])); $this->set('availableRegistrations', $this->_availableRegistrations); } $this->assign_by_ref('paymentProcessor', $this->_paymentProcessor); // check if this is a paypal auto return and redirect accordingly if (CRM_Core_Payment::paypalRedirect($this->_paymentProcessor)) { $url = CRM_Utils_System::url('civicrm/event/register', "_qf_ThankYou_display=1&qfKey={$this->controller->_key}"); CRM_Utils_System::redirect($url); } $this->_contributeMode = $this->get('contributeMode'); $this->assign('contributeMode', $this->_contributeMode); // setting CMS page title CRM_Utils_System::setTitle($this->_values['event']['title']); $this->assign('title', $this->_values['event']['title']); $this->assign('paidEvent', $this->_values['event']['is_monetary']); // we do not want to display recently viewed items on Registration pages $this->assign('displayRecent', FALSE); // Registration page values are cleared from session, so can't use normal Printer Friendly view. // Use Browser Print instead. $this->assign('browserPrint', TRUE); $isShowLocation = CRM_Utils_Array::value('is_show_location', $this->_values['event']); $this->assign('isShowLocation', $isShowLocation); // Handle PCP $pcpId = CRM_Utils_Request::retrieve('pcpId', 'Positive', $this); if ($pcpId) { $pcp = CRM_PCP_BAO_PCP::handlePcp($pcpId, 'event', $this->_values['event']); $this->_pcpId = $pcp['pcpId']; $this->_values['event']['intro_text'] = CRM_Utils_Array::value('intro_text', $pcp['pcpInfo']); } // assign all event properties so wizard templates can display event info. $this->assign('event', $this->_values['event']); $this->assign('location', $this->_values['location']); $this->assign('bltID', $this->_bltID); $isShowLocation = CRM_Utils_Array::value('is_show_location', $this->_values['event']); $this->assign('isShowLocation', $isShowLocation); //CRM-6907 $config->defaultCurrency = CRM_Utils_Array::value('currency', $this->_values['event'], $config->defaultCurrency); //lets allow user to override campaign. $campID = CRM_Utils_Request::retrieve('campID', 'Positive', $this); if ($campID && CRM_Core_DAO::getFieldValue('CRM_Campaign_DAO_Campaign', $campID)) { $this->_values['event']['campaign_id'] = $campID; } // check if billing block is required for pay later if (CRM_Utils_Array::value('is_pay_later', $this->_values['event'])) { $this->_isBillingAddressRequiredForPayLater = CRM_Utils_Array::value('is_billing_required', $this->_values['event']); $this->assign('isBillingAddressRequiredForPayLater', $this->_isBillingAddressRequiredForPayLater); } }
/** * Function to set variables up before form is built * * @return void * @access public */ public function preProcess() { $config = CRM_Core_Config::singleton(); $session = CRM_Core_Session::singleton(); // current contribution page id $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this); if (!$this->_id) { // seems like the session is corrupted and/or we lost the id trail // lets just bump this to a regular session error and redirect user to main page $this->controller->invalidKeyRedirect(); } // this was used prior to the cleverer this_>getContactID - unsure now $this->_userID = $session->get('userID'); $this->_contactID = $this->_membershipContactID = $this->getContactID(); $this->_mid = NULL; if ($this->_contactID) { $this->_mid = CRM_Utils_Request::retrieve('mid', 'Positive', $this); if ($this->_mid) { $membership = new CRM_Member_DAO_Membership(); $membership->id = $this->_mid; if ($membership->find(TRUE)) { $this->_defaultMemTypeId = $membership->membership_type_id; if ($membership->contact_id != $this->_contactID) { $validMembership = FALSE; $employers = CRM_Contact_BAO_Relationship::getPermissionedEmployer($this->_userID); if (!empty($employers) && array_key_exists($membership->contact_id, $employers)) { $this->_membershipContactID = $membership->contact_id; $this->assign('membershipContactID', $this->_membershipContactID); $this->assign('membershipContactName', $employers[$this->_membershipContactID]['name']); $validMembership = TRUE; } else { $membershipType = new CRM_Member_BAO_MembershipType(); $membershipType->id = $membership->membership_type_id; if ($membershipType->find(TRUE)) { // CRM-14051 - membership_type.relationship_type_id is a CTRL-A padded string w one or more ID values. // Convert to commma separated list. $inheritedRelTypes = implode(CRM_Utils_Array::explodePadded($membershipType->relationship_type_id), ','); $permContacts = CRM_Contact_BAO_Relationship::getPermissionedContacts($this->_userID, $membershipType->relationship_type_id); if (array_key_exists($membership->contact_id, $permContacts)) { $this->_membershipContactID = $membership->contact_id; $validMembership = TRUE; } } } if (!$validMembership) { CRM_Core_Session::setStatus(ts("Oops. The membership you're trying to renew appears to be invalid. Contact your site administrator if you need assistance. If you continue, you will be issued a new membership."), ts('Membership Invalid'), 'alert'); } } } else { CRM_Core_Session::setStatus(ts("Oops. The membership you're trying to renew appears to be invalid. Contact your site administrator if you need assistance. If you continue, you will be issued a new membership."), ts('Membership Invalid'), 'alert'); } unset($membership); } } // we do not want to display recently viewed items, so turn off $this->assign('displayRecent', FALSE); // Contribution page values are cleared from session, so can't use normal Printer Friendly view. // Use Browser Print instead. $this->assign('browserPrint', TRUE); // action $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add'); $this->assign('action', $this->_action); // current mode $this->_mode = $this->_action == 1024 ? 'test' : 'live'; $this->_values = $this->get('values'); $this->_fields = $this->get('fields'); $this->_bltID = $this->get('bltID'); $this->_paymentProcessor = $this->get('paymentProcessor'); $this->_priceSetId = $this->get('priceSetId'); $this->_priceSet = $this->get('priceSet'); if (!$this->_values) { // get all the values from the dao object $this->_values = array(); $this->_fields = array(); CRM_Contribute_BAO_ContributionPage::setValues($this->_id, $this->_values); // check if form is active if (!CRM_Utils_Array::value('is_active', $this->_values)) { // form is inactive, die a fatal death CRM_Core_Error::fatal(ts('The page you requested is currently unavailable.')); } // also check for billing informatin // get the billing location type $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array(), 'validate'); // CRM-8108 remove ts around Billing location type //$this->_bltID = array_search( ts('Billing'), $locationTypes ); $this->_bltID = array_search('Billing', $locationTypes); if (!$this->_bltID) { CRM_Core_Error::fatal(ts('Please set a location type of %1', array(1 => 'Billing'))); } $this->set('bltID', $this->_bltID); // check for is_monetary status $isMonetary = CRM_Utils_Array::value('is_monetary', $this->_values); $isPayLater = CRM_Utils_Array::value('is_pay_later', $this->_values); //FIXME: to support multiple payment processors if ($isMonetary && (!$isPayLater || CRM_Utils_Array::value('payment_processor', $this->_values))) { $ppID = CRM_Utils_Array::value('payment_processor', $this->_values); if (!$ppID) { CRM_Core_Error::fatal(ts('A payment processor must be selected for this contribution page (contact the site administrator for assistance).')); } $ppIds = explode(CRM_Core_DAO::VALUE_SEPARATOR, $ppID); $this->_paymentProcessors = CRM_Financial_BAO_PaymentProcessor::getPayments($ppIds, $this->_mode); $this->set('paymentProcessors', $this->_paymentProcessors); //set default payment processor if (!empty($this->_paymentProcessors) && empty($this->_paymentProcessor)) { foreach ($this->_paymentProcessors as $ppId => $values) { if ($values['is_default'] == 1 || count($this->_paymentProcessors) == 1) { $defaultProcessorId = $ppId; break; } } } if (isset($defaultProcessorId)) { $this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($defaultProcessorId, $this->_mode); $this->assign_by_ref('paymentProcessor', $this->_paymentProcessor); } if (!CRM_Utils_System::isNull($this->_paymentProcessors)) { foreach ($this->_paymentProcessors as $eachPaymentProcessor) { // check selected payment processor is active if (empty($eachPaymentProcessor)) { CRM_Core_Error::fatal(ts('A payment processor configured for this page might be disabled (contact the site administrator for assistance).')); } // ensure that processor has a valid config $this->_paymentObject =& CRM_Core_Payment::singleton($this->_mode, $eachPaymentProcessor, $this); $error = $this->_paymentObject->checkConfig(); if (!empty($error)) { CRM_Core_Error::fatal($error); } } } } // get price info // CRM-5095 CRM_Price_BAO_PriceSet::initSet($this, $this->_id, 'civicrm_contribution_page'); // this avoids getting E_NOTICE errors in php $setNullFields = array('amount_block_is_active', 'honor_block_is_active', 'is_allow_other_amount', 'footer_text'); foreach ($setNullFields as $f) { if (!isset($this->_values[$f])) { $this->_values[$f] = NULL; } } //check if Membership Block is enabled, if Membership Fields are included in profile //get membership section for this contribution page $this->_membershipBlock = CRM_Member_BAO_Membership::getMembershipBlock($this->_id); $this->set('membershipBlock', $this->_membershipBlock); if ($this->_values['custom_pre_id']) { $preProfileType = CRM_Core_BAO_UFField::getProfileType($this->_values['custom_pre_id']); } if ($this->_values['custom_post_id']) { $postProfileType = CRM_Core_BAO_UFField::getProfileType($this->_values['custom_post_id']); } if ((isset($postProfileType) && $postProfileType == 'Membership' || isset($preProfileType) && $preProfileType == 'Membership') && !$this->_membershipBlock['is_active']) { CRM_Core_Error::fatal(ts('This page includes a Profile with Membership fields - but the Membership Block is NOT enabled. Please notify the site administrator.')); } $pledgeBlock = CRM_Pledge_BAO_PledgeBlock::getPledgeBlock($this->_id); if ($pledgeBlock) { $this->_values['pledge_block_id'] = CRM_Utils_Array::value('id', $pledgeBlock); $this->_values['max_reminders'] = CRM_Utils_Array::value('max_reminders', $pledgeBlock); $this->_values['initial_reminder_day'] = CRM_Utils_Array::value('initial_reminder_day', $pledgeBlock); $this->_values['additional_reminder_day'] = CRM_Utils_Array::value('additional_reminder_day', $pledgeBlock); //set pledge id in values $pledgeId = CRM_Utils_Request::retrieve('pledgeId', 'Positive', $this); //authenticate pledge user for pledge payment. if ($pledgeId) { $this->_values['pledge_id'] = $pledgeId; //lets override w/ pledge campaign. $this->_values['campaign_id'] = CRM_Core_DAO::getFieldValue('CRM_Pledge_DAO_Pledge', $pledgeId, 'campaign_id'); self::authenticatePledgeUser(); } } $this->set('values', $this->_values); $this->set('fields', $this->_fields); } // Handle PCP $pcpId = CRM_Utils_Request::retrieve('pcpId', 'Positive', $this); if ($pcpId) { $pcp = CRM_PCP_BAO_PCP::handlePcp($pcpId, 'contribute', $this->_values); $this->_pcpId = $pcp['pcpId']; $this->_pcpBlock = $pcp['pcpBlock']; $this->_pcpInfo = $pcp['pcpInfo']; } // Link (button) for users to create their own Personal Campaign page if ($linkText = CRM_PCP_BAO_PCP::getPcpBlockStatus($this->_id, 'contribute')) { $linkTextUrl = CRM_Utils_System::url('civicrm/contribute/campaign', "action=add&reset=1&pageId={$this->_id}&component=contribute", FALSE, NULL, TRUE); $this->assign('linkTextUrl', $linkTextUrl); $this->assign('linkText', $linkText); } //set pledge block if block id is set if (CRM_Utils_Array::value('pledge_block_id', $this->_values)) { $this->assign('pledgeBlock', TRUE); } // check if one of the (amount , membership) bloks is active or not $this->_membershipBlock = $this->get('membershipBlock'); if (!$this->_values['amount_block_is_active'] && !$this->_membershipBlock['is_active'] && !$this->_priceSetId) { CRM_Core_Error::fatal(ts('The requested online contribution page is missing a required Contribution Amount section or Membership section or Price Set. Please check with the site administrator for assistance.')); } if ($this->_values['amount_block_is_active']) { $this->set('amount_block_is_active', $this->_values['amount_block_is_active']); } $this->_contributeMode = $this->get('contributeMode'); $this->assign('contributeMode', $this->_contributeMode); //assigning is_monetary and is_email_receipt to template $this->assign('is_monetary', $this->_values['is_monetary']); $this->assign('is_email_receipt', $this->_values['is_email_receipt']); $this->assign('bltID', $this->_bltID); //assign cancelSubscription URL to templates $this->assign('cancelSubscriptionUrl', CRM_Utils_Array::value('cancelSubscriptionUrl', $this->_values)); // assigning title to template in case someone wants to use it, also setting CMS page title if ($this->_pcpId) { $this->assign('title', $this->_pcpInfo['title']); CRM_Utils_System::setTitle($this->_pcpInfo['title']); } else { $this->assign('title', $this->_values['title']); CRM_Utils_System::setTitle($this->_values['title']); } $this->_defaults = array(); $this->_amount = $this->get('amount'); //CRM-6907 $config = CRM_Core_Config::singleton(); $config->defaultCurrency = CRM_Utils_Array::value('currency', $this->_values, $config->defaultCurrency); //lets allow user to override campaign. $campID = CRM_Utils_Request::retrieve('campID', 'Positive', $this); if ($campID && CRM_Core_DAO::getFieldValue('CRM_Campaign_DAO_Campaign', $campID)) { $this->_values['campaign_id'] = $campID; } //do check for cancel recurring and clean db, CRM-7696 if (CRM_Utils_Request::retrieve('cancel', 'Boolean', CRM_Core_DAO::$_nullObject)) { self::cancelRecurring(); } }
function simpledonate_civicrm_pageRun(&$page) { $pageName = $page->getVar('_name'); if ($pageName == 'Civi\\Angular\\Page\\Main' && $page->urlPath[1] == 'simple') { //Get all contribution page detils and session details to be used in js $settingVal = simpledonate_getSimpleDonateSetting(); $session = CRM_Core_Session::singleton(); $contactID = $session->get('userID'); if ($settingVal['donatePageID']) { $extends = CRM_Core_Component::getComponentID('CiviContribute'); $priceSetID = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $settingVal['donatePageID'], $extends); $priceField = civicrm_api3('PriceField', 'get', array("price_set_id" => $priceSetID)); //Check for is_quick_config $isQuickConfig = civicrm_api3('PriceSet', 'getvalue', array('id' => $priceSetID, 'return' => "is_quick_config")); //Check for Other amount $otherAmount = FALSE; foreach ($priceField['values'] as $key => $value) { if ($value['name'] == 'other_amount') { $otherAmount = TRUE; } else { $priceFieldVal = civicrm_api3('PriceFieldValue', 'get', array('return' => "amount, title, name, is_default", "price_field_id" => $value['id'])); $priceList = $priceFieldVal['values']; $htmlPriceList[$value['html_type']] = $priceFieldVal['values']; } } //Get donation page details $donateConfig = $donatePage = civicrm_api3('ContributionPage', 'getsingle', array('id' => $settingVal['donatePageID'])); CRM_Utils_System::setTitle($donateConfig['title']); // Set the page title $currencySymbol = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_Currency', $donatePage['currency'], 'symbol', 'name'); $test = !empty($_GET['test']) ? 'test' : 'live'; // Check for test or live donation //Get payment processor details if (is_array($donatePage['payment_processor'])) { $paymentProcessors = CRM_Financial_BAO_PaymentProcessor::getPayments($donatePage['payment_processor'], $test); } else { $paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($donatePage['payment_processor'], $test); $paymentProcessors[$paymentProcessor['id']] = $paymentProcessor; $paymentProcessors[$paymentProcessor['id']]['hide'] = $donateConfig['is_pay_later'] ? FALSE : TRUE; } //set Country and State value $config = CRM_Core_Config::singleton(); $defaultContactCountry = $config->defaultContactCountry; $stateProvince = array_flip(CRM_Core_PseudoConstant::stateProvinceForCountry($defaultContactCountry)); $countryList = CRM_Core_PseudoConstant::country(); $stateList = array(); foreach ($countryList as $key => $val) { $stateList[$key] = CRM_Core_PseudoConstant::stateProvinceForCountry($key); } CRM_Core_Resources::singleton()->addSetting(array('simpledonate' => array('sessionContact' => $contactID, 'priceSetID' => $priceSetID, 'ziptasticEnable' => $settingVal['ziptasticEnable'], 'countryList' => CRM_Core_PseudoConstant::country(), 'stateList' => $stateList, 'country' => $defaultContactCountry, 'allStates' => $stateProvince, 'currency' => $currencySymbol, 'config' => $donateConfig, 'paymentProcessor' => $paymentProcessors, 'priceList' => $priceList, 'otherAmount' => $otherAmount, 'isTest' => $test == 'test' ? 1 : 0, 'htmlPriceList' => $htmlPriceList, 'isQuickConfig' => $isQuickConfig))); //Include bootstrap and custom css files to affect this angular page only CRM_Core_Resources::singleton()->addStyleFile('com.webaccessglobal.simpledonate', 'css/bootstrap.min.css', 103, 'page-header'); CRM_Core_Resources::singleton()->addStyleFile('com.webaccessglobal.simpledonate', 'css/simpledonate.css', 100, 'page-body'); } if ($contactID) { $id = array('id' => $contactID); $result = civicrm_api3('Contact', 'getSingle', $id); CRM_Core_Resources::singleton()->addSetting(array('simpledonateVal' => $result)); } } }