当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Event_BAO_Participant::getAdditionalParticipantIds方法代码示例

本文整理汇总了PHP中CRM_Event_BAO_Participant::getAdditionalParticipantIds方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Event_BAO_Participant::getAdditionalParticipantIds方法的具体用法?PHP CRM_Event_BAO_Participant::getAdditionalParticipantIds怎么用?PHP CRM_Event_BAO_Participant::getAdditionalParticipantIds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Event_BAO_Participant的用法示例。


在下文中一共展示了CRM_Event_BAO_Participant::getAdditionalParticipantIds方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: preProcess

 /**
  * Set variables up before form is built.
  */
 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']);
         // check for is_monetary status
         $isMonetary = CRM_Utils_Array::value('is_monetary', $this->_values['event']);
         // check for ability to add contributions of type
         if ($isMonetary && CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && !CRM_Core_Permission::check('add contributions of type ' . CRM_Contribute_PseudoConstant::financialType($this->_values['event']['financial_type_id']))) {
             CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
         }
         $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']}"];
         }
         $isPayLater = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_eventId, 'is_pay_later');
         //check for various combinations for paylater, payment
         //process with paid event.
         if ($isMonetary && (!$isPayLater || !empty($this->_values['event']['payment_processor']))) {
             $this->_paymentProcessorIDs = explode(CRM_Core_DAO::VALUE_SEPARATOR, CRM_Utils_Array::value('payment_processor', $this->_values['event']));
//.........这里部分代码省略.........
开发者ID:nyimbi,项目名称:civicrm-core,代码行数:101,代码来源:Registration.php

示例2: postProcess

 /**
  * Process the form submission.
  */
 public function postProcess()
 {
     // get the submitted form values.
     $params = $this->controller->exportValues($this->_name);
     if ($this->_action & CRM_Core_Action::DELETE) {
         if (CRM_Utils_Array::value('delete_participant', $params) == 2) {
             $additionalId = CRM_Event_BAO_Participant::getAdditionalParticipantIds($this->_id);
             $participantLinks = CRM_Event_BAO_Participant::getAdditionalParticipantUrl($additionalId);
         }
         if (CRM_Utils_Array::value('delete_participant', $params) == 1) {
             $additionalIds = CRM_Event_BAO_Participant::getAdditionalParticipantIds($this->_id);
             foreach ($additionalIds as $value) {
                 CRM_Event_BAO_Participant::deleteParticipant($value);
             }
         }
         CRM_Event_BAO_Participant::deleteParticipant($this->_id);
         CRM_Core_Session::setStatus(ts('Selected participant was deleted successfully.'), ts('Record Deleted'), 'success');
         if (!empty($participantLinks)) {
             $status = ts('The following participants no longer have an event fee recorded. You can edit their registration and record a replacement contribution by clicking the links below:') . '<br/>' . $participantLinks;
             CRM_Core_Session::setStatus($status, ts('Group Payment Deleted'));
         }
         return;
     }
     // When adding a single contact, the formRule prevents you from adding duplicates
     // (See above in formRule()). When adding more than one contact, the duplicates are
     // removed automatically and the user receives one notification.
     if ($this->_action & CRM_Core_Action::ADD) {
         $event_id = $this->_eventId;
         if (empty($event_id) && !empty($params['event_id'])) {
             $event_id = $params['event_id'];
         }
         if (!$this->_single && !empty($event_id)) {
             $duplicateContacts = 0;
             while (list($k, $dupeCheckContactId) = each($this->_contactIds)) {
                 // Eliminate contacts that have already been assigned to this event.
                 $dupeCheck = new CRM_Event_BAO_Participant();
                 $dupeCheck->contact_id = $dupeCheckContactId;
                 $dupeCheck->event_id = $event_id;
                 $dupeCheck->find(TRUE);
                 if (!empty($dupeCheck->id)) {
                     $duplicateContacts++;
                     unset($this->_contactIds[$k]);
                 }
             }
             if ($duplicateContacts > 0) {
                 $msg = ts("%1 contacts have already been assigned to this event. They were not added a second time.", array(1 => $duplicateContacts));
                 CRM_Core_Session::setStatus($msg);
             }
             if (count($this->_contactIds) == 0) {
                 CRM_Core_Session::setStatus(ts("No participants were added."));
                 return;
             }
             // We have to re-key $this->_contactIds so each contact has the same
             // key as their corresponding record in the $participants array that
             // will be created below.
             $this->_contactIds = array_values($this->_contactIds);
         }
     }
     $participantStatus = CRM_Event_PseudoConstant::participantStatus();
     // set the contact, when contact is selected
     if (!empty($params['contact_id'])) {
         $this->_contactId = $params['contact_id'];
     }
     if ($this->_priceSetId && ($isQuickConfig = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config'))) {
         $this->_quickConfig = $isQuickConfig;
     }
     if ($this->_id) {
         $params['id'] = $this->_id;
     }
     $config = CRM_Core_Config::singleton();
     if ($this->_isPaidEvent) {
         $contributionParams = array();
         $lineItem = array();
         $additionalParticipantDetails = array();
         if (CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) {
             $eventStartDate = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_eventId, 'start_date');
             if ($eventStartDate) {
                 $contributionParams['revenue_recognition_date'] = date('Ymd', strtotime($eventStartDate));
             }
         }
         if ($this->_id && $this->_action & CRM_Core_Action::UPDATE && $this->_paymentId) {
             $participantBAO = new CRM_Event_BAO_Participant();
             $participantBAO->id = $this->_id;
             $participantBAO->find(TRUE);
             $contributionParams['total_amount'] = $participantBAO->fee_amount;
             $params['discount_id'] = NULL;
             //re-enter the values for UPDATE mode
             $params['fee_level'] = $params['amount_level'] = $participantBAO->fee_level;
             $params['fee_amount'] = $participantBAO->fee_amount;
             if (isset($params['priceSetId'])) {
                 $lineItem[0] = CRM_Price_BAO_LineItem::getLineItems($this->_id);
             }
             //also add additional participant's fee level/priceset
             if (CRM_Event_BAO_Participant::isPrimaryParticipant($this->_id)) {
                 $additionalIds = CRM_Event_BAO_Participant::getAdditionalParticipantIds($this->_id);
                 $hasLineItems = CRM_Utils_Array::value('priceSetId', $params, FALSE);
                 $additionalParticipantDetails = CRM_Event_BAO_Participant::getFeeDetails($additionalIds, $hasLineItems);
//.........这里部分代码省略.........
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:101,代码来源:Participant.php

示例3: postProcess

 /**
  * Function to process the form
  *
  * @access public
  *
  * @return void
  */
 public function postProcess()
 {
     //get the button.
     $buttonName = $this->controller->getButtonName();
     $participantId = $this->_participantId;
     if ($buttonName == '_qf_ParticipantConfirm_next') {
         //lets get contact id in session.
         $session = CRM_Core_Session::singleton();
         $session->set('userID', $this->_csContactID);
         $this->postProcessHook();
         //check user registration status is from pending class
         $url = CRM_Utils_System::url('civicrm/event/register', "reset=1&id={$this->_eventId}&participantId={$participantId}");
         CRM_Utils_System::redirect($url);
     } elseif ($buttonName == '_qf_ParticipantConfirm_submit') {
         //need to registration status to 'cancelled'.
         $cancelledId = array_search('Cancelled', CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Negative'"));
         $additionalParticipantIds = CRM_Event_BAO_Participant::getAdditionalParticipantIds($participantId);
         $participantIds = array_merge(array($participantId), $additionalParticipantIds);
         $results = CRM_Event_BAO_Participant::transitionParticipants($participantIds, $cancelledId, NULL, TRUE);
         if (count($participantIds) > 1) {
             $statusMessage = ts("%1 Event registration(s) have been cancelled.", array(1 => count($participantIds)));
         } else {
             $statusMessage = ts("Your event registration has been cancelled.");
         }
         if (!empty($results['mailedParticipants'])) {
             foreach ($results['mailedParticipants'] as $key => $displayName) {
                 $statusMessage .= "<br />" . ts("Email has been sent to : %1", array(1 => $displayName));
             }
         }
         $this->postProcessHook();
         CRM_Core_Error::statusBounce($statusMessage, CRM_Utils_System::url('civicrm/event/info', "reset=1&id={$this->_eventId}&noFullMsg=1", FALSE, NULL, FALSE, TRUE));
     }
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:40,代码来源:ParticipantConfirm.php

示例4: postProcess

 /**
  * process the form after the input has been submitted and validated
  *
  * @access public
  *
  * @return void
  */
 public function postProcess()
 {
     $params = $this->controller->exportValues($this->_name);
     if (CRM_Utils_Array::value('delete_participant', $params) == 2) {
         $links = array();
         foreach ($this->_participantIds as $participantId) {
             $additionalId = CRM_Event_BAO_Participant::getAdditionalParticipantIds($participantId);
             $participantLinks = CRM_Event_BAO_Participant::getAdditionalParticipantUrl($additionalId);
         }
     }
     $deletedParticipants = $additionalCount = 0;
     foreach ($this->_participantIds as $participantId) {
         if (CRM_Utils_Array::value('delete_participant', $params) == 1) {
             if (CRM_Event_BAO_Participant::isPrimaryParticipant($participantId)) {
                 $additionalIds = CRM_Event_BAO_Participant::getAdditionalParticipantIds($participantId);
                 $additionalCount = count($additionalIds);
                 foreach ($additionalIds as $value) {
                     CRM_Event_BAO_Participant::deleteParticipant($value);
                 }
                 CRM_Event_BAO_Participant::deleteParticipant($participantId);
             }
             $deletedParticipants++;
         } else {
             CRM_Event_BAO_Participant::deleteParticipant($participantId);
             $deletedParticipants++;
         }
     }
     if ($additionalCount) {
         $deletedParticipants += $additionalCount;
     }
     $status = array(ts('Participant(s) Deleted: %1', array(1 => $deletedParticipants)), ts('Total Selected Participant(s): %1', array(1 => $deletedParticipants)));
     if (!empty($participantLinks)) {
         $status[] = ts('The following participants no longer have an event fee recorded. You can edit their registration and record a replacement contribution by clicking the links below:') . '<br>' . $participantLinks;
     }
     CRM_Core_Session::setStatus($status);
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:43,代码来源:Delete.php

示例5: recordFinancialAccounts

 /**
  * Create all financial accounts entry.
  *
  * @param array $params
  *   Contribution object, line item array and params for trxn.
  *
  *
  * @param array $financialTrxnValues
  *
  * @return null|object
  */
 public static function recordFinancialAccounts(&$params, $financialTrxnValues = NULL)
 {
     $skipRecords = $update = $return = $isRelatedId = FALSE;
     $additionalParticipantId = array();
     $contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
     if (CRM_Utils_Array::value('contribution_mode', $params) == 'participant') {
         $entityId = $params['participant_id'];
         $entityTable = 'civicrm_participant';
         $additionalParticipantId = CRM_Event_BAO_Participant::getAdditionalParticipantIds($entityId);
     } elseif (!empty($params['membership_id'])) {
         //so far $params['membership_id'] should only be set coming in from membershipBAO::create so the situation where multiple memberships
         // are created off one contribution should be handled elsewhere
         $entityId = $params['membership_id'];
         $entityTable = 'civicrm_membership';
     } else {
         $entityId = $params['contribution']->id;
         $entityTable = 'civicrm_contribution';
     }
     if (CRM_Utils_Array::value('contribution_mode', $params) == 'membership') {
         $isRelatedId = TRUE;
     }
     $entityID[] = $entityId;
     if (!empty($additionalParticipantId)) {
         $entityID += $additionalParticipantId;
     }
     // prevContribution appears to mean - original contribution object- ie copy of contribution from before the update started that is being updated
     if (empty($params['prevContribution'])) {
         $entityID = NULL;
     } else {
         $update = TRUE;
     }
     $statusId = $params['contribution']->contribution_status_id;
     // CRM-13964 partial payment
     if (CRM_Utils_Array::value('contribution_status_id', $params) == array_search('Partially paid', $contributionStatuses) && !empty($params['partial_payment_total']) && !empty($params['partial_amount_pay'])) {
         $partialAmtPay = $params['partial_amount_pay'];
         $partialAmtTotal = $params['partial_payment_total'];
         $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
         $fromFinancialAccountId = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id'], $relationTypeId);
         $statusId = CRM_Core_OptionGroup::getValue('contribution_status', 'Completed', 'name');
         $params['total_amount'] = $partialAmtPay;
         $balanceTrxnInfo = CRM_Core_BAO_FinancialTrxn::getBalanceTrxnAmt($params['contribution']->id, $params['financial_type_id']);
         if (empty($balanceTrxnInfo['trxn_id'])) {
             // create new balance transaction record
             $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
             $toFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id'], $relationTypeId);
             $balanceTrxnParams['total_amount'] = $partialAmtTotal;
             $balanceTrxnParams['to_financial_account_id'] = $toFinancialAccount;
             $balanceTrxnParams['contribution_id'] = $params['contribution']->id;
             $balanceTrxnParams['trxn_date'] = !empty($params['contribution']->receive_date) ? $params['contribution']->receive_date : date('YmdHis');
             $balanceTrxnParams['fee_amount'] = CRM_Utils_Array::value('fee_amount', $params);
             $balanceTrxnParams['net_amount'] = CRM_Utils_Array::value('net_amount', $params);
             $balanceTrxnParams['currency'] = $params['contribution']->currency;
             $balanceTrxnParams['trxn_id'] = $params['contribution']->trxn_id;
             $balanceTrxnParams['status_id'] = $statusId;
             $balanceTrxnParams['payment_instrument_id'] = $params['contribution']->payment_instrument_id;
             $balanceTrxnParams['check_number'] = CRM_Utils_Array::value('check_number', $params);
             if (!empty($params['payment_processor'])) {
                 $balanceTrxnParams['payment_processor_id'] = $params['payment_processor'];
             }
             $financialTxn = CRM_Core_BAO_FinancialTrxn::create($balanceTrxnParams);
         }
     }
     // build line item array if its not set in $params
     if (empty($params['line_item']) || $additionalParticipantId) {
         CRM_Price_BAO_LineItem::getLineItemArray($params, $entityID, str_replace('civicrm_', '', $entityTable), $isRelatedId);
     }
     if (CRM_Utils_Array::value('contribution_status_id', $params) != array_search('Failed', $contributionStatuses) && !(CRM_Utils_Array::value('contribution_status_id', $params) == array_search('Pending', $contributionStatuses) && !$params['contribution']->is_pay_later)) {
         $skipRecords = TRUE;
         $pendingStatus = array(array_search('Pending', $contributionStatuses), array_search('In Progress', $contributionStatuses));
         if (in_array(CRM_Utils_Array::value('contribution_status_id', $params), $pendingStatus)) {
             $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
             $params['to_financial_account_id'] = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id'], $relationTypeId);
         } elseif (!empty($params['payment_processor'])) {
             $params['to_financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount($params['payment_processor'], 'civicrm_payment_processor', 'financial_account_id');
         } elseif (!empty($params['payment_instrument_id'])) {
             $params['to_financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount($params['payment_instrument_id']);
         } else {
             $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('financial_account_type', NULL, " AND v.name LIKE 'Asset' "));
             $queryParams = array(1 => array($relationTypeId, 'Integer'));
             $params['to_financial_account_id'] = CRM_Core_DAO::singleValueQuery("SELECT id FROM civicrm_financial_account WHERE is_default = 1 AND financial_account_type_id = %1", $queryParams);
         }
         $totalAmount = CRM_Utils_Array::value('total_amount', $params);
         if (!isset($totalAmount) && !empty($params['prevContribution'])) {
             $totalAmount = $params['total_amount'] = $params['prevContribution']->total_amount;
         }
         //build financial transaction params
         $trxnParams = array('contribution_id' => $params['contribution']->id, 'to_financial_account_id' => $params['to_financial_account_id'], 'trxn_date' => !empty($params['contribution']->receive_date) ? $params['contribution']->receive_date : date('YmdHis'), 'total_amount' => $totalAmount, 'fee_amount' => CRM_Utils_Array::value('fee_amount', $params), 'net_amount' => CRM_Utils_Array::value('net_amount', $params, $totalAmount), 'currency' => $params['contribution']->currency, 'trxn_id' => $params['contribution']->trxn_id, 'status_id' => $statusId, 'payment_instrument_id' => $params['contribution']->payment_instrument_id, 'check_number' => CRM_Utils_Array::value('check_number', $params));
         if (!empty($params['payment_processor'])) {
             $trxnParams['payment_processor_id'] = $params['payment_processor'];
//.........这里部分代码省略.........
开发者ID:nganivet,项目名称:civicrm-core,代码行数:101,代码来源:Contribution.php

示例6: updateParticipantStatus

 public function updateParticipantStatus()
 {
     require_once 'CRM/Event/PseudoConstant.php';
     $participantRole = CRM_Event_PseudoConstant::participantRole();
     $pendingStatuses = CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Pending'");
     $expiredStatuses = CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Negative'");
     $waitingStatuses = CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Waiting'");
     //build the required status ids.
     $statusIds = '(' . implode(',', array_merge(array_keys($pendingStatuses), array_keys($waitingStatuses))) . ')';
     $participantDetails = $fullEvents = array();
     $expiredParticipantCount = $waitingConfirmCount = $waitingApprovalCount = 0;
     //get all participant who's status in class pending and waiting
     $query = "SELECT * FROM civicrm_participant WHERE status_id IN {$statusIds} ORDER BY register_date";
     $query = "\n   SELECT  participant.id,\n           participant.contact_id,\n           participant.status_id,\n           participant.register_date,\n           participant.registered_by_id,\n           participant.event_id,\n           event.title as eventTitle,\n           event.registration_start_date,\n           event.registration_end_date,\n           event.end_date,\n           event.expiration_time,\n           event.requires_approval\n     FROM  civicrm_participant participant\nLEFT JOIN  civicrm_event event ON ( event.id = participant.event_id )\n    WHERE  participant.status_id IN {$statusIds}\n     AND   (event.end_date > now() OR event.end_date IS NULL)\n     AND   event.is_active = 1 \n ORDER BY  participant.register_date, participant.id \n";
     $dao = CRM_Core_DAO::executeQuery($query);
     while ($dao->fetch()) {
         $participantDetails[$dao->id] = array('id' => $dao->id, 'event_id' => $dao->event_id, 'status_id' => $dao->status_id, 'contact_id' => $dao->contact_id, 'register_date' => $dao->register_date, 'registered_by_id' => $dao->registered_by_id, 'eventTitle' => $dao->eventTitle, 'registration_start_date' => $dao->registration_start_date, 'registration_end_date' => $dao->registration_end_date, 'end_date' => $dao->end_date, 'expiration_time' => $dao->expiration_time, 'requires_approval' => $dao->requires_approval);
     }
     if (!empty($participantDetails)) {
         //cron 1. move participant from pending to expire if needed
         foreach ($participantDetails as $participantId => $values) {
             //process the additional participant at the time of
             //primary participant, don't process separately.
             if (CRM_Utils_Array::value('registered_by_id', $values)) {
                 continue;
             }
             $expirationTime = CRM_Utils_Array::value('expiration_time', $values);
             if ($expirationTime && array_key_exists($values['status_id'], $pendingStatuses)) {
                 //get the expiration and registration pending time.
                 $expirationSeconds = $expirationTime * 3600;
                 $registrationPendingSeconds = CRM_Utils_Date::unixTime($values['register_date']);
                 // expired registration since registration cross allow confirmation time.
                 if ($expirationSeconds + $registrationPendingSeconds < time()) {
                     //lets get the transaction mechanism.
                     require_once 'CRM/Core/Transaction.php';
                     $transaction = new CRM_Core_Transaction();
                     require_once 'CRM/Event/BAO/Participant.php';
                     $ids = array($participantId);
                     $expiredId = array_search('Expired', $expiredStatuses);
                     $results = CRM_Event_BAO_Participant::transitionParticipants($ids, $expiredId, $values['status_id'], TRUE, TRUE);
                     $transaction->commit();
                     if (!empty($results)) {
                         //diaplay updated participants
                         if (is_array($results['updatedParticipantIds']) && !empty($results['updatedParticipantIds'])) {
                             foreach ($results['updatedParticipantIds'] as $processedId) {
                                 $expiredParticipantCount += 1;
                                 echo "<br /><br />- status updated to: Expired";
                                 //mailed participants.
                                 if (is_array($results['mailedParticipants']) && array_key_exists($processedId, $results['mailedParticipants'])) {
                                     echo "<br />Expiration Mail sent to: {$results['mailedParticipants'][$processedId]}";
                                 }
                             }
                         }
                     }
                 }
             }
         }
         //cron 1 end.
         //cron 2. lets move participants from waiting list to pending status
         foreach ($participantDetails as $participantId => $values) {
             //process the additional participant at the time of
             //primary participant, don't process separately.
             if (CRM_Utils_Array::value('registered_by_id', $values)) {
                 continue;
             }
             if (array_key_exists($values['status_id'], $waitingStatuses) && !array_key_exists($values['event_id'], $fullEvents)) {
                 if ($waitingStatuses[$values['status_id']] == 'On waitlist' && CRM_Event_BAO_Event::validRegistrationDate($values)) {
                     //check the target event having space.
                     require_once 'CRM/Event/BAO/Participant.php';
                     $eventOpenSpaces = CRM_Event_BAO_Participant::eventFull($values['event_id'], TRUE, FALSE);
                     if ($eventOpenSpaces && is_numeric($eventOpenSpaces) || $eventOpenSpaces === NULL) {
                         //get the additional participant if any.
                         $additionalIds = CRM_Event_BAO_Participant::getAdditionalParticipantIds($participantId);
                         $allIds = array($participantId);
                         if (!empty($additionalIds)) {
                             $allIds = array_merge($allIds, $additionalIds);
                         }
                         $pClause = ' participant.id IN ( ' . implode(' , ', $allIds) . ' )';
                         $requiredSpaces = CRM_Event_BAO_Event::eventTotalSeats($values['event_id'], $pClause);
                         //need to check as to see if event has enough speces
                         if ($requiredSpaces <= $eventOpenSpaces || $eventOpenSpaces === NULL) {
                             require_once 'CRM/Core/Transaction.php';
                             $transaction = new CRM_Core_Transaction();
                             require_once 'CRM/Event/BAO/Participant.php';
                             $ids = array($participantId);
                             $updateStatusId = array_search('Pending from waitlist', $pendingStatuses);
                             //lets take a call to make pending or need approval
                             if ($values['requires_approval']) {
                                 $updateStatusId = array_search('Awaiting approval', $waitingStatuses);
                             }
                             $results = CRM_Event_BAO_Participant::transitionParticipants($ids, $updateStatusId, $values['status_id'], TRUE, TRUE);
                             //commit the transaction.
                             $transaction->commit();
                             if (!empty($results)) {
                                 //diaplay updated participants
                                 if (is_array($results['updatedParticipantIds']) && !empty($results['updatedParticipantIds'])) {
                                     foreach ($results['updatedParticipantIds'] as $processedId) {
                                         if ($values['requires_approval']) {
                                             $waitingApprovalCount += 1;
                                             echo "<br /><br />- status updated to: Awaiting approval";
//.........这里部分代码省略.........
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:101,代码来源:ParticipantProcessor.php

示例7: getLineItems

 /**
  * Given a participant id/contribution id,
  * return contribution/fee line items
  *
  * @param int $entityId
  *   participant/contribution id.
  * @param string $entity
  *   participant/contribution.
  *
  * @param null $isQuick
  * @param bool $isQtyZero
  * @param bool $relatedEntity
  *
  * @param string $overrideWhereClause
  *   E.g "WHERE contribution id = 7 " per the getLineItemsByContributionID wrapper.
  *   this function precedes the convenience of the contribution id but since it does quite a bit more than just a db retrieval we need to be able to use it even
  *   when we don't want it's entity-id magix
  *
  * @param bool $invoice
  * @return array
  *   Array of line items
  */
 public static function getLineItems($entityId, $entity = 'participant', $isQuick = NULL, $isQtyZero = TRUE, $relatedEntity = FALSE, $overrideWhereClause = '', $invoice = FALSE)
 {
     $whereClause = $fromClause = NULL;
     $selectClause = "\n      SELECT    li.id,\n      li.label,\n      li.contribution_id,\n      li.qty,\n      li.unit_price,\n      li.line_total,\n      li.entity_table,\n      li.entity_id,\n      pf.label as field_title,\n      pf.html_type,\n      pfv.membership_type_id,\n      pfv.membership_num_terms,\n      li.price_field_id,\n      li.participant_count,\n      li.price_field_value_id,\n      li.financial_type_id,\n      li.tax_amount,\n      pfv.description";
     $condition = "li.entity_id = %2.id AND li.entity_table = 'civicrm_%2'";
     if ($relatedEntity) {
         $condition = "li.contribution_id = %2.id ";
     }
     $fromClause = "\n      FROM      civicrm_%2 as %2\n      LEFT JOIN civicrm_line_item li ON ({$condition})\n      LEFT JOIN civicrm_price_field_value pfv ON ( pfv.id = li.price_field_value_id )\n      LEFT JOIN civicrm_price_field pf ON (pf.id = li.price_field_id )";
     $whereClause = "\n      WHERE     %2.id = %1";
     // CRM-16250 get additional participant's fee selection details only for invoice PDF (if any)
     if ($entity == 'participant' && $invoice) {
         $additionalParticipantIDs = CRM_Event_BAO_Participant::getAdditionalParticipantIds($entityId);
         if (!empty($additionalParticipantIDs)) {
             $whereClause = "WHERE %2.id IN (%1, " . implode(', ', $additionalParticipantIDs) . ")";
         }
     }
     $orderByClause = " ORDER BY pf.weight, pfv.weight";
     if ($isQuick) {
         $fromClause .= " LEFT JOIN civicrm_price_set cps on cps.id = pf.price_set_id ";
         $whereClause .= " and cps.is_quick_config = 0";
     }
     if (!$isQtyZero) {
         $whereClause .= " and li.qty != 0";
     }
     $lineItems = array();
     if (!$entityId || !$entity || !$fromClause) {
         return $lineItems;
     }
     $params = array(1 => array($entityId, 'Integer'), 2 => array($entity, 'Text'));
     $getTaxDetails = FALSE;
     $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
     $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
     if ($overrideWhereClause) {
         $whereClause = $overrideWhereClause;
     }
     $dao = CRM_Core_DAO::executeQuery("{$selectClause} {$fromClause} {$whereClause} {$orderByClause}", $params);
     while ($dao->fetch()) {
         if (!$dao->id) {
             continue;
         }
         $lineItems[$dao->id] = array('qty' => (double) $dao->qty, 'label' => $dao->label, 'unit_price' => $dao->unit_price, 'line_total' => $dao->line_total, 'price_field_id' => $dao->price_field_id, 'participant_count' => $dao->participant_count, 'price_field_value_id' => $dao->price_field_value_id, 'field_title' => $dao->field_title, 'html_type' => $dao->html_type, 'description' => $dao->description, 'entity_id' => empty($overrideWhereClause) ? $entityId : $dao->entity_id, 'entity_table' => $dao->entity_table, 'contribution_id' => $dao->contribution_id, 'financial_type_id' => $dao->financial_type_id, 'membership_type_id' => $dao->membership_type_id, 'membership_num_terms' => $dao->membership_num_terms, 'tax_amount' => $dao->tax_amount);
         $lineItems[$dao->id]['tax_rate'] = CRM_Price_BAO_LineItem::calculateTaxRate($lineItems[$dao->id]);
         $lineItems[$dao->id]['subTotal'] = $lineItems[$dao->id]['qty'] * $lineItems[$dao->id]['unit_price'];
         if ($lineItems[$dao->id]['tax_amount'] != '') {
             $getTaxDetails = TRUE;
         }
     }
     if ($invoicing) {
         $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings);
         $smarty = CRM_Core_Smarty::singleton();
         $smarty->assign('taxTerm', $taxTerm);
         $smarty->assign('getTaxDetails', $getTaxDetails);
     }
     return $lineItems;
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:78,代码来源:LineItem.php

示例8: recordFinancialAccounts

 /**
  * Create all financial accounts entry.
  *
  * @param array $params
  *   Contribution object, line item array and params for trxn.
  *
  *
  * @param array $financialTrxnValues
  *
  * @return null|object
  */
 public static function recordFinancialAccounts(&$params, $financialTrxnValues = NULL)
 {
     $skipRecords = $update = $return = $isRelatedId = FALSE;
     $additionalParticipantId = array();
     $contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
     $contributionStatus = empty($params['contribution_status_id']) ? NULL : $contributionStatuses[$params['contribution_status_id']];
     if (CRM_Utils_Array::value('contribution_mode', $params) == 'participant') {
         $entityId = $params['participant_id'];
         $entityTable = 'civicrm_participant';
         $additionalParticipantId = CRM_Event_BAO_Participant::getAdditionalParticipantIds($entityId);
     } elseif (!empty($params['membership_id'])) {
         //so far $params['membership_id'] should only be set coming in from membershipBAO::create so the situation where multiple memberships
         // are created off one contribution should be handled elsewhere
         $entityId = $params['membership_id'];
         $entityTable = 'civicrm_membership';
     } else {
         $entityId = $params['contribution']->id;
         $entityTable = 'civicrm_contribution';
     }
     if (CRM_Utils_Array::value('contribution_mode', $params) == 'membership') {
         $isRelatedId = TRUE;
     }
     $entityID[] = $entityId;
     if (!empty($additionalParticipantId)) {
         $entityID += $additionalParticipantId;
     }
     // prevContribution appears to mean - original contribution object- ie copy of contribution from before the update started that is being updated
     if (empty($params['prevContribution'])) {
         $entityID = NULL;
     } else {
         $update = TRUE;
     }
     $statusId = $params['contribution']->contribution_status_id;
     // CRM-13964 partial payment
     if ($contributionStatus == 'Partially paid' && !empty($params['partial_payment_total']) && !empty($params['partial_amount_pay'])) {
         $partialAmtPay = $params['partial_amount_pay'];
         $partialAmtTotal = $params['partial_payment_total'];
         $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
         $fromFinancialAccountId = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id'], $relationTypeId);
         $statusId = CRM_Core_OptionGroup::getValue('contribution_status', 'Completed', 'name');
         $params['total_amount'] = $partialAmtPay;
         $balanceTrxnInfo = CRM_Core_BAO_FinancialTrxn::getBalanceTrxnAmt($params['contribution']->id, $params['financial_type_id']);
         if (empty($balanceTrxnInfo['trxn_id'])) {
             // create new balance transaction record
             $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
             $toFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id'], $relationTypeId);
             $balanceTrxnParams['total_amount'] = $partialAmtTotal;
             $balanceTrxnParams['to_financial_account_id'] = $toFinancialAccount;
             $balanceTrxnParams['contribution_id'] = $params['contribution']->id;
             $balanceTrxnParams['trxn_date'] = !empty($params['contribution']->receive_date) ? $params['contribution']->receive_date : date('YmdHis');
             $balanceTrxnParams['fee_amount'] = CRM_Utils_Array::value('fee_amount', $params);
             $balanceTrxnParams['net_amount'] = CRM_Utils_Array::value('net_amount', $params);
             $balanceTrxnParams['currency'] = $params['contribution']->currency;
             $balanceTrxnParams['trxn_id'] = $params['contribution']->trxn_id;
             $balanceTrxnParams['status_id'] = $statusId;
             $balanceTrxnParams['payment_instrument_id'] = $params['contribution']->payment_instrument_id;
             $balanceTrxnParams['check_number'] = CRM_Utils_Array::value('check_number', $params);
             if (!empty($balanceTrxnParams['from_financial_account_id']) && ($statusId == array_search('Completed', $contributionStatuses) || $statusId == array_search('Partially paid', $contributionStatuses))) {
                 $balanceTrxnParams['is_payment'] = 1;
             }
             if (!empty($params['payment_processor'])) {
                 $balanceTrxnParams['payment_processor_id'] = $params['payment_processor'];
             }
             $financialTxn = CRM_Core_BAO_FinancialTrxn::create($balanceTrxnParams);
         }
     }
     // build line item array if its not set in $params
     if (empty($params['line_item']) || $additionalParticipantId) {
         CRM_Price_BAO_LineItem::getLineItemArray($params, $entityID, str_replace('civicrm_', '', $entityTable), $isRelatedId);
     }
     if ($contributionStatus != 'Failed' && !($contributionStatus == 'Pending' && !$params['contribution']->is_pay_later)) {
         $skipRecords = TRUE;
         $pendingStatus = array('Pending', 'In Progress');
         if (in_array($contributionStatus, $pendingStatus)) {
             $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
             $params['to_financial_account_id'] = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id'], $relationTypeId);
         } elseif (!empty($params['payment_processor'])) {
             $params['to_financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount($params['payment_processor'], 'civicrm_payment_processor', 'financial_account_id');
         } elseif (!empty($params['payment_instrument_id'])) {
             $params['to_financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount($params['payment_instrument_id']);
         } else {
             $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('financial_account_type', NULL, " AND v.name LIKE 'Asset' "));
             $queryParams = array(1 => array($relationTypeId, 'Integer'));
             $params['to_financial_account_id'] = CRM_Core_DAO::singleValueQuery("SELECT id FROM civicrm_financial_account WHERE is_default = 1 AND financial_account_type_id = %1", $queryParams);
         }
         $totalAmount = CRM_Utils_Array::value('total_amount', $params);
         if (!isset($totalAmount) && !empty($params['prevContribution'])) {
             $totalAmount = $params['total_amount'] = $params['prevContribution']->total_amount;
         }
//.........这里部分代码省略.........
开发者ID:joshgowans,项目名称:civicrm-core,代码行数:101,代码来源:Contribution.php

示例9: postProcess

 /** 
  * Function to process the form 
  * 
  * @access public 
  */
 public function postProcess()
 {
     // get the submitted form values.
     $params = $this->controller->exportValues($this->_name);
     if ($this->_action & CRM_Core_Action::DELETE) {
         require_once "CRM/Event/BAO/Participant.php";
         if (CRM_Utils_Array::value('delete_participant', $params) == 2) {
             $additionalId = CRM_Event_BAO_Participant::getAdditionalParticipantIds($this->_id);
             $participantLinks = CRM_Event_BAO_Participant::getAdditionalParticipantUrl($additionalId);
         }
         if (CRM_Utils_Array::value('delete_participant', $params) == 1) {
             $additionalIds = CRM_Event_BAO_Participant::getAdditionalParticipantIds($this->_id);
             foreach ($additionalIds as $value) {
                 CRM_Event_BAO_Participant::deleteParticipant($value);
             }
         }
         CRM_Event_BAO_Participant::deleteParticipant($this->_id);
         if (!empty($participantLinks)) {
             $status = ts('The following participants no longer have an event fee recorded. You can edit their registration and record a replacement contribution by clicking the links below:') . '<br>' . $participantLinks;
         } else {
             $status = "Selected Participants was deleted sucessfully.";
         }
         CRM_Core_Session::setStatus($status);
         return;
     }
     // set the contact, when contact is selected
     if (CRM_Utils_Array::value('contact_select_id', $params)) {
         $this->_contactId = $params['contact_select_id'][1];
     }
     if ($this->_id) {
         $params['id'] = $this->_id;
     }
     $config = CRM_Core_Config::singleton();
     if ($this->_isPaidEvent) {
         $contributionParams = array();
         $lineItem = array();
         $additionalParticipantDetails = array();
         if ($this->_id && $this->_action & CRM_Core_Action::UPDATE && $this->_paymentId) {
             $participantBAO = new CRM_Event_BAO_Participant();
             $participantBAO->id = $this->_id;
             $participantBAO->find(true);
             $contributionParams['total_amount'] = $participantBAO->fee_amount;
             $params['discount_id'] = null;
             //re-enter the values for UPDATE mode
             $params['fee_level'] = $params['amount_level'] = $participantBAO->fee_level;
             $params['fee_amount'] = $participantBAO->fee_amount;
             if (isset($params['priceSetId'])) {
                 require_once 'CRM/Price/BAO/LineItem.php';
                 $lineItem[0] = CRM_Price_BAO_LineItem::getLineItems($this->_id);
             }
             //also add additional participant's fee level/priceset
             if (CRM_Event_BAO_Participant::isPrimaryParticipant($this->_id)) {
                 $additionalIds = CRM_Event_BAO_Participant::getAdditionalParticipantIds($this->_id);
                 $hasLineItems = CRM_Utils_Array::value('priceSetId', $params, false);
                 $additionalParticipantDetails = CRM_Event_BAO_Participant::getFeeDetails($additionalIds, $hasLineItems);
             }
         } else {
             //check if discount is selected
             if (CRM_Utils_Array::value('discount_id', $params)) {
                 $discountId = $params['discount_id'];
             } else {
                 $discountId = $params['discount_id'] = 'null';
             }
             //lets carry currency, CRM-4453
             $params['fee_currency'] = $config->defaultCurrency;
             // fix for CRM-3088
             if ($discountId && !empty($this->_values['discount'][$discountId])) {
                 $params['amount_level'] = $this->_values['discount'][$discountId][$params['amount']]['label'];
                 $params['amount'] = $this->_values['discount'][$discountId][$params['amount']]['value'];
             } else {
                 if (!isset($params['priceSetId']) && CRM_Utils_Array::value('amount', $params)) {
                     $params['amount_level'] = $this->_values['fee'][$params['amount']]['label'];
                     $params['amount'] = $this->_values['fee'][$params['amount']]['value'];
                 } else {
                     CRM_Price_BAO_Set::processAmount($this->_values['fee'], $params, $lineItem[0]);
                 }
             }
             $params['fee_level'] = $params['amount_level'];
             $contributionParams['total_amount'] = $params['amount'];
             //fix for CRM-3086
             $params['fee_amount'] = $params['amount'];
         }
         if (isset($params['priceSetId'])) {
             $this->set('lineItem', $lineItem);
             $this->_lineItem = $lineItem;
             $lineItem = array_merge($lineItem, $additionalParticipantDetails);
             $participantCount = array();
             foreach ($lineItem as $k) {
                 foreach ($k as $v) {
                     if (CRM_Utils_Array::value('participant_count', $v) > 0) {
                         $participantCount[] = $v['participant_count'];
                     }
                 }
             }
             if ($participantCount) {
//.........这里部分代码省略.........
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:101,代码来源:Participant.php

示例10: preProcess

 /**
  * Function to set variables up before form is built
  *
  * @return void
  * @access 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) {
//.........这里部分代码省略.........
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:101,代码来源:Registration.php

示例11: postProcess

 /**
  * Process the form after the input has been submitted and validated.
  *
  *
  * @return void
  */
 public function postProcess()
 {
     $params = $this->controller->exportValues($this->_name);
     $participantLinks = NULL;
     if (CRM_Utils_Array::value('delete_participant', $params) == 2) {
         $links = array();
         foreach ($this->_participantIds as $participantId) {
             $additionalId = CRM_Event_BAO_Participant::getAdditionalParticipantIds($participantId);
             $participantLinks = CRM_Event_BAO_Participant::getAdditionalParticipantUrl($additionalId);
         }
     }
     $deletedParticipants = $additionalCount = 0;
     foreach ($this->_participantIds as $participantId) {
         if (CRM_Utils_Array::value('delete_participant', $params) == 1) {
             $primaryParticipantId = CRM_Core_DAO::getFieldValue("CRM_Event_DAO_Participant", $participantId, 'registered_by_id', 'id');
             if (CRM_Event_BAO_Participant::isPrimaryParticipant($participantId)) {
                 $additionalIds = CRM_Event_BAO_Participant::getAdditionalParticipantIds($participantId);
                 $additionalCount += count($additionalIds);
                 foreach ($additionalIds as $value) {
                     CRM_Event_BAO_Participant::deleteParticipant($value);
                 }
                 CRM_Event_BAO_Participant::deleteParticipant($participantId);
                 $deletedParticipants++;
             } elseif (empty($primaryParticipantId) || !in_array($primaryParticipantId, $this->_participantIds)) {
                 CRM_Event_BAO_Participant::deleteParticipant($participantId);
                 $deletedParticipants++;
             }
         } else {
             CRM_Event_BAO_Participant::deleteParticipant($participantId);
             $deletedParticipants++;
         }
     }
     if ($additionalCount) {
         $deletedParticipants += $additionalCount;
     }
     $status = ts('%count participant deleted.', array('plural' => '%count participants deleted.', 'count' => $deletedParticipants));
     if ($participantLinks) {
         $status .= '<p>' . ts('The following participants no longer have an event fee recorded. You can edit their registration and record a replacement contribution by clicking the links below:') . '</p>' . $participantLinks;
     }
     CRM_Core_Session::setStatus($status, ts('Removed'), 'info');
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:47,代码来源:Delete.php

示例12: preProcess

 /** 
  * Function to set variables up before form is built 
  *                                                           
  * @return void 
  * @access 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');
     //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');
     //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)) {
             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 = array();
         $this->_fields = array();
         // get the participant values, CRM-4320
         $this->_allowConfirmation = false;
         if ($this->_participantId) {
             require_once 'CRM/Event/BAO/Event.php';
             $ids = $participantValues = array();
             $participantParams = array('id' => $this->_participantId);
             require_once 'CRM/Event/BAO/Participant.php';
             CRM_Event_BAO_Participant::getValues($participantParams, $participantValues, $ids);
             $this->_values['participant'] = $participantValues[$this->_participantId];
             //allow pending status class walk registration wizard.
             require_once 'CRM/Core/PseudoConstant.php';
             if (array_key_exists($participantValues[$this->_participantId]['status_id'], CRM_Event_PseudoConstant::participantStatus(null, "class = 'Pending'"))) {
                 $this->_allowConfirmation = true;
                 $this->set('allowConfirmation', true);
             }
         }
         //retrieve event information
         require_once 'CRM/Event/BAO/Event.php';
         $params = array('id' => $this->_eventId);
         CRM_Event_BAO_Event::retrieve($params, $this->_values['event']);
         require_once 'CRM/Event/BAO/Participant.php';
         //check for additional participants.
         if ($this->_allowConfirmation && $this->_values['event']['is_multiple_registrations']) {
             $this->_additionalParticipantIds = CRM_Event_BAO_Participant::getAdditionalParticipantIds($this->_participantId);
             $this->set('additionalParticipantIds', $this->_additionalParticipantIds);
         }
         $eventFull = CRM_Event_BAO_Participant::eventFull($this->_eventId);
         $this->_allowWaitlist = false;
         if ($eventFull && !$this->_allowConfirmation) {
             //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('allowWaitlist', $this->_allowWaitlist);
         //check for require requires approval.
         $this->_requireApproval = false;
         if (CRM_Utils_Array::value('requires_approval', $this->_values['event']) && !$this->_allowConfirmation) {
             $this->_requireApproval = true;
         }
         $this->set('requireApproval', $this->_requireApproval);
         // also get the accounting code
         if (CRM_Utils_Array::value('contribution_type_id', $this->_values['event'])) {
             $this->_values['event']['accountingCode'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionType', $this->_values['event']['contribution_type_id'], 'accounting_code');
         }
         if (isset($this->_values['event']['default_role_id'])) {
             require_once 'CRM/Core/OptionGroup.php';
             $participant_role = CRM_Core_OptionGroup::values('participant_role');
             $this->_values['event']['participant_role'] = $participant_role["{$this->_values['event']['default_role_id']}"];
         }
         // is the event active (enabled)?
         if (!$this->_values['event']['is_active']) {
             // form is inactive, die a fatal death
             CRM_Core_Error::statusBounce(ts('The event you requested is currently unavailable (contact the site administrator for assistance).'));
         }
         // is online registration is enabled?
         if (!$this->_values['event']['is_online_registration']) {
             CRM_Core_Error::statusBounce(ts('Online registration is not currently available for this event (contact the site administrator for assistance).'), $infoUrl);
         }
         // is this an event template ?
//.........这里部分代码省略.........
开发者ID:bhirsch,项目名称:voipdev,代码行数:101,代码来源:Registration.php


注:本文中的CRM_Event_BAO_Participant::getAdditionalParticipantIds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。