From 0479b4c8095005abb475f17c243d9ea4613db58c Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 6 Jan 2015 13:10:53 -0800 Subject: [PATCH] INFRA-132 - CRM/Event - phpcbf --- CRM/Event/BAO/Event.php | 73 +-- CRM/Event/BAO/Participant.php | 32 +- CRM/Event/BAO/ParticipantPayment.php | 2 +- CRM/Event/BAO/Query.php | 3 +- CRM/Event/Badge.php | 3 +- CRM/Event/Badge/Logo.php | 15 +- CRM/Event/Badge/Logo5395.php | 15 +- CRM/Event/Badge/NameTent.php | 15 +- CRM/Event/Cart/BAO/Cart.php | 5 +- CRM/Event/Cart/BAO/EventInCart.php | 14 +- CRM/Event/Cart/BAO/MerParticipant.php | 2 +- CRM/Event/Cart/Controller/Checkout.php | 1 - CRM/Event/Cart/Form/Cart.php | 3 +- CRM/Event/Cart/Form/Checkout/Payment.php | 3 +- CRM/Event/Cart/Page/AddToCart.php | 4 +- CRM/Event/Controller/Search.php | 1 - CRM/Event/Form/EventFees.php | 10 +- CRM/Event/Form/ManageEvent.php | 6 +- CRM/Event/Form/ManageEvent/Conference.php | 2 +- CRM/Event/Form/ManageEvent/Fee.php | 43 +- CRM/Event/Form/ManageEvent/Location.php | 3 +- CRM/Event/Form/ManageEvent/Registration.php | 40 +- CRM/Event/Form/ManageEvent/Repeat.php | 430 +++++++++--------- .../Form/ManageEvent/ScheduleReminders.php | 4 +- CRM/Event/Form/ManageEvent/TabHeader.php | 4 +- CRM/Event/Form/Participant.php | 23 +- CRM/Event/Form/ParticipantFeeSelection.php | 6 +- CRM/Event/Form/ParticipantView.php | 3 +- .../Registration/AdditionalParticipant.php | 23 +- CRM/Event/Form/Registration/Confirm.php | 44 +- .../Form/Registration/ParticipantConfirm.php | 7 +- CRM/Event/Page/ParticipantListing.php | 2 +- .../ParticipantListing/NameStatusAndDate.php | 9 +- CRM/Event/Page/ParticipantListing/Simple.php | 6 +- CRM/Event/PseudoConstant.php | 4 +- CRM/Event/Selector/Search.php | 16 +- CRM/Event/Task.php | 5 +- 37 files changed, 466 insertions(+), 415 deletions(-) diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index 513838596a..b21113f0cb 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -198,7 +198,8 @@ class CRM_Event_BAO_Event extends CRM_Event_DAO_Event { 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'), ); @@ -268,8 +269,8 @@ class CRM_Event_BAO_Event extends CRM_Event_DAO_Event { * @static */ static function getEvents($all = 0, - $id = FALSE, - $isActive = TRUE, + $id = FALSE, + $isActive = TRUE, $checkPermission = TRUE ) { $query = " @@ -554,7 +555,8 @@ $event_summary_limit $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, @@ -584,13 +586,13 @@ $event_summary_limit * 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. * * @@ -598,9 +600,9 @@ $event_summary_limit */ 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. @@ -713,13 +715,13 @@ WHERE civicrm_address.geo_code_1 IS NOT NULL * * @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 @@ -820,7 +822,6 @@ WHERE civicrm_event.is_active = 1 } $query .= " ORDER BY civicrm_event.start_date ASC"; - $params = array(1 => array($optionGroupId, 'Integer')); $dao = CRM_Core_DAO::executeQuery($query, $params); $all = array(); @@ -925,7 +926,7 @@ WHERE civicrm_event.is_active = 1 // 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; } @@ -1081,10 +1082,10 @@ WHERE civicrm_event.is_active = 1 } 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, @@ -1092,19 +1093,19 @@ WHERE civicrm_event.is_active = 1 $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); @@ -1188,7 +1189,7 @@ WHERE civicrm_event.is_active = 1 // 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 ) { @@ -1231,7 +1232,7 @@ WHERE civicrm_event.is_active = 1 $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); @@ -1626,11 +1627,11 @@ WHERE id = $cfID ) { $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 @@ -1711,8 +1712,8 @@ WHERE id = $cfID */ static function buildCustomProfile($participantId, $values, - $contactId = NULL, - $isTest = FALSE, + $contactId = NULL, + $isTest = FALSE, $isIdsArray = FALSE, $skipCancel = TRUE ) { @@ -2060,7 +2061,8 @@ WHERE ce.loc_block_id = $locBlockId"; $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); @@ -2114,7 +2116,7 @@ LEFT JOIN civicrm_price_field_value value ON ( value.id = lineItem.price_field {$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'))); } /** @@ -2197,7 +2199,8 @@ LEFT JOIN civicrm_price_field_value value ON ( value.id = lineItem.price_field 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); } diff --git a/CRM/Event/BAO/Participant.php b/CRM/Event/BAO/Participant.php index 44af511657..2a1fcd0b56 100644 --- a/CRM/Event/BAO/Participant.php +++ b/CRM/Event/BAO/Participant.php @@ -674,7 +674,7 @@ GROUP BY participant.event_id )); $tmpContactField = $contactFields = array(); - $contactFields = array( ); + $contactFields = array(); if (!$onlyParticipant) { $contactFields = CRM_Contact_BAO_Contact::importableFields($contactType, NULL); @@ -741,27 +741,32 @@ GROUP BY participant.event_id $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', )); @@ -1098,7 +1103,8 @@ INNER JOIN civicrm_price_field_value value ON ( value.id = lineItem.price_field_ } } else { - foreach ($feeProperties as $property) $feeDetails[$feeInfo->id][$property] = $feeInfo->$property; + foreach ($feeProperties as $property) { $feeDetails[$feeInfo->id][$property] = $feeInfo->$property; + } } } @@ -1299,7 +1305,8 @@ UPDATE civicrm_participant 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(), ); @@ -1791,14 +1798,15 @@ WHERE civicrm_participant.contact_id = {$contactID} AND */ 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' ")); @@ -2030,8 +2038,8 @@ WHERE (li.entity_table = 'civicrm_participant' AND li.entity_id = {$participantI $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); diff --git a/CRM/Event/BAO/ParticipantPayment.php b/CRM/Event/BAO/ParticipantPayment.php index e92ce28871..8e8c59682d 100644 --- a/CRM/Event/BAO/ParticipantPayment.php +++ b/CRM/Event/BAO/ParticipantPayment.php @@ -58,7 +58,7 @@ class CRM_Event_BAO_ParticipantPayment extends CRM_Event_DAO_ParticipantPayment $participantPayment->copyValues($params); if (isset($ids['id'])) { $participantPayment->id = CRM_Utils_Array::value('id', $ids); - } + } else { $participantPayment->find(TRUE); } diff --git a/CRM/Event/BAO/Query.php b/CRM/Event/BAO/Query.php index a06a8b93b1..e1aef626e2 100644 --- a/CRM/Event/BAO/Query.php +++ b/CRM/Event/BAO/Query.php @@ -679,7 +679,8 @@ class CRM_Event_BAO_Query { * @param $row * @param int $id */ - public static function searchAction(&$row, $id) {} + public static function searchAction(&$row, $id) { + } /** * @param $tables diff --git a/CRM/Event/Badge.php b/CRM/Event/Badge.php index b0e6911686..e11044703c 100644 --- a/CRM/Event/Badge.php +++ b/CRM/Event/Badge.php @@ -167,7 +167,8 @@ class CRM_Event_Badge { $this->pdf->MultiCell($this->pdf->width, $this->pdf->lineHeight, $txt); } - public function pdfExtraFormat() {} + public function pdfExtraFormat() { + } /** * Create labels (pdf) diff --git a/CRM/Event/Badge/Logo.php b/CRM/Event/Badge/Logo.php index 0c119ff3ce..dbc170172f 100644 --- a/CRM/Event/Badge/Logo.php +++ b/CRM/Event/Badge/Logo.php @@ -15,9 +15,18 @@ class CRM_Event_Badge_Logo extends CRM_Event_Badge { $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; diff --git a/CRM/Event/Badge/Logo5395.php b/CRM/Event/Badge/Logo5395.php index ba6fe5b8bd..5f6ff40942 100644 --- a/CRM/Event/Badge/Logo5395.php +++ b/CRM/Event/Badge/Logo5395.php @@ -15,9 +15,18 @@ class CRM_Event_Badge_Logo5395 extends CRM_Event_Badge { $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; diff --git a/CRM/Event/Badge/NameTent.php b/CRM/Event/Badge/NameTent.php index a3c91bb748..a701ae9ece 100644 --- a/CRM/Event/Badge/NameTent.php +++ b/CRM/Event/Badge/NameTent.php @@ -51,9 +51,18 @@ class CRM_Event_Badge_NameTent extends CRM_Event_Badge { $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 (); } diff --git a/CRM/Event/Cart/BAO/Cart.php b/CRM/Event/Cart/BAO/Cart.php index 204ca1a285..c14cbaf4aa 100644 --- a/CRM/Event/Cart/BAO/Cart.php +++ b/CRM/Event/Cart/BAO/Cart.php @@ -5,9 +5,8 @@ */ 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 diff --git a/CRM/Event/Cart/BAO/EventInCart.php b/CRM/Event/Cart/BAO/EventInCart.php index c93ae2bd02..9b375887be 100644 --- a/CRM/Event/Cart/BAO/EventInCart.php +++ b/CRM/Event/Cart/BAO/EventInCart.php @@ -8,8 +8,7 @@ class CRM_Event_Cart_BAO_EventInCart extends CRM_Event_Cart_DAO_EventInCart impl public $event; public $event_cart; public $location = NULL; - public $participants = array( - ); + public $participants = array(); /** * @@ -50,7 +49,7 @@ class CRM_Event_Cart_BAO_EventInCart extends CRM_Event_Cart_DAO_EventInCart impl /** * @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) { @@ -254,12 +253,14 @@ class CRM_Event_Cart_BAO_EventInCart extends CRM_Event_Cart_DAO_EventInCart impl * @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 @@ -316,6 +317,7 @@ class CRM_Event_Cart_BAO_EventInCart extends CRM_Event_Cart_DAO_EventInCart impl 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; + } } } diff --git a/CRM/Event/Cart/BAO/MerParticipant.php b/CRM/Event/Cart/BAO/MerParticipant.php index b7693ab999..2731d858d8 100644 --- a/CRM/Event/Cart/BAO/MerParticipant.php +++ b/CRM/Event/Cart/BAO/MerParticipant.php @@ -39,7 +39,7 @@ class CRM_Event_Cart_BAO_MerParticipant extends CRM_Event_BAO_Participant { */ public function __construct($participant = NULL) { parent::__construct(); - $a = (array)$participant; + $a = (array) $participant; $this->copyValues($a); $this->email = CRM_Utils_Array::value('email', $participant); diff --git a/CRM/Event/Cart/Controller/Checkout.php b/CRM/Event/Cart/Controller/Checkout.php index cb69db8258..c860b4f93e 100644 --- a/CRM/Event/Cart/Controller/Checkout.php +++ b/CRM/Event/Cart/Controller/Checkout.php @@ -12,7 +12,6 @@ class CRM_Event_Cart_Controller_Checkout extends CRM_Core_Controller { 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(); diff --git a/CRM/Event/Cart/Form/Cart.php b/CRM/Event/Cart/Form/Cart.php index 28d884d297..58316bfef7 100644 --- a/CRM/Event/Cart/Form/Cart.php +++ b/CRM/Event/Cart/Form/Cart.php @@ -136,7 +136,8 @@ class CRM_Event_Cart_Form_Cart extends CRM_Core_Form { if (is_array($ids)) { return array_pop($ids); } - else return NULL; + else { return NULL; + } } /** diff --git a/CRM/Event/Cart/Form/Checkout/Payment.php b/CRM/Event/Cart/Form/Checkout/Payment.php index da7abff601..ce39419576 100644 --- a/CRM/Event/Cart/Form/Checkout/Payment.php +++ b/CRM/Event/Cart/Form/Checkout/Payment.php @@ -338,8 +338,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { '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, diff --git a/CRM/Event/Cart/Page/AddToCart.php b/CRM/Event/Cart/Page/AddToCart.php index 0ec31cdbf4..327029bf7f 100644 --- a/CRM/Event/Cart/Page/AddToCart.php +++ b/CRM/Event/Cart/Page/AddToCart.php @@ -15,8 +15,8 @@ class CRM_Event_Cart_Page_AddToCart extends CRM_Core_Page { $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("%1 has been added to your cart. View your cart.", array(1 => $event_in_cart->event->title,2 => $url))); + $url = CRM_Utils_System::url('civicrm/event/view_cart'); + CRM_Utils_System::setUFMessage(ts("%1 has been added to your cart. View your cart.", array(1 => $event_in_cart->event->title, 2 => $url))); $transaction->commit(); diff --git a/CRM/Event/Controller/Search.php b/CRM/Event/Controller/Search.php index da641fe2ca..a97e56f6f6 100644 --- a/CRM/Event/Controller/Search.php +++ b/CRM/Event/Controller/Search.php @@ -58,7 +58,6 @@ class CRM_Event_Controller_Search extends CRM_Core_Controller { // create and instantiate the pages $this->addPages($this->_stateMachine, $action); - $session = CRM_Core_Session::singleton(); $uploadNames = $session->get('uploadNames'); if (!empty($uploadNames)) { diff --git a/CRM/Event/Form/EventFees.php b/CRM/Event/Form/EventFees.php index 6b116153fd..f0cf91d1ed 100644 --- a/CRM/Event/Form/EventFees.php +++ b/CRM/Event/Form/EventFees.php @@ -152,7 +152,6 @@ class CRM_Event_Form_EventFees { // $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; @@ -179,10 +178,9 @@ class CRM_Event_Form_EventFees { 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), @@ -235,8 +233,8 @@ class CRM_Event_Form_EventFees { 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); } @@ -373,7 +371,7 @@ SELECT id, html_type 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))) { diff --git a/CRM/Event/Form/ManageEvent.php b/CRM/Event/Form/ManageEvent.php index 05764d8d80..76dbf160c1 100644 --- a/CRM/Event/Form/ManageEvent.php +++ b/CRM/Event/Form/ManageEvent.php @@ -206,14 +206,16 @@ class CRM_Event_Form_ManageEvent extends CRM_Core_Form { $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, )); } diff --git a/CRM/Event/Form/ManageEvent/Conference.php b/CRM/Event/Form/ManageEvent/Conference.php index 05721ceb65..ad967dbea7 100644 --- a/CRM/Event/Form/ManageEvent/Conference.php +++ b/CRM/Event/Form/ManageEvent/Conference.php @@ -85,7 +85,7 @@ class CRM_Event_Form_ManageEvent_Conference extends CRM_Event_Form_ManageEvent { 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), diff --git a/CRM/Event/Form/ManageEvent/Fee.php b/CRM/Event/Form/ManageEvent/Fee.php index 76797422dc..871e6c8719 100644 --- a/CRM/Event/Form/ManageEvent/Fee.php +++ b/CRM/Event/Form/ManageEvent/Fee.php @@ -100,7 +100,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { $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) { @@ -149,7 +149,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { $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']; } @@ -445,10 +445,11 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { } } - 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 @@ -585,7 +586,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { // 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'); } } @@ -597,7 +598,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { 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 { @@ -609,7 +610,8 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { 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, @@ -630,7 +632,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { $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; @@ -664,15 +666,16 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { $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 @@ -700,7 +703,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { 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) { @@ -714,7 +717,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { $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; @@ -724,8 +727,8 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { $priceSetID = $priceSet->id; } else { - $priceSetID = $discountPriceSets[$j-1]; - $setParams = array ( + $priceSetID = $discountPriceSets[$j - 1]; + $setParams = array( 'title' => $params['discount_name'][$j], 'id' => $priceSetID, ); @@ -733,7 +736,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { $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'); } @@ -784,7 +787,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { 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; @@ -793,7 +796,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { //update 'is_billing_required' if (empty($params['is_pay_later'])) { - $params['is_billing_required'] = False; + $params['is_billing_required'] = FALSE; } //update events table diff --git a/CRM/Event/Form/ManageEvent/Location.php b/CRM/Event/Form/ManageEvent/Location.php index bf06870257..077715e18e 100644 --- a/CRM/Event/Form/ManageEvent/Location.php +++ b/CRM/Event/Form/ManageEvent/Location.php @@ -197,7 +197,8 @@ class CRM_Event_Form_ManageEvent_Location extends CRM_Event_Form_ManageEvent { $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'), ); diff --git a/CRM/Event/Form/ManageEvent/Registration.php b/CRM/Event/Form/ManageEvent/Registration.php index 765e813c82..707c2d5f65 100644 --- a/CRM/Event/Form/ManageEvent/Registration.php +++ b/CRM/Event/Form/ManageEvent/Registration.php @@ -322,14 +322,14 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent */ 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); @@ -338,8 +338,8 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent $form->addProfileSelector( 'custom_pre_id', ts('Include Profile') . '
' . ts('(top of page)'), $allowCoreTypes, $allowSubTypes, $profileEntities, TRUE); $form->addProfileSelector( 'custom_post_id', ts('Include Profile') . '
' . ts('(bottom of page)'), $allowCoreTypes, $allowSubTypes, $profileEntities, TRUE); - $form->addProfileSelector( 'additional_custom_pre_id', ts('Profile for Additional Participants') . '
' . ts('(top of page)'), $allowCoreTypes, $allowSubTypes, $profileEntities, TRUE); - $form->addProfileSelector( 'additional_custom_post_id', ts('Profile for Additional Participants') . '
' . ts('(bottom of page)'), $allowCoreTypes, $allowSubTypes, $profileEntities, TRUE); + $form->addProfileSelector( 'additional_custom_pre_id', ts('Profile for Additional Participants') . '
' . ts('(top of page)'), $allowCoreTypes, $allowSubTypes, $profileEntities, TRUE); + $form->addProfileSelector( 'additional_custom_post_id', ts('Profile for Additional Participants') . '
' . ts('(bottom of page)'), $allowCoreTypes, $allowSubTypes, $profileEntities, TRUE); } /** @@ -356,11 +356,11 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent * @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 .= '
'.ts('(bottom of page)'); - $form->addProfileSelector( $element, $label, $allowCoreTypes, $allowSubTypes, $profileEntities, TRUE); + $form->addProfileSelector( $element, $label, $allowCoreTypes, $allowSubTypes, $profileEntities, TRUE); } /** @@ -378,7 +378,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent $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'); @@ -389,7 +389,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent $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; } /** @@ -401,7 +401,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent */ 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); @@ -415,7 +415,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent $footerAttribs = array( 'rows' => 2, 'cols' => 40, - 'click_wysiwyg' => true, + 'click_wysiwyg' => TRUE, ); $form->addWysiwyg('confirm_footer_text', ts('Footer Text'), $footerAttribs); } @@ -446,7 +446,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent */ 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 @@ -454,7 +454,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent $footerAttribs = array( 'rows' => 2, 'cols' => 40, - 'click_wysiwyg' => true, + 'click_wysiwyg' => TRUE, ); $form->addWysiwyg('thankyou_footer_text', ts('Footer Text'), $footerAttribs); } @@ -747,7 +747,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent $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); @@ -764,7 +764,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent // 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) { @@ -783,17 +783,18 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent // 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 @@ -856,7 +857,6 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent 'entity_id' => $this->_id, ); - // first delete all past entries CRM_Core_BAO_UFJoin::deleteAll($ufJoinParams); @@ -968,7 +968,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent 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)) { @@ -976,6 +976,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent $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."); @@ -991,6 +992,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent $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'; diff --git a/CRM/Event/Form/ManageEvent/Repeat.php b/CRM/Event/Form/ManageEvent/Repeat.php index d943e4b896..18add1a8e7 100644 --- a/CRM/Event/Form/ManageEvent/Repeat.php +++ b/CRM/Event/Form/ManageEvent/Repeat.php @@ -1,218 +1,216 @@ -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 - * +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 . - * - * @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 type $eventID - * Event ID . - * @return type - */ - 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; - } -} + * + * @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; + } +} diff --git a/CRM/Event/Form/ManageEvent/ScheduleReminders.php b/CRM/Event/Form/ManageEvent/ScheduleReminders.php index 2f3f07d656..c8ada7f0a6 100644 --- a/CRM/Event/Form/ManageEvent/ScheduleReminders.php +++ b/CRM/Event/Form/ManageEvent/ScheduleReminders.php @@ -82,8 +82,8 @@ class CRM_Event_Form_ManageEvent_ScheduleReminders extends CRM_Event_Form_Manage } $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); diff --git a/CRM/Event/Form/ManageEvent/TabHeader.php b/CRM/Event/Form/ManageEvent/TabHeader.php index fea18c8998..edd9177eea 100644 --- a/CRM/Event/Form/ManageEvent/TabHeader.php +++ b/CRM/Event/Form/ManageEvent/TabHeader.php @@ -52,7 +52,8 @@ class CRM_Event_Form_ManageEvent_TabHeader { $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(); @@ -91,7 +92,6 @@ class CRM_Event_Form_ManageEvent_TabHeader { $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' diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index 3cc7039ee8..de8c5d5d82 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -286,7 +286,8 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment $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'), )); @@ -612,7 +613,8 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment 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, '
'); @@ -636,7 +638,6 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment return; } - if ($this->_single && $this->_context == 'standalone') { $this->addEntityRef('contact_id', ts('Contact'), array('create' => TRUE, 'api' => array('extra' => array('email'))), TRUE); } @@ -896,7 +897,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment } 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; @@ -925,7 +926,6 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment } } - $participantStatus = CRM_Event_PseudoConstant::participantStatus(); // set the contact, when contact is selected if (!empty($params['contact_id'])) { @@ -1023,7 +1023,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment 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']); @@ -1045,7 +1045,6 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment $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'); @@ -1156,7 +1155,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment } //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'); } @@ -1232,7 +1231,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment } //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); @@ -1405,7 +1404,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment $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); } @@ -1608,7 +1607,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment 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; @@ -1677,7 +1676,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment $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); diff --git a/CRM/Event/Form/ParticipantFeeSelection.php b/CRM/Event/Form/ParticipantFeeSelection.php index 7e4498c81b..a80d8f7d32 100644 --- a/CRM/Event/Form/ParticipantFeeSelection.php +++ b/CRM/Event/Form/ParticipantFeeSelection.php @@ -154,12 +154,12 @@ class CRM_Event_Form_ParticipantFeeSelection extends CRM_Core_Form { 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(); diff --git a/CRM/Event/Form/ParticipantView.php b/CRM/Event/Form/ParticipantView.php index 51acae3eda..ba3aba2b75 100644 --- a/CRM/Event/Form/ParticipantView.php +++ b/CRM/Event/Form/ParticipantView.php @@ -96,7 +96,6 @@ class CRM_Event_Form_ParticipantView extends CRM_Core_Form { $values[$participantID]['note'] = array_values($noteValue); - // Get Line Items $lineItem = CRM_Price_BAO_LineItem::getLineItems($participantID); @@ -178,7 +177,7 @@ class CRM_Event_Form_ParticipantView extends CRM_Core_Form { $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) { diff --git a/CRM/Event/Form/Registration/AdditionalParticipant.php b/CRM/Event/Form/Registration/AdditionalParticipant.php index b085e00e3c..92198dfa2d 100644 --- a/CRM/Event/Form/Registration/AdditionalParticipant.php +++ b/CRM/Event/Form/Registration/AdditionalParticipant.php @@ -101,8 +101,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R 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)); } @@ -329,7 +328,8 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R $this->assign('statusMessage', $statusMessage); $buttons = array( - array('type' => 'back', + array( + 'type' => 'back', 'name' => ts('<< Go Back'), 'spacing' => '    ', ), @@ -338,7 +338,8 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R //CRM-4320 if ($allowToProceed) { $buttons = array_merge($buttons, array( - array('type' => 'next', + array( + 'type' => 'next', 'name' => ts('Continue >>'), 'spacing' => '                  ', 'isDefault' => TRUE, @@ -348,7 +349,8 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R ); if ($includeSkipButton) { $buttons = array_merge($buttons, array( - array('type' => 'next', + array( + 'type' => 'next', 'name' => ts('Skip Participant >>|'), 'subName' => 'skip', ), @@ -412,12 +414,12 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R $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; @@ -433,7 +435,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R 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; @@ -493,7 +495,6 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R } } - if ($button != 'skip' && $self->_values['event']['is_monetary'] && !isset($errors['_qf_default']) && diff --git a/CRM/Event/Form/Registration/Confirm.php b/CRM/Event/Form/Registration/Confirm.php index e0e922de3e..b288f681ab 100644 --- a/CRM/Event/Form/Registration/Confirm.php +++ b/CRM/Event/Form/Registration/Confirm.php @@ -92,10 +92,12 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { 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']; @@ -273,7 +275,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { } } - $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) { @@ -394,7 +396,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { $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']; @@ -408,8 +410,8 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { if (!empty($errors)) { $soldOutOptions = implode("
", $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; @@ -578,10 +580,12 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { } } 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); @@ -715,7 +719,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { } $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(); @@ -878,8 +882,9 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { unset($copyParticipantCount[$participantNum]); } } - if ($participantNum === NULL) - break; + if ($participantNum === NULL) { + break; + } //carry the participant submitted values. $this->_values['params'][$participantID] = $params[$participantNum]; @@ -968,8 +973,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { $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'], @@ -1213,18 +1217,18 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { $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 @@ -1268,11 +1272,11 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { } 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); } } } diff --git a/CRM/Event/Form/Registration/ParticipantConfirm.php b/CRM/Event/Form/Registration/ParticipantConfirm.php index 50188c6015..6d3ca4c6a3 100644 --- a/CRM/Event/Form/Registration/ParticipantConfirm.php +++ b/CRM/Event/Form/Registration/ParticipantConfirm.php @@ -109,7 +109,6 @@ class CRM_Event_Form_Registration_ParticipantConfirm extends CRM_Event_Form_Regi 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); @@ -128,7 +127,8 @@ class CRM_Event_Form_Registration_ParticipantConfirm extends CRM_Event_Form_Regi 1 => $values['title'])) . '

' . ts('Click the "Confirm Registration" button to begin, or click "Cancel Registration" if you are no longer interested in attending this event.') . '
'; } $buttons = array_merge($buttons, array( - array('type' => 'next', + array( + 'type' => 'next', 'name' => ts('Confirm Registration'), 'spacing' => '         ', 'isDefault' => TRUE, @@ -142,7 +142,8 @@ class CRM_Event_Form_Registration_ParticipantConfirm extends CRM_Event_Form_Regi )) { $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 . '\');'), diff --git a/CRM/Event/Page/ParticipantListing.php b/CRM/Event/Page/ParticipantListing.php index 080222f3f3..eca8e14d2b 100644 --- a/CRM/Event/Page/ParticipantListing.php +++ b/CRM/Event/Page/ParticipantListing.php @@ -85,7 +85,7 @@ class CRM_Event_Page_ParticipantListing extends CRM_Core_Page { 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.'); } diff --git a/CRM/Event/Page/ParticipantListing/NameStatusAndDate.php b/CRM/Event/Page/ParticipantListing/NameStatusAndDate.php index 44c9620518..c9d124268e 100644 --- a/CRM/Event/Page/ParticipantListing/NameStatusAndDate.php +++ b/CRM/Event/Page/ParticipantListing/NameStatusAndDate.php @@ -155,15 +155,18 @@ SELECT count( civicrm_contact.id ) 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, ); diff --git a/CRM/Event/Page/ParticipantListing/Simple.php b/CRM/Event/Page/ParticipantListing/Simple.php index 04c83ac348..63cd3b8d89 100644 --- a/CRM/Event/Page/ParticipantListing/Simple.php +++ b/CRM/Event/Page/ParticipantListing/Simple.php @@ -143,12 +143,14 @@ SELECT count( civicrm_contact.id ) 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, ); diff --git a/CRM/Event/PseudoConstant.php b/CRM/Event/PseudoConstant.php index 90b79fcbcc..fda9f63e8c 100644 --- a/CRM/Event/PseudoConstant.php +++ b/CRM/Event/PseudoConstant.php @@ -293,9 +293,9 @@ class CRM_Event_PseudoConstant extends CRM_Core_PseudoConstant { * @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; - } + } } /** diff --git a/CRM/Event/Selector/Search.php b/CRM/Event/Selector/Search.php index 9adad8e768..4988f5b534 100644 --- a/CRM/Event/Selector/Search.php +++ b/CRM/Event/Selector/Search.php @@ -162,11 +162,11 @@ class CRM_Event_Selector_Search extends CRM_Core_Selector_Base implements CRM_Co @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 @@ -230,7 +230,6 @@ class CRM_Event_Selector_Search extends CRM_Core_Selector_Base implements CRM_Co $extraParams .= "&key={$qfKey}"; } - if (!(self::$_links)) { self::$_links = array( CRM_Core_Action::VIEW => array( @@ -399,9 +398,7 @@ class CRM_Event_Selector_Search extends CRM_Core_Selector_Base implements CRM_Co $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']); @@ -453,7 +450,8 @@ class CRM_Event_Selector_Search extends CRM_Core_Selector_Base implements CRM_Co 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, ), diff --git a/CRM/Event/Task.php b/CRM/Event/Task.php index 4793f8944d..c704ca3a8e 100644 --- a/CRM/Event/Task.php +++ b/CRM/Event/Task.php @@ -70,7 +70,8 @@ class CRM_Event_Task { */ 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, @@ -139,7 +140,7 @@ class CRM_Event_Task { } //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]); } } -- 2.25.1