foreach ($groupTree as $values) {
$query = "DELETE FROM " . $values['table_name'] . " WHERE entity_id = " . $id;
- $params = array(1 => array($values['table_name'], 'string'),
+ $params = array(
+ 1 => array($values['table_name'], 'string'),
2 => array($id, 'integer'),
);
* @static
*/
static function getEvents($all = 0,
- $id = FALSE,
- $isActive = TRUE,
+ $id = FALSE,
+ $isActive = TRUE,
$checkPermission = TRUE
) {
$query = "
$statusCount = self::eventTotalSeats($dao->id, "( participant.status_id = {$statusId} )");
if ($statusCount) {
$urlString = "reset=1&force=1&event={$dao->id}&status=$statusId";
- $statusInfo = array('url' => CRM_Utils_System::url('civicrm/event/search', $urlString),
+ $statusInfo = array(
+ 'url' => CRM_Utils_System::url('civicrm/event/search', $urlString),
'name' => $statusValue['name'],
'label' => $statusValue['label'],
'count' => $statusCount,
* Get participant count
*
* @param int $eventId
- * @param boolean $considerStatus
+ * @param bool $considerStatusConsider status for participant count.
* Consider status for participant count.
- * @param boolean $status
+ * @param bool $statusConsider counted participant.
* Consider counted participant.
- * @param boolean $considerRole
+ * @param bool $considerRoleConsider role for participant count.
* Consider role for participant count.
- * @param boolean $role
+ * @param bool $roleConsider counted( is filter role) participant.
* Consider counted( is filter role) participant.
*
*
*/
public static function getParticipantCount($eventId,
$considerStatus = TRUE,
- $status = TRUE,
- $considerRole = TRUE,
- $role = TRUE
+ $status = TRUE,
+ $considerRole = TRUE,
+ $role = TRUE
) {
// consider both role and status for counted participants, CRM-4924.
*
* @param date $start
* Get events with start date >= this date.
- * @param integer $type
+ * @param int $typeGet events on the a specific event type (by event_type_id).
* Get events on the a specific event type (by event_type_id).
- * @param integer $eventId
+ * @param int $eventIdReturn a single event - by event id.
* Return a single event - by event id.
* @param date $end
* Also get events with end date >= this date.
- * @param boolean $onlyPublic
+ * @param bool $onlyPublicInclude public events only, default TRUE.
* Include public events only, default TRUE.
*
* @return array $all array of all the events that are searched
}
$query .= " ORDER BY civicrm_event.start_date ASC";
-
$params = array(1 => array($optionGroupId, 'Integer'));
$dao = CRM_Core_DAO::executeQuery($query, $params);
$all = array();
// since the location is sharable, lets use the same loc_block_id.
$locBlockId = CRM_Utils_Array::value('loc_block_id', $eventValues);
- $fieldsFix = ($afterCreate) ? array( ) : array('prefix' => array('title' => ts('Copy of') . ' '));
+ $fieldsFix = ($afterCreate) ? array() : array('prefix' => array('title' => ts('Copy of') . ' '));
if (empty($eventValues['is_show_location'])) {
$fieldsFix['prefix']['is_show_location'] = 0;
}
}
foreach ($gIdValues as $gId) {
- $email = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $gId, 'notify');
- if ($email) {
- //get values of corresponding profile fields for notification
- list($profileValues) = self::buildCustomDisplay($gId,
+ $email = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $gId, 'notify');
+ if ($email) {
+ //get values of corresponding profile fields for notification
+ list($profileValues) = self::buildCustomDisplay($gId,
NULL,
$contactID,
$template,
$isTest,
TRUE,
$participantParams
- );
- list($profileValues) = $profileValues;
- $val = array(
+ );
+ list($profileValues) = $profileValues;
+ $val = array(
'id' => $gId,
'values' => $profileValues,
'email' => $email,
- );
- CRM_Core_BAO_UFGroup::commonSendMail($contactID, $val);
+ );
+ CRM_Core_BAO_UFGroup::commonSendMail($contactID, $val);
+ }
}
}
}
}
- }
if ($values['event']['is_email_confirm'] || $returnMessageText) {
list($displayName, $email) = CRM_Contact_BAO_Contact_Location::getEmailDetails($contactID);
// check if additional prticipant, if so filter only to relevant ones
// CRM-9902
if (!empty($values['params']['additionalParticipant'])) {
- $ownLineItems = array( );
+ $ownLineItems = array();
foreach ( $lineItem as $liKey => $liValue ) {
$firstElement = array_pop( $liValue );
if ( $firstElement['entity_id'] == $participantId ) {
$prefixValue = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
$invoicing = CRM_Utils_Array::value('invoicing', $prefixValue);
if ($taxAmt && (isset($invoicing) && isset($prefixValue['is_email_pdf'])) ) {
- $sendTemplateParams['isEmailPdf'] = True;
+ $sendTemplateParams['isEmailPdf'] = TRUE;
$sendTemplateParams['contributionId'] = $values['contributionId'];
}
CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams);
) {
$v = $params[$name];
if (!CRM_Utils_System::isNull($v)) {
- $customVal = (int)$v;
+ $customVal = (int) $v;
}
}
elseif ($dao->data_type == 'Float') {
- $customVal = (float )($params[$name]);
+ $customVal = (float ) ($params[$name]);
}
elseif ($dao->data_type == 'Date') {
//@todo note the currently we are using default date time formatting. Since you can select/set
*/
static function buildCustomProfile($participantId,
$values,
- $contactId = NULL,
- $isTest = FALSE,
+ $contactId = NULL,
+ $isTest = FALSE,
$isIdsArray = FALSE,
$skipCancel = TRUE
) {
$eventEmailId = "{$eventEmail['confirm_from_name']} <{$eventEmail['confirm_from_email']}>";
$fromEmailValues['from_email_id'][$eventEmailId] = htmlspecialchars($eventEmailId);
- $fromEmailId = array('cc' => CRM_Utils_Array::value('cc_confirm', $eventEmail),
+ $fromEmailId = array(
+ 'cc' => CRM_Utils_Array::value('cc_confirm', $eventEmail),
'bcc' => CRM_Utils_Array::value('bcc_confirm', $eventEmail),
);
$fromEmailValues = array_merge($fromEmailValues, $fromEmailId);
{$extraWhereClause}
GROUP BY participant.event_id";
- return (int)CRM_Core_DAO::singleValueQuery($query, array(1 => array($eventId, 'Positive')));
+ return (int) CRM_Core_DAO::singleValueQuery($query, array(1 => array($eventId, 'Positive')));
}
/**
case 'financial_type_id':
// Fixme - this is going to ignore context, better to get conditions, add params, and call PseudoConstant::get
return CRM_Financial_BAO_FinancialType::getIncomeFinancialType();
- break;
+
+ break;
}
return CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context);
}
));
$tmpContactField = $contactFields = array();
- $contactFields = array( );
+ $contactFields = array();
if (!$onlyParticipant) {
$contactFields = CRM_Contact_BAO_Contact::importableFields($contactType, NULL);
$participantFields = CRM_Event_DAO_Participant::export();
$noteField = array(
- 'participant_note' => array('title' => 'Participant Note',
+ 'participant_note' => array(
+ 'title' => 'Participant Note',
'name' => 'participant_note',
));
$participantStatus = array(
- 'participant_status' => array('title' => 'Participant Status',
+ 'participant_status' => array(
+ 'title' => 'Participant Status',
'name' => 'participant_status',
));
$participantRole = array(
- 'participant_role' => array('title' => 'Participant Role',
+ 'participant_role' => array(
+ 'title' => 'Participant Role',
'name' => 'participant_role',
));
//CRM-13595 add event id to participant export
$eventid = array(
- 'event_id' => array('title' => 'Event ID',
+ 'event_id' => array(
+ 'title' => 'Event ID',
'name' => 'event_id',
));
$eventtitle = array(
- 'event_title' => array('title' => 'Event Title',
+ 'event_title' => array(
+ 'title' => 'Event Title',
'name' => 'event_title',
));
}
}
else {
- foreach ($feeProperties as $property) $feeDetails[$feeInfo->id][$property] = $feeInfo->$property;
+ foreach ($feeProperties as $property) { $feeDetails[$feeInfo->id][$property] = $feeInfo->$property;
+ }
}
}
if (empty($domainValues)) {
// making all tokens available to templates.
$domain = CRM_Core_BAO_Domain::getDomain();
- $tokens = array('domain' => array('name', 'phone', 'address', 'email'),
+ $tokens = array(
+ 'domain' => array('name', 'phone', 'address', 'email'),
'contact' => CRM_Core_SelectValues::contactTokens(),
);
*/
public static function createDiscountTrxn($eventID, $contributionParams, $feeLevel) {
// CRM-11124
- $checkDiscount = CRM_Core_BAO_Discount::findSet($eventID,'civicrm_event');
+ $checkDiscount = CRM_Core_BAO_Discount::findSet($eventID, 'civicrm_event');
if (!empty($checkDiscount)) {
$feeLevel = current($feeLevel);
$priceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_event', $eventID, NULL);
$query = "SELECT cpfv.amount FROM `civicrm_price_field_value` cpfv
LEFT JOIN civicrm_price_field cpf ON cpfv.price_field_id = cpf.id
WHERE cpf.price_set_id = %1 AND cpfv.label LIKE %2";
- $params = array(1 => array($priceSetId, 'Integer'),
+ $params = array(
+ 1 => array($priceSetId, 'Integer'),
2 => array($feeLevel, 'String'));
$mainAmount = CRM_Core_DAO::singleValueQuery($query, $params);
$relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Discounts Account is' "));
$partUpdateFeeAmt['id'] = $participantId;
foreach ($lineItems as $lineValue) {
if ($lineValue['price_field_value_id']) {
- $line[$lineValue['price_field_value_id']] = $lineValue['label'] . ' - '. $lineValue['qty'];
- }
+ $line[$lineValue['price_field_value_id']] = $lineValue['label'] . ' - '. $lineValue['qty'];
+ }
}
$partUpdateFeeAmt['fee_level'] = implode(', ', $line);
$participantPayment->copyValues($params);
if (isset($ids['id'])) {
$participantPayment->id = CRM_Utils_Array::value('id', $ids);
- }
+ }
else {
$participantPayment->find(TRUE);
}
* @param $row
* @param int $id
*/
- public static function searchAction(&$row, $id) {}
+ public static function searchAction(&$row, $id) {
+ }
/**
* @param $tables
$this->pdf->MultiCell($this->pdf->width, $this->pdf->lineHeight, $txt);
}
- public function pdfExtraFormat() {}
+ public function pdfExtraFormat() {
+ }
/**
* Create labels (pdf)
$h = 50;
$w = 75;
$this->format = array(
- 'name' => 'Sigel 3C', 'paper-size' => 'A4', 'metric' => 'mm', 'lMargin' => ($pw - $w * 2) / 2,
- 'tMargin' => ($ph - $h * 5) / 2, 'NX' => 2, 'NY' => 5, 'SpaceX' => 0, 'SpaceY' => 0,
- 'width' => $w, 'height' => $h, 'font-size' => 12,
+ 'name' => 'Sigel 3C',
+ 'paper-size' => 'A4',
+ 'metric' => 'mm',
+ 'lMargin' => ($pw - $w * 2) / 2,
+ 'tMargin' => ($ph - $h * 5) / 2,
+ 'NX' => 2,
+ 'NY' => 5,
+ 'SpaceX' => 0,
+ 'SpaceY' => 0,
+ 'width' => $w,
+ 'height' => $h,
+ 'font-size' => 12,
);
$this->lMarginLogo = 20;
$this->tMarginName = 20;
$h = 59.2;
$w = 85.7;
$this->format = array(
- 'name' => 'Avery 5395', 'paper-size' => 'A4', 'metric' => 'mm', 'lMargin' => 13.5,
- 'tMargin' => 3, 'NX' => 2, 'NY' => 4, 'SpaceX' => 15, 'SpaceY' => 8.5,
- 'width' => $w, 'height' => $h, 'font-size' => 12,
+ 'name' => 'Avery 5395',
+ 'paper-size' => 'A4',
+ 'metric' => 'mm',
+ 'lMargin' => 13.5,
+ 'tMargin' => 3,
+ 'NX' => 2,
+ 'NY' => 4,
+ 'SpaceX' => 15,
+ 'SpaceY' => 8.5,
+ 'width' => $w,
+ 'height' => $h,
+ 'font-size' => 12,
);
$this->lMarginLogo = 20;
$this->tMarginName = 20;
$w = $pw - 2 * $this->lMargin;
$h = $ph - 2 * $this->tMargin;
$this->format = array(
- 'name' => 'A4 horiz', 'paper-size' => 'A4', 'metric' => 'mm', 'lMargin' => 0,
- 'tMargin' => 0, 'NX' => 1, 'NY' => 1, 'SpaceX' => 0, 'SpaceY' => 0,
- 'width' => $w, 'height' => $h, 'font-size' => 36,
+ 'name' => 'A4 horiz',
+ 'paper-size' => 'A4',
+ 'metric' => 'mm',
+ 'lMargin' => 0,
+ 'tMargin' => 0,
+ 'NX' => 1,
+ 'NY' => 1,
+ 'SpaceX' => 0,
+ 'SpaceY' => 0,
+ 'width' => $w,
+ 'height' => $h,
+ 'font-size' => 36,
);
// $this->setDebug ();
}
*/
class CRM_Event_Cart_BAO_Cart extends CRM_Event_Cart_DAO_Cart {
public $associations_loaded = FALSE;
- /* event_in_cart_id => $event_in_cart */
- public $events_in_carts = array(
- );
+ /* event_in_cart_id => $event_in_cart */
+ public $events_in_carts = array();
/**
* @param array $params
public $event;
public $event_cart;
public $location = NULL;
- public $participants = array(
- );
+ public $participants = array();
/**
*
/**
* @param bool $useWhere
*/
- public function delete($useWhere = false) {
+ public function delete($useWhere = FALSE) {
$this->load_associations();
$contacts_to_delete = array();
foreach ($this->participants as $participant) {
* @param mixed $offset
* @param mixed $value
*/
- public function offsetSet($offset, $value) {}
+ public function offsetSet($offset, $value) {
+ }
/**
* @param mixed $offset
*/
- public function offsetUnset($offset) {}
+ public function offsetUnset($offset) {
+ }
/**
* @return array
if ($parent_event_id == NULL) {
return $this->event->parent_event_id;
}
- else return $this->event->parent_event_id == $parent_event_id;
+ else { return $this->event->parent_event_id == $parent_event_id;
+ }
}
}
*/
public function __construct($participant = NULL) {
parent::__construct();
- $a = (array)$participant;
+ $a = (array) $participant;
$this->copyValues($a);
$this->email = CRM_Utils_Array::value('email', $participant);
public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
parent::__construct($title, $modal);
-
$this->_stateMachine = new CRM_Event_Cart_StateMachine_Checkout($this, $action);
$this->addPages($this->_stateMachine, $action);
$config = CRM_Core_Config::singleton();
if (is_array($ids)) {
return array_pop($ids);
}
- else return NULL;
+ else { return NULL;
+ }
}
/**
'isTest' => FALSE,
'toEmail' => $contact_details[1],
'toName' => $contact_details[0],
- 'tplParams' => array
- (
+ 'tplParams' => array(
'billing_name' => "{$params['billing_first_name']} {$params['billing_last_name']}",
'billing_city' => $params["billing_city-{$this->_bltID}"],
'billing_country' => $country->name,
$cart = CRM_Event_Cart_BAO_Cart::find_or_create_for_current_session();
$event_in_cart = $cart->add_event($this->_id);
- $url=CRM_Utils_System::url('civicrm/event/view_cart');
- CRM_Utils_System::setUFMessage(ts("<b>%1</b> has been added to your cart. <a href='%2'>View your cart.</a>", array(1 => $event_in_cart->event->title,2 => $url)));
+ $url = CRM_Utils_System::url('civicrm/event/view_cart');
+ CRM_Utils_System::setUFMessage(ts("<b>%1</b> has been added to your cart. <a href='%2'>View your cart.</a>", array(1 => $event_in_cart->event->title, 2 => $url)));
$transaction->commit();
// create and instantiate the pages
$this->addPages($this->_stateMachine, $action);
-
$session = CRM_Core_Session::singleton();
$uploadNames = $session->get('uploadNames');
if (!empty($uploadNames)) {
// $defaults[$form->_pId]['credit_card_exp_date'] = array( 'Y' => '2012', 'M' => '05' );
}
-
// if user has selected discount use that to set default
if (isset($form->_discountId)) {
$defaults[$form->_pId]['discount_id'] = $form->_discountId;
if (($form->_action == CRM_Core_Action::ADD) && $form->_eventId && $discountId) {
// this case is for add mode, where we show discount automatically
- $defaults[$form->_pId]['discount_id'] = $discountId;
+ $defaults[$form->_pId]['discount_id'] = $discountId;
}
-
if ($priceSetId) {
// get price set default values, CRM-4090
if (in_array(get_class($form),
if ($contriId = $form->get('onlinePendingContributionId')) {
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->id = $contriId;
- $contribution->find( true );
- foreach( array('financial_type_id', 'payment_instrument_id','contribution_status_id', 'receive_date', 'total_amount' ) as $f ) {
+ $contribution->find( TRUE );
+ foreach( array('financial_type_id', 'payment_instrument_id', 'contribution_status_id', 'receive_date', 'total_amount' ) as $f ) {
if ($f == 'receive_date') {
list($defaults[$form->_pId]['receive_date']) = CRM_Utils_Date::setDateDefaults($contribution->$f);
}
CRM_Event_Form_Registration::initEventFee($form, $event['id']);
CRM_Event_Form_Registration_Register::buildAmount($form, TRUE, $form->_discountId);
$lineItem = array();
- $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings');
+ $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
$invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
$totalTaxAmount = 0;
if (!CRM_Utils_System::isNull(CRM_Utils_Array::value('line_items', $form->_values))) {
$this->_doneUrl = CRM_Utils_System::url('civicrm/event/manage',
'reset=1'
);
- $breadCrumb = array(array('title' => ts('Manage Events'),
+ $breadCrumb = array(array(
+ 'title' => ts('Manage Events'),
'url' => $this->_doneUrl,
));
}
}
else {
$this->_doneUrl = CRM_Utils_System::url('civicrm/admin/eventTemplate', 'reset=1');
- $breadCrumb = array(array('title' => ts('Manage Event Templates'),
+ $breadCrumb = array(array(
+ 'title' => ts('Manage Event Templates'),
'url' => $this->_doneUrl,
));
}
FALSE
);
- $this->addEntityRef('parent_event_id', ts('Parent Event'), array(
+ $this->addEntityRef('parent_event_id', ts('Parent Event'), array(
'entity' => 'event',
'placeholder' => ts('- any -'),
'select' => array('minimumInputLength' => 0),
$this->assign('isQuick', $isQuick);
$priceField = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $priceSetId, 'id', 'price_set_id');
$options = array();
- $priceFieldOptions = CRM_Price_BAO_PriceFieldValue::getValues($priceField, $options, 'weight', true);
+ $priceFieldOptions = CRM_Price_BAO_PriceFieldValue::getValues($priceField, $options, 'weight', TRUE);
$defaults['price_field_id'] = $priceField;
$countRow = 0;
foreach ($options as $optionId => $optionValue) {
$defaults['discounted_label'][$discountFieldsval['weight']] = $discountFieldsval['label'];
$defaults['discounted_value'][$discountFieldsval['weight']][$rowCount] =
CRM_Utils_Money::format($discountFieldsval['amount'], NULL, '%a');
- $defaults['discount_option_id'][$rowCount][$discountFieldsval['weight']]= $discountFieldsval['id'];
+ $defaults['discount_option_id'][$rowCount][$discountFieldsval['weight']] = $discountFieldsval['id'];
if (!empty($discountFieldsval['is_default'])) {
$defaults['discounted_default'] = $discountFieldsval['weight'];
}
}
}
- foreach ($occurDiscount as $key => $value) if ($value > 1 && $key <> '') {
- if ($key == $values['discount_name'][$i]) {
- $errors['discount_name[' . $i . ']'] = ts('%1 is already used for Discount Name.', array(1 => $key));
- }
+ foreach ($occurDiscount as $key => $value) { if ($value > 1 && $key <> '') {
+ if ($key == $values['discount_name'][$i]) {
+ $errors['discount_name[' . $i . ']'] = ts('%1 is already used for Discount Name.', array(1 => $key));
+ }
+ }
}
//validation for discount labels and values
// to event.create see CRM-14069
// @todo get all of this logic out of form layer (currently partially in BAO/api layer)
if (CRM_Price_BAO_PriceSet::removeFrom('civicrm_event', $this->_id)) {
- CRM_Core_BAO_Discount::del($this->_id,'civicrm_event');
+ CRM_Core_BAO_Discount::del($this->_id, 'civicrm_event');
}
}
CRM_Price_BAO_PriceSet::addTo('civicrm_event', $this->_id, $params['price_set_id']);
if (!empty($params['price_field_id'])) {
$priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $params['price_field_id'], 'price_set_id');
- CRM_Price_BAO_PriceSet::setIsQuickConfig($priceSetID,0);
+ CRM_Price_BAO_PriceSet::setIsQuickConfig($priceSetID, 0);
}
}
else {
if (!CRM_Utils_System::isNull($labels) && !CRM_Utils_System::isNull($values)) {
for ($i = 1; $i < self::NUM_OPTION; $i++) {
if (!empty($labels[$i]) && !CRM_Utils_System::isNull($values[$i])) {
- $options[] = array('label' => trim($labels[$i]),
+ $options[] = array(
+ 'label' => trim($labels[$i]),
'value' => CRM_Utils_Rule::cleanMoney(trim($values[$i])),
'weight' => $i,
'is_active' => 1,
$setParams['name'] = $eventTitle . '_' . $this->_id;
}
else {
- $timeSec = explode('.', microtime(true));
+ $timeSec = explode('.', microtime(TRUE));
$setParams['name'] = $eventTitle . '_' . date('is', $timeSec[0]) . $timeSec[1];
}
$setParams['is_quick_config'] = 1;
$fieldParams['option_label'] = $params['label'];
$fieldParams['option_amount'] = $params['value'];
$fieldParams['financial_type_id'] = $params['financial_type_id'];
- foreach ($options as $value) $fieldParams['option_weight'][$value['weight']] = $value['weight'];
+ foreach ($options as $value) { $fieldParams['option_weight'][$value['weight']] = $value['weight'];
+ }
$fieldParams['default_option'] = $params['default'];
$priceField = CRM_Price_BAO_PriceField::create($fieldParams);
}
}
}
- $discountPriceSets = !empty($this->_defaultValues['discount_price_set']) ? $this->_defaultValues['discount_price_set']: array();
- $discountFieldIDs = !empty($this->_defaultValues['discount_option_id']) ? $this->_defaultValues['discount_option_id']: array();
+ $discountPriceSets = !empty($this->_defaultValues['discount_price_set']) ? $this->_defaultValues['discount_price_set'] : array();
+ $discountFieldIDs = !empty($this->_defaultValues['discount_option_id']) ? $this->_defaultValues['discount_option_id'] : array();
if (CRM_Utils_Array::value('is_discount', $params) == 1) {
// if there are discounted set of label / values,
// create custom options for them
if (!empty($discountOptions)) {
$fieldParams = array();
$params['default_discount_fee_id'] = NULL;
- $keyCheck = $j-1;
+ $keyCheck = $j - 1;
$setParams = array();
if (empty($discountPriceSets[$keyCheck])) {
if (!$eventTitle) {
$setParams['name'] = $eventTitle . '_' . $params['discount_name'][$j] . '_' . $this->_id;
}
else {
- $timeSec = explode('.', microtime(true));
+ $timeSec = explode('.', microtime(TRUE));
$setParams['name'] = $eventTitle . '_' . $params['discount_name'][$j] . '_' . date('is', $timeSec[0]) . $timeSec[1];
}
$setParams['is_quick_config'] = 1;
$priceSetID = $priceSet->id;
}
else {
- $priceSetID = $discountPriceSets[$j-1];
- $setParams = array (
+ $priceSetID = $discountPriceSets[$j - 1];
+ $setParams = array(
'title' => $params['discount_name'][$j],
'id' => $priceSetID,
);
$setParams['financial_type_id'] = $params['financial_type_id'];
}
CRM_Price_BAO_PriceSet::create($setParams);
- unset($discountPriceSets[$j-1]);
+ unset($discountPriceSets[$j - 1]);
$fieldParams['id'] = CRM_Core_DAO::getFieldValue('CRM_Price_BAO_PriceField', $priceSetID, 'id', 'price_set_id');
}
else {
if (!empty($params['price_field_id'])) {
$priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $params['price_field_id'], 'price_set_id');
- CRM_Price_BAO_PriceSet::setIsQuickConfig($priceSetID,0);
+ CRM_Price_BAO_PriceSet::setIsQuickConfig($priceSetID, 0);
}
$params['financial_type_id'] = '';
$params['is_pay_later'] = 0;
//update 'is_billing_required'
if (empty($params['is_pay_later'])) {
- $params['is_billing_required'] = False;
+ $params['is_billing_required'] = FALSE;
}
//update events table
$events = array();
if (!empty($locationEvents)) {
$this->assign('locEvents', TRUE);
- $optionTypes = array('1' => ts('Create new location'),
+ $optionTypes = array(
+ '1' => ts('Create new location'),
'2' => ts('Use existing location'),
);
*/
public function buildRegistrationBlock(&$form) {
$attributes = CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event');
- $attributes['intro_text']['click_wysiwyg'] = true;
+ $attributes['intro_text']['click_wysiwyg'] = TRUE;
$form->addWysiwyg('intro_text', ts('Introductory Text'), $attributes['intro_text']);
// FIXME: This hack forces height of editor to 175px. Need to modify QF classes for editors to allow passing
// explicit height and width.
$footerAttribs = array(
'rows' => 2,
'cols' => 40,
- 'click_wysiwyg' => true,
+ 'click_wysiwyg' => TRUE,
);
$form->addWysiwyg('footer_text', ts('Footer Text'), $footerAttribs);
$form->addProfileSelector( 'custom_pre_id', ts('Include Profile') . '<br />' . ts('(top of page)'), $allowCoreTypes, $allowSubTypes, $profileEntities, TRUE);
$form->addProfileSelector( 'custom_post_id', ts('Include Profile') . '<br />' . ts('(bottom of page)'), $allowCoreTypes, $allowSubTypes, $profileEntities, TRUE);
- $form->addProfileSelector( 'additional_custom_pre_id', ts('Profile for Additional Participants') . '<br />' . ts('(top of page)'), $allowCoreTypes, $allowSubTypes, $profileEntities, TRUE);
- $form->addProfileSelector( 'additional_custom_post_id', ts('Profile for Additional Participants') . '<br />' . ts('(bottom of page)'), $allowCoreTypes, $allowSubTypes, $profileEntities, TRUE);
+ $form->addProfileSelector( 'additional_custom_pre_id', ts('Profile for Additional Participants') . '<br />' . ts('(top of page)'), $allowCoreTypes, $allowSubTypes, $profileEntities, TRUE);
+ $form->addProfileSelector( 'additional_custom_post_id', ts('Profile for Additional Participants') . '<br />' . ts('(bottom of page)'), $allowCoreTypes, $allowSubTypes, $profileEntities, TRUE);
}
/**
* @param array $configs
* Optional, for addProfileSelector(), defaults to using getProfileSelectorTypes().
**/
- public function buildMultipleProfileBottom(&$form, $count, $prefix = '', $label = 'Include Profile', $configs = null) {
+ public function buildMultipleProfileBottom(&$form, $count, $prefix = '', $label = 'Include Profile', $configs = NULL) {
extract( ( is_null($configs) ) ? self::getProfileSelectorTypes() : $configs );
$element = $prefix . "custom_post_id_multiple[$count]";
$label .= '<br />'.ts('(bottom of page)');
- $form->addProfileSelector( $element, $label, $allowCoreTypes, $allowSubTypes, $profileEntities, TRUE);
+ $form->addProfileSelector( $element, $label, $allowCoreTypes, $allowSubTypes, $profileEntities, TRUE);
}
/**
$configs['allowCoreTypes'] = array_merge(array('Contact', 'Individual'), CRM_Contact_BAO_ContactType::subTypes('Individual'));
$configs['allowCoreTypes'][] = 'Participant';
//CRM-15427
- $id = CRM_Utils_Request::retrieve( 'id' , 'Integer' );
+ $id = CRM_Utils_Request::retrieve( 'id', 'Integer' );
if ($id) {
$participantEventType = CRM_Core_DAO::getFieldValue("CRM_Event_DAO_Event", $id, 'event_type_id', 'id');
$participantRole = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $id, 'default_role_id');
$configs['profileEntities'][] = array('entity_name' => 'contact_1', 'entity_type' => 'IndividualModel');
$configs['profileEntities'][] = array('entity_name' => 'participant_1', 'entity_type' => 'ParticipantModel', 'entity_sub_type' => '*');
- return $configs;
+ return $configs;
}
/**
*/
public function buildConfirmationBlock(&$form) {
$attributes = CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event');
- $attributes['confirm_text']['click_wysiwyg'] = true;
+ $attributes['confirm_text']['click_wysiwyg'] = TRUE;
// CRM-11182 - Optional confirmation page for free events
$is_monetary = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $form->_id, 'is_monetary');
$form->assign('is_monetary', $is_monetary);
$footerAttribs = array(
'rows' => 2,
'cols' => 40,
- 'click_wysiwyg' => true,
+ 'click_wysiwyg' => TRUE,
);
$form->addWysiwyg('confirm_footer_text', ts('Footer Text'), $footerAttribs);
}
*/
public function buildThankYouBlock(&$form) {
$attributes = CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event');
- $attributes['thankyou_text']['click_wysiwyg'] = true;
+ $attributes['thankyou_text']['click_wysiwyg'] = TRUE;
$form->add('text', 'thankyou_title', ts('Title'), $attributes['thankyou_title']);
$form->addWysiwyg('thankyou_text', ts('Introductory Text'), $attributes['thankyou_text']);
// FIXME: This hack forces height of editor to 175px. Need to modify QF classes for editors to allow passing
$footerAttribs = array(
'rows' => 2,
'cols' => 40,
- 'click_wysiwyg' => true,
+ 'click_wysiwyg' => TRUE,
);
$form->addWysiwyg('thankyou_footer_text', ts('Footer Text'), $footerAttribs);
}
$index = array();
foreach ($combos as $comboid => $combo) {
foreach ($combo as $cfield) {
- $index[$cfield][$comboid] = true;
+ $index[$cfield][$comboid] = TRUE;
}
$combos[$comboid] = array_fill_keys($combo, 0);
$okCombos[$comboid] = array_fill_keys($combo, 2);
// check each of the fields in the index against the profile field
foreach ($index as $ifield => $icombos) {
- if(strpos($field['name'], $ifield) !== false) {
+ if(strpos($field['name'], $ifield) !== FALSE) {
// we found the field in the profile, now record it in the index
foreach ($icombos as $icombo => $dontcare) {
// check the combos to see if everything is > 0
foreach ($combos as $comboid => $combo) {
- $complete = false;
+ $complete = FALSE;
foreach ($combo as $cfield) {
if ($cfield > 0) {
- $complete = true;
+ $complete = TRUE;
}
else {
// this combo isn't complete--skip to the next combo
continue 2;
}
}
- if ($complete) { return 1; }
+ if ($complete) { return 1;
+ }
}
// no combo succeeded
'entity_id' => $this->_id,
);
-
// first delete all past entries
CRM_Core_BAO_UFJoin::deleteAll($ufJoinParams);
self::addMultipleProfiles($profileIds, $params, 'custom_post_id_multiple');
self::addMultipleProfiles($additionalProfileIds, $params, 'additional_custom_post_id_multiple');
- $cantDedupe = false;
+ $cantDedupe = FALSE;
$rgId = CRM_Utils_Array::value('dedupe_rule_group_id', $params, 0);
switch (self::canProfilesDedupe($profileIds, $rgId)) {
$dedupeTitle = 'Duplicate Matching Impossible';
$cantDedupe = ts("The selected profiles do not contain the fields necessary to match registrations with existing contacts. This means all anonymous registrations will result in a new contact.");
break;
+
case 1:
$dedupeTitle = 'Duplicate Contacts Possible';
$cantDedupe = ts("The selected profiles can collect enough information to match registrations with existing contacts, but not all of the relevant fields are required. Anonymous registrations may result in duplicate contacts.");
$cantDedupe = ts("The selected profiles do not contain the fields necessary to match additional participants with existing contacts. This means all additional participants will result in a new contact.");
}
break;
+
case 1:
if (!$cantDedupe) {
$dedupeTitle = 'Duplicate Contacts Possible';
-<?php\r
-\r
-/*\r
- * To change this license header, choose License Headers in Project Properties.\r
- * To change this template file, choose Tools | Templates\r
- * and open the template in the editor.\r
- */\r
-\r
-/**\r
- * Description of Repeat\r
- *\r
- * @author Priyanka\r
- */\r
-class CRM_Event_Form_ManageEvent_Repeat extends CRM_Event_Form_ManageEvent {\r
-\r
- /**\r
- * Parent Event Start Date\r
- */\r
- protected $_parentEventStartDate = NULL;\r
-\r
- /**\r
- * Parent Event End Date\r
- */\r
- protected $_parentEventEndDate = NULL;\r
-\r
-\r
- public function preProcess() {\r
- parent::preProcess();\r
- CRM_Core_Form_RecurringEntity::preProcess('civicrm_event');\r
- $this->assign('currentEventId', $this->_id);\r
-\r
- $checkParentExistsForThisId = CRM_Core_BAO_RecurringEntity::getParentFor($this->_id, 'civicrm_event');\r
- //If this ID has parent, send parent id\r
- if ($checkParentExistsForThisId) {\r
- /**\r
- * Get connected event information list\r
- */\r
- //Get all connected event ids\r
- $allEventIdsArray = CRM_Core_BAO_RecurringEntity::getEntitiesForParent($checkParentExistsForThisId, 'civicrm_event');\r
- $allEventIds = array();\r
- if (!empty($allEventIdsArray)) {\r
- foreach($allEventIdsArray as $key => $val) {\r
- $allEventIds[] = $val['id'];\r
- }\r
- if (!empty($allEventIds)) {\r
- $params = array();\r
- $query = "\r
- SELECT *\r
- FROM civicrm_event\r
- WHERE id IN (".implode(",", $allEventIds).")\r
- ORDER BY start_date asc\r
- ";\r
-\r
- $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Event_DAO_Event');\r
- $permissions = CRM_Event_BAO_Event::checkPermission();\r
- while($dao->fetch()) {\r
- if (in_array($dao->id, $permissions[CRM_Core_Permission::VIEW])) {\r
- $manageEvent[$dao->id] = array();\r
- CRM_Core_DAO::storeValues($dao, $manageEvent[$dao->id]);\r
- }\r
- }\r
- }\r
- $this->assign('rows', $manageEvent);\r
- }\r
- }\r
-\r
- $parentEventParams = array('id' => $this->_id);\r
- $parentEventValues = array();\r
- $parentEventReturnProperties = array('start_date', 'end_date');\r
- $parentEventAttributes = CRM_Core_DAO::commonRetrieve('CRM_Event_DAO_Event', $parentEventParams, $parentEventValues, $parentEventReturnProperties);\r
- $this->_parentEventStartDate = $parentEventAttributes->start_date;\r
- $this->_parentEventEndDate = $parentEventAttributes->end_date;\r
- }\r
-\r
- /**\r
- * Set default values for the form. For edit/view mode\r
- * the default values are retrieved from the database\r
- *\r
- *\r
- * @return None\r
- */\r
- public function setDefaultValues() {\r
- $defaults = array();\r
-\r
- //Always pass current event's start date by default\r
- $currentEventStartDate = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_id, 'start_date', 'id');\r
- list($defaults['repetition_start_date'], $defaults['repetition_start_date_time']) = CRM_Utils_Date::setDateDefaults($currentEventStartDate, 'activityDateTime');\r
- $defaults['allowRepeatConfigToSubmit'] = 1;\r
- $recurringEntityDefaults = array();\r
- $recurringEntityDefaults = CRM_Core_Form_RecurringEntity::setDefaultValues();\r
- $defaults = array_merge($defaults, $recurringEntityDefaults);\r
- return $defaults;\r
- }\r
-\r
- public function buildQuickForm() {\r
- CRM_Core_Form_RecurringEntity::buildQuickForm($this);\r
- }\r
-\r
- public function postProcess() {\r
- if ($this->_id) {\r
- $params = $this->controller->exportValues($this->_name);\r
- if ($this->_parentEventStartDate && $this->_parentEventEndDate) {\r
- $interval = CRM_Core_BAO_RecurringEntity::getInterval($this->_parentEventStartDate, $this->_parentEventEndDate);\r
- $params['intervalDateColumns'] = array('end_date' => $interval);\r
- }\r
- $params['dateColumns'] = array('start_date');\r
- $params['excludeDateRangeColumns'] = array('start_date', 'end_date');\r
- $params['entity_table'] = 'civicrm_event';\r
- //Unset event id\r
- unset($params['id']);\r
-\r
- $url = 'civicrm/event/manage/repeat';\r
- $urlParams = "action=update&reset=1&id={$this->_id}";\r
-\r
- $linkedEntities = array(\r
- array(\r
- 'table' => 'civicrm_price_set_entity',\r
- 'findCriteria' => array(\r
- 'entity_id' => $this->_id,\r
- 'entity_table' => 'civicrm_event'\r
- ),\r
- 'linkedColumns' => array('entity_id'),\r
- 'isRecurringEntityRecord' => FALSE,\r
- ),\r
- array(\r
- 'table' => 'civicrm_uf_join',\r
- 'findCriteria' => array(\r
- 'entity_id' => $this->_id,\r
- 'entity_table' => 'civicrm_event'\r
- ),\r
- 'linkedColumns' => array('entity_id'),\r
- 'isRecurringEntityRecord' => FALSE,\r
- ),\r
- array(\r
- 'table' => 'civicrm_tell_friend',\r
- 'findCriteria' => array(\r
- 'entity_id' => $this->_id,\r
- 'entity_table' => 'civicrm_event'\r
- ),\r
- 'linkedColumns' => array('entity_id'),\r
- 'isRecurringEntityRecord' => TRUE,\r
- ),\r
- array(\r
- 'table' => 'civicrm_pcp_block',\r
- 'findCriteria' => array(\r
- 'entity_id' => $this->_id,\r
- 'entity_table' => 'civicrm_event'\r
- ),\r
- 'linkedColumns' => array('entity_id'),\r
- 'isRecurringEntityRecord' => TRUE,\r
- ),\r
- );\r
- CRM_Core_Form_RecurringEntity::postProcess($params, 'civicrm_event', $linkedEntities);\r
- CRM_Utils_System::redirect(CRM_Utils_System::url($url, $urlParams));\r
- }\r
- else {\r
- CRM_Core_Error::fatal("Could not find Event ID");\r
- }\r
- parent::endPostProcess();\r
- }\r
-\r
- /**\r
- * This function gets the number of participant count for the list of related event ids\r
- *\r
+<?php
+
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+/**
+ * Description of Repeat
+ *
+ * @author Priyanka
+ */
+class CRM_Event_Form_ManageEvent_Repeat extends CRM_Event_Form_ManageEvent {
+
+ /**
+ * Parent Event Start Date
+ */
+ protected $_parentEventStartDate = NULL;
+
+ /**
+ * Parent Event End Date
+ */
+ protected $_parentEventEndDate = NULL;
+
+
+ public function preProcess() {
+ parent::preProcess();
+ CRM_Core_Form_RecurringEntity::preProcess('civicrm_event');
+ $this->assign('currentEventId', $this->_id);
+
+ $checkParentExistsForThisId = CRM_Core_BAO_RecurringEntity::getParentFor($this->_id, 'civicrm_event');
+ //If this ID has parent, send parent id
+ if ($checkParentExistsForThisId) {
+ /**
+ * Get connected event information list
+ */
+ //Get all connected event ids
+ $allEventIdsArray = CRM_Core_BAO_RecurringEntity::getEntitiesForParent($checkParentExistsForThisId, 'civicrm_event');
+ $allEventIds = array();
+ if (!empty($allEventIdsArray)) {
+ foreach($allEventIdsArray as $key => $val) {
+ $allEventIds[] = $val['id'];
+ }
+ if (!empty($allEventIds)) {
+ $params = array();
+ $query = "
+ SELECT *
+ FROM civicrm_event
+ WHERE id IN (".implode(",", $allEventIds).")
+ ORDER BY start_date asc
+ ";
+
+ $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Event_DAO_Event');
+ $permissions = CRM_Event_BAO_Event::checkPermission();
+ while($dao->fetch()) {
+ if (in_array($dao->id, $permissions[CRM_Core_Permission::VIEW])) {
+ $manageEvent[$dao->id] = array();
+ CRM_Core_DAO::storeValues($dao, $manageEvent[$dao->id]);
+ }
+ }
+ }
+ $this->assign('rows', $manageEvent);
+ }
+ }
+
+ $parentEventParams = array('id' => $this->_id);
+ $parentEventValues = array();
+ $parentEventReturnProperties = array('start_date', 'end_date');
+ $parentEventAttributes = CRM_Core_DAO::commonRetrieve('CRM_Event_DAO_Event', $parentEventParams, $parentEventValues, $parentEventReturnProperties);
+ $this->_parentEventStartDate = $parentEventAttributes->start_date;
+ $this->_parentEventEndDate = $parentEventAttributes->end_date;
+ }
+
+ /**
+ * Set default values for the form. For edit/view mode
+ * the default values are retrieved from the database
+ *
+ *
+ * @return None
+ */
+ public function setDefaultValues() {
+ $defaults = array();
+
+ //Always pass current event's start date by default
+ $currentEventStartDate = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_id, 'start_date', 'id');
+ list($defaults['repetition_start_date'], $defaults['repetition_start_date_time']) = CRM_Utils_Date::setDateDefaults($currentEventStartDate, 'activityDateTime');
+ $defaults['allowRepeatConfigToSubmit'] = 1;
+ $recurringEntityDefaults = array();
+ $recurringEntityDefaults = CRM_Core_Form_RecurringEntity::setDefaultValues();
+ $defaults = array_merge($defaults, $recurringEntityDefaults);
+ return $defaults;
+ }
+
+ public function buildQuickForm() {
+ CRM_Core_Form_RecurringEntity::buildQuickForm($this);
+ }
+
+ public function postProcess() {
+ if ($this->_id) {
+ $params = $this->controller->exportValues($this->_name);
+ if ($this->_parentEventStartDate && $this->_parentEventEndDate) {
+ $interval = CRM_Core_BAO_RecurringEntity::getInterval($this->_parentEventStartDate, $this->_parentEventEndDate);
+ $params['intervalDateColumns'] = array('end_date' => $interval);
+ }
+ $params['dateColumns'] = array('start_date');
+ $params['excludeDateRangeColumns'] = array('start_date', 'end_date');
+ $params['entity_table'] = 'civicrm_event';
+ //Unset event id
+ unset($params['id']);
+
+ $url = 'civicrm/event/manage/repeat';
+ $urlParams = "action=update&reset=1&id={$this->_id}";
+
+ $linkedEntities = array(
+ array(
+ 'table' => 'civicrm_price_set_entity',
+ 'findCriteria' => array(
+ 'entity_id' => $this->_id,
+ 'entity_table' => 'civicrm_event'
+ ),
+ 'linkedColumns' => array('entity_id'),
+ 'isRecurringEntityRecord' => FALSE,
+ ),
+ array(
+ 'table' => 'civicrm_uf_join',
+ 'findCriteria' => array(
+ 'entity_id' => $this->_id,
+ 'entity_table' => 'civicrm_event'
+ ),
+ 'linkedColumns' => array('entity_id'),
+ 'isRecurringEntityRecord' => FALSE,
+ ),
+ array(
+ 'table' => 'civicrm_tell_friend',
+ 'findCriteria' => array(
+ 'entity_id' => $this->_id,
+ 'entity_table' => 'civicrm_event'
+ ),
+ 'linkedColumns' => array('entity_id'),
+ 'isRecurringEntityRecord' => TRUE,
+ ),
+ array(
+ 'table' => 'civicrm_pcp_block',
+ 'findCriteria' => array(
+ 'entity_id' => $this->_id,
+ 'entity_table' => 'civicrm_event'
+ ),
+ 'linkedColumns' => array('entity_id'),
+ 'isRecurringEntityRecord' => TRUE,
+ ),
+ );
+ CRM_Core_Form_RecurringEntity::postProcess($params, 'civicrm_event', $linkedEntities);
+ CRM_Utils_System::redirect(CRM_Utils_System::url($url, $urlParams));
+ }
+ else {
+ CRM_Core_Error::fatal("Could not find Event ID");
+ }
+ parent::endPostProcess();
+ }
+
+ /**
+ * This function gets the number of participant count for the list of related event ids
+ *
* @param array $listOfRelatedEntities
* List of related event ids .
- *\r
- * @static\r
- *\r
- * @return array\r
- */\r
- static public function getParticipantCountforEvent($listOfRelatedEntities = array()) {\r
- if (!empty($listOfRelatedEntities)) {\r
- $implodeRelatedEntities = implode(',', array_map(function($entity) {\r
- return $entity['id'];\r
- }, $listOfRelatedEntities));\r
- if ($implodeRelatedEntities) {\r
- $query = "SELECT p.event_id as event_id,\r
- concat_ws(' ', e.title, concat_ws(' - ', DATE_FORMAT(e.start_date, '%b %d %Y %h:%i %p'), DATE_FORMAT(e.end_date, '%b %d %Y %h:%i %p'))) as event_data,\r
- count(p.id) as participant_count\r
- FROM civicrm_participant p, civicrm_event e\r
- WHERE p.event_id = e.id AND p.event_id IN ({$implodeRelatedEntities})\r
- GROUP BY p.event_id";\r
- $dao = CRM_Core_DAO::executeQuery($query);\r
- $participantDetails = array();\r
- while($dao->fetch()) {\r
- $participantDetails['countByID'][$dao->event_id] = $dao->participant_count;\r
- $participantDetails['countByName'][$dao->event_id][$dao->event_data] = $dao->participant_count;\r
- }\r
- }\r
- }\r
- return $participantDetails;\r
- }\r
-\r
- /**\r
- * This function checks if there was any registraion for related event ids,\r
- * and returns array of ids with no regsitrations\r
- * @param type $eventID
- * Event ID .
- * @return type\r
- */\r
- public static function checkRegistrationForEvents($eventID) {\r
- $eventIdsWithNoRegistration = array();\r
- if ($eventID) {\r
- $getRelatedEntities = CRM_Core_BAO_RecurringEntity::getEntitiesFor($eventID, 'civicrm_event', TRUE);\r
- $participantDetails = CRM_Event_Form_ManageEvent_Repeat::getParticipantCountforEvent($getRelatedEntities);\r
- //Check if participants exists for events\r
- foreach ($getRelatedEntities as $key => $value) {\r
- if (!CRM_Utils_Array::value($value['id'], $participantDetails['countByID']) && $value['id'] != $eventID) {\r
- //CRM_Event_BAO_Event::del($value['id']);\r
- $eventIdsWithNoRegistration[] = $value['id'];\r
- }\r
- }\r
- }\r
- CRM_Core_BAO_RecurringEntity::$_entitiesToBeDeleted = $eventIdsWithNoRegistration;\r
- return CRM_Core_BAO_RecurringEntity::$_entitiesToBeDeleted;\r
- }\r
-}\r
+ *
+ * @static
+ *
+ * @return array
+ */
+ static public function getParticipantCountforEvent($listOfRelatedEntities = array()) {
+ if (!empty($listOfRelatedEntities)) {
+ $implodeRelatedEntities = implode(',', array_map(function($entity) {
+ return $entity['id'];
+ }, $listOfRelatedEntities));
+ if ($implodeRelatedEntities) {
+ $query = "SELECT p.event_id as event_id,
+ concat_ws(' ', e.title, concat_ws(' - ', DATE_FORMAT(e.start_date, '%b %d %Y %h:%i %p'), DATE_FORMAT(e.end_date, '%b %d %Y %h:%i %p'))) as event_data,
+ count(p.id) as participant_count
+ FROM civicrm_participant p, civicrm_event e
+ WHERE p.event_id = e.id AND p.event_id IN ({$implodeRelatedEntities})
+ GROUP BY p.event_id";
+ $dao = CRM_Core_DAO::executeQuery($query);
+ $participantDetails = array();
+ while($dao->fetch()) {
+ $participantDetails['countByID'][$dao->event_id] = $dao->participant_count;
+ $participantDetails['countByName'][$dao->event_id][$dao->event_data] = $dao->participant_count;
+ }
+ }
+ }
+ return $participantDetails;
+ }
+
+ /**
+ * This function checks if there was any registraion for related event ids,
+ * and returns array of ids with no regsitrations
+ * @param string or int or object... $eventID
+ */
+ public static function checkRegistrationForEvents($eventID) {
+ $eventIdsWithNoRegistration = array();
+ if ($eventID) {
+ $getRelatedEntities = CRM_Core_BAO_RecurringEntity::getEntitiesFor($eventID, 'civicrm_event', TRUE);
+ $participantDetails = CRM_Event_Form_ManageEvent_Repeat::getParticipantCountforEvent($getRelatedEntities);
+ //Check if participants exists for events
+ foreach ($getRelatedEntities as $key => $value) {
+ if (!CRM_Utils_Array::value($value['id'], $participantDetails['countByID']) && $value['id'] != $eventID) {
+ //CRM_Event_BAO_Event::del($value['id']);
+ $eventIdsWithNoRegistration[] = $value['id'];
+ }
+ }
+ }
+ CRM_Core_BAO_RecurringEntity::$_entitiesToBeDeleted = $eventIdsWithNoRegistration;
+ return CRM_Core_BAO_RecurringEntity::$_entitiesToBeDeleted;
+ }
+}
}
$this->assign('rows', $reminderList);
- $this->assign('setTab' , $setTab);
- $this->assign('component' , 'event');
+ $this->assign('setTab', $setTab);
+ $this->assign('component', 'event');
// Update tab "disabled" css class
$this->ajaxResponse['tabValid'] = is_array($reminderList) && (count($reminderList) > 0);
$form->assign_by_ref('tabHeader', $tabs);
CRM_Core_Resources::singleton()
->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js', 1, 'html-header')
- ->addSetting(array('tabSettings' => array(
+ ->addSetting(array(
+ 'tabSettings' => array(
'active' => self::getCurrentTab($tabs),
)));
CRM_Event_Form_ManageEvent::addProfileEditScripts();
$tabs['pcp'] = array('title' => ts('Personal Campaigns')) + $default;
$tabs['repeat'] = array('title' => ts('Repeat')) + $default;
-
// check if we're in shopping cart mode for events
$enableCart = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME,
'enable_cart'
$this->_single = TRUE;
$this->assign('urlPath', 'civicrm/contact/view/participant');
if (!$this->_id && !$this->_contactId) {
- $breadCrumbs = array(array('title' => ts('CiviEvent Dashboard'),
+ $breadCrumbs = array(array(
+ 'title' => ts('CiviEvent Dashboard'),
'url' => CRM_Utils_System::url('civicrm/event', 'reset=1'),
));
TRUE
)) - 1;
if ($additionalParticipant) {
- $deleteParticipants = array(1 => ts('Delete this participant record along with associated participant record(s).'),
+ $deleteParticipants = array(
+ 1 => ts('Delete this participant record along with associated participant record(s).'),
2 => ts('Delete only this participant record.'),
);
$this->addRadio('delete_participant', NULL, $deleteParticipants, NULL, '<br />');
return;
}
-
if ($this->_single && $this->_context == 'standalone') {
$this->addEntityRef('contact_id', ts('Contact'), array('create' => TRUE, 'api' => array('extra' => array('email'))), TRUE);
}
}
if(!$this->_single && !empty($event_id)) {
$duplicateContacts = 0;
- while(list($k,$dupeCheckContactId) = each($this->_contactIds)) {
+ 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;
}
}
-
$participantStatus = CRM_Event_PseudoConstant::participantStatus();
// set the contact, when contact is selected
if (!empty($params['contact_id'])) {
if (isset($participantCount)) {
$this->assign('pricesetFieldsCount', $participantCount);
}
- $this->assign('lineItem', empty($lineItem[0]) || $this->_quickConfig? FALSE : $lineItem);
+ $this->assign('lineItem', empty($lineItem[0]) || $this->_quickConfig ? FALSE : $lineItem);
}
else {
$this->assign('amount_level', $params['amount_level']);
$contributionParams['total_amount'] = CRM_Utils_Array::value('total_amount', $params);
}
-
// Retrieve the name and email of the current user - this will be the FROM for the receipt email
$session = CRM_Core_Session::singleton();
$userID = $session->get('userID');
}
//do cleanup line items if participant edit the Event Fee.
- if (($this->_lineItem || !isset($params['proceSetId'])) && !$this->_paymentId && $this->_id) {
+ if (($this->_lineItem || !isset($params['proceSetId'])) && !$this->_paymentId && $this->_id) {
CRM_Price_BAO_LineItem::deleteLineItems($this->_id, 'civicrm_participant');
}
}
//CRM-15372 patch to fix fee amount replacing amount
- $this->_params['fee_amount'] = $this->_params['amount'];
+ $this->_params['fee_amount'] = $this->_params['amount'];
$participants[] = CRM_Event_Form_Registration::addParticipant($this, $contactID);
$feeLevel = $this->_params['amount_priceset_level_radio'];
}
else {
- $feeLevel[] = $this->_params['fee_level'] ;
+ $feeLevel[] = $this->_params['fee_level'];
}
CRM_Event_BAO_Participant::createDiscountTrxn($this->_eventId, $contributionParams, $feeLevel);
}
if ($this->_isPaidEvent) {
// fix amount for each of participants ( for bulk mode )
$eventAmount = array();
- $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings');
+ $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
$invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
$totalTaxAmount = 0;
$prefixValue = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
$invoicing = CRM_Utils_Array::value('invoicing', $prefixValue);
if (count($taxAmt) > 0 && (isset($invoicing) && isset($prefixValue['is_email_pdf']))) {
- $sendTemplateParams['isEmailPdf'] = True;
+ $sendTemplateParams['isEmailPdf'] = TRUE;
$sendTemplateParams['contributionId'] = $contributionId;
}
list($mailSent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams);
public function buildQuickForm() {
$statuses = CRM_Event_PseudoConstant::participantStatus();
- $this->assign('partiallyPaid', array_search('Partially paid', $statuses));
- $this->assign('pendingRefund', array_search('Pending refund', $statuses));
+ $this->assign('partiallyPaid', array_search('Partially paid', $statuses));
+ $this->assign('pendingRefund', array_search('Pending refund', $statuses));
$this->assign('participantStatus', $this->_participantStatus);
$config = CRM_Core_Config::singleton();
- $this->assign('currencySymbol', $config->defaultCurrencySymbol);
+ $this->assign('currencySymbol', $config->defaultCurrencySymbol);
// line items block
$lineItem = $event = array();
$values[$participantID]['note'] = array_values($noteValue);
-
// Get Line Items
$lineItem = CRM_Price_BAO_LineItem::getLineItems($participantID);
$displayName = CRM_Contact_BAO_Contact::displayName($values[$participantID]['contact_id']);
$participantCount = array();
- $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings');
+ $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
$invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
$totalTaxAmount = 0;
foreach ($lineItem as $k => $v) {
if (!empty($this->_values['discount'])) {
$discountId = CRM_Core_BAO_Discount::findSet($this->_eventId, 'civicrm_event');
if ($discountId && !empty($this->_values['event']['default_discount_fee_id'])) {
- $discountKey = CRM_Core_DAO::getFieldValue("CRM_Core_DAO_OptionValue", $this->_values['event']['default_discount_fee_id']
- , 'weight', 'id'
+ $discountKey = CRM_Core_DAO::getFieldValue("CRM_Core_DAO_OptionValue", $this->_values['event']['default_discount_fee_id'], 'weight', 'id'
);
$defaults['amount'] = key(array_slice($this->_values['discount'][$discountId], $discountKey - 1, $discountKey, TRUE));
}
$this->assign('statusMessage', $statusMessage);
$buttons = array(
- array('type' => 'back',
+ array(
+ 'type' => 'back',
'name' => ts('<< Go Back'),
'spacing' => '  ',
),
//CRM-4320
if ($allowToProceed) {
$buttons = array_merge($buttons, array(
- array('type' => 'next',
+ array(
+ 'type' => 'next',
'name' => ts('Continue >>'),
'spacing' => ' ',
'isDefault' => TRUE,
);
if ($includeSkipButton) {
$buttons = array_merge($buttons, array(
- array('type' => 'next',
+ array(
+ 'type' => 'next',
'name' => ts('Skip Participant >>|'),
'subName' => 'skip',
),
$existingEmails = array();
$additionalParticipantEmails = array();
if (is_array($value)) {
- foreach ($value as $key => $val) {
- if (substr($key, 0, 6) == 'email-' && $val) {
- $existingEmails[] = $val;
+ foreach ($value as $key => $val) {
+ if (substr($key, 0, 6) == 'email-' && $val) {
+ $existingEmails[] = $val;
+ }
}
}
- }
foreach ($fields as $key => $val) {
if (substr($key, 0, 6) == 'email-' && $val) {
$additionalParticipantEmails[] = $val;
else {
// check with first_name and last_name for additional participants
if (!empty($value['first_name']) && ($value['first_name'] == CRM_Utils_Array::value('first_name', $fields)) &&
- (CRM_Utils_Array::value('last_name',$value) == CRM_Utils_Array::value('last_name', $fields))
+ (CRM_Utils_Array::value('last_name', $value) == CRM_Utils_Array::value('last_name', $fields))
) {
$errors['first_name'] = ts('The first name and last name must be unique for each participant.');
break;
}
}
-
if ($button != 'skip' &&
$self->_values['event']['is_monetary'] &&
!isset($errors['_qf_default']) &&
if ($rfp || CRM_Utils_Array::value('additional_participants', $this->_params[0], FALSE)) {
$payment = CRM_Core_Payment::singleton($this->_mode, $this->_paymentProcessor, $this);
$paymentObjError = ts('The system did not record payment details for this payment and so could not process the transaction. Please report this error to the site administrator.');
- if (is_object($payment))
+ if (is_object($payment)) {
$expressParams = $payment->getExpressCheckoutDetails($this->get('token'));
- else
+ }
+ else {
CRM_Core_Error::fatal($paymentObjError);
+ }
$params['payer'] = CRM_Utils_Array::value('payer', $expressParams);
$params['payer_id'] = $expressParams['payer_id'];
}
}
- $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings');
+ $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
$taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings);
$invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
if ($invoicing) {
$eventFull = CRM_Event_BAO_Participant::eventFull($self->_eventId, FALSE, CRM_Utils_Array::value('has_waitlist', $self->_values['event']));
if ($eventFull && empty($self->_allowConfirmation)) {
if (empty($self->_allowWaitlist)) {
- CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/event/register', "reset=1&id={$self->_eventId}",FALSE, NULL, FALSE, TRUE));
+ CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/event/register', "reset=1&id={$self->_eventId}", FALSE, NULL, FALSE, TRUE));
}
}
$self->_feeBlock = $self->_values['fee'];
if (!empty($errors)) {
$soldOutOptions = implode("<br>", $priceSetErrors['soldOutOptions']);
- CRM_Core_Session::setStatus(ts('You have been returned to the start of the registration process and any sold out events have been removed from your selections. You will not be able to continue until you review your booking and select different events if you wish. The following events were sold out:') , ts('Unfortunately some of your options have now sold out for one or more participants.') , 'error');
- CRM_Core_Session::setStatus(ts("{$soldOutOptions}") , ts('Sold out:') , 'error');
+ CRM_Core_Session::setStatus(ts('You have been returned to the start of the registration process and any sold out events have been removed from your selections. You will not be able to continue until you review your booking and select different events if you wish. The following events were sold out:'), ts('Unfortunately some of your options have now sold out for one or more participants.'), 'error');
+ CRM_Core_Session::setStatus(ts("{$soldOutOptions}"), ts('Sold out:'), 'error');
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/event/register', "_qf_Register_display=true&qfKey=" . $fields['qfKey']));
}
return empty($errors) ? TRUE : $errors;
}
}
elseif ($this->_contributeMode == 'express' && !empty($value['is_primary'])) {
- if (is_object($payment))
+ if (is_object($payment)) {
$result = $payment->doExpressCheckout($value);
- else
+ }
+ else {
CRM_Core_Error::fatal($paymentObjError);
+ }
}
elseif (!empty($value['is_primary'])) {
CRM_Core_Payment_Form::mapParams($this->_bltID, $value, $value, TRUE);
}
$entityTable = 'civicrm_participant';
- $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings');
+ $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
$invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
$totalTaxAmount = 0;
$dataArray = array();
unset($copyParticipantCount[$participantNum]);
}
}
- if ($participantNum === NULL)
- break;
+ if ($participantNum === NULL) {
+ break;
+ }
//carry the participant submitted values.
$this->_values['params'][$participantID] = $params[$participantNum];
$contribParams = array(
'contact_id' => $contactID,
- 'financial_type_id' => !empty($form->_values['event']['financial_type_id']) ?
- $form->_values['event']['financial_type_id'] : $params['financial_type_id'],
+ 'financial_type_id' => !empty($form->_values['event']['financial_type_id']) ? $form->_values['event']['financial_type_id'] : $params['financial_type_id'],
'receive_date' => $now,
'total_amount' => $params['amount'],
'tax_amount' => $params['tax_amount'],
$count = 1;
foreach ($participantParams as $participantNum => $participantValue) {
if ($participantNum) {
- $prefix1 = 'additional';
- $prefix2 = 'additional_';
+ $prefix1 = 'additional';
+ $prefix2 = 'additional_';
} else {
- $prefix1 = '';
- $prefix2 = '';
+ $prefix1 = '';
+ $prefix2 = '';
}
if ($participantValue != 'skip') {
//get the customPre profile info
if (!empty($form->_values[$prefix2 . 'custom_pre_id'])) {
$values = $groupName = array();
CRM_Event_BAO_Event::displayProfile($participantValue,
- $form->_values[ $prefix2 . 'custom_pre_id'],
+ $form->_values[$prefix2 . 'custom_pre_id'],
$groupName,
$values,
$profileFields
}
if (!empty($formattedValues) ) {
$form->assign('primaryParticipantProfile', $formattedValues[1]);
- $form->set('primaryParticipantProfile', $formattedValues[1]);
+ $form->set('primaryParticipantProfile', $formattedValues[1]);
if ($count > 2) {
unset($formattedValues[1]);
$form->assign('addParticipantProfile', $formattedValues);
- $form->set('addParticipantProfile', $formattedValues);
+ $form->set('addParticipantProfile', $formattedValues);
}
}
}
CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Pending'")
)) {
-
//need to confirm that though participant confirming
//registration - but is there enough space to confirm.
$emptySeats = CRM_Event_BAO_Participant::pendingToConfirmSpaces($this->_eventId);
1 => $values['title'])) . '</div><div><br />' . ts('Click the "Confirm Registration" button to begin, or click "Cancel Registration" if you are no longer interested in attending this event.') . '</div>';
}
$buttons = array_merge($buttons, array(
- array('type' => 'next',
+ array(
+ 'type' => 'next',
'name' => ts('Confirm Registration'),
'spacing' => ' ',
'isDefault' => TRUE,
)) {
$cancelConfirm = ts('Are you sure you want to cancel your registration for this event?');
$buttons = array_merge($buttons, array(
- array('type' => 'submit',
+ array(
+ 'type' => 'submit',
'name' => ts('Cancel Registration'),
'spacing' => ' ',
'js' => array('onclick' => 'return confirm(\'' . $cancelConfirm . '\');'),
DIRECTORY_SEPARATOR,
$className
) . '.php';
- $error = include_once ($classFile);
+ $error = include_once $classFile;
if ($error == FALSE) {
CRM_Core_Error::fatal('Participant listing code file: ' . $classFile . ' does not exist. Please verify your custom particpant listing settings in CiviCRM administrative panel.');
}
static $headers = NULL;
if (!$headers) {
$headers = array();
- $headers[1] = array('name' => ts('Name'),
+ $headers[1] = array(
+ 'name' => ts('Name'),
'sort' => 'civicrm_contact.sort_name',
'direction' => CRM_Utils_Sort::ASCENDING,
);
- $headers[2] = array('name' => ts('Status'),
+ $headers[2] = array(
+ 'name' => ts('Status'),
'sort' => 'civicrm_participant.status_id',
'direction' => CRM_Utils_Sort::DONTCARE,
);
- $headers[3] = array('name' => ts('Register Date'),
+ $headers[3] = array(
+ 'name' => ts('Register Date'),
'sort' => 'civicrm_participant.register_date',
'direction' => CRM_Utils_Sort::DONTCARE,
);
static $headers = NULL;
if (!$headers) {
$headers = array();
- $headers[1] = array('name' => ts('Name'),
+ $headers[1] = array(
+ 'name' => ts('Name'),
'sort' => 'civicrm_contact.sort_name',
'direction' => CRM_Utils_Sort::ASCENDING,
);
if ($this->_participantListingType == 'Name and Email') {
- $headers[2] = array('name' => ts('Email'),
+ $headers[2] = array(
+ 'name' => ts('Email'),
'sort' => 'civicrm_email.email',
'direction' => CRM_Utils_Sort::DONTCARE,
);
* @param bool|string $name pseudoconstant to be flushed
*/
public static function flush($name = 'cache') {
- if (isset(self::$$name)) {
+ if (isset(self::$$name)) {
self::$$name = NULL;
- }
+ }
}
/**
@access public
*/
function __construct(&$queryParams,
- $action = CRM_Core_Action::NONE,
+ $action = CRM_Core_Action::NONE,
$eventClause = NULL,
- $single = FALSE,
- $limit = NULL,
- $context = 'search',
+ $single = FALSE,
+ $limit = NULL,
+ $context = 'search',
$compContext = NULL
) {
// submitted form values
$extraParams .= "&key={$qfKey}";
}
-
if (!(self::$_links)) {
self::$_links = array(
CRM_Core_Action::VIEW => array(
$result->participant_id
);
-
- $row['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ?
- $result->contact_sub_type : $result->contact_type, FALSE, $result->contact_id
+ $row['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ? $result->contact_sub_type : $result->contact_type, FALSE, $result->contact_id
);
$row['paid'] = CRM_Event_BAO_Event::isMonetary($row['event_id']);
public function &getColumnHeaders($action = NULL, $output = NULL) {
if (!isset(self::$_columnHeaders)) {
self::$_columnHeaders = array(
- array('name' => ts('Event'),
+ array(
+ 'name' => ts('Event'),
'sort' => 'event_title',
'direction' => CRM_Utils_Sort::DONTCARE,
),
*/
public static function &tasks() {
if (!(self::$_tasks)) {
- self::$_tasks = array(1 => array(
+ self::$_tasks = array(
+ 1 => array(
'title' => ts('Delete Participants'),
'class' => 'CRM_Event_Form_Task_Delete',
'result' => FALSE,
}
//CRM-12920 - check for edit permission
if( !CRM_Core_Permission::check('edit event participants') ){
- unset(self::$_tasks[4],self::$_tasks[5],self::$_tasks[15]);
+ unset(self::$_tasks[4], self::$_tasks[5], self::$_tasks[15]);
}
}