diff --git a/civicrm.php b/civicrm.php index 383df682e31110fa6c78a7d6c21172c3177a0281..cc90caade642276181b8a9a42e706c4ecb6d083c 100644 --- a/civicrm.php +++ b/civicrm.php @@ -87,16 +87,29 @@ if (!defined( 'CIVICRM_PLUGIN_DIR')) { define( 'CIVICRM_PLUGIN_DIR', plugin_dir_path(CIVICRM_PLUGIN_FILE) ); } -// Test where the settings file exists, if in the 4.6 and prior location use that as CIVICRM_SETTINGS_PATH, otherwise set the new location as CIVICRM_SETTINGS_PATH +/** + * The constant CIVICRM_SETTINGS_PATH is also defined in civicrm.config.php and + * may already have been defined there - e.g. by cron or external scripts. + */ +if ( !defined( 'CIVICRM_SETTINGS_PATH' ) ) { + + /** + * Test where the settings file exists. + * + * If the settings file is found in the 4.6 and prior location, use that as + * CIVICRM_SETTINGS_PATH, otherwise use the new location. + */ $upload_dir = wp_upload_dir(); $wp_civi_settings = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . 'civicrm' . DIRECTORY_SEPARATOR . 'civicrm.settings.php' ; $wp_civi_settings_deprectated = CIVICRM_PLUGIN_DIR . 'civicrm.settings.php'; -if (file_exists($wp_civi_settings_deprectated)) { - define( 'CIVICRM_SETTINGS_PATH', $wp_civi_settings_deprectated ); -} -else { - define( 'CIVICRM_SETTINGS_PATH', $wp_civi_settings ); + if (file_exists($wp_civi_settings_deprectated)) { + define( 'CIVICRM_SETTINGS_PATH', $wp_civi_settings_deprectated ); + } + else { + define( 'CIVICRM_SETTINGS_PATH', $wp_civi_settings ); + } + } // test if Civi is installed diff --git a/civicrm/CRM/Activity/BAO/Activity.php b/civicrm/CRM/Activity/BAO/Activity.php index f5a5a0ac46b849a5e850e4071dd0d4b8f9379f03..2faca0e791e96d9d534abb2b789b56cf7d200640 100644 --- a/civicrm/CRM/Activity/BAO/Activity.php +++ b/civicrm/CRM/Activity/BAO/Activity.php @@ -2173,11 +2173,13 @@ AND cl.modified_id = c.id 'title' => ts('Activity Type'), 'name' => 'activity_type', 'type' => CRM_Utils_Type::T_STRING, + 'searchByLabel' => TRUE, ), 'activity_status' => array( 'title' => ts('Activity Status'), 'name' => 'activity_status', 'type' => CRM_Utils_Type::T_STRING, + 'searchByLabel' => TRUE, ), ); $fields = array_merge($Activityfields, $exportableFields); @@ -2604,7 +2606,7 @@ INNER JOIN civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n ); if ($values['is_recurring_activity']) { - $contactActivities[$activityId]['is_recurring_activity'] = CRM_Core_BAO_RecurringEntity::getPositionAndCount($values['activity_id'], 'civicrm_activity'); + $activity['is_recurring_activity'] = CRM_Core_BAO_RecurringEntity::getPositionAndCount($values['activity_id'], 'civicrm_activity'); } array_push($contactActivities, $activity); diff --git a/civicrm/CRM/Activity/BAO/Query.php b/civicrm/CRM/Activity/BAO/Query.php index 2f241f9a48f3611c7326d3a2be4d07aa63667fcc..20677e49770a7fd1186e3b3a594bf17251bfdd16 100644 --- a/civicrm/CRM/Activity/BAO/Query.php +++ b/civicrm/CRM/Activity/BAO/Query.php @@ -415,6 +415,9 @@ class CRM_Activity_BAO_Query { ); CRM_Core_Form_Date::buildDateRange($form, 'activity_date', 1, '_low', '_high', ts('From'), FALSE, FALSE); + $form->addElement('hidden', 'activity_date_range_error'); + $form->addFormRule(array('CRM_Activity_BAO_Query', 'formRule'), $form); + $followUpActivity = array( 1 => ts('Yes'), 2 => ts('No'), @@ -555,4 +558,25 @@ class CRM_Activity_BAO_Query { return $properties; } + /** + * Custom form rules. + * + * @param array $fields + * @param array $files + * @param CRM_Core_Form $form + * + * @return bool|array + */ + public static function formRule($fields, $files, $form) { + $errors = array(); + + if (empty($fields['activity_date_low']) || empty($fields['activity_date_high'])) { + return TRUE; + } + + CRM_Utils_Rule::validDateRange($fields, 'activity_date', $errors, ts('Activity Date')); + + return empty($errors) ? TRUE : $errors; + } + } diff --git a/civicrm/CRM/Admin/Form/PaymentProcessor.php b/civicrm/CRM/Admin/Form/PaymentProcessor.php index c14991c9f8f188facfd69d63f153a7607a93273c..d392c4337f319964304d51853711b7e777792147 100644 --- a/civicrm/CRM/Admin/Form/PaymentProcessor.php +++ b/civicrm/CRM/Admin/Form/PaymentProcessor.php @@ -378,6 +378,11 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form { * @param bool $test */ public function updatePaymentProcessor(&$values, $domainID, $test) { + if ($test) { + foreach (array('user_name', 'password', 'signature') as $field) { + $values[$field] = empty($values["test_{$field}"]) ? CRM_Utils_Array::value($field, $values) : $values["test_{$field}"]; + } + } $params = array_merge(array( 'id' => $test ? $this->_testID : $this->_id, 'domain_id' => $domainID, diff --git a/civicrm/CRM/Admin/Form/ScheduleReminders.php b/civicrm/CRM/Admin/Form/ScheduleReminders.php index 61fca0e171b18d80a4e827ac9cceeab4cff4ffc9..89c62408027c15e1b14299aa9f3e505f6fe560ca 100644 --- a/civicrm/CRM/Admin/Form/ScheduleReminders.php +++ b/civicrm/CRM/Admin/Form/ScheduleReminders.php @@ -667,6 +667,7 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form { $tokens = array_merge(CRM_Core_SelectValues::activityTokens(), $tokens); $tokens = array_merge(CRM_Core_SelectValues::eventTokens(), $tokens); $tokens = array_merge(CRM_Core_SelectValues::membershipTokens(), $tokens); + $tokens = array_merge(CRM_Core_SelectValues::contributionTokens(), $tokens); return $tokens; } diff --git a/civicrm/CRM/Campaign/Form/Petition.php b/civicrm/CRM/Campaign/Form/Petition.php index 6931a7917fb10d2b607b4f4693769ba6ed16dd37..44fbbe2f3158671729e40b4263be3b386d33c8b5 100644 --- a/civicrm/CRM/Campaign/Form/Petition.php +++ b/civicrm/CRM/Campaign/Form/Petition.php @@ -66,8 +66,11 @@ class CRM_Campaign_Form_Petition extends CRM_Core_Form { // when custom data is included in this page if (!empty($_POST['hidden_custom'])) { - CRM_Custom_Form_CustomData::preProcess($this); + $this->set('type', 'Event'); + $this->set('entityId', $this->_surveyId); + CRM_Custom_Form_CustomData::preProcess($this, NULL, NULL, 1, 'Survey', $this->_surveyId); CRM_Custom_Form_CustomData::buildQuickForm($this); + CRM_Custom_Form_CustomData::setDefaultValues($this); } $session = CRM_Core_Session::singleton(); @@ -318,6 +321,12 @@ WHERE $whereClause $params['is_active'] = CRM_Utils_Array::value('is_active', $params, 0); $params['is_default'] = CRM_Utils_Array::value('is_default', $params, 0); + $customFields = CRM_Core_BAO_CustomField::getFields('Survey'); + $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, + $this->_surveyId, + 'Survey' + ); + $surveyId = CRM_Campaign_BAO_Survey::create($params); // also update the ProfileModule tables diff --git a/civicrm/CRM/Campaign/Form/Survey.php b/civicrm/CRM/Campaign/Form/Survey.php index 7ebc9887f0d1b188b1da8cdb89d10f22902ff21a..2f7f2894e4a8c89c483c8309404fb159b0817476 100644 --- a/civicrm/CRM/Campaign/Form/Survey.php +++ b/civicrm/CRM/Campaign/Form/Survey.php @@ -78,6 +78,15 @@ class CRM_Campaign_Form_Survey extends CRM_Core_Form { $this->assign('action', $this->_action); $this->assign('surveyId', $this->_surveyId); + // when custom data is included in this page + if (!empty($_POST['hidden_custom'])) { + $this->set('type', 'Event'); + $this->set('entityId', $this->_surveyId); + CRM_Custom_Form_CustomData::preProcess($this, NULL, NULL, 1, 'Survey', $this->_surveyId); + CRM_Custom_Form_CustomData::buildQuickForm($this); + CRM_Custom_Form_CustomData::setDefaultValues($this); + } + // CRM-11480, CRM-11682 // Preload libraries required by the "Questions" tab CRM_UF_Page_ProfileEditor::registerProfileScripts(); diff --git a/civicrm/CRM/Case/BAO/Case.php b/civicrm/CRM/Case/BAO/Case.php index 63171a485db4489b11ad5b76dc6197653430fb5d..44b2557c752aac8ae4e11e3e0ff27166c6e98368 100644 --- a/civicrm/CRM/Case/BAO/Case.php +++ b/civicrm/CRM/Case/BAO/Case.php @@ -883,7 +883,7 @@ SELECT case_status.label AS case_status, status_id, civicrm_case_type.title AS c // CRM-5081 - formatting the dates to omit seconds. // Note the 00 in the date format string is needed otherwise later on it thinks scheduled ones are overdue. $select = " - SELECT COUNT(ca.id) AS ismultiple, + SELECT SQL_CALC_FOUND_ROWS COUNT(ca.id) AS ismultiple, ca.id AS id, ca.activity_type_id AS type, ca.activity_type_id AS activity_type_id, @@ -1015,6 +1015,7 @@ SELECT case_status.label AS case_status, status_id, civicrm_case_type.title AS c $queryParams = array(1 => array($caseID, 'Integer')); $dao = CRM_Core_DAO::executeQuery($query, $queryParams); + $caseCount = CRM_Core_DAO::singleValueQuery('SELECT FOUND_ROWS()'); $activityTypes = CRM_Case_PseudoConstant::caseActivityType(FALSE, TRUE); $activityStatuses = CRM_Core_PseudoConstant::activityStatus(); @@ -1074,10 +1075,8 @@ SELECT case_status.label AS case_status, status_id, civicrm_case_type.title AS c } $caseActivities = array(); - $caseCount = 0; while ($dao->fetch()) { - $caseCount++; $caseActivity = array(); $caseActivityId = $dao->id; diff --git a/civicrm/CRM/Case/BAO/Query.php b/civicrm/CRM/Case/BAO/Query.php index 503d6f01215bcfe22d3e4842724825b6fa47a37f..f55b737d8e497adfa81ec7b00c20c8bb6a39bf0c 100644 --- a/civicrm/CRM/Case/BAO/Query.php +++ b/civicrm/CRM/Case/BAO/Query.php @@ -688,6 +688,9 @@ case_relation_type.id = case_relationship.relationship_type_id )"; CRM_Core_Form_Date::buildDateRange($form, 'case_from', 1, '_start_date_low', '_start_date_high', ts('From'), FALSE); CRM_Core_Form_Date::buildDateRange($form, 'case_to', 1, '_end_date_low', '_end_date_high', ts('From'), FALSE); + $form->addElement('hidden', 'case_from_start_date_range_error'); + $form->addElement('hidden', 'case_to_end_date_range_error'); + $form->addFormRule(array('CRM_Case_BAO_Query', 'formRule'), $form); $form->assign('validCiviCase', TRUE); @@ -738,4 +741,26 @@ case_relation_type.id = case_relationship.relationship_type_id )"; public static function searchAction(&$row, $id) { } + /** + * Custom form rules. + * + * @param array $fields + * @param array $files + * @param CRM_Core_Form $form + * + * @return bool|array + */ + public static function formRule($fields, $files, $form) { + $errors = array(); + + if ((empty($fields['case_from_start_date_low']) || empty($fields['case_from_start_date_high'])) && (empty($fields['case_to_end_date_low']) || empty($fields['case_to_end_date_high']))) { + return TRUE; + } + + CRM_Utils_Rule::validDateRange($fields, 'case_from_start_date', $errors, ts('Case Start Date')); + CRM_Utils_Rule::validDateRange($fields, 'case_to_end_date', $errors, ts('Case End Date')); + + return empty($errors) ? TRUE : $errors; + } + } diff --git a/civicrm/CRM/Case/Form/Activity.php b/civicrm/CRM/Case/Form/Activity.php index 03feaa4f55031419ec145a769bc1be4d64e6937a..e58471ae02ea4ba2e1166dbe38097936db4e6aaa 100644 --- a/civicrm/CRM/Case/Form/Activity.php +++ b/civicrm/CRM/Case/Form/Activity.php @@ -413,6 +413,10 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity { // format activity custom data if (!empty($params['hidden_custom'])) { if ($this->_activityId) { + // retrieve and include the custom data of old Activity + $oldActivity = civicrm_api3('Activity', 'getsingle', array('id' => $this->_activityId)); + $params = array_merge($params, $oldActivity); + // unset custom fields-id from params since we want custom // fields to be saved for new activity. foreach ($params as $key => $value) { @@ -504,8 +508,8 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity { else { $newActParams['original_id'] = $activity->id; } - //is_current_revision will be set to 1 by default. + //is_current_revision will be set to 1 by default. // add attachments if any CRM_Core_BAO_File::formatAttachment($newActParams, $newActParams, diff --git a/civicrm/CRM/Contact/BAO/Group.php b/civicrm/CRM/Contact/BAO/Group.php index c0d1f629294600f9cafe2dc5d25d13c3c1fcd780..afa89e2b6e51a63975ee65c091d46abfa2566fa6 100644 --- a/civicrm/CRM/Contact/BAO/Group.php +++ b/civicrm/CRM/Contact/BAO/Group.php @@ -368,7 +368,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { } } else { - $params['group_type'] = ''; + $params['group_type'] = NULL; } $session = CRM_Core_Session::singleton(); @@ -752,7 +752,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { $group['DT_RowId'] = 'row_' . $value['id']; if (!$params['parentsOnly']) { foreach ($value['class'] as $id => $class) { - if ($class = 'crm-group-parent') { + if ($class == 'crm-group-parent') { unset($value['class'][$id]); } } diff --git a/civicrm/CRM/Contact/BAO/Query.php b/civicrm/CRM/Contact/BAO/Query.php index 7db2bafb4763cd1adef80a9835b23d401e76f2eb..f0ff34aeb6f5d924f8f08fd6550f052c1ec5b258 100644 --- a/civicrm/CRM/Contact/BAO/Query.php +++ b/civicrm/CRM/Contact/BAO/Query.php @@ -1507,6 +1507,8 @@ class CRM_Contact_BAO_Query { return $params; } + self::filterCountryFromValuesIfStateExists($formValues); + foreach ($formValues as $id => $values) { if (self::isAlreadyProcessedForQueryFormat($values)) { @@ -4456,6 +4458,29 @@ civicrm_relationship.is_permission_a_b = 0 return in_array($operator, CRM_Core_DAO::acceptedSQLOperators()); } + /** + * If the state and country are passed remove state. + * + * Country is implicit from the state, but including both results in + * a poor query as there is no combined index on state AND country. + * + * CRM-18125 + * + * @param array $formValues + */ + public static function filterCountryFromValuesIfStateExists(&$formValues) { + if (!empty($formValues['country']) && !empty($formValues['state_province'])) { + // The use of array map sanitises the data by ensuring we are dealing with integers. + $states = implode(', ', array_map('intval', $formValues['state_province'])); + $countryList = CRM_Core_DAO::singleValueQuery( + "SELECT GROUP_CONCAT(country_id) FROM civicrm_state_province WHERE id IN ($states)" + ); + if ($countryList == $formValues['country']) { + unset($formValues['country']); + } + } + } + /** * Create and query the db for an contact search. * @@ -5842,13 +5867,13 @@ AND displayRelType.is_active = 1 $pseudoOptions = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE); } elseif ($fieldName == 'country_id') { - $pseduoOptions = CRM_Core_PseudoConstant::country(); + $pseudoOptions = CRM_Core_PseudoConstant::country(); } elseif ($fieldName == 'county_id') { - $pseduoOptions = CRM_Core_PseudoConstant::county(); + $pseudoOptions = CRM_Core_PseudoConstant::county(); } elseif ($fieldName == 'world_region') { - $pseduoOptions = CRM_Core_PseudoConstant::worldRegion(); + $pseudoOptions = CRM_Core_PseudoConstant::worldRegion(); } elseif ($daoName == 'CRM_Event_DAO_Event' && $fieldName == 'id') { $pseudoOptions = CRM_Event_BAO_Event::getEvents(0, $fieldValue, TRUE, TRUE, TRUE); diff --git a/civicrm/CRM/Contact/Form/Edit/CommunicationPreferences.php b/civicrm/CRM/Contact/Form/Edit/CommunicationPreferences.php index ed3e4dbe8c272f19e24b6b5eec9b1d7238a76e55..03ba749b804688e66bc1e8a1eca8315db986f0a0 100644 --- a/civicrm/CRM/Contact/Form/Edit/CommunicationPreferences.php +++ b/civicrm/CRM/Contact/Form/Edit/CommunicationPreferences.php @@ -166,7 +166,7 @@ class CRM_Contact_Form_Edit_CommunicationPreferences { // CRM-17778 -- set preferred_mail_format to default if unset if (empty($defaults['preferred_mail_format'])) { - $defaults['preferred_mail_format'] = array_search('Both', CRM_Core_SelectValues::pmf()); + $defaults['preferred_mail_format'] = 'Both'; } //set default from greeting types CRM-4575, CRM-9739 diff --git a/civicrm/CRM/Contact/Form/Merge.php b/civicrm/CRM/Contact/Form/Merge.php index 3027767cc5c1727619068b0b0d5a0938db5df1b3..270275ab0bcd9ba0242e90e0135420fedf437ad2 100644 --- a/civicrm/CRM/Contact/Form/Merge.php +++ b/civicrm/CRM/Contact/Form/Merge.php @@ -321,20 +321,6 @@ class CRM_Contact_Form_Merge extends CRM_Core_Form { $message = '<ul><li>' . ts('%1 has been updated.', array(1 => $name)) . '</li><li>' . ts('Contact ID %1 has been deleted.', array(1 => $this->_oid)) . '</li></ul>'; CRM_Core_Session::setStatus($message, ts('Contacts Merged'), 'success'); - //create activity for merge - //To do: this should be refactored into BAO layer at some point. - $messageActivity = ts('Contact ID %1 has been merged and deleted.', array(1 => $this->_oid)); - $activityParams = array( - 'subject' => $messageActivity, - 'source_contact_id' => $session->get('userID'), - 'target_contact_id' => $this->_cid, - 'activity_type_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Contact Merged'), - 'status_id' => 'Completed', - 'priority_id' => 'Normal', - 'activity_date_time' => date('YmdHis'), - ); - civicrm_api3('activity', 'create', $activityParams); - $url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->_cid}"); if (!empty($formValues['_qf_Merge_submit'])) { $listParamsURL = "reset=1&action=update&rgid={$this->_rgid}"; diff --git a/civicrm/CRM/Contact/Form/Search/Advanced.php b/civicrm/CRM/Contact/Form/Search/Advanced.php index aca7d35e79cb7fc626241b41b9c3ca5a474f87b7..7c059e41c8091cdab7ac3195f760b7c709ea876b 100644 --- a/civicrm/CRM/Contact/Form/Search/Advanced.php +++ b/civicrm/CRM/Contact/Form/Search/Advanced.php @@ -381,11 +381,29 @@ class CRM_Contact_Form_Search_Advanced extends CRM_Contact_Form_Search { if (!is_array($defaults)) { $defaults = array(); } - + $this->loadDefaultCountryBasedOnState($defaults); if ($this->_ssID && empty($_POST)) { $defaults = array_merge($defaults, CRM_Contact_BAO_SavedSearch::getFormValues($this->_ssID)); } return $defaults; } + /** + * Set the default country for the form. + * + * For performance reasons country might be removed from the form CRM-18125 + * but we need to include it in our defaults or the state will not be visible. + * + * @param array $defaults + */ + public function loadDefaultCountryBasedOnState(&$defaults) { + if (!empty($defaults['state_province'])) { + $defaults['country'] = CRM_Core_DAO::singleValueQuery( + "SELECT country_id FROM civicrm_state_province + WHERE id = %1", + array(1 => array($defaults['state_province'][0], 'Integer')) + ); + } + } + } diff --git a/civicrm/CRM/Contact/Form/Search/Builder.php b/civicrm/CRM/Contact/Form/Search/Builder.php index 5577b25610cb85b60e57342d9b1ccede76366ee1..9f4995cf767d69a9c287c5aa6f2a98491f34e1b6 100644 --- a/civicrm/CRM/Contact/Form/Search/Builder.php +++ b/civicrm/CRM/Contact/Form/Search/Builder.php @@ -94,10 +94,20 @@ class CRM_Contact_Form_Search_Builder extends CRM_Contact_Form_Search { // Get fields of type date // FIXME: This is a hack until our fields contain this meta-data $dateFields = array(); + $stringFields = array(); + $searchByLabelFields = array(); foreach ($fields as $name => $field) { if (strpos($name, '_date') || CRM_Utils_Array::value('data_type', $field) == 'Date') { $dateFields[] = $name; } + // it's necessary to know which of the fields are from string data type + if (isset($field['type']) && $field['type'] === CRM_Utils_Type::T_STRING) { + $stringFields[] = $name; + } + // it's necessary to know which of the fields are searchable by label + if (isset($field['searchByLabel']) && $field['searchByLabel']) { + $searchByLabelFields[] = $name; + } } // Add javascript CRM_Core_Resources::singleton() @@ -108,6 +118,10 @@ class CRM_Contact_Form_Search_Builder extends CRM_Contact_Form_Search { 'newBlock' => $this->get('newBlock'), 'dateFields' => $dateFields, 'fieldOptions' => self::fieldOptions(), + 'stringFields' => $stringFields, + 'searchByLabelFields' => $searchByLabelFields, + 'generalOperators' => array('' => ts('-operator-')) + CRM_Core_SelectValues::getSearchBuilderOperators(), + 'stringOperators' => array('' => ts('-operator-')) + CRM_Core_SelectValues::getSearchBuilderOperators(CRM_Utils_Type::T_STRING), ), )); //get the saved search mapping id diff --git a/civicrm/CRM/Contact/Form/Task/AddToHousehold.php b/civicrm/CRM/Contact/Form/Task/AddToHousehold.php index b6a1443b325c880f889aded63f1abaca7edf858f..95298009b372032fcdef10c397aabfb680a104fd 100644 --- a/civicrm/CRM/Contact/Form/Task/AddToHousehold.php +++ b/civicrm/CRM/Contact/Form/Task/AddToHousehold.php @@ -93,7 +93,7 @@ class CRM_Contact_Form_Task_AddToHousehold extends CRM_Contact_Form_Task_AddToPa $this->set('searchDone', 0); if (!empty($_POST['_qf_AddToHousehold_refresh'])) { - $searchParams['contact_type'] = array('Household' => 'Household'); + $searchParams['contact_type'] = 'Household'; $searchParams['rel_contact'] = $this->params['name']; $this->search($this, $searchParams); $this->set('searchDone', 1); diff --git a/civicrm/CRM/Contact/Form/Task/AddToOrganization.php b/civicrm/CRM/Contact/Form/Task/AddToOrganization.php index d1eb806a430b361807a4caa398de34113ded57a8..145d77323aea77e26626c87c2a4babc49027851a 100644 --- a/civicrm/CRM/Contact/Form/Task/AddToOrganization.php +++ b/civicrm/CRM/Contact/Form/Task/AddToOrganization.php @@ -101,7 +101,7 @@ class CRM_Contact_Form_Task_AddToOrganization extends CRM_Contact_Form_Task_AddT $this->set('searchDone', 0); if (!empty($_POST['_qf_AddToOrganization_refresh'])) { - $searchParams['contact_type'] = array('Organization' => 'Organization'); + $searchParams['contact_type'] = 'Organization'; $searchParams['rel_contact'] = $this->params['name']; $this->search($this, $searchParams); $this->set('searchDone', 1); diff --git a/civicrm/CRM/Contact/Page/View/Sunlight.php b/civicrm/CRM/Contact/Page/View/Sunlight.php deleted file mode 100644 index add1aa6afc3190fef375043526f87e1f36a46238..0000000000000000000000000000000000000000 --- a/civicrm/CRM/Contact/Page/View/Sunlight.php +++ /dev/null @@ -1,65 +0,0 @@ -<?php -/* - +--------------------------------------------------------------------+ - | CiviCRM version 4.7 | - +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2015 | - +--------------------------------------------------------------------+ - | This file is a part of CiviCRM. | - | | - | CiviCRM is free software; you can copy, modify, and distribute it | - | under the terms of the GNU Affero General Public License | - | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | - | | - | CiviCRM is distributed in the hope that it will be useful, but | - | WITHOUT ANY WARRANTY; without even the implied warranty of | - | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | - | See the GNU Affero General Public License for more details. | - | | - | You should have received a copy of the GNU Affero General Public | - | License and the CiviCRM Licensing Exception along | - | with this program; if not, contact CiviCRM LLC | - | at info[AT]civicrm[DOT]org. If you have questions about the | - | GNU Affero General Public License or the licensing of CiviCRM, | - | see the CiviCRM license FAQ at http://civicrm.org/licensing | - +--------------------------------------------------------------------+ - */ - -/** - * - * @package CRM - * @copyright CiviCRM LLC (c) 2004-2015 - */ -class CRM_Contact_Page_View_Sunlight extends CRM_Contact_Page_View { - - /** - * Called when action is browse. - */ - public function browse() { - // get the primary city, state and zip for the contact - $ids = array($this->_contactId); - $locations = CRM_Contact_BAO_Contact_Location::getMapInfo($ids); - - $rows = &CRM_Utils_Sunlight::getInfo($locations[0]['city'], - $locations[0]['state'], - $locations[0]['postal_code'] - ); - $this->assign('rowCount', count($rows)); - $this->assign_by_ref('rows', $rows); - } - - /** - * the main function that is called when the page loads, - * it decides the which action has to be taken for the page. - * - * @return null - */ - public function run() { - $this->preProcess(); - - $this->browse(); - - return parent::run(); - } - -} diff --git a/civicrm/CRM/Contribute/BAO/Contribution.php b/civicrm/CRM/Contribute/BAO/Contribution.php index f62cbc7cbb10b1f1e93015d47f7453691fddd387..365ca8f1e2b507ec3770259317518e6ead492f2a 100644 --- a/civicrm/CRM/Contribute/BAO/Contribution.php +++ b/civicrm/CRM/Contribute/BAO/Contribution.php @@ -3803,20 +3803,21 @@ WHERE eft.financial_trxn_id IN ({$trxnId}, {$baseTrxnId['financialTrxnId']}) } // add financial item entry $financialItemStatus = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialItem', 'status_id'); - $getLine['entity_id'] = $contributionDAO->id; - $getLine['entity_table'] = 'civicrm_contribution'; - $lineItemId = CRM_Price_BAO_LineItem::retrieve($getLine, CRM_Core_DAO::$_nullArray); - if (!empty($lineItemId->id)) { - $addFinancialEntry = array( - 'transaction_date' => $financialTrxn->trxn_date, - 'contact_id' => $contributionDAO->contact_id, - 'amount' => $financialTrxn->total_amount, - 'status_id' => array_search('Paid', $financialItemStatus), - 'entity_id' => $lineItemId->id, - 'entity_table' => 'civicrm_line_item', - ); - $trxnIds['id'] = $financialTrxn->id; - CRM_Financial_BAO_FinancialItem::create($addFinancialEntry, NULL, $trxnIds); + $lineItems = CRM_Price_BAO_LineItem::getLineItemsByContributionID($contributionDAO->id); + if (!empty($lineItems)) { + foreach ($lineItems as $lineItemId => $lineItemValue) { + $paid = $lineItemValue['line_total'] * ($financialTrxn->total_amount / $contributionDAO->total_amount); + $addFinancialEntry = array( + 'transaction_date' => $financialTrxn->trxn_date, + 'contact_id' => $contributionDAO->contact_id, + 'amount' => round($paid, 2), + 'status_id' => array_search('Paid', $financialItemStatus), + 'entity_id' => $lineItemId, + 'entity_table' => 'civicrm_line_item', + ); + $trxnIds['id'] = $financialTrxn->id; + CRM_Financial_BAO_FinancialItem::create($addFinancialEntry, NULL, $trxnIds); + } } if ($participantId) { // update participant status @@ -4400,10 +4401,6 @@ WHERE eft.financial_trxn_id IN ({$trxnId}, {$baseTrxnId['financialTrxnId']}) $values['is_email_receipt'] = $recurContrib->is_email_receipt; } - if (!empty($values['is_email_receipt'])) { - $contributionParams['receipt_date'] = $changeDate; - } - if (!empty($memberships)) { foreach ($memberships as $membershipTypeIdKey => $membership) { if ($membership) { @@ -4620,6 +4617,10 @@ LIMIT 1;"; $values['receipt_from_name'] = CRM_Utils_Array::value('receipt_from_name', $input, $userName); } } + // Contribution ID should really always be set. But ? + if (!$returnMessageText && (!isset($input['receipt_update']) || $input['receipt_update'])) { + civicrm_api3('Contribution', 'create', array('receipt_date' => 'now', 'id' => $contribution->id)); + } return $contribution->composeMessageArray($input, $ids, $values, $recur, $returnMessageText); } @@ -4785,10 +4786,10 @@ LIMIT 1;"; */ public static function addPayments($lineItems, $contributions) { // get financial trxn which is a payment - $ftSql = "SELECT ft.id + $ftSql = "SELECT ft.id, ft.total_amount FROM civicrm_financial_trxn ft INNER JOIN civicrm_entity_financial_trxn eft ON eft.financial_trxn_id = ft.id AND eft.entity_table = 'civicrm_contribution' - WHERE eft.entity_id = %1 AND ft.is_payment = 1"; + WHERE eft.entity_id = %1 AND ft.is_payment = 1 ORDER BY ft.id DESC LIMIT 1"; $sql = "SELECT fi.id, li.price_field_value_id FROM civicrm_financial_item fi INNER JOIN civicrm_line_item li ON li.id = fi.entity_id @@ -4798,7 +4799,11 @@ LIMIT 1;"; if ($contribution->contribution_status_id != CRM_Core_OptionGroup::getValue('contribution_status', 'Partially paid', 'name')) { continue; } - $ftId = CRM_Core_DAO::singleValueQuery($ftSql, array(1 => array($contribution->id, 'Integer'))); + $ftDao = CRM_Core_DAO::executeQuery($ftSql, array(1 => array($contribution->id, 'Integer'))); + $ftDao->fetch(); + $trxnAmount = $ftDao->total_amount; + $ftId = $ftDao->id; + // get financial item $dao = CRM_Core_DAO::executeQuery($sql, array(1 => array($contribution->id, 'Integer'))); while ($dao->fetch()) { @@ -4810,7 +4815,7 @@ LIMIT 1;"; 'financial_trxn_id' => $ftId, ); foreach ($lineItems as $key => $value) { - $paid = $value['line_total'] * ($contribution->net_amount / $contribution->total_amount); + $paid = $value['line_total'] * ($trxnAmount / $contribution->total_amount); // Record Entity Financial Trxn $params['amount'] = round($paid, 2); $params['entity_id'] = $ftIds[$value['price_field_value_id']]; diff --git a/civicrm/CRM/Contribute/BAO/ContributionRecur.php b/civicrm/CRM/Contribute/BAO/ContributionRecur.php index b139c9469b3bde2c0229a2da9f0d6a2b6a13270c..98b1a1d9f4e3c6bf6c698daac2ac4036c3b6fe1f 100644 --- a/civicrm/CRM/Contribute/BAO/ContributionRecur.php +++ b/civicrm/CRM/Contribute/BAO/ContributionRecur.php @@ -760,7 +760,7 @@ INNER JOIN civicrm_contribution con ON ( con.id = mp.contribution_id ) public static function recurringContribution(&$form) { // Recurring contribution fields foreach (self::getRecurringFields() as $key => $label) { - if ($key == 'contribution_recur_payment_made' && + if ($key == 'contribution_recur_payment_made' && !empty($form->_formValues) && !CRM_Utils_System::isNull(CRM_Utils_Array::value($key, $form->_formValues)) ) { $form->assign('contribution_recur_pane_open', TRUE); @@ -768,7 +768,7 @@ INNER JOIN civicrm_contribution con ON ( con.id = mp.contribution_id ) } CRM_Core_Form_Date::buildDateRange($form, $key, 1, '_low', '_high'); // If data has been entered for a recurring field, tell the tpl layer to open the pane - if (!empty($form->_formValues[$key . '_relative']) || !empty($form->_formValues[$key . '_low']) || !empty($form->_formValues[$key . '_high'])) { + if (!empty($form->_formValues) && !empty($form->_formValues[$key . '_relative']) || !empty($form->_formValues[$key . '_low']) || !empty($form->_formValues[$key . '_high'])) { $form->assign('contribution_recur_pane_open', TRUE); break; } diff --git a/civicrm/CRM/Contribute/BAO/ContributionSoft.php b/civicrm/CRM/Contribute/BAO/ContributionSoft.php index aecf78541a7646e5352a2ed3aa400c863817465a..bd7354d7fa51365b68592b48d7b3bbbd479fe51a 100644 --- a/civicrm/CRM/Contribute/BAO/ContributionSoft.php +++ b/civicrm/CRM/Contribute/BAO/ContributionSoft.php @@ -243,12 +243,15 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio * @return array */ public static function getSoftContributionTotals($contact_id, $isTest = 0) { - $query = ' + + $whereClause = "AND cc.cancel_date IS NULL"; + + $query = " SELECT SUM(amount) as amount, AVG(total_amount) as average, cc.currency FROM civicrm_contribution_soft ccs LEFT JOIN civicrm_contribution cc ON ccs.contribution_id = cc.id - WHERE cc.is_test = %2 AND ccs.contact_id = %1 - GROUP BY currency'; + WHERE cc.is_test = %2 AND ccs.contact_id = %1 {$whereClause} + GROUP BY currency"; $params = array( 1 => array($contact_id, 'Integer'), @@ -258,7 +261,7 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio $cs = CRM_Core_DAO::executeQuery($query, $params); $count = 0; - $amount = $average = array(); + $amount = $average = $cancelAmount = array(); while ($cs->fetch()) { if ($cs->amount > 0) { @@ -269,11 +272,23 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio } } + //to get cancel amount + $cancelAmountWhereClause = "AND cc.cancel_date IS NOT NULL"; + $query = str_replace($whereClause, $cancelAmountWhereClause, $query); + $cancelAmountSQL = CRM_Core_DAO::executeQuery($query, $params); + while ($cancelAmountSQL->fetch()) { + if ($cancelAmountSQL->amount > 0) { + $count++; + $cancelAmount[] = $cancelAmountSQL->amount; + } + } + if ($count > 0) { return array( implode(', ', $amount), implode(', ', $average), implode(', ', $currency), + implode(', ', $cancelAmount), ); } return array(0, 0); diff --git a/civicrm/CRM/Contribute/BAO/Premium.php b/civicrm/CRM/Contribute/BAO/Premium.php index 1d7449b4ca3af0ef2e09211bd0185848b8b0bfa5..eff02f0cd21c07f185269d5c3a033f7464100c1d 100644 --- a/civicrm/CRM/Contribute/BAO/Premium.php +++ b/civicrm/CRM/Contribute/BAO/Premium.php @@ -34,6 +34,7 @@ class CRM_Contribute_BAO_Premium extends CRM_Contribute_DAO_Premium { /** * Product information. + * * @var array */ private static $productInfo; @@ -53,7 +54,7 @@ class CRM_Contribute_BAO_Premium extends CRM_Contribute_DAO_Premium { * @param array $defaults * (reference ) an assoc array to hold the flattened values. * - * @return CRM_Contribute_BAO_ManagePremium + * @return CRM_Contribute_DAO_Product */ public static function retrieve(&$params, &$defaults) { $premium = new CRM_Contribute_DAO_Product(); @@ -84,12 +85,8 @@ class CRM_Contribute_BAO_Premium extends CRM_Contribute_DAO_Premium { * Delete financial Types. * * @param int $premiumID - * */ public static function del($premiumID) { - //check dependencies - - //delete from financial Type table $premium = new CRM_Contribute_DAO_Premium(); $premium->id = $premiumID; $premium->delete(); @@ -102,8 +99,7 @@ class CRM_Contribute_BAO_Premium extends CRM_Contribute_DAO_Premium { * @param int $pageID * @param bool $formItems * @param int $selectedProductID - * @param null $selectedOption - * + * @param string $selectedOption */ public static function buildPremiumBlock(&$form, $pageID, $formItems = FALSE, $selectedProductID = NULL, $selectedOption = NULL) { $form->add('hidden', "selectProduct", $selectedProductID, array('id' => 'selectProduct')); @@ -175,7 +171,6 @@ class CRM_Contribute_BAO_Premium extends CRM_Contribute_DAO_Premium { * @param CRM_Core_Form $form * @param int $productID * @param int $premiumProductID - * */ public function buildPremiumPreviewBlock($form, $productID, $premiumProductID = NULL) { if ($premiumProductID) { @@ -213,7 +208,6 @@ class CRM_Contribute_BAO_Premium extends CRM_Contribute_DAO_Premium { * Delete premium associated w/ contribution page. * * @param int $contributionPageID - * */ public static function deletePremium($contributionPageID) { if (!$contributionPageID) { diff --git a/civicrm/CRM/Contribute/BAO/Query.php b/civicrm/CRM/Contribute/BAO/Query.php index e86b91fabd40800571658d101a73399dd3cd7623..157b0b9f6ded4f847afa00067dd72b8a0adb20ea 100644 --- a/civicrm/CRM/Contribute/BAO/Query.php +++ b/civicrm/CRM/Contribute/BAO/Query.php @@ -51,7 +51,7 @@ class CRM_Contribute_BAO_Query { * @return array * Associative array of contribution fields */ - public static function &getFields($checkPermission = TRUE) { + public static function getFields($checkPermission = TRUE) { if (!self::$_contributionFields) { self::$_contributionFields = array(); @@ -864,7 +864,7 @@ class CRM_Contribute_BAO_Query { * kills a small kitten so add carefully. */ public static function selectorReturnProperties() { - return array( + $properties = array( 'contact_type' => 1, 'contact_sub_type' => 1, 'sort_name' => 1, @@ -887,6 +887,11 @@ class CRM_Contribute_BAO_Query { 'contribution_product_id' => 1, 'product_name' => 1, ); + if (self::isSoftCreditOptionEnabled()) { + $properties = array_merge($properties, self::softCreditReturnProperties()); + } + + return $properties; } /** @@ -1014,6 +1019,10 @@ class CRM_Contribute_BAO_Query { $form->addElement('text', 'contribution_source', ts('Contribution Source'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution', 'source')); CRM_Core_Form_Date::buildDateRange($form, 'contribution_date', 1, '_low', '_high', ts('From:'), FALSE); + // CRM-17602 + // This hidden element added for displaying Date Range error correctly. Definitely a dirty hack, but... it works. + $form->addElement('hidden', 'contribution_date_range_error'); + $form->addFormRule(array('CRM_Contribute_BAO_Query', 'formRule'), $form); $form->add('text', 'contribution_amount_low', ts('From'), array('size' => 8, 'maxlength' => 8)); $form->addRule('contribution_amount_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money'); @@ -1192,4 +1201,25 @@ class CRM_Contribute_BAO_Query { return TRUE; } + /** + * Custom form rules. + * + * @param array $fields + * @param array $files + * @param CRM_Core_Form $form + * + * @return bool|array + */ + public static function formRule($fields, $files, $form) { + $errors = array(); + + if (empty($fields['contribution_date_high']) || empty($fields['contribution_date_low'])) { + return TRUE; + } + + CRM_Utils_Rule::validDateRange($fields, 'contribution_date', $errors, ts('Date Received')); + + return empty($errors) ? TRUE : $errors; + } + } diff --git a/civicrm/CRM/Contribute/Form/AdditionalPayment.php b/civicrm/CRM/Contribute/Form/AdditionalPayment.php index 2e02e3701f7764e7aa534098f616d77904d3da2c..0077c7912871144a3abd9ee175f5a283e2086f34 100644 --- a/civicrm/CRM/Contribute/Form/AdditionalPayment.php +++ b/civicrm/CRM/Contribute/Form/AdditionalPayment.php @@ -382,7 +382,15 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract $this->processCreditCard($submittedValues); } else { + $defaults = array(); $result = CRM_Contribute_BAO_Contribution::recordAdditionalPayment($this->_contributionId, $submittedValues, $this->_paymentType, $participantId); + // Fetch the contribution & do proportional line item assignment + $params = array('id' => $this->_contributionId); + $contribution = CRM_Contribute_BAO_Contribution::retrieve($params, $defaults, $params); + $lineItems = CRM_Price_BAO_LineItem::getLineItemsByContributionID($this->_contributionId); + if (!empty($lineItems)) { + CRM_Contribute_BAO_Contribution::addPayments($lineItems, array($contribution)); + } // email sending if (!empty($result) && !empty($submittedValues['is_email_receipt'])) { diff --git a/civicrm/CRM/Contribute/Form/Contribution.php b/civicrm/CRM/Contribute/Form/Contribution.php index 4e286e39979ec54966928ee1c67d292fd927d20c..2c90c8159d0e7ae928933f1bcb36e52affacbde0 100644 --- a/civicrm/CRM/Contribute/Form/Contribution.php +++ b/civicrm/CRM/Contribute/Form/Contribution.php @@ -705,6 +705,11 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $name = CRM_Utils_Array::value($contributionStatus, $statusName); switch ($name) { case 'Completed': + // [CRM-17498] Removing unsupported status change options. + unset($status[CRM_Utils_Array::key('Pending', $statusName)]); + unset($status[CRM_Utils_Array::key('Failed', $statusName)]); + unset($status[CRM_Utils_Array::key('Partially paid', $statusName)]); + unset($status[CRM_Utils_Array::key('Pending refund', $statusName)]); case 'Cancelled': case 'Chargeback': case 'Refunded': diff --git a/civicrm/CRM/Contribute/Form/Contribution/Confirm.php b/civicrm/CRM/Contribute/Form/Contribution/Confirm.php index 5c733a583dff8d0c306de19bb64a32429d35929f..8a6db269bb304c5fc02c98f261d7cf373119ac47 100644 --- a/civicrm/CRM/Contribute/Form/Contribution/Confirm.php +++ b/civicrm/CRM/Contribute/Form/Contribution/Confirm.php @@ -1333,6 +1333,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $isPending = $this->getIsPending(); $this->assign('membership_name', CRM_Utils_Array::value('name', $membershipType)); + $this->_values['membership_name'] = CRM_Utils_Array::value('name', $membershipType); $isPaidMembership = FALSE; if ($this->_amount >= 0.0 && isset($membershipParams['amount'])) { @@ -1499,12 +1500,8 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr ); $form->set('renewal_mode', $renewalMode); if (!empty($dates)) { - $form->assign('mem_start_date', - CRM_Utils_Date::customFormat($dates['start_date'], '%Y%m%d') - ); - $form->assign('mem_end_date', - CRM_Utils_Date::customFormat($dates['end_date'], '%Y%m%d') - ); + $form->assign('mem_start_date', CRM_Utils_Date::customFormat($dates['start_date'], '%Y%m%d')); + $form->assign('mem_end_date', CRM_Utils_Date::customFormat($dates['end_date'], '%Y%m%d')); } if (!empty($membershipContribution)) { @@ -1562,7 +1559,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $form->_values['contribution_id'] = $membershipContributionID; } - if ($form->_paymentProcessor) { + if (empty($form->_params['is_pay_later']) && $form->_paymentProcessor) { // the is_monetary concept probably should be deprecated as it can be calculated from // the existence of 'amount' & seems fragile. if ($form->_values['is_monetary'] && $form->_amount > 0.0 && !$form->_params['is_pay_later']) { @@ -1580,19 +1577,23 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr // Do not send an email if Recurring transaction is done via Direct Mode // Email will we sent when the IPN is received. foreach ($paymentResults as $result) { - $this->completeTransaction($result['result'], $result['contribution_id']); + //CRM-18211: Fix situation where second contribution doesn't exist because it is optional. + if ($result['contribution_id']) { + $this->completeTransaction($result['result'], $result['contribution_id']); + } } return; } - $emailValues = $form->_values; + $emailValues = array_merge($membershipParams, $form->_values); + $emailValues['membership_assign'] = 1; // Finally send an email receipt for pay-later scenario (although it might sometimes be caught above!) if ($totalAmount == 0) { // This feels like a bizarre hack as the variable name doesn't seem to be directly connected to it's use in the template. $emailValues['useForMember'] = 0; - $emailValues['membership_assign'] = 1; $emailValues['amount'] = 0; } + CRM_Contribute_BAO_ContributionPage::sendMail($contactID, $emailValues, $isTest, FALSE, diff --git a/civicrm/CRM/Contribute/Form/Contribution/Main.php b/civicrm/CRM/Contribute/Form/Contribution/Main.php index 7dd7574d28dd835d6225f36d0d26fc05cca37ba8..73cb547540a7c3a1d9f315ec14eda4a8705d7bcf 100644 --- a/civicrm/CRM/Contribute/Form/Contribution/Main.php +++ b/civicrm/CRM/Contribute/Form/Contribution/Main.php @@ -1008,6 +1008,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $params['currencyID'] = CRM_Core_Config::singleton()->defaultCurrency; + $is_quick_config = 0; if (!empty($params['priceSetId'])) { $is_quick_config = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config'); if ($is_quick_config) { @@ -1024,14 +1025,15 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu case 'membership_amount': $this->_params['selectMembership'] = $params['selectMembership'] = CRM_Utils_Array::value('membership_type_id', $priceOptions[$selectedPriceOptionID]); $this->set('selectMembership', $params['selectMembership']); - if (CRM_Utils_Array::value('is_separate_payment', $this->_membershipBlock) == 0) { - $this->_values['amount'] = CRM_Utils_Array::value('amount', $priceOptions[$selectedPriceOptionID]); - } - break; case 'contribution_amount': $params['amount'] = $selectedPriceOptionID; - $this->_values['amount'] = CRM_Utils_Array::value('amount', $priceOptions[$selectedPriceOptionID]); + if ($priceField->name == 'contribution_amount' || + ($priceField->name == 'membership_amount' && + CRM_Utils_Array::value('is_separate_payment', $this->_membershipBlock) == 0) + ) { + $this->_values['amount'] = CRM_Utils_Array::value('amount', $priceOptions[$selectedPriceOptionID]); + } $this->_values[$selectedPriceOptionID]['value'] = CRM_Utils_Array::value('amount', $priceOptions[$selectedPriceOptionID]); $this->_values[$selectedPriceOptionID]['label'] = CRM_Utils_Array::value('label', $priceOptions[$selectedPriceOptionID]); $this->_values[$selectedPriceOptionID]['amount_id'] = CRM_Utils_Array::value('id', $priceOptions[$selectedPriceOptionID]); @@ -1048,12 +1050,11 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } // from here on down, $params['amount'] holds a monetary value (or null) rather than an option ID $params['amount'] = self::computeAmount($params, $this->_values); - if (($this->_values['is_pay_later'] && empty($this->_paymentProcessor) && !array_key_exists('hidden_processor', $params)) || (CRM_Utils_Array::value('payment_processor_id', $params) == 0) - && $params['amount'] != 0 + && ($is_quick_config == 0 || $params['amount'] != 0) ) { $params['is_pay_later'] = 1; } diff --git a/civicrm/CRM/Contribute/Form/ContributionPage/Settings.php b/civicrm/CRM/Contribute/Form/ContributionPage/Settings.php index 4e7e883cc3dd724dcddd7c5c11baa6fa490e6559..6efc73568e1ae334193e39150a7ee365c0a4684f 100644 --- a/civicrm/CRM/Contribute/Form/ContributionPage/Settings.php +++ b/civicrm/CRM/Contribute/Form/ContributionPage/Settings.php @@ -57,6 +57,7 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_ $ufJoinDAO = new CRM_Core_DAO_UFJoin(); $ufJoinDAO->module = $module; $ufJoinDAO->entity_id = $this->_id; + $ufJoinDAO->entity_table = 'civicrm_contribution_page'; if ($ufJoinDAO->find(TRUE)) { $jsonData = CRM_Contribute_BAO_ContributionPage::formatModuleData($ufJoinDAO->module_data, TRUE, $module); if ($module == 'soft_credit') { diff --git a/civicrm/CRM/Contribute/Form/SoftCredit.php b/civicrm/CRM/Contribute/Form/SoftCredit.php index 670bbcb812457ee8a1a7fefc49ec4bd21309c76d..78411d4d51e5b88cf08a9442befc82619d9bf533 100644 --- a/civicrm/CRM/Contribute/Form/SoftCredit.php +++ b/civicrm/CRM/Contribute/Form/SoftCredit.php @@ -55,7 +55,7 @@ class CRM_Contribute_Form_SoftCredit { //check if any honree profile is enabled if yes then assign its profile type to $_honoreeProfileType // which will be used to constraint soft-credit contact type in formRule, CRM-13981 - if ($profileId[0]) { + if (!empty($profileId[0]) && !empty($profileId[2])) { $form->_honoreeProfileType = CRM_Core_BAO_UFGroup::getContactType($profileId[0]); } } diff --git a/civicrm/CRM/Contribute/Form/Task/PDF.php b/civicrm/CRM/Contribute/Form/Task/PDF.php index e06a79e877061d36358c0ddfaae8744bc95e8213..a3b941811f2d5eba7eb3d820c0a2a07b64dbe1a6 100644 --- a/civicrm/CRM/Contribute/Form/Task/PDF.php +++ b/civicrm/CRM/Contribute/Form/Task/PDF.php @@ -180,7 +180,7 @@ AND {$this->_componentClause}"; $input['net_amount'] = $contribution->net_amount; $input['trxn_id'] = $contribution->trxn_id; $input['trxn_date'] = isset($contribution->trxn_date) ? $contribution->trxn_date : NULL; - $input['receipt_date'] = $contribution->receipt_date; + $input['receipt_update'] = $params['receipt_update']; // CRM_Contribute_BAO_Contribution::composeMessageArray expects mysql formatted date $objects['contribution']->receive_date = CRM_Utils_Date::isoToMysql($objects['contribution']->receive_date); @@ -198,10 +198,6 @@ AND {$this->_componentClause}"; // reset template values before processing next transactions $template->clearTemplateVars(); - if (!empty($params['receipt_update'])) { - $objects['contribution']->receipt_date = date('Y-m-d H-i-s'); - $objects['contribution']->save(); - } } if ($elements['createPdf']) { diff --git a/civicrm/CRM/Contribute/Page/Tab.php b/civicrm/CRM/Contribute/Page/Tab.php index b284ed0118ac1efe2e8436849909767752f65770..e7ee1f2cfd3a32215bd09132e23f0a64e72023ce 100644 --- a/civicrm/CRM/Contribute/Page/Tab.php +++ b/civicrm/CRM/Contribute/Page/Tab.php @@ -180,7 +180,8 @@ class CRM_Contribute_Page_Tab extends CRM_Core_Page { list($softCreditTotals['amount'], $softCreditTotals['avg'], - $softCreditTotals['currency'] + $softCreditTotals['currency'], + $softCreditTotals['cancelAmount'] //to get cancel amount ) = CRM_Contribute_BAO_ContributionSoft::getSoftContributionTotals($this->_contactId, $isTest); $this->assign('softCredit', TRUE); diff --git a/civicrm/CRM/Contribute/Selector/Search.php b/civicrm/CRM/Contribute/Selector/Search.php index fd1327706d374547e3c7f34c895c7ee34b5763b5..ef60698c8881fb4f113f5fa99777ba29f9875384 100644 --- a/civicrm/CRM/Contribute/Selector/Search.php +++ b/civicrm/CRM/Contribute/Selector/Search.php @@ -311,7 +311,7 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) { if ($this->_includeSoftCredits) { // especial sort order when rows include soft credits - $sort = "civicrm_contribution.receive_date DESC, civicrm_contribution.id, civicrm_contribution_soft.id"; + $sort = $sort->orderBy() . ", civicrm_contribution.id, civicrm_contribution_soft.id"; } $result = $this->_query->searchQuery($offset, $rowCount, $sort, FALSE, FALSE, diff --git a/civicrm/CRM/Core/BAO/CustomField.php b/civicrm/CRM/Core/BAO/CustomField.php index 5756980c206099527cc4d8baf66ba2511772d6c6..a562a1c1d4d619a4dec92cb2ac32fda1f6359806 100644 --- a/civicrm/CRM/Core/BAO/CustomField.php +++ b/civicrm/CRM/Core/BAO/CustomField.php @@ -1619,14 +1619,27 @@ SELECT id $fName = $value['name']; $mimeType = $value['type']; + // If we are already passing the file id as a value then retrieve and set the file data + if (CRM_Utils_Rule::integer($value)) { + $fileDAO = new CRM_Core_DAO_File(); + $fileDAO->id = $value; + $fileDAO->find(TRUE); + if ($fileDAO->N) { + $fileID = $value; + $fName = $fileDAO->uri; + $mimeType = $fileDAO->mime_type; + } + } + $filename = pathinfo($fName, PATHINFO_BASENAME); - // rename this file to go into the secure directory - if (!rename($fName, $config->customFileUploadDir . $filename)) { + // rename this file to go into the secure directory only if + // user has uploaded new file not existing verfied on the basis of $fileID + if (!$fileID && !rename($fName, $config->customFileUploadDir . $filename)) { CRM_Core_Error::statusBounce(ts('Could not move custom file to custom upload directory')); } - if ($customValueId) { + if ($customValueId && !$fileID) { $query = " SELECT $columnName FROM $tableName diff --git a/civicrm/CRM/Core/BAO/CustomQuery.php b/civicrm/CRM/Core/BAO/CustomQuery.php index 67cf0c624aa7fc0464fcd25eaea9211a8abbf74b..12cbfaa4a6259e21041dfcfe4f84c698be70a2f8 100644 --- a/civicrm/CRM/Core/BAO/CustomQuery.php +++ b/civicrm/CRM/Core/BAO/CustomQuery.php @@ -349,7 +349,7 @@ SELECT f.id, f.label, f.data_type, } // CRM-14563,CRM-16575 : Special handling of multi-select custom fields - if ($isSerialized && !empty($value) && !strstr($op, 'NULL') && !strstr($op, 'LIKE')) { + if ($isSerialized && !CRM_Utils_System::isNull($value) && !strstr($op, 'NULL') && !strstr($op, 'LIKE')) { $sp = CRM_Core_DAO::VALUE_SEPARATOR; if (strstr($op, 'IN')) { $value = str_replace(",", "$sp|$sp", $value); diff --git a/civicrm/CRM/Core/BAO/Dashboard.php b/civicrm/CRM/Core/BAO/Dashboard.php index e42bf80bfab52c9a769a5f50f2c78ba5416c05e4..c8df7cbdc738afb5735363efd24ddb962cc289af 100644 --- a/civicrm/CRM/Core/BAO/Dashboard.php +++ b/civicrm/CRM/Core/BAO/Dashboard.php @@ -107,29 +107,30 @@ class CRM_Core_BAO_Dashboard extends CRM_Core_DAO_Dashboard { public static function getContactDashlets($flatFormat = FALSE, $contactID = NULL) { $dashlets = array(); - if (!$contactID) { - $contactID = CRM_Core_Session::singleton()->get('userID'); - } - // Get contact dashboard dashlets. $hasDashlets = FALSE; $dao = new CRM_Contact_DAO_DashboardContact(); - $dao->contact_id = $contactID; + $dao->contact_id = $contactID ? $contactID : CRM_Core_Session::singleton()->getLoggedInContactID(); $dao->orderBy('column_no asc, weight asc'); $dao->find(); + + // The available list will only include those which are valid for the domain. + $availableDashlets = self::getDashlets(); while ($dao->fetch()) { // When a dashlet is removed, it stays in the table with status disabled, // so even if a user decides not to have any dashlets show, they will still // have records in the table to indicate that we are not newly initializing. - $hasDashlets = TRUE; - if (!$flatFormat) { - if ($dao->is_active) { - // append weight so that order is preserved. - $dashlets[$dao->column_no]["{$dao->weight}-{$dao->dashboard_id}"] = $dao->is_minimized; + if ((!empty($availableDashlets[$dao->dashboard_id]) && $availableDashlets[$dao->dashboard_id]['is_active'])) { + $hasDashlets = TRUE; + if (!$flatFormat) { + if ($dao->is_active) { + // append weight so that order is preserved. + $dashlets[$dao->column_no]["{$dao->weight}-{$dao->dashboard_id}"] = $dao->is_minimized; + } + } + else { + $dashlets[$dao->dashboard_id] = $dao->dashboard_id; } - } - else { - $dashlets[$dao->dashboard_id] = $dao->dashboard_id; } } @@ -162,7 +163,7 @@ class CRM_Core_BAO_Dashboard extends CRM_Core_DAO_Dashboard { 'domain_id' => CRM_Core_Config::domainID(), 'option.limit' => 0, )); - $contactID = CRM_Core_Session::singleton()->get('userID'); + $contactID = CRM_Core_Session::singleton()->getLoggedInContactID(); $allDashlets = CRM_Utils_Array::index(array('name'), $getDashlets['values']); $defaultDashlets = array(); $defaults = array('blog' => 1, 'getting-started' => '0'); diff --git a/civicrm/CRM/Core/BAO/UFJoin.php b/civicrm/CRM/Core/BAO/UFJoin.php index 92bd4cf9cd975d89e440468df73ed41638dfface..877db2524b599e8b3eb5efcd2f1c20bd613b050e 100644 --- a/civicrm/CRM/Core/BAO/UFJoin.php +++ b/civicrm/CRM/Core/BAO/UFJoin.php @@ -141,6 +141,7 @@ class CRM_Core_BAO_UFJoin extends CRM_Core_DAO_UFJoin { $dao->entity_table = CRM_Utils_Array::value('entity_table', $params); $dao->entity_id = CRM_Utils_Array::value('entity_id', $params); $dao->weight = CRM_Utils_Array::value('weight', $params); + $dao->module = CRM_Utils_Array::value('module', $params); if ($dao->find(TRUE)) { return $dao->uf_group_id; } diff --git a/civicrm/CRM/Core/DAO.php b/civicrm/CRM/Core/DAO.php index 189b6c8d59a626440de68f4d23b33d6c1fdba50d..c7a401353365b322cbe408d2db153f66cd417456 100644 --- a/civicrm/CRM/Core/DAO.php +++ b/civicrm/CRM/Core/DAO.php @@ -112,6 +112,7 @@ class CRM_Core_DAO extends DB_DataObject { CRM_Core_DAO::executeQuery('SET SESSION sql_mode = STRICT_TRANS_TABLES'); } CRM_Core_DAO::executeQuery('SET NAMES utf8'); + CRM_Core_DAO::executeQuery('SET @uniqueID = %1', array(1 => array(CRM_Utils_Request::id(), 'String'))); } /** diff --git a/civicrm/CRM/Core/Payment/PayPalImpl.php b/civicrm/CRM/Core/Payment/PayPalImpl.php index 6c1617fc74fc1b4b0fde58162f4cf5f4e5e7189c..c4d904927daa2cd93d810c7a1748497f00f2e1d4 100644 --- a/civicrm/CRM/Core/Payment/PayPalImpl.php +++ b/civicrm/CRM/Core/Payment/PayPalImpl.php @@ -511,7 +511,7 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { $params['frequency_interval'] . " " . $params['frequency_unit']; $args['amt'] = $params['amount']; - $args['totalbillingcycles'] = $params['installments']; + $args['totalbillingcycles'] = CRM_Utils_Array::value('installments', $params); $args['version'] = 56.0; $args['PROFILEREFERENCE'] = "" . "i=" . $params['invoiceID'] . "&m=" . $component . @@ -562,7 +562,11 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { * @throws \Civi\Payment\Exception\PaymentProcessorException */ public function doQuery($params) { - if (empty($params['trxn_id'])) { + //CRM-18140 - trxn_id not returned for recurring paypal transaction + if (!empty($params['is_recur'])) { + return array(); + } + elseif (empty($params['trxn_id'])) { throw new \Civi\Payment\Exception\PaymentProcessorException('transaction id not set'); } $args = array( diff --git a/civicrm/CRM/Core/Payment/ProcessorForm.php b/civicrm/CRM/Core/Payment/ProcessorForm.php index 463c6abeecff5a959ef467486653c2db81f3c7b7..f33d98ae196095650ee5dfd7b16c0645760704af 100644 --- a/civicrm/CRM/Core/Payment/ProcessorForm.php +++ b/civicrm/CRM/Core/Payment/ProcessorForm.php @@ -66,7 +66,7 @@ class CRM_Core_Payment_ProcessorForm { $form->assign('suppressSubmitButton', $form->_paymentObject->isSuppressSubmitButtons()); - $form->assign('currency', $form->_values['currency']); + $form->assign('currency', CRM_Utils_Array::value('currency', $form->_values)); // also set cancel subscription url if (!empty($form->_paymentProcessor['is_recur']) && !empty($form->_values['is_recur'])) { diff --git a/civicrm/CRM/Core/PseudoConstant.php b/civicrm/CRM/Core/PseudoConstant.php index 16a6ef8933d91e728827171c7d3f9dfbcc3f8127..509a3ea29d55f8308f8ac27dc3cd64c3eb0781d4 100644 --- a/civicrm/CRM/Core/PseudoConstant.php +++ b/civicrm/CRM/Core/PseudoConstant.php @@ -77,7 +77,7 @@ class CRM_Core_PseudoConstant { * States/provinces abbreviations * @var array */ - private static $stateProvinceAbbreviation; + private static $stateProvinceAbbreviation = array(); /** * Country. @@ -738,22 +738,22 @@ class CRM_Core_PseudoConstant { * array reference of all State/Province abbreviations. */ public static function stateProvinceAbbreviation($id = FALSE, $limit = TRUE) { - if ($id > 1) { - $query = " -SELECT abbreviation + if ($id && is_numeric($id)) { + if (!array_key_exists($id, (array) self::$stateProvinceAbbreviation)) { + $query = "SELECT abbreviation FROM civicrm_state_province WHERE id = %1"; - $params = array( - 1 => array( - $id, - 'Integer', - ), - ); - return CRM_Core_DAO::singleValueQuery($query, $params); + $params = array( + 1 => array( + $id, + 'Integer', + ), + ); + self::$stateProvinceAbbreviation[$id] = CRM_Core_DAO::singleValueQuery($query, $params); + } + return self::$stateProvinceAbbreviation[$id]; } - - if (!self::$stateProvinceAbbreviation || !$id) { - + else { $whereClause = FALSE; if ($limit) { @@ -774,15 +774,6 @@ WHERE id = %1"; self::populate(self::$stateProvinceAbbreviation, 'CRM_Core_DAO_StateProvince', TRUE, 'abbreviation', 'is_active', $whereClause); } - if ($id) { - if (array_key_exists($id, self::$stateProvinceAbbreviation)) { - return self::$stateProvinceAbbreviation[$id]; - } - else { - $result = NULL; - return $result; - } - } return self::$stateProvinceAbbreviation; } diff --git a/civicrm/CRM/Core/SelectValues.php b/civicrm/CRM/Core/SelectValues.php index c54b58ea881604efd8104f4e225d0270905b5d75..fd89fae817248ff2aab2e3465052e666c5fae338 100644 --- a/civicrm/CRM/Core/SelectValues.php +++ b/civicrm/CRM/Core/SelectValues.php @@ -910,8 +910,8 @@ class CRM_Core_SelectValues { * * @return array */ - public static function getSearchBuilderOperators() { - return array( + public static function getSearchBuilderOperators($fieldType = NULL) { + $builderOperators = array( '=' => '=', '!=' => '≠', '>' => '>', @@ -928,6 +928,17 @@ class CRM_Core_SelectValues { 'IS NULL' => ts('Is Null'), 'IS NOT NULL' => ts('Not Null'), ); + if ($fieldType) { + switch ($fieldType) { + case CRM_Utils_Type::T_STRING: + unset($builderOperators['>']); + unset($builderOperators['<']); + unset($builderOperators['>=']); + unset($builderOperators['<=']); + break; + } + } + return $builderOperators; } /** diff --git a/civicrm/CRM/Core/xml/Menu/Contact.xml b/civicrm/CRM/Core/xml/Menu/Contact.xml index 7f1ac88b2a4110640171edbd880689b1a2b25bfc..cee3a1b9c2ee14bd6306214e1f09988e0ac9c0d4 100644 --- a/civicrm/CRM/Core/xml/Menu/Contact.xml +++ b/civicrm/CRM/Core/xml/Menu/Contact.xml @@ -194,11 +194,6 @@ <title>Smart Groups</title> <page_callback>CRM_Contact_Page_View_ContactSmartGroup</page_callback> </item> - <item> - <path>civicrm/contact/view/sunlight</path> - <title>Sunlight</title> - <page_callback>CRM_Contact_Page_View_Sunlight</page_callback> - </item> <item> <path>civicrm/contact/view/note</path> <path_arguments>cid=%%cid%%</path_arguments> diff --git a/civicrm/CRM/Dedupe/Merger.php b/civicrm/CRM/Dedupe/Merger.php index 6fba6f79b9f14a3c06ae05083dd60a6fa1686475..74bea9e8b3f6a0c139607d02bed86e85167bc92b 100644 --- a/civicrm/CRM/Dedupe/Merger.php +++ b/civicrm/CRM/Dedupe/Merger.php @@ -979,11 +979,7 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m $$moniker = $result['values'][$cid]; } - static $fields = array(); - if (empty($fields)) { - $fields = CRM_Contact_DAO_Contact::fields(); - CRM_Core_DAO::freeResult(); - } + $fields = CRM_Contact_DAO_Contact::fields(); // FIXME: there must be a better way foreach (array('main', 'other') as $moniker) { @@ -1781,12 +1777,6 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m CRM_Core_BAO_CustomValueTable::setValues($viewOnlyCustomFields); } - // **** Delete other contact & update prev-next caching - $otherParams = array( - 'contact_id' => $otherId, - 'id' => $otherId, - 'version' => 3, - ); if (CRM_Core_Permission::check('merge duplicate contacts') && CRM_Core_Permission::check('delete contacts') ) { @@ -1796,15 +1786,13 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m CRM_Core_DAO::executeQuery($query); } - civicrm_api('contact', 'delete', $otherParams); + civicrm_api3('contact', 'delete', array('id' => $otherId)); CRM_Core_BAO_PrevNextCache::deleteItem($otherId); } // FIXME: else part - /* else { */ - - /* CRM_Core_Session::setStatus( ts('Do not have sufficient permission to delete duplicate contact.') ); */ - - /* } */ + // else { + // CRM_Core_Session::setStatus( ts('Do not have sufficient permission to delete duplicate contact.') ); + // } // CRM-15681 merge sub_types if ($other_sub_types = CRM_Utils_array::value('contact_sub_type', $migrationInfo['other_details'])) { @@ -1840,17 +1828,19 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m } CRM_Contact_BAO_Contact::createProfileContact($submitted, CRM_Core_DAO::$_nullArray, $mainId); - unset($submitted); } CRM_Utils_Hook::post('merge', 'Contact', $mainId, CRM_Core_DAO::$_nullObject); + self::createMergeActivities($mainId, $otherId); return TRUE; } /** + * Get fields in the contact table suitable for merging. + * * @return array - * Array of field names which will be compared, so everything except ID. + * Array of field names to be potentially merged. */ public static function getContactFields() { $contactFields = CRM_Contact_DAO_Contact::fields(); @@ -1927,4 +1917,32 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m } } + /** + * Create activities tracking the merge on affected contacts. + * + * @param int $mainId + * @param int $otherId + * + * @throws \CiviCRM_API3_Exception + */ + public static function createMergeActivities($mainId, $otherId) { + $params = array( + 1 => $otherId, + 2 => $mainId, + ); + $activity = civicrm_api3('activity', 'create', array( + 'subject' => ts('Contact ID %1 has been merged and deleted.', $params), + 'target_contact_id' => $mainId, + 'activity_type_id' => 'Contact Merged', + 'status_id' => 'Completed', + )); + civicrm_api3('activity', 'create', array( + 'subject' => ts('Contact ID %1 has been merged into Contact ID %2 and deleted.', $params), + 'target_contact_id' => $otherId, + 'activity_type_id' => 'Contact Deleted by Merge', + 'parent_id' => $activity['id'], + 'status_id' => 'Completed', + )); + } + } diff --git a/civicrm/CRM/Event/BAO/Query.php b/civicrm/CRM/Event/BAO/Query.php index cddba764ad964bd9befbda984cdccfa88f506d3d..4905cf56e4c58fa8a636ce24b287a3e8b8ac780f 100644 --- a/civicrm/CRM/Event/BAO/Query.php +++ b/civicrm/CRM/Event/BAO/Query.php @@ -285,7 +285,7 @@ class CRM_Event_BAO_Query { $value = $extractEventId[2]; $where = $query->_where[$grouping][$key]; } - else if (strstr($val, 'civicrm_event.id IN')) { + elseif (strstr($val, 'civicrm_event.id IN')) { //extract the first event id if multiple events are selected preg_match('/civicrm_event.id IN \(\"(\d+)/', $val, $matches); $value = $matches[1]; @@ -296,7 +296,7 @@ class CRM_Event_BAO_Query { $extractEventId = explode(" ", $exEventId); $value = $extractEventId[2]; } - else if(!empty($matches[1])) { + elseif (!empty($matches[1])) { $value = $matches[1]; } $where = $query->_where[$grouping][$key]; @@ -611,6 +611,10 @@ class CRM_Event_BAO_Query { CRM_Core_Form_Date::buildDateRange($form, 'participant', 1, '_register_date_low', '_register_date_high', ts('From'), FALSE); + $form->addElement('hidden', 'event_date_range_error'); + $form->addElement('hidden', 'participant_date_range_error'); + $form->addFormRule(array('CRM_Event_BAO_Query', 'formRule'), $form); + $form->addElement('checkbox', "event_include_repeating_events", NULL, ts('Include participants from all events in the %1 series', array(1 => '<em>%1</em>'))); $form->addSelect('participant_status_id', @@ -677,4 +681,37 @@ class CRM_Event_BAO_Query { } } + /** + * Check if the values in the date range are in correct chronological order. + * + * @todo Get this to work with CRM_Utils_Rule::validDateRange + * + * @param array $fields + * @param array $files + * @param CRM_Core_Form $form + * + * @return bool|array + */ + public static function formRule($fields, $files, $form) { + $errors = array(); + + if ((empty($fields['event_start_date_low']) || empty($fields['event_end_date_high'])) && (empty($fields['participant_register_date_low']) || empty($fields['participant_register_date_high']))) { + return TRUE; + } + $lowDate = strtotime($fields['event_start_date_low']); + $highDate = strtotime($fields['event_end_date_high']); + + if ($lowDate > $highDate) { + $errors['event_date_range_error'] = ts('Please check that your Event Date Range is in correct chronological order.'); + } + + $lowDate1 = strtotime($fields['participant_register_date_low']); + $highDate1 = strtotime($fields['participant_register_date_high']); + + if ($lowDate1 > $highDate1) { + $errors['participant_date_range_error'] = ts('Please check that your Registration Date Range is in correct chronological order.'); + } + return empty($errors) ? TRUE : $errors; + } + } diff --git a/civicrm/CRM/Export/BAO/Export.php b/civicrm/CRM/Export/BAO/Export.php index 0bb887c7d565b6c947a69ac130e2b8d5e222f292..c17e424ee969172c16dfd9d9bfd88610e0276b19 100644 --- a/civicrm/CRM/Export/BAO/Export.php +++ b/civicrm/CRM/Export/BAO/Export.php @@ -98,6 +98,7 @@ class CRM_Export_BAO_Export { */ public static function defaultReturnProperty($exportMode) { // hack to add default return property based on export mode + $property = NULL; if ($exportMode == CRM_Export_Form_Select::CONTRIBUTE_EXPORT) { $property = 'contribution_id'; } @@ -119,9 +120,6 @@ class CRM_Export_BAO_Export { elseif ($exportMode == CRM_Export_Form_Select::ACTIVITY_EXPORT) { $property = 'activity_id'; } - elseif ($exportMode == CRM_Export_Form_Select::CONTACT_EXPORT) { - $property = 'contact_id'; - } return $property; } @@ -434,7 +432,9 @@ class CRM_Export_BAO_Export { } } } - $returnProperties[self::defaultReturnProperty($exportMode)] = 1; + if (!empty(self::defaultReturnProperty($exportMode))) { + $returnProperties[self::defaultReturnProperty($exportMode)] = 1; + } } else { $primary = TRUE; @@ -560,7 +560,7 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c list($select, $from, $where, $having) = $query->query(); if ($mergeSameHousehold == 1) { - if (!$returnProperties['id']) { + if (empty($returnProperties['id'])) { $returnProperties['id'] = 1; } diff --git a/civicrm/CRM/Export/Form/Select.php b/civicrm/CRM/Export/Form/Select.php index c2dac7b530d859b707ce3c181d71bae6035dfc4e..4349d3427a1016f50ee4a89ba6a7c027d224efe8 100644 --- a/civicrm/CRM/Export/Form/Select.php +++ b/civicrm/CRM/Export/Form/Select.php @@ -444,7 +444,7 @@ FROM {$this->_componentTable} * @return string */ public function getTitle() { - return ts('Export All or Selected Fields'); + return ts('Export Options'); } /** diff --git a/civicrm/CRM/Financial/BAO/ExportFormat/CSV.php b/civicrm/CRM/Financial/BAO/ExportFormat/CSV.php index d3c36ac0a7853051b67d1242f951fc07fd20cdc2..e2c03c5c3d72ac859edaaf795a8d262369b64e45 100644 --- a/civicrm/CRM/Financial/BAO/ExportFormat/CSV.php +++ b/civicrm/CRM/Financial/BAO/ExportFormat/CSV.php @@ -242,4 +242,13 @@ class CRM_Financial_BAO_ExportFormat_CSV extends CRM_Financial_BAO_ExportFormat return 'csv'; } + public function exportACCNT() { + } + + public function exportCUST() { + } + + public function exportTRANS() { + } + } diff --git a/civicrm/CRM/Group/Form/Edit.php b/civicrm/CRM/Group/Form/Edit.php index 7def4f7ab9723cb9ee12487ec24929ef1169cd23..ad97550ff89e15c265024229848d6c1164fe63ab 100644 --- a/civicrm/CRM/Group/Form/Edit.php +++ b/civicrm/CRM/Group/Form/Edit.php @@ -384,6 +384,7 @@ WHERE title = %1 } $params['is_reserved'] = CRM_Utils_Array::value('is_reserved', $params, FALSE); + $params['group_type'] = CRM_Utils_Array::value('group_type', $params, array()); $customFields = CRM_Core_BAO_CustomField::getFields('Group'); $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, diff --git a/civicrm/CRM/Group/Form/Search.php b/civicrm/CRM/Group/Form/Search.php index ace4b5d081fee17bd671436844f21751208af8b3..9d2404d8a1770cbbe106bfba7b56c86610d39485 100644 --- a/civicrm/CRM/Group/Form/Search.php +++ b/civicrm/CRM/Group/Form/Search.php @@ -64,7 +64,7 @@ class CRM_Group_Form_Search extends CRM_Core_Form { unset($groupTypes['Access Control']); } - $this->addCheckBox('group_type', + $this->addCheckBox('group_type_search', ts('Type'), $groupTypes, NULL, NULL, NULL, NULL, ' ' diff --git a/civicrm/CRM/Logging/Differ.php b/civicrm/CRM/Logging/Differ.php index c6cc7530c7d55225faf3f9666fcbf88baf5edb95..77d2caf1c14843acb945e082eeedebad0ce738dc 100644 --- a/civicrm/CRM/Logging/Differ.php +++ b/civicrm/CRM/Logging/Differ.php @@ -257,25 +257,8 @@ WHERE lt.log_conn_id = %1 AND static $titles = array(); static $values = array(); - // FIXME: split off the table → DAO mapping to a GenCode-generated class - static $daos = array( - 'civicrm_address' => 'CRM_Core_DAO_Address', - 'civicrm_contact' => 'CRM_Contact_DAO_Contact', - 'civicrm_email' => 'CRM_Core_DAO_Email', - 'civicrm_im' => 'CRM_Core_DAO_IM', - 'civicrm_openid' => 'CRM_Core_DAO_OpenID', - 'civicrm_phone' => 'CRM_Core_DAO_Phone', - 'civicrm_website' => 'CRM_Core_DAO_Website', - 'civicrm_contribution' => 'CRM_Contribute_DAO_Contribution', - 'civicrm_note' => 'CRM_Core_DAO_Note', - 'civicrm_relationship' => 'CRM_Contact_DAO_Relationship', - 'civicrm_activity' => 'CRM_Activity_DAO_Activity', - 'civicrm_case' => 'CRM_Case_DAO_Case', - ); - if (!isset($titles[$table]) or !isset($values[$table])) { - - if (in_array($table, array_keys($daos))) { + if (($tableDAO = CRM_Core_DAO_AllCoreTables::getClassForTable($table)) != FALSE) { // FIXME: these should be populated with pseudo constants as they // were at the time of logging rather than their current values // FIXME: Use *_BAO:buildOptions() method rather than pseudoconstants & fetch programmatically @@ -311,7 +294,7 @@ WHERE lt.log_conn_id = %1 AND break; } - $dao = new $daos[$table](); + $dao = new $tableDAO(); foreach ($dao->fields() as $field) { $titles[$table][$field['name']] = CRM_Utils_Array::value('title', $field); diff --git a/civicrm/CRM/Logging/Reverter.php b/civicrm/CRM/Logging/Reverter.php index 6cb8a80370ba5a44d8884144048ee0e6a380d24d..ed04ddb4b26fc50b1453628128e01efe6a753bdd 100644 --- a/civicrm/CRM/Logging/Reverter.php +++ b/civicrm/CRM/Logging/Reverter.php @@ -49,22 +49,11 @@ class CRM_Logging_Reverter { } /** + * Revert changes in the array of diffs in $this->diffs. + * * @param $tables */ public function revert($tables) { - // FIXME: split off the table → DAO mapping to a GenCode-generated class - $daos = array( - 'civicrm_address' => 'CRM_Core_DAO_Address', - 'civicrm_contact' => 'CRM_Contact_DAO_Contact', - 'civicrm_email' => 'CRM_Core_DAO_Email', - 'civicrm_im' => 'CRM_Core_DAO_IM', - 'civicrm_openid' => 'CRM_Core_DAO_OpenID', - 'civicrm_phone' => 'CRM_Core_DAO_Phone', - 'civicrm_website' => 'CRM_Core_DAO_Website', - 'civicrm_contribution' => 'CRM_Contribute_DAO_Contribution', - 'civicrm_note' => 'CRM_Core_DAO_Note', - 'civicrm_relationship' => 'CRM_Contact_DAO_Relationship', - ); // get custom data tables, columns and types $ctypes = array(); @@ -109,14 +98,13 @@ class CRM_Logging_Reverter { foreach ($deletes as $table => $ids) { CRM_Core_DAO::executeQuery("DELETE FROM `$table` WHERE id IN (" . implode(', ', array_unique($ids)) . ')'); } - // revert updates by updating to previous values foreach ($reverts as $table => $row) { switch (TRUE) { // DAO-based tables - case in_array($table, array_keys($daos)): - $dao = new $daos[$table](); + case (($tableDAO = CRM_Core_DAO_AllCoreTables::getClassForTable($table)) != FALSE): + $dao = new $tableDAO (); foreach ($row as $id => $changes) { $dao->id = $id; foreach ($changes as $field => $value) { diff --git a/civicrm/CRM/Logging/Schema.php b/civicrm/CRM/Logging/Schema.php index 952496747664a14afe3765f981d18788ef66033e..98e6ed562ef762cbb636a40843b6d6ee33ea5365 100644 --- a/civicrm/CRM/Logging/Schema.php +++ b/civicrm/CRM/Logging/Schema.php @@ -127,6 +127,9 @@ AND TABLE_NAME LIKE 'civicrm_%' //CRM-14672 $this->tables = preg_grep('/^civicrm_menu/', $this->tables, PREG_GREP_INVERT); $this->tables = preg_grep('/_temp_/', $this->tables, PREG_GREP_INVERT); + // CRM-18178 + $this->tables = preg_grep('/_bak$/', $this->tables, PREG_GREP_INVERT); + $this->tables = preg_grep('/_backup$/', $this->tables, PREG_GREP_INVERT); // do not log civicrm_mailing_event* tables, CRM-12300 $this->tables = preg_grep('/^civicrm_mailing_event_/', $this->tables, PREG_GREP_INVERT); diff --git a/civicrm/CRM/Mailing/BAO/Query.php b/civicrm/CRM/Mailing/BAO/Query.php index 2cf2f04cd846e384a07b6aaf4d3008c523be57f6..56e1df0f62a2779b10012e8a6e66178f8ec5105b 100644 --- a/civicrm/CRM/Mailing/BAO/Query.php +++ b/civicrm/CRM/Mailing/BAO/Query.php @@ -407,6 +407,8 @@ class CRM_Mailing_BAO_Query { } CRM_Core_Form_Date::buildDateRange($form, 'mailing_date', 1, '_low', '_high', ts('From'), FALSE); + $form->addElement('hidden', 'mailing_date_range_error'); + $form->addFormRule(array('CRM_Mailing_BAO_Query', 'formRule'), $form); $mailingJobStatuses = array( '' => ts('- select -'), @@ -494,4 +496,25 @@ class CRM_Mailing_BAO_Query { $query->_tables[$tableName] = $query->_whereTables[$tableName] = 1; } + /** + * Check if the values in the date range are in correct chronological order. + * + * @param array $fields + * @param array $files + * @param CRM_Core_Form $form + * + * @return bool|array + */ + public static function formRule($fields, $files, $form) { + $errors = array(); + + if (empty($fields['mailing_date_high']) || empty($fields['mailing_date_low'])) { + return TRUE; + } + + CRM_Utils_Rule::validDateRange($fields, 'mailing_date', $errors, ts('Mailing Date')); + + return empty($errors) ? TRUE : $errors; + } + } diff --git a/civicrm/CRM/Member/BAO/Query.php b/civicrm/CRM/Member/BAO/Query.php index 970a14b485d5eb93e9ff5f1f58cef81c313e860a..985d731026209b6623216439c04be193b8d2cb66 100644 --- a/civicrm/CRM/Member/BAO/Query.php +++ b/civicrm/CRM/Member/BAO/Query.php @@ -432,10 +432,15 @@ class CRM_Member_BAO_Query { $form->addElement('text', 'member_source', ts('Source')); CRM_Core_Form_Date::buildDateRange($form, 'member_join_date', 1, '_low', '_high', ts('From'), FALSE); + $form->addElement('hidden', 'member_join_date_range_error'); CRM_Core_Form_Date::buildDateRange($form, 'member_start_date', 1, '_low', '_high', ts('From'), FALSE); + $form->addElement('hidden', 'member_start_date_range_error'); CRM_Core_Form_Date::buildDateRange($form, 'member_end_date', 1, '_low', '_high', ts('From'), FALSE); + $form->addElement('hidden', 'member_end_date_range_error'); + + $form->addFormRule(array('CRM_Member_BAO_Query', 'formRule'), $form); $form->addYesNo('member_is_primary', ts('Primary Member?'), TRUE); $form->addYesNo('member_pay_later', ts('Pay Later?'), TRUE); @@ -483,4 +488,27 @@ class CRM_Member_BAO_Query { } } + /** + * Custom form rules. + * + * @param array $fields + * @param array $files + * @param CRM_Core_Form $form + * + * @return bool|array + */ + public static function formRule($fields, $files, $form) { + $errors = array(); + + if ((empty($fields['member_join_date_low']) || empty($fields['member_join_date_high'])) && (empty($fields['member_start_date_low']) || empty($fields['member_start_date_high'])) && (empty($fields['member_end_date_low']) || empty($fields['member_end_date_high']))) { + return TRUE; + } + + CRM_Utils_Rule::validDateRange($fields, 'member_join_date', $errors, ts('Member Since')); + CRM_Utils_Rule::validDateRange($fields, 'member_start_date', $errors, ts('Start Date')); + CRM_Utils_Rule::validDateRange($fields, 'member_end_date', $errors, ts('End Date')); + + return empty($errors) ? TRUE : $errors; + } + } diff --git a/civicrm/CRM/Pledge/BAO/Pledge.php b/civicrm/CRM/Pledge/BAO/Pledge.php index b6835b238568690d4e41d1b46b41b12a014c9baa..1fee5bf50db7ab5a84047efd979d66be78702205 100644 --- a/civicrm/CRM/Pledge/BAO/Pledge.php +++ b/civicrm/CRM/Pledge/BAO/Pledge.php @@ -738,7 +738,7 @@ GROUP BY currency * @return array * array of exportable Fields */ - public static function &exportableFields($checkPermission) { + public static function exportableFields($checkPermission) { if (!self::$_exportableFields) { if (!self::$_exportableFields) { self::$_exportableFields = array(); @@ -1013,11 +1013,13 @@ SELECT pledge.contact_id as contact_id, if (empty($details['reminder_date'])) { $nextReminderDate = new DateTime($details['scheduled_date']); + $details['initial_reminder_day'] = empty($details['initial_reminder_day']) ? 0 : $details['initial_reminder_day']; $nextReminderDate->modify("-" . $details['initial_reminder_day'] . "day"); $nextReminderDate = $nextReminderDate->format("Ymd"); } else { $nextReminderDate = new DateTime($details['reminder_date']); + $details['additional_reminder_day'] = empty($details['additional_reminder_day']) ? 0 : $details['additional_reminder_day']; $nextReminderDate->modify("+" . $details['additional_reminder_day'] . "day"); $nextReminderDate = $nextReminderDate->format("Ymd"); } diff --git a/civicrm/CRM/Pledge/BAO/Query.php b/civicrm/CRM/Pledge/BAO/Query.php index 2d890f373dc47e4ac0a977042f6613b1f9b7b84e..b4bfd73b66d21ce542ef22bfbf27625983e72351 100644 --- a/civicrm/CRM/Pledge/BAO/Query.php +++ b/civicrm/CRM/Pledge/BAO/Query.php @@ -38,17 +38,17 @@ class CRM_Pledge_BAO_Query { * * @return array */ - public static function &getFields($checkPermission = TRUE) { - $fields = CRM_Pledge_BAO_Pledge::exportableFields($checkPermission); - return $fields; + public static function getFields($checkPermission = TRUE) { + return CRM_Pledge_BAO_Pledge::exportableFields($checkPermission); } /** * Build select for Pledge. * - * @param $query + * @param CRM_Contact_BAO_Query $query */ public static function select(&$query) { + $statusId = implode(',', array_keys(CRM_Core_PseudoConstant::accountOptionValues("contribution_status", NULL, " AND v.name IN ('Pending', 'Overdue')"))); if (($query->_mode & CRM_Contact_BAO_Query::MODE_PLEDGE) || !empty($query->_returnProperties['pledge_id'])) { $query->_select['pledge_id'] = 'civicrm_pledge.id as pledge_id'; @@ -272,6 +272,26 @@ class CRM_Pledge_BAO_Query { ); return; + case 'pledge_installments_low': + case 'pledge_installments_high': + // process min/max amount + $query->numberRangeBuilder($values, + 'civicrm_pledge', 'pledge_installments', 'installments', 'Number of Installments' + ); + return; + + case 'pledge_acknowledge_date_is_not_null': + if ($value) { + $op = "IS NOT NULL"; + $query->_qill[$grouping][] = ts('Pledge Acknowledgement Sent'); + } + else { + $op = "IS NULL"; + $query->_qill[$grouping][] = ts('Pledge Acknowledgement Not Sent'); + } + $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_pledge.acknowledge_date", $op); + return; + case 'pledge_payment_status_id': case 'pledge_status_id': if ($name == 'pledge_status_id') { @@ -515,17 +535,22 @@ class CRM_Pledge_BAO_Query { $form->addRule('pledge_amount_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money'); $statusValues = CRM_Contribute_PseudoConstant::contributionStatus(); - // Remove status values that are only used for recurring contributions for now (Failed and In Progress). unset($statusValues['4']); - + // unset in progress for payment + unset($statusValues['5']); $form->add('select', 'pledge_status_id', ts('Pledge Status'), $statusValues, FALSE, array('class' => 'crm-select2', 'multiple' => 'multiple') ); - // unset in progress for payment - unset($statusValues['5']); + $form->addYesNo('pledge_acknowledge_date_is_not_null', ts('Acknowledgement sent?'), TRUE); + + $form->add('text', 'pledge_installments_low', ts('From'), array('size' => 8, 'maxlength' => 8)); + $form->addRule('pledge_installments_low', ts('Please enter a number'), 'integer'); + + $form->add('text', 'pledge_installments_high', ts('To'), array('size' => 8, 'maxlength' => 8)); + $form->addRule('pledge_installments_high', ts('Please enter number.'), 'integer'); $form->add('select', 'pledge_payment_status_id', ts('Pledge Payment Status'), $statusValues, diff --git a/civicrm/CRM/Pledge/Form/Search.php b/civicrm/CRM/Pledge/Form/Search.php index 4c0facb86e0d4e149d48875d93d944ce1a700a08..561aa360f207182a00d1f7f7ff135291ccf3c2e8 100644 --- a/civicrm/CRM/Pledge/Form/Search.php +++ b/civicrm/CRM/Pledge/Form/Search.php @@ -67,18 +67,15 @@ class CRM_Pledge_Form_Search extends CRM_Core_Form_Search { */ public function preProcess() { - // set the button names - $this->_searchButtonName = $this->getButtonName('refresh'); $this->_actionButtonName = $this->getButtonName('next', 'action'); $this->_done = FALSE; $this->defaults = array(); - // we allow the controller to set force/reset externally, useful when we are being // driven by the wizard framework - + $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject); $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE); $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this); @@ -302,6 +299,8 @@ class CRM_Pledge_Form_Search extends CRM_Core_Form_Search { * * @param array $fields * Posted values of the form. + * + * @return array|bool */ public static function formRule($fields) { $errors = array(); diff --git a/civicrm/CRM/Price/BAO/PriceFieldValue.php b/civicrm/CRM/Price/BAO/PriceFieldValue.php index 85bcc5b15c70fb26e6dd016dd5a02685b217d4e6..fc0210d5cfacf5780dc8e994122629ce06da30ce 100644 --- a/civicrm/CRM/Price/BAO/PriceFieldValue.php +++ b/civicrm/CRM/Price/BAO/PriceFieldValue.php @@ -310,21 +310,22 @@ WHERE cpse.id IS NOT NULL {$where}"; $lineItem->label = $prevLabel; $lineItem->find(); while ($lineItem->fetch()) { - $lineItem->label = $newLabel; - $lineItem->save(); + $lineItemParams['id'] = $lineItem->id; + $lineItemParams['label'] = $newLabel; + CRM_Price_BAO_LineItem::create($lineItemParams); + // update amount and fee level in civicrm_contribution and civicrm_participant $params = array( 1 => array(CRM_Core_DAO::VALUE_SEPARATOR . $prevLabel . ' -', 'String'), 2 => array(CRM_Core_DAO::VALUE_SEPARATOR . $newLabel . ' -', 'String'), ); + // Update contribution if (!empty($lineItem->contribution_id)) { CRM_Core_DAO::executeQuery("UPDATE `civicrm_contribution` SET `amount_level` = REPLACE(amount_level, %1, %2) WHERE id = {$lineItem->contribution_id}", $params); - $participantIds = CRM_Event_BAO_Participant::getParticipantIds($lineItem->contribution_id); - foreach ($participantIds as $key => $id) { - if (!empty($id)) { - CRM_Core_DAO::executeQuery("UPDATE `civicrm_participant` SET `fee_level` = REPLACE(fee_level, %1, %2) WHERE id = {$id}", $params); - } - } + } + // Update participant + if ($lineItem->entity_table == 'civicrm_participant') { + CRM_Core_DAO::executeQuery("UPDATE `civicrm_participant` SET `fee_level` = REPLACE(fee_level, %1, %2) WHERE id = {$lineItem->entity_id}", $params); } } } diff --git a/civicrm/CRM/Report/Form/Activity.php b/civicrm/CRM/Report/Form/Activity.php index 84bc5ea730eeaf236f897703efb467c4a9b3e109..960b5516edf58f7910977d1c126a15b53a2ae3dc 100644 --- a/civicrm/CRM/Report/Form/Activity.php +++ b/civicrm/CRM/Report/Form/Activity.php @@ -59,7 +59,8 @@ class CRM_Report_Form_Activity extends CRM_Report_Form { $components = CRM_Core_Component::getEnabledComponents(); foreach ($components as $componentName => $componentInfo) { - if (CRM_Core_Permission::check("access $componentName")) { + $permission = sprintf("access %s", $componentName == 'CiviCase' ? "all cases and activities" : $componentName); + if (CRM_Core_Permission::check($permission)) { $accessAllowed[] = $componentInfo->componentID; } } @@ -282,8 +283,6 @@ class CRM_Report_Form_Activity extends CRM_Report_Form { ) + $this->addressFields(TRUE); if ($caseEnabled && CRM_Core_Permission::check('access all cases and activities')) { - $this->activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE); - $this->_columns['civicrm_activity']['filters']['activity_type_id']['options'] = $this->activityTypes; $this->_columns['civicrm_activity']['filters']['include_case_activities'] = array( 'name' => 'include_case_activities', 'title' => ts('Include Case Activities'), @@ -433,7 +432,7 @@ class CRM_Report_Form_Activity extends CRM_Report_Form { strstr($clause, 'civicrm_email_contact_target_email') || strstr($clause, 'civicrm_phone_contact_target_phone') ) { - $this->_selectClauses[$key] = "GROUP_CONCAT($clause SEPARATOR '; ') as $clause"; + $this->_selectClauses[$key] = "GROUP_CONCAT($clause SEPARATOR ';') as $clause"; } } } diff --git a/civicrm/CRM/Report/Form/Contribute/Lybunt.php b/civicrm/CRM/Report/Form/Contribute/Lybunt.php index b5703dcf01a1edcb2c70d79fd2b5d65f3ceab58a..3a3b2b92e927c75dd14e855afb976ee86b38140b 100644 --- a/civicrm/CRM/Report/Form/Contribute/Lybunt.php +++ b/civicrm/CRM/Report/Form/Contribute/Lybunt.php @@ -414,7 +414,13 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form { * @return string */ public function whereGroupClause($field, $value, $op) { - if (empty($this->contactTempTable)) { + if ($op == 'notin') { + // We do not have an optimisation for this scenario at this stage. Use + // parent. + return parent::whereGroupClause($field, $value, $op); + } + + if (empty($this->groupTempTable)) { $group = new CRM_Contact_DAO_Group(); $group->is_active = 1; $group->find(); @@ -656,10 +662,13 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form { * @return string */ public function buildQuery($applyLimit = TRUE) { + + // Calling where & select before FROM allows us to build temp tables to use in from. + $this->where(); $this->select(); $this->from(); $this->customDataFrom(empty($this->contactTempTable)); - $this->where(); + $this->groupBy(); $this->orderBy(); $this->getPermissionedFTQuery($this); diff --git a/civicrm/CRM/UF/Page/Field.php b/civicrm/CRM/UF/Page/Field.php index c2cec5186e358b8e81fd62277c4f1fbbecc868af..7fb6b880eb03be003ca612ccf13304570a35349e 100644 --- a/civicrm/CRM/UF/Page/Field.php +++ b/civicrm/CRM/UF/Page/Field.php @@ -125,8 +125,8 @@ class CRM_UF_Page_Field extends CRM_Core_Page { $isGroupReserved = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'is_reserved'); $this->assign('isGroupReserved', $isGroupReserved); - $profileType = CRM_Core_BAO_UFField::getProfileType($this->_gid); - if ($profileType == 'Contribution' || $profileType == 'Membership' || $profileType == 'Activity' || $profileType == 'Participant') { + $isMixedProfile = CRM_Core_BAO_UFField::checkProfileType($this->_gid); + if ($isMixedProfile) { $this->assign('skipCreate', TRUE); } diff --git a/civicrm/CRM/UF/Page/Group.php b/civicrm/CRM/UF/Page/Group.php index 273dfab8fae523f578faad0c67565838944f0a16..aa60dd5e571cc0fd0fd05d74ad498936c8ac96b6 100644 --- a/civicrm/CRM/UF/Page/Group.php +++ b/civicrm/CRM/UF/Page/Group.php @@ -351,10 +351,13 @@ class CRM_UF_Page_Group extends CRM_Core_Page { $groupTypes = self::extractGroupTypes($value['group_type']); // drop Create, Edit and View mode links if profile group_type is one of the following: - $groupComponents = array('Contribution', 'Membership', 'Activity', 'Participant', 'Case'); - $componentFound = array_intersect($groupComponents, array_keys($groupTypes)); - if (!empty($componentFound)) { + // Contribution, Membership, Activity, Participant, Case, Grant + $isMixedProfile = CRM_Core_BAO_UFField::checkProfileType($id); + if ($isMixedProfile) { $action -= CRM_Core_Action::ADD; + $action -= CRM_Core_Action::ADVANCED; + $action -= CRM_Core_Action::BASIC; + $action -= CRM_Core_Action::PROFILE; } $ufGroup[$id]['group_type'] = self::formatGroupTypes($groupTypes); diff --git a/civicrm/CRM/Upgrade/4.7.4.msg_template/civicrm_msg_template.tpl b/civicrm/CRM/Upgrade/4.7.4.msg_template/civicrm_msg_template.tpl new file mode 100644 index 0000000000000000000000000000000000000000..f66b9c78d17adc9458fe35840e5dead3b5b73d4b --- /dev/null +++ b/civicrm/CRM/Upgrade/4.7.4.msg_template/civicrm_msg_template.tpl @@ -0,0 +1,16 @@ +{php} + $dir = SMARTY_DIR . '/../../CRM/Upgrade/4.7.4.msg_template/message_templates'; + $templates = array(); + foreach (preg_grep('/\.tpl$/', scandir($dir)) as $filename) { + $parts = explode('_', basename($filename, '.tpl')); + $templates[] = array('type' => array_pop($parts), 'name' => implode('_', $parts), 'filename' => "$dir/$filename"); + } + $this->assign('templates', $templates); +{/php} + +{foreach from=$templates item=tpl} + {fetch assign=content file=$tpl.filename} + SELECT @workflow_id := MAX(id) FROM civicrm_option_value WHERE name = '{$tpl.name}'; + SELECT @content := msg_{$tpl.type} FROM civicrm_msg_template WHERE workflow_id = @workflow_id AND is_reserved = 1 LIMIT 1; + UPDATE civicrm_msg_template SET msg_{$tpl.type} = '{$content|escape:"quotes"}' WHERE workflow_id = @workflow_id AND (is_reserved = 1 OR (is_default = 1 AND msg_{$tpl.type} = @content)); +{/foreach} diff --git a/civicrm/CRM/Upgrade/4.7.4.msg_template/message_templates/event_offline_receipt_html.tpl b/civicrm/CRM/Upgrade/4.7.4.msg_template/message_templates/event_offline_receipt_html.tpl new file mode 100644 index 0000000000000000000000000000000000000000..f42bcc33fc03817b6dc575e385b46f602caf6680 --- /dev/null +++ b/civicrm/CRM/Upgrade/4.7.4.msg_template/message_templates/event_offline_receipt_html.tpl @@ -0,0 +1,527 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <title></title> +</head> +<body> + +{capture assign=headerStyle}colspan="2" style="text-align: left; padding: 4px; border-bottom: 1px solid #999; background-color: #eee;"{/capture} +{capture assign=labelStyle }style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture} +{capture assign=valueStyle }style="padding: 4px; border-bottom: 1px solid #999;"{/capture} + +<center> + <table width="620" border="0" cellpadding="0" cellspacing="0" id="crm-event_receipt" style="font-family: Arial, Verdana, sans-serif; text-align: left;"> + + <!-- BEGIN HEADER --> + <!-- You can add table row(s) here with logo or other header elements --> + <!-- END HEADER --> + + <!-- BEGIN CONTENT --> + + <tr> + <td> + <p>{contact.email_greeting}</p> + + {if $event.confirm_email_text AND (not $isOnWaitlist AND not $isRequireApproval)} + <p>{$event.confirm_email_text|htmlize}</p> + {/if} + + {if $isOnWaitlist} + <p>{ts}You have been added to the WAIT LIST for this event.{/ts}</p> + {if $isPrimary} + <p>{ts}If space becomes available you will receive an email with a link to a web page where you can complete your registration.{/ts}</p> + {/if} + {elseif $isRequireApproval} + <p>{ts}Your registration has been submitted.{/ts}</p> + {if $isPrimary} + <p>{ts}Once your registration has been reviewed, you will receive an email with a link to a web page where you can complete the registration process.{/ts}</p> + {/if} + {elseif $is_pay_later} + <p>{$pay_later_receipt}</p> {* FIXME: this might be text rather than HTML *} + {else} + <p>{ts}Please print this confirmation for your records.{/ts}</p> + {/if} + + </td> + </tr> + <tr> + <td> + <table style="border: 1px solid #999; margin: 1em 0em 1em; border-collapse: collapse; width:100%;"> + <tr> + <th {$headerStyle}> + {ts}Event Information and Location{/ts} + </th> + </tr> + <tr> + <td colspan="2" {$valueStyle}> + {$event.event_title}<br /> + {$event.event_start_date|crmDate}{if $event.event_end_date}-{if $event.event_end_date|date_format:"%Y%m%d" == $event.event_start_date|date_format:"%Y%m%d"}{$event.event_end_date|crmDate:0:1}{else}{$event.event_end_date|crmDate}{/if}{/if} + </td> + </tr> + + {if $event.participant_role neq 'Attendee' and $defaultRole} + <tr> + <td {$labelStyle}> + {ts}Participant Role{/ts} + </td> + <td {$valueStyle}> + {$event.participant_role} + </td> + </tr> + {/if} + + {if $isShowLocation} + <tr> + <td colspan="2" {$valueStyle}> + {if $location.address.1.name} + {$location.address.1.name}<br /> + {/if} + {if $location.address.1.street_address} + {$location.address.1.street_address}<br /> + {/if} + {if $location.address.1.supplemental_address_1} + {$location.address.1.supplemental_address_1}<br /> + {/if} + {if $location.address.1.supplemental_address_2} + {$location.address.1.supplemental_address_2}<br /> + {/if} + {if $location.address.1.city} + {$location.address.1.city} {$location.address.1.postal_code}{if $location.address.1.postal_code_suffix} - {$location.address.1.postal_code_suffix}{/if}<br /> + {/if} + </td> + </tr> + {/if} + + {if $location.phone.1.phone || $location.email.1.email} + <tr> + <td colspan="2" {$labelStyle}> + {ts}Event Contacts:{/ts} + </td> + </tr> + {foreach from=$location.phone item=phone} + {if $phone.phone} + <tr> + <td {$labelStyle}> + {if $phone.phone_type} + {$phone.phone_type_display} + {else} + {ts}Phone{/ts} + {/if} + </td> + <td {$valueStyle}> + {$phone.phone} {if $phone.phone_ext} {ts}ext.{/ts} {$phone.phone_ext}{/if} + </td> + </tr> + {/if} + {/foreach} + {foreach from=$location.email item=eventEmail} + {if $eventEmail.email} + <tr> + <td {$labelStyle}> + {ts}Email{/ts} + </td> + <td {$valueStyle}> + {$eventEmail.email} + </td> + </tr> + {/if} + {/foreach} + {/if} + + {if $event.is_public} + <tr> + <td colspan="2" {$valueStyle}> + {capture assign=icalFeed}{crmURL p='civicrm/event/ical' q="reset=1&id=`$event.id`" h=0 a=1 fe=1}{/capture} + <a href="{$icalFeed}">{ts}Download iCalendar File{/ts}</a> + </td> + </tr> + {/if} + + {if $email} + <tr> + <th {$headerStyle}> + {ts}Registered Email{/ts} + </th> + </tr> + <tr> + <td colspan="2" {$valueStyle}> + {$email} + </td> + </tr> + {/if} + + + {if $event.is_monetary} + + <tr> + <th {$headerStyle}> + {$event.fee_label} + </th> + </tr> + + {if $lineItem} + {foreach from=$lineItem item=value key=priceset} + {if $value neq 'skip'} + {if $isPrimary} + {if $lineItem|@count GT 1} {* Header for multi participant registration cases. *} + <tr> + <td colspan="2" {$labelStyle}> + {ts 1=$priceset+1}Participant %1{/ts} + </td> + </tr> + {/if} + {/if} + <tr> + <td colspan="2" {$valueStyle}> + <table> {* FIXME: style this table so that it looks like the text version (justification, etc.) *} + <tr> + <th>{ts}Item{/ts}</th> + <th>{ts}Qty{/ts}</th> + <th>{ts}Each{/ts}</th> + {if $dataArray} + <th>{ts}SubTotal{/ts}</th> + <th>{ts}Tax Rate{/ts}</th> + <th>{ts}Tax Amount{/ts}</th> + {/if} + <th>{ts}Total{/ts}</th> + {if $pricesetFieldsCount }<th>{ts}Total Participants{/ts}</th>{/if} + </tr> + {foreach from=$value item=line} + <tr> + <td> + {if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description}<div>{$line.description|truncate:30:"..."}</div>{/if} + </td> + <td> + {$line.qty} + </td> + <td> + {$line.unit_price|crmMoney} + </td> + {if $dataArray} + <td> + {$line.unit_price*$line.qty|crmMoney} + </td> + {if $line.tax_rate != "" || $line.tax_amount != ""} + <td> + {$line.tax_rate|string_format:"%.2f"}% + </td> + <td> + {$line.tax_amount|crmMoney} + </td> + {else} + <td></td> + <td></td> + {/if} + {/if} + <td> + {$line.line_total+$line.tax_amount|crmMoney} + </td> + {if $pricesetFieldsCount } + <td> + {$line.participant_count} + </td> + {/if} + </tr> + {/foreach} + </table> + </td> + </tr> + {/if} + {/foreach} + {if $dataArray} + <tr> + <td {$labelStyle}> + {ts}Amount Before Tax:{/ts} + </td> + <td {$valueStyle}> + {$totalAmount-$totalTaxAmount|crmMoney} + </td> + </tr> + {foreach from=$dataArray item=value key=priceset} + <tr> + {if $priceset || $priceset == 0} + <td> {$taxTerm} {$priceset|string_format:"%.2f"}%</td> + <td> {$value|crmMoney:$currency}</td> + {else} + <td> {ts}No{/ts} {$taxTerm}</td> + <td> {$value|crmMoney:$currency}</td> + {/if} + </tr> + {/foreach} + {/if} + {/if} + + {if $amount && !$lineItem} + {foreach from=$amount item=amnt key=level} + <tr> + <td colspan="2" {$valueStyle}> + {$amnt.amount|crmMoney} {$amnt.label} + </td> + </tr> + {/foreach} + {/if} + {if $totalTaxAmount} + <tr> + <td {$labelStyle}> + {ts}Total Tax Amount{/ts} + </td> + <td {$valueStyle}> + {$totalTaxAmount|crmMoney:$currency} + </td> + </tr> + {/if} + {if $isPrimary} + <tr> + <td {$labelStyle}> + {if $balanceAmount} + {ts}Total Paid{/ts} + {else} + {ts}Total Amount{/ts} + {/if} + </td> + <td {$valueStyle}> + {$totalAmount|crmMoney} {if $hookDiscount.message}({$hookDiscount.message}){/if} + </td> + </tr> + {if $balanceAmount} + <tr> + <td {$labelStyle}> + {ts}Balance{/ts} + </td> + <td {$valueStyle}> + {$balanceAmount|crmMoney} + </td> + </tr> + {/if} + {if $pricesetFieldsCount } + <tr> + <td {$labelStyle}> + {ts}Total Participants{/ts}</td> + <td {$valueStyle}> + {assign var="count" value= 0} + {foreach from=$lineItem item=pcount} + {assign var="lineItemCount" value=0} + {if $pcount neq 'skip'} + {foreach from=$pcount item=p_count} + {assign var="lineItemCount" value=$lineItemCount+$p_count.participant_count} + {/foreach} + {if $lineItemCount < 1 } + assign var="lineItemCount" value=1} + {/if} + {assign var="count" value=$count+$lineItemCount} + {/if} + {/foreach} + {$count} + </td> + </tr> + {/if} + {if $is_pay_later} + <tr> + <td colspan="2" {$labelStyle}> + {$pay_later_receipt} + </td> + </tr> + {/if} + + {if $register_date} + <tr> + <td {$labelStyle}> + {ts}Registration Date{/ts} + </td> + <td {$valueStyle}> + {$register_date|crmDate} + </td> + </tr> + {/if} + + {if $receive_date} + <tr> + <td {$labelStyle}> + {ts}Transaction Date{/ts} + </td> + <td {$valueStyle}> + {$receive_date|crmDate} + </td> + </tr> + {/if} + + {if $financialTypeName} + <tr> + <td {$labelStyle}> + {ts}Financial Type{/ts} + </td> + <td {$valueStyle}> + {$financialTypeName} + </td> + </tr> + {/if} + + {if $trxn_id} + <tr> + <td {$labelStyle}> + {ts}Transaction #{/ts} + </td> + <td {$valueStyle}> + {$trxn_id} + </td> + </tr> + {/if} + + {if $paidBy} + <tr> + <td {$labelStyle}> + {ts}Paid By{/ts} + </td> + <td {$valueStyle}> + {$paidBy} + </td> + </tr> + {/if} + + {if $checkNumber} + <tr> + <td {$labelStyle}> + {ts}Check Number{/ts} + </td> + <td {$valueStyle}> + {$checkNumber} + </td> + </tr> + {/if} + + {if $contributeMode ne 'notify' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval} + <tr> + <th {$headerStyle}> + {ts}Billing Name and Address{/ts} + </th> + </tr> + <tr> + <td colspan="2" {$valueStyle}> + {$billingName}<br /> + {$address|nl2br} + </td> + </tr> + {/if} + + {if $contributeMode eq 'direct' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval} + <tr> + <th {$headerStyle}> + {ts}Credit Card Information{/ts} + </th> + </tr> + <tr> + <td colspan="2" {$valueStyle}> + {$credit_card_type}<br /> + {$credit_card_number}<br /> + {ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate} + </td> + </tr> + {/if} + + {/if} + + {/if} {* End of conditional section for Paid events *} + + {if $customPre} + <tr> + <th {$headerStyle}> + {$customPre_grouptitle} + </th> + </tr> + {foreach from=$customPre item=value key=customName} + {if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields} + <tr> + <td {$labelStyle}> + {$customName} + </td> + <td {$valueStyle}> + {$value} + </td> + </tr> + {/if} + {/foreach} + {/if} + + {if $customPost} + <tr> + <th {$headerStyle}> + {$customPost_grouptitle} + </th> + </tr> + {foreach from=$customPost item=value key=customName} + {if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields} + <tr> + <td {$labelStyle}> + {$customName} + </td> + <td {$valueStyle}> + {$value} + </td> + </tr> + {/if} + {/foreach} + {/if} + + {if $customProfile} + {foreach from=$customProfile item=value key=customName} + <tr> + <th {$headerStyle}> + {ts 1=$customName+1}Participant Information - Participant %1{/ts} + </th> + </tr> + {foreach from=$value item=val key=field} + {if $field eq 'additionalCustomPre' or $field eq 'additionalCustomPost'} + <tr> + <td colspan="2" {$labelStyle}> + {if $field eq 'additionalCustomPre'} + {$additionalCustomPre_grouptitle} + {else} + {$additionalCustomPost_grouptitle} + {/if} + </td> + </tr> + {foreach from=$val item=v key=f} + <tr> + <td {$labelStyle}> + {$f} + </td> + <td {$valueStyle}> + {$v} + </td> + </tr> + {/foreach} + {/if} + {/foreach} + {/foreach} + {/if} + + {if $customGroup} + {foreach from=$customGroup item=value key=customName} + <tr> + <th {$headerStyle}> + {$customName} + </th> + </tr> + {foreach from=$value item=v key=n} + <tr> + <td {$labelStyle}> + {$n} + </td> + <td {$valueStyle}> + {$v} + </td> + </tr> + {/foreach} + {/foreach} + {/if} + + </table> + </td> + </tr> + + </table> +</center> + +</body> +</html> diff --git a/civicrm/CRM/Upgrade/4.7.4.msg_template/message_templates/event_offline_receipt_text.tpl b/civicrm/CRM/Upgrade/4.7.4.msg_template/message_templates/event_offline_receipt_text.tpl new file mode 100644 index 0000000000000000000000000000000000000000..678fa7b5b7e7a7cd27edbf96d08dfe118bd38ca7 --- /dev/null +++ b/civicrm/CRM/Upgrade/4.7.4.msg_template/message_templates/event_offline_receipt_text.tpl @@ -0,0 +1,304 @@ +{contact.email_greeting} +{if $event.confirm_email_text AND (not $isOnWaitlist AND not $isRequireApproval)} +{$event.confirm_email_text} +{/if} + +{if $isOnWaitlist} +==========================================================={if $pricesetFieldsCount }===================={/if} + +{ts}You have been added to the WAIT LIST for this event.{/ts} + +{if $isPrimary} +{ts}If space becomes available you will receive an email with a link to a web page where you can complete your registration.{/ts} + +{/if} +==========================================================={if $pricesetFieldsCount }===================={/if} + +{elseif $isRequireApproval} +==========================================================={if $pricesetFieldsCount }===================={/if} + +{ts}Your registration has been submitted.{/ts} + +{if $isPrimary} +{ts}Once your registration has been reviewed, you will receive an email with a link to a web page where you can complete the registration process.{/ts} + +{/if} +==========================================================={if $pricesetFieldsCount }===================={/if} + +{elseif $is_pay_later} + +==========================================================={if $pricesetFieldsCount }===================={/if} + +{$pay_later_receipt} +==========================================================={if $pricesetFieldsCount }===================={/if} + +{else} + +{ts}Please print this confirmation for your records.{/ts} +{/if} + + +==========================================================={if $pricesetFieldsCount }===================={/if} + +{ts}Event Information and Location{/ts} + +==========================================================={if $pricesetFieldsCount }===================={/if} + +{$event.event_title} +{$event.event_start_date|crmDate}{if $event.event_end_date}-{if $event.event_end_date|date_format:"%Y%m%d" == $event.event_start_date|date_format:"%Y%m%d"}{$event.event_end_date|crmDate:0:1}{else}{$event.event_end_date|crmDate}{/if}{/if} + +{if $event.participant_role neq 'Attendee' and $defaultRole} +{ts}Participant Role{/ts}: {$event.participant_role} +{/if} + +{if $isShowLocation} +{if $location.address.1.name} + +{$location.address.1.name} +{/if} +{if $location.address.1.street_address}{$location.address.1.street_address} +{/if} +{if $location.address.1.supplemental_address_1}{$location.address.1.supplemental_address_1} +{/if} +{if $location.address.1.supplemental_address_2}{$location.address.1.supplemental_address_2} +{/if} +{if $location.address.1.city}{$location.address.1.city} {$location.address.1.postal_code}{if $location.address.1.postal_code_suffix} - {$location.address.1.postal_code_suffix}{/if} +{/if} + +{/if}{*End of isShowLocation condition*} + +{if $location.phone.1.phone || $location.email.1.email} + +{ts}Event Contacts:{/ts} +{foreach from=$location.phone item=phone} +{if $phone.phone} + +{if $phone.phone_type}{$phone.phone_type_display}{else}{ts}Phone{/ts}{/if}: {$phone.phone}{/if} {if $phone.phone_ext} {ts}ext.{/ts} {$phone.phone_ext}{/if} +{/foreach} +{foreach from=$location.email item=eventEmail} +{if $eventEmail.email} + +{ts}Email{/ts}: {$eventEmail.email}{/if}{/foreach} +{/if} + +{if $event.is_public} +{capture assign=icalFeed}{crmURL p='civicrm/event/ical' q="reset=1&id=`$event.id`" h=0 a=1 fe=1}{/capture} +{ts}Download iCalendar File:{/ts} {$icalFeed} +{/if} + +{if $email} + +==========================================================={if $pricesetFieldsCount }===================={/if} + +{ts}Registered Email{/ts} + +==========================================================={if $pricesetFieldsCount }===================={/if} + +{$email} +{/if} +{if $event.is_monetary} {* This section for Paid events only.*} + +==========================================================={if $pricesetFieldsCount }===================={/if} + +{$event.fee_label} +==========================================================={if $pricesetFieldsCount }===================={/if} + +{if $lineItem}{foreach from=$lineItem item=value key=priceset} + +{if $value neq 'skip'} +{if $isPrimary} +{if $lineItem|@count GT 1} {* Header for multi participant registration cases. *} +{ts 1=$priceset+1}Participant %1{/ts} +{/if} +{/if} +---------------------------------------------------------{if $pricesetFieldsCount }--------------------{/if} + +{capture assign=ts_item}{ts}Item{/ts}{/capture} +{capture assign=ts_qty}{ts}Qty{/ts}{/capture} +{capture assign=ts_each}{ts}Each{/ts}{/capture} +{if $dataArray} +{capture assign=ts_subtotal}{ts}Subtotal{/ts}{/capture} +{capture assign=ts_taxRate}{ts}Tax Rate{/ts}{/capture} +{capture assign=ts_taxAmount}{ts}Tax Amount{/ts}{/capture} +{/if} +{capture assign=ts_total}{ts}Total{/ts}{/capture} +{capture assign=ts_participant_total}{if $pricesetFieldsCount }{ts}Total Participants{/ts}{/if}{/capture} +{$ts_item|string_format:"%-30s"} {$ts_qty|string_format:"%5s"} {$ts_each|string_format:"%10s"} {if $dataArray} {$ts_subtotal|string_format:"%10s"} {$ts_taxRate|string_format:"%10s"} {$ts_taxAmount|string_format:"%10s"} {/if} {$ts_total|string_format:"%10s"} {$ts_participant_total|string_format:"%10s"} +----------------------------------------------------------{if $pricesetFieldsCount }--------------------{/if} + +{foreach from=$value item=line} +{if $pricesetFieldsCount }{capture assign=ts_participant_count}{$line.participant_count}{/capture}{/if} +{capture assign=ts_item}{if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description} {$line.description}{/if}{/capture}{$ts_item|truncate:30:"..."|string_format:"%-30s"} {$line.qty|string_format:"%5s"} {$line.unit_price|crmMoney|string_format:"%10s"} {if $dataArray} {$line.unit_price*$line.qty|crmMoney:$currency|string_format:"%10s"} {if $line.tax_rate != "" || $line.tax_amount != ""} {$line.tax_rate|string_format:"%.2f"} % {$line.tax_amount|crmMoney:$currency|string_format:"%10s"} {else} {/if} {/if} {$line.line_total+$line.tax_amount|crmMoney|string_format:"%10s"} {$ts_participant_count|string_format:"%10s"} +{/foreach} +{/if} +{/foreach} + +{if $dataArray} +{ts}Amount before Tax{/ts}: {$totalAmount-$totalTaxAmount|crmMoney:$currency} + +{foreach from=$dataArray item=value key=priceset} +{if $priceset || $priceset == 0} +{$taxTerm} {$priceset|string_format:"%.2f"}%: {$value|crmMoney:$currency} +{else} +{ts}No{/ts} {$taxTerm}: {$value|crmMoney:$currency} +{/if} +{/foreach} +{/if} +{/if} + +{if $amount && !$lineItem} +{foreach from=$amount item=amnt key=level}{$amnt.amount|crmMoney} {$amnt.label} +{/foreach} +{/if} + +{if $totalTaxAmount} +{ts}Total Tax Amount{/ts}: {$totalTaxAmount|crmMoney:$currency} +{/if} +{if $isPrimary} + +{if $balanceAmount}{ts}Total Paid{/ts}{else}{ts}Total Amount{/ts}{/if}: {$totalAmount|crmMoney} {if $hookDiscount.message}({$hookDiscount.message}){/if} + +{if $balanceAmount} +{ts}Balance{/ts}: {$balanceAmount|crmMoney} +{/if} + +{if $pricesetFieldsCount } + {assign var="count" value= 0} + {foreach from=$lineItem item=pcount} + {assign var="lineItemCount" value=0} + {if $pcount neq 'skip'} + {foreach from=$pcount item=p_count} + {assign var="lineItemCount" value=$lineItemCount+$p_count.participant_count} + {/foreach} + {if $lineItemCount < 1 } + {assign var="lineItemCount" value=1} + {/if} + {assign var="count" value=$count+$lineItemCount} + {/if} + {/foreach} + +{ts}Total Participants{/ts}: {$count} +{/if} + +{if $is_pay_later } + +==========================================================={if $pricesetFieldsCount }===================={/if} + +{$pay_later_receipt} +==========================================================={if $pricesetFieldsCount }===================={/if} + +{/if} + +{if $register_date} +{ts}Registration Date{/ts}: {$register_date|crmDate} +{/if} +{if $receive_date} +{ts}Transaction Date{/ts}: {$receive_date|crmDate} +{/if} +{if $financialTypeName} +{ts}Financial Type{/ts}: {$financialTypeName} +{/if} +{if $trxn_id} +{ts}Transaction #{/ts}: {$trxn_id} +{/if} +{if $paidBy} +{ts}Paid By{/ts}: {$paidBy} +{/if} +{if $checkNumber} +{ts}Check Number{/ts}: {$checkNumber} +{/if} +{if $contributeMode ne 'notify' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval} + +==========================================================={if $pricesetFieldsCount }===================={/if} + +{ts}Billing Name and Address{/ts} + +==========================================================={if $pricesetFieldsCount }===================={/if} + +{$billingName} +{$address} +{/if} + +{if $contributeMode eq 'direct' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval} +=========================================================== +{ts}Credit Card Information{/ts} + +==========================================================={if $pricesetFieldsCount }===================={/if} + +{$credit_card_type} +{$credit_card_number} +{ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate} +{/if} +{/if} +{/if} {* End of conditional section for Paid events *} + +{if $customPre} +==========================================================={if $pricesetFieldsCount }===================={/if} + +{$customPre_grouptitle} +==========================================================={if $pricesetFieldsCount }===================={/if} + +{foreach from=$customPre item=value key=customName} +{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields} +{$customName}: {$value} +{/if} +{/foreach} +{/if} + +{if $customPost} +==========================================================={if $pricesetFieldsCount }===================={/if} + +{$customPost_grouptitle} +==========================================================={if $pricesetFieldsCount }===================={/if} + +{foreach from=$customPost item=value key=customName} +{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields} +{$customName}: {$value} +{/if} +{/foreach} +{/if} +{if $customProfile} + +{foreach from=$customProfile item=value key=customName} +==========================================================={if $pricesetFieldsCount }===================={/if} + +{ts 1=$customName+1}Participant Information - Participant %1{/ts} + +==========================================================={if $pricesetFieldsCount }===================={/if} + +{foreach from=$value item=val key=field} +{if $field eq 'additionalCustomPre' or $field eq 'additionalCustomPost' } +{if $field eq 'additionalCustomPre' } +----------------------------------------------------------{if $pricesetFieldsCount }--------------------{/if} + +{$additionalCustomPre_grouptitle} +----------------------------------------------------------{if $pricesetFieldsCount }--------------------{/if} + +{else} +----------------------------------------------------------{if $pricesetFieldsCount }--------------------{/if} + +{$additionalCustomPost_grouptitle} +----------------------------------------------------------{if $pricesetFieldsCount }--------------------{/if} + +{/if} +{foreach from=$val item=v key=f} +{$f}: {$v} +{/foreach} +{/if} +{/foreach} +{/foreach} +{/if} +{if $customGroup} +{foreach from=$customGroup item=value key=customName} +=========================================================={if $pricesetFieldsCount }===================={/if} + +{$customName} +=========================================================={if $pricesetFieldsCount }===================={/if} + +{foreach from=$value item=v key=n} +{$n}: {$v} +{/foreach} +{/foreach} +{/if} + + diff --git a/civicrm/CRM/Upgrade/4.7.4.msg_template/message_templates/event_online_receipt_html.tpl b/civicrm/CRM/Upgrade/4.7.4.msg_template/message_templates/event_online_receipt_html.tpl new file mode 100644 index 0000000000000000000000000000000000000000..90d93bb5fbab9b2a793cc304db026e096a25a247 --- /dev/null +++ b/civicrm/CRM/Upgrade/4.7.4.msg_template/message_templates/event_online_receipt_html.tpl @@ -0,0 +1,526 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <title></title> +</head> +<body> + +{capture assign=headerStyle}colspan="2" style="text-align: left; padding: 4px; border-bottom: 1px solid #999; background-color: #eee;"{/capture} +{capture assign=labelStyle }style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture} +{capture assign=valueStyle }style="padding: 4px; border-bottom: 1px solid #999;"{/capture} +{capture assign=tdfirstStyle}style="width: 180px; padding-bottom: 15px;"{/capture} +{capture assign=tdStyle}style="width: 100px;"{/capture} +{capture assign=participantTotal}style="margin: 0.5em 0 0.5em;padding: 0.5em;background-color: #999999;font-weight: bold;color: #FAFAFA;border-radius: 2px;"{/capture} + + +<center> + <table width="700" border="0" cellpadding="0" cellspacing="0" id="crm-event_receipt" style="font-family: Arial, Verdana, sans-serif; text-align: left;"> + + <!-- BEGIN HEADER --> + <!-- You can add table row(s) here with logo or other header elements --> + <!-- END HEADER --> + + <!-- BEGIN CONTENT --> + + <tr> + <td> + <p>{contact.email_greeting},</p> + + {if $event.confirm_email_text AND (not $isOnWaitlist AND not $isRequireApproval)} + <p>{$event.confirm_email_text|htmlize}</p> + + {else} + <p>Thank you for your participation. This letter is a confirmation that your registration has been received and your status has been updated to <strong>{if $participant_status}{$participant_status}{else}{if $isOnWaitlist}waitlisted{else}registered{/if}{/if}</strong>.</p> + + {/if} + + <p> + {if $isOnWaitlist} + <p>{ts}You have been added to the WAIT LIST for this event.{/ts}</p> + {if $isPrimary} + <p>{ts}If space becomes available you will receive an email with a link to a web page where you can complete your registration.{/ts}</p> + {/if} + {elseif $isRequireApproval} + <p>{ts}Your registration has been submitted.{/ts}</p> + {if $isPrimary} + <p>{ts}Once your registration has been reviewed, you will receive an email with a link to a web page where you can complete the registration process.{/ts}</p> + {/if} + {elseif $is_pay_later && !$isAmountzero && !$isAdditionalParticipant} + <p>{$pay_later_receipt}</p> {* FIXME: this might be text rather than HTML *} + {else} + <p>{ts}Please print this confirmation for your records.{/ts}</p> + {/if} + + </td> + </tr> + <tr> + <td> + <table width="700" style="border: 1px solid #999; margin: 1em 0em 1em; border-collapse: collapse;"> + <tr> + <th {$headerStyle}> + {ts}Event Information and Location{/ts} + </th> + </tr> + <tr> + <td colspan="2" {$valueStyle}> + {$event.event_title}<br /> + {$event.event_start_date|date_format:"%A"} {$event.event_start_date|crmDate}{if $event.event_end_date}-{if $event.event_end_date|date_format:"%Y%m%d" == $event.event_start_date|date_format:"%Y%m%d"}{$event.event_end_date|crmDate:0:1}{else}{$event.event_end_date|date_format:"%A"} {$event.event_end_date|crmDate}{/if}{/if} + </td> + </tr> + + + {if $conference_sessions} + <tr> + <td colspan="2" {$labelStyle}> + {ts}Your schedule:{/ts} + </td> + </tr> + <tr> + <td colspan="2" {$valueStyle}> + {assign var='group_by_day' value='NA'} + {foreach from=$conference_sessions item=session} + {if $session.start_date|date_format:"%Y/%m/%d" != $group_by_day|date_format:"%Y/%m/%d"} + {assign var='group_by_day' value=$session.start_date} + <em>{$group_by_day|date_format:"%m/%d/%Y"}</em><br /> + {/if} + {$session.start_date|crmDate:0:1}{if $session.end_date}-{$session.end_date|crmDate:0:1}{/if} {$session.title}<br /> + {if $session.location} {$session.location}<br />{/if} + {/foreach} + </td> + </tr> + {/if} + + {if $event.participant_role neq 'Attendee' and $defaultRole} + <tr> + <td {$labelStyle}> + {ts}Participant Role{/ts} + </td> + <td {$valueStyle}> + {$event.participant_role} + </td> + </tr> + {/if} + + {if $isShowLocation} + <tr> + <td colspan="2" {$valueStyle}> + {if $location.address.1.name} + {$location.address.1.name}<br /> + {/if} + {if $location.address.1.street_address} + {$location.address.1.street_address}<br /> + {/if} + {if $location.address.1.supplemental_address_1} + {$location.address.1.supplemental_address_1}<br /> + {/if} + {if $location.address.1.supplemental_address_2} + {$location.address.1.supplemental_address_2}<br /> + {/if} + {if $location.address.1.city} + {$location.address.1.city}, {$location.address.1.state_province} {$location.address.1.postal_code}{if $location.address.1.postal_code_suffix} - {$location.address.1.postal_code_suffix}{/if}<br /> + {/if} + </td> + </tr> + {/if} + + {if $location.phone.1.phone || $location.email.1.email} + <tr> + <td colspan="2" {$labelStyle}> + {ts}Event Contacts:{/ts} + </td> + </tr> + {foreach from=$location.phone item=phone} + {if $phone.phone} + <tr> + <td {$labelStyle}> + {if $phone.phone_type} + {$phone.phone_type_display} + {else} + {ts}Phone{/ts} + {/if} + </td> + <td {$valueStyle}> + {$phone.phone} {if $phone.phone_ext} {ts}ext.{/ts} {$phone.phone_ext}{/if} + </td> + </tr> + {/if} + {/foreach} + {foreach from=$location.email item=eventEmail} + {if $eventEmail.email} + <tr> + <td {$labelStyle}> + {ts}Email{/ts} + </td> + <td {$valueStyle}> + {$eventEmail.email} + </td> + </tr> + {/if} + {/foreach} + {/if} + + {if $event.is_public} + <tr> + <td colspan="2" {$valueStyle}> + {capture assign=icalFeed}{crmURL p='civicrm/event/ical' q="reset=1&id=`$event.id`" h=0 a=1 fe=1}{/capture} + <a href="{$icalFeed}">{ts}Download iCalendar File{/ts}</a> + </td> + </tr> + {/if} + + {if $event.is_share} + <tr> + <td colspan="2" {$valueStyle}> + {capture assign=eventUrl}{crmURL p='civicrm/event/info' q="id=`$event.id`&reset=1" a=true fe=1 h=1}{/capture} + {include file="CRM/common/SocialNetwork.tpl" emailMode=true url=$eventUrl title=$event.title pageURL=$eventUrl} + </td> + </tr> + {/if} + {if $payer.name} + <tr> + <th {$headerStyle}> + {ts}You were registered by:{/ts} + </th> + </tr> + <tr> + <td colspan="2" {$valueStyle}> + {$payer.name} + </td> + </tr> + {/if} + {if $event.is_monetary} + + <tr> + <th {$headerStyle}> + {$event.fee_label} + </th> + </tr> + + {if $lineItem} + {foreach from=$lineItem item=value key=priceset} + {if $value neq 'skip'} + {if $isPrimary} + {if $lineItem|@count GT 1} {* Header for multi participant registration cases. *} + <tr> + <td colspan="2" {$labelStyle}> + {ts 1=$priceset+1}Participant %1{/ts} {$part.$priceset.info} + </td> + </tr> + {/if} + {/if} + <tr> + <td colspan="2" {$valueStyle}> + <table> {* FIXME: style this table so that it looks like the text version (justification, etc.) *} + <tr> + <th>{ts}Item{/ts}</th> + <th>{ts}Qty{/ts}</th> + <th>{ts}Each{/ts}</th> + {if $dataArray} + <th>{ts}SubTotal{/ts}</th> + <th>{ts}Tax Rate{/ts}</th> + <th>{ts}Tax Amount{/ts}</th> + {/if} + <th>{ts}Total{/ts}</th> + {if $pricesetFieldsCount }<th>{ts}Total Participants{/ts}</th>{/if} + </tr> + {foreach from=$value item=line} + <tr> + <td {$tdfirstStyle}> + {if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description}<div>{$line.description|truncate:30:"..."}</div>{/if} + </td> + <td {$tdStyle} align="middle"> + {$line.qty} + </td> + <td {$tdStyle}> + {$line.unit_price|crmMoney:$currency} + </td> + {if $dataArray} + <td {$tdStyle}> + {$line.unit_price*$line.qty|crmMoney} + </td> + {if $line.tax_rate != "" || $line.tax_amount != ""} + <td {$tdStyle}> + {$line.tax_rate|string_format:"%.2f"}% + </td> + <td {$tdStyle}> + {$line.tax_amount|crmMoney} + </td> + {else} + <td></td> + <td></td> + {/if} + {/if} + <td {$tdStyle}> + {$line.line_total+$line.tax_amount|crmMoney:$currency} + </td> + {if $pricesetFieldsCount }<td {$tdStyle}>{$line.participant_count}</td> {/if} + </tr> + {/foreach} + {if $individual} + <tr {$participantTotal}> + <td colspan=3>{ts}Participant Total{/ts}</td> + <td colspan=2>{$individual.$priceset.totalAmtWithTax-$individual.$priceset.totalTaxAmt|crmMoney}</td> + <td colspan=1>{$individual.$priceset.totalTaxAmt|crmMoney}</td> + <td colspan=2>{$individual.$priceset.totalAmtWithTax|crmMoney}</td> + </tr> + {/if} + </table> + </td> + </tr> + {/if} + {/foreach} + {if $dataArray} + <tr> + <td {$labelStyle}> + {ts} Amount Before Tax: {/ts} + </td> + <td {$valueStyle}> + {$totalAmount-$totalTaxAmount|crmMoney} + </td> + </tr> + {foreach from=$dataArray item=value key=priceset} + <tr> + {if $priceset || $priceset == 0} + <td> {$taxTerm} {$priceset|string_format:"%.2f"}%</td> + <td> {$value|crmMoney:$currency}</td> + {else} + <td> {ts}No{/ts} {$taxTerm}</td> + <td> {$value|crmMoney:$currency}</td> + {/if} + </tr> + {/foreach} + {/if} + {/if} + + {if $amounts && !$lineItem} + {foreach from=$amounts item=amnt key=level} + <tr> + <td colspan="2" {$valueStyle}> + {$amnt.amount|crmMoney:$currency} {$amnt.label} + </td> + </tr> + {/foreach} + {/if} + + {if $totalTaxAmount} + <tr> + <td {$labelStyle}> + {ts}Total Tax Amount{/ts} + </td> + <td {$valueStyle}> + {$totalTaxAmount|crmMoney:$currency} + </td> + </tr> + {/if} + {if $isPrimary} + <tr> + <td {$labelStyle}> + {ts}Total Amount{/ts} + </td> + <td {$valueStyle}> + {$totalAmount|crmMoney:$currency} {if $hookDiscount.message}({$hookDiscount.message}){/if} + </td> + </tr> + {if $pricesetFieldsCount } + <tr> + <td {$labelStyle}> + {ts}Total Participants{/ts}</td> + <td {$valueStyle}> + {assign var="count" value= 0} + {foreach from=$lineItem item=pcount} + {assign var="lineItemCount" value=0} + {if $pcount neq 'skip'} + {foreach from=$pcount item=p_count} + {assign var="lineItemCount" value=$lineItemCount+$p_count.participant_count} + {/foreach} + {if $lineItemCount < 1 } + {assign var="lineItemCount" value=1} + {/if} + {assign var="count" value=$count+$lineItemCount} + {/if} + {/foreach} + {$count} + </td> </tr> + {/if} + + {if $register_date} + <tr> + <td {$labelStyle}> + {ts}Registration Date{/ts} + </td> + <td {$valueStyle}> + {$register_date|crmDate} + </td> + </tr> + {/if} + + {if $receive_date} + <tr> + <td {$labelStyle}> + {ts}Transaction Date{/ts} + </td> + <td {$valueStyle}> + {$receive_date|crmDate} + </td> + </tr> + {/if} + + {if $financialTypeName} + <tr> + <td {$labelStyle}> + {ts}Financial Type{/ts} + </td> + <td {$valueStyle}> + {$financialTypeName} + </td> + </tr> + {/if} + + {if $trxn_id} + <tr> + <td {$labelStyle}> + {ts}Transaction #{/ts} + </td> + <td {$valueStyle}> + {$trxn_id} + </td> + </tr> + {/if} + + {if $paidBy} + <tr> + <td {$labelStyle}> + {ts}Paid By{/ts} + </td> + <td {$valueStyle}> + {$paidBy} + </td> + </tr> + {/if} + + {if $checkNumber} + <tr> + <td {$labelStyle}> + {ts}Check Number{/ts} + </td> + <td {$valueStyle}> + {$checkNumber} + </td> + </tr> + {/if} + + {if $contributeMode ne 'notify' and !$isAmountzero and (!$is_pay_later or $isBillingAddressRequiredForPayLater) and !$isOnWaitlist and !$isRequireApproval} + <tr> + <th {$headerStyle}> + {ts}Billing Name and Address{/ts} + </th> + </tr> + <tr> + <td colspan="2" {$valueStyle}> + {$billingName}<br /> + {$address|nl2br} + </td> + </tr> + {/if} + + {if $contributeMode eq 'direct' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval} + <tr> + <th {$headerStyle}> + {ts}Credit Card Information{/ts} + </th> + </tr> + <tr> + <td colspan="2" {$valueStyle}> + {$credit_card_type}<br /> + {$credit_card_number}<br /> + {ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate} + </td> + </tr> + {/if} + + {/if} + + {/if} {* End of conditional section for Paid events *} + + +{if $customPre} +{foreach from=$customPre item=customPr key=i} + <tr> <th {$headerStyle}>{$customPre_grouptitle.$i}</th></tr> + {foreach from=$customPr item=customValue key=customName} + {if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields} + <tr> + <td {$labelStyle}>{$customName}</td> + <td {$valueStyle}>{$customValue}</td> + </tr> + {/if} + {/foreach} +{/foreach} +{/if} + +{if $customPost} +{foreach from=$customPost item=customPos key=j} + <tr> <th {$headerStyle}>{$customPost_grouptitle.$j}</th></tr> + {foreach from=$customPos item=customValue key=customName} + {if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields} + <tr> + <td {$labelStyle}>{$customName}</td> + <td {$valueStyle}>{$customValue}</td> + </tr> +{/if} +{/foreach} +{/foreach} +{/if} + +{if $customProfile} +{foreach from=$customProfile.profile item=eachParticipant key=participantID} + <tr><th {$headerStyle}>{ts 1=$participantID+2}Participant %1{/ts} </th></tr> + {foreach from=$eachParticipant item=eachProfile key=pid} + <tr><th {$headerStyle}>{$customProfile.title.$pid}</th></tr> + {foreach from=$eachProfile item=val key=field} + <tr>{foreach from=$val item=v key=f} + <td {$labelStyle}>{$field}</td> + <td {$valueStyle}>{$v}</td> + {/foreach} + </tr> + {/foreach} +{/foreach} +{/foreach} +{/if} + + {if $customGroup} + {foreach from=$customGroup item=value key=customName} + <tr> + <th {$headerStyle}> + {$customName} + </th> + </tr> + {foreach from=$value item=v key=n} + <tr> + <td {$labelStyle}> + {$n} + </td> + <td {$valueStyle}> + {$v} + </td> + </tr> + {/foreach} + {/foreach} + {/if} + </table> + {if $event.allow_selfcancelxfer } + <tr> + <td colspan="2" {$valueStyle}> + {ts 1=$event.selfcancelxfer_time}You may transfer your registration to another participant or cancel your registration up to %1 hours before the event.{/ts} {if $totalAmount}{ts}Cancellations are not refundable.{/ts}{/if}<br /> + {capture assign=selfService}{crmURL p='civicrm/event/selfsvcupdate' q="reset=1&pid=`$participant.id`&{contact.checksum}" h=0 a=1 fe=1}{/capture} + <a href="{$selfService}">{ts}Click here to transfer or cancel your registration.{/ts}</a> + </td> + </tr> + {/if} + </td> + </tr> + </table> +</center> + +</body> +</html> diff --git a/civicrm/CRM/Upgrade/4.7.4.msg_template/message_templates/event_online_receipt_text.tpl b/civicrm/CRM/Upgrade/4.7.4.msg_template/message_templates/event_online_receipt_text.tpl new file mode 100644 index 0000000000000000000000000000000000000000..e5a9c23f22b36109c8158c6661ab52cd386f396e --- /dev/null +++ b/civicrm/CRM/Upgrade/4.7.4.msg_template/message_templates/event_online_receipt_text.tpl @@ -0,0 +1,311 @@ +{contact.email_greeting}, + +{if $event.confirm_email_text AND (not $isOnWaitlist AND not $isRequireApproval)} +{$event.confirm_email_text} + +{else} +Thank you for your participation. This letter is a confirmation that your registration has been received and your status has been updated to {if $participant_status}{$participant_status}{else}{if $isOnWaitlist}waitlisted{else}registered{/if}{/if}. + +{/if} + +{if $isOnWaitlist} +==========================================================={if $pricesetFieldsCount }===================={/if} + +{ts}You have been added to the WAIT LIST for this event.{/ts} + +{if $isPrimary} +{ts}If space becomes available you will receive an email with a link to a web page where you can complete your registration.{/ts} +{/if} +==========================================================={if $pricesetFieldsCount }===================={/if} + +{elseif $isRequireApproval} +==========================================================={if $pricesetFieldsCount }===================={/if} + +{ts}Your registration has been submitted.{/ts} + +{if $isPrimary} +{ts}Once your registration has been reviewed, you will receive an email with a link to a web page where you can complete the registration process.{/ts} + +{/if} +==========================================================={if $pricesetFieldsCount }===================={/if} + +{elseif $is_pay_later && !$isAmountzero && !$isAdditionalParticipant} + +==========================================================={if $pricesetFieldsCount }===================={/if} + +{$pay_later_receipt} +==========================================================={if $pricesetFieldsCount }===================={/if} + +{else} + +{ts}Please print this confirmation for your records.{/ts} +{/if} + + +==========================================================={if $pricesetFieldsCount }===================={/if} + +{ts}Event Information and Location{/ts} + +==========================================================={if $pricesetFieldsCount }===================={/if} + +{$event.event_title} +{$event.event_start_date|date_format:"%A"} {$event.event_start_date|crmDate}{if $event.event_end_date}-{if $event.event_end_date|date_format:"%Y%m%d" == $event.event_start_date|date_format:"%Y%m%d"}{$event.event_end_date|crmDate:0:1}{else}{$event.event_end_date|date_format:"%A"} {$event.event_end_date|crmDate}{/if}{/if} +{if $conference_sessions} + + +{ts}Your schedule:{/ts} +{assign var='group_by_day' value='NA'} +{foreach from=$conference_sessions item=session} +{if $session.start_date|date_format:"%Y/%m/%d" != $group_by_day|date_format:"%Y/%m/%d"} +{assign var='group_by_day' value=$session.start_date} + +{$group_by_day|date_format:"%m/%d/%Y"} + + +{/if} +{$session.start_date|crmDate:0:1}{if $session.end_date}-{$session.end_date|crmDate:0:1}{/if} {$session.title} +{if $session.location} {$session.location}{/if} +{/foreach} +{/if} + +{if $event.participant_role neq 'Attendee' and $defaultRole} +{ts}Participant Role{/ts}: {$event.participant_role} +{/if} + +{if $isShowLocation} +{if $location.address.1.name} + +{$location.address.1.name} +{/if} +{if $location.address.1.street_address}{$location.address.1.street_address} +{/if} +{if $location.address.1.supplemental_address_1}{$location.address.1.supplemental_address_1} +{/if} +{if $location.address.1.supplemental_address_2}{$location.address.1.supplemental_address_2} +{/if} +{if $location.address.1.city}{$location.address.1.city}, {$location.address.1.state_province} {$location.address.1.postal_code}{if $location.address.1.postal_code_suffix} - {$location.address.1.postal_code_suffix}{/if} +{/if} + +{/if}{*End of isShowLocation condition*} + +{if $location.phone.1.phone || $location.email.1.email} + +{ts}Event Contacts:{/ts} +{foreach from=$location.phone item=phone} +{if $phone.phone} + +{if $phone.phone_type}{$phone.phone_type_display}{else}{ts}Phone{/ts}{/if}: {$phone.phone}{/if} {if $phone.phone_ext} {ts}ext.{/ts} {$phone.phone_ext}{/if} +{/foreach} +{foreach from=$location.email item=eventEmail} +{if $eventEmail.email} + +{ts}Email{/ts}: {$eventEmail.email}{/if}{/foreach} +{/if} + +{if $event.is_public} +{capture assign=icalFeed}{crmURL p='civicrm/event/ical' q="reset=1&id=`$event.id`" h=0 a=1 fe=1}{/capture} +{ts}Download iCalendar File:{/ts} {$icalFeed} +{/if} + +{if $payer.name} +You were registered by: {$payer.name} +{/if} +{if $event.is_monetary} {* This section for Paid events only.*} + +==========================================================={if $pricesetFieldsCount }===================={/if} + +{$event.fee_label} +==========================================================={if $pricesetFieldsCount }===================={/if} + +{if $lineItem}{foreach from=$lineItem item=value key=priceset} + +{if $value neq 'skip'} +{if $isPrimary} +{if $lineItem|@count GT 1} {* Header for multi participant registration cases. *} +{ts 1=$priceset+1}Participant %1{/ts} {$part.$priceset.info} + +{/if} +{/if} +-----------------------------------------------------------{if $pricesetFieldsCount }-----------------------------------------------------{/if} + +{capture assign=ts_item}{ts}Item{/ts}{/capture} +{capture assign=ts_qty}{ts}Qty{/ts}{/capture} +{capture assign=ts_each}{ts}Each{/ts}{/capture} +{if $dataArray} +{capture assign=ts_subtotal}{ts}Subtotal{/ts}{/capture} +{capture assign=ts_taxRate}{ts}Tax Rate{/ts}{/capture} +{capture assign=ts_taxAmount}{ts}Tax Amount{/ts}{/capture} +{/if} +{capture assign=ts_total}{ts}Total{/ts}{/capture} +{if $pricesetFieldsCount }{capture assign=ts_participant_total}{ts}Total Participants{/ts}{/capture}{/if} +{$ts_item|string_format:"%-30s"} {$ts_qty|string_format:"%5s"} {$ts_each|string_format:"%10s"} {if $dataArray} {$ts_subtotal|string_format:"%10s"} {$ts_taxRate|string_format:"%10s"} {$ts_taxAmount|string_format:"%10s"} {/if} {$ts_total|string_format:"%10s"} {$ts_participant_total|string_format:"%10s"} +-----------------------------------------------------------{if $pricesetFieldsCount }-----------------------------------------------------{/if} + +{foreach from=$value item=line} +{if $pricesetFieldsCount }{capture assign=ts_participant_count}{$line.participant_count}{/capture}{/if} +{capture assign=ts_item}{if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description} {$line.description}{/if}{/capture}{$ts_item|truncate:30:"..."|string_format:"%-30s"} {$line.qty|string_format:"%5s"} {$line.unit_price|crmMoney:$currency|string_format:"%10s"} {if $dataArray} {$line.unit_price*$line.qty|crmMoney:$currency|string_format:"%10s"} {if $line.tax_rate != "" || $line.tax_amount != ""} {$line.tax_rate|string_format:"%.2f"} % {$line.tax_amount|crmMoney:$currency|string_format:"%10s"} {else} {/if} {/if} {$line.line_total+$line.tax_amount|crmMoney:$currency|string_format:"%10s"}{$ts_participant_count|string_format:"%10s"} +{/foreach} +---------------------------------------------------------------------------------------------------------------- +{if $individual}{ts}Participant Total{/ts} {$individual.$priceset.totalAmtWithTax-$individual.$priceset.totalTaxAmt|crmMoney:$currency|string_format:"%29s"} {$individual.$priceset.totalTaxAmt|crmMoney:$currency|string_format:"%33s"} {$individual.$priceset.totalAmtWithTax|crmMoney:$currency|string_format:"%12s"}{/if} +{/if} +{""|string_format:"%120s"} +{/foreach} +{""|string_format:"%120s"} + +{if $dataArray} +{ts}Amount before Tax{/ts}: {$totalAmount-$totalTaxAmount|crmMoney:$currency} + +{foreach from=$dataArray item=value key=priceset} +{if $priceset || $priceset == 0} +{$taxTerm} {$priceset|string_format:"%.2f"}%: {$value|crmMoney:$currency} +{else} +{ts}No{/ts} {$taxTerm}: {$value|crmMoney:$currency} +{/if} +{/foreach} +{/if} +{/if} + +{if $amounts && !$lineItem} +{foreach from=$amounts item=amnt key=level}{$amnt.amount|crmMoney:$currency} {$amnt.label} +{/foreach} +{/if} + +{if $totalTaxAmount} +{ts}Total Tax Amount{/ts}: {$totalTaxAmount|crmMoney:$currency} +{/if} +{if $isPrimary } + +{ts}Total Amount{/ts}: {$totalAmount|crmMoney:$currency} {if $hookDiscount.message}({$hookDiscount.message}){/if} + +{if $pricesetFieldsCount } + {assign var="count" value= 0} + {foreach from=$lineItem item=pcount} + {assign var="lineItemCount" value=0} + {if $pcount neq 'skip'} + {foreach from=$pcount item=p_count} + {assign var="lineItemCount" value=$lineItemCount+$p_count.participant_count} + {/foreach} + {if $lineItemCount < 1 } + {assign var="lineItemCount" value=1} + {/if} + {assign var="count" value=$count+$lineItemCount} + {/if} + {/foreach} + +{ts}Total Participants{/ts}: {$count} +{/if} + +{if $register_date} +{ts}Registration Date{/ts}: {$register_date|crmDate} +{/if} +{if $receive_date} +{ts}Transaction Date{/ts}: {$receive_date|crmDate} +{/if} +{if $financialTypeName} +{ts}Financial Type{/ts}: {$financialTypeName} +{/if} +{if $trxn_id} +{ts}Transaction #{/ts}: {$trxn_id} +{/if} +{if $paidBy} +{ts}Paid By{/ts}: {$paidBy} +{/if} +{if $checkNumber} +{ts}Check Number{/ts}: {$checkNumber} +{/if} +{if $contributeMode ne 'notify' and !$isAmountzero and (!$is_pay_later or $isBillingAddressRequiredForPayLater) and !$isOnWaitlist and !$isRequireApproval} + +==========================================================={if $pricesetFieldsCount }===================={/if} + +{ts}Billing Name and Address{/ts} + +==========================================================={if $pricesetFieldsCount }===================={/if} + +{$billingName} +{$address} +{/if} + +{if $contributeMode eq 'direct' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval} +==========================================================={if $pricesetFieldsCount }===================={/if} + +{ts}Credit Card Information{/ts} + +==========================================================={if $pricesetFieldsCount }===================={/if} + +{$credit_card_type} +{$credit_card_number} +{ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate} +{/if} +{/if} +{/if} {* End of conditional section for Paid events *} + +{if $customPre} +{foreach from=$customPre item=customPr key=i} +==========================================================={if $pricesetFieldsCount }===================={/if} + +{$customPre_grouptitle.$i} +==========================================================={if $pricesetFieldsCount }===================={/if} + +{foreach from=$customPr item=customValue key=customName} +{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields} + {$customName}: {$customValue} +{/if} +{/foreach} +{/foreach} +{/if} + +{if $customPost} +{foreach from=$customPost item=customPos key=j} +==========================================================={if $pricesetFieldsCount }===================={/if} + +{$customPost_grouptitle.$j} +==========================================================={if $pricesetFieldsCount }===================={/if} + +{foreach from=$customPos item=customValue key=customName} +{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields} + {$customName}: {$customValue} +{/if} +{/foreach} +{/foreach} +{/if} +{if $customProfile} + +{foreach from=$customProfile.profile item=eachParticipant key=participantID} +==========================================================={if $pricesetFieldsCount }===================={/if} + +{ts 1=$participantID+2}Participant Information - Participant %1{/ts} + +==========================================================={if $pricesetFieldsCount }===================={/if} + +{foreach from=$eachParticipant item=eachProfile key=pid} +----------------------------------------------------------{if $pricesetFieldsCount }--------------------{/if} + +{$customProfile.title.$pid} +----------------------------------------------------------{if $pricesetFieldsCount }--------------------{/if} + +{foreach from=$eachProfile item=val key=field} +{foreach from=$val item=v key=f} +{$field}: {$v} +{/foreach} +{/foreach} +{/foreach} +{/foreach} +{/if} +{if $customGroup} +{foreach from=$customGroup item=value key=customName} +=========================================================={if $pricesetFieldsCount }===================={/if} + +{$customName} +=========================================================={if $pricesetFieldsCount }===================={/if} + +{foreach from=$value item=v key=n} +{$n}: {$v} +{/foreach} +{/foreach} +{/if} + +{if $event.allow_selfcancelxfer } +{ts 1=$event.selfcancelxfer_time}You may transfer your registration to another participant or cancel your registration up to %1 hours before the event.{/ts} {if $totalAmount}{ts}Cancellations are not refundable.{/ts}{/if} + {capture assign=selfService}{crmURL p='civicrm/event/selfsvcupdate' q="reset=1&pid=`$participant.id`&{contact.checksum}" h=0 a=1 fe=1}{/capture} +{ts}Transfer or cancel your registration:{/ts} {$selfService} +{/if} diff --git a/civicrm/CRM/Upgrade/Incremental/php/FourSeven.php b/civicrm/CRM/Upgrade/Incremental/php/FourSeven.php index ec6282f129ad35550547d1d6161714283ff24ae6..66221d929cd08cb9111cfd400bf7f4c2fcff6c8e 100644 --- a/civicrm/CRM/Upgrade/Incremental/php/FourSeven.php +++ b/civicrm/CRM/Upgrade/Incremental/php/FourSeven.php @@ -174,6 +174,15 @@ class CRM_Upgrade_Incremental_php_FourSeven extends CRM_Upgrade_Incremental_Base $this->addTask('Add Index to civicrm_contribution.total_amount', 'addIndexContributionAmount'); } + /** + * Upgrade function. + * + * @param string $rev + */ + public function upgrade_4_7_4($rev) { + $this->addTask('Add Contact Deleted by Merge Activity Type', 'addDeletedByMergeActivityType'); + } + /** * CRM-16354 * @@ -526,4 +535,25 @@ FROM `civicrm_dashboard_contact` WHERE 1 GROUP BY contact_id"; return TRUE; } + /** + * CRM-18124 Add index to civicrm_contribution.total_amount. + * + * Note that I made this a combined index with receive_date because the issue included + * both criteria and they seemed likely to be used in conjunction to me in other cases. + * + * @param \CRM_Queue_TaskContext $ctx + * + * @return bool + */ + public function addDeletedByMergeActivityType(CRM_Queue_TaskContext $ctx) { + CRM_Core_BAO_OptionValue::ensureOptionValueExists(array( + 'option_group_id' => 'activity_type', + 'name' => 'Contact Deleted by Merge', + 'label' => ts('Contact Deleted by Merge'), + 'description' => ts('Contact was merged into another contact'), + 'is_active' => TRUE, + )); + return TRUE; + } + } diff --git a/civicrm/CRM/Upgrade/Incremental/sql/4.7.4.mysql.tpl b/civicrm/CRM/Upgrade/Incremental/sql/4.7.4.mysql.tpl new file mode 100644 index 0000000000000000000000000000000000000000..4755bbea29d95e7fba323d36339faa091457233e --- /dev/null +++ b/civicrm/CRM/Upgrade/Incremental/sql/4.7.4.mysql.tpl @@ -0,0 +1,5 @@ +{* file to handle db changes in 4.7.4 during upgrade *} +{include file='../CRM/Upgrade/4.7.4.msg_template/civicrm_msg_template.tpl'} + +-- CRM-18037 - update preferred mail format to set as default +UPDATE `civicrm_contact` SET `preferred_mail_format` = 'Both' WHERE `preferred_mail_format` IS NULL; diff --git a/civicrm/CRM/Utils/Array.php b/civicrm/CRM/Utils/Array.php index 17fc32963be70b71f824b90dcf4b04018c39374a..0ac816af053b5785bfe8b2a1eb717ff25df1dfc0 100644 --- a/civicrm/CRM/Utils/Array.php +++ b/civicrm/CRM/Utils/Array.php @@ -1034,6 +1034,9 @@ class CRM_Utils_Array { * @return void */ public static function formatArrayKeys(&$array) { + if (!is_array($array)) { + return; + } $keys = array_keys($array, 1); if (count($keys) > 1 || (count($keys) == 1 && diff --git a/civicrm/CRM/Utils/Request.php b/civicrm/CRM/Utils/Request.php index fd0c8fe0e9bb38c86a4cf8e91a06a3a1bb3b7030..3d546bac7cecb69d46690aed294846b627c022af 100644 --- a/civicrm/CRM/Utils/Request.php +++ b/civicrm/CRM/Utils/Request.php @@ -36,6 +36,34 @@ */ class CRM_Utils_Request { + /** + * Get a unique ID for the request. + * + * This unique ID is assigned to mysql when the connection is opened and is + * available in PHP. + * + * The intent is that it is available for logging purposes and for triggers. + * + * The resulting string is 17 characters long. This consists of 13 characters of uniqid + * and 4 more random characters. + * + * Uniqid is unique to the microsecond - to make it more unique we add 4 more characters + * but stop short of the full 23 character string that a prefix would generate. + * + * It is intended that this string will be saved to log tables so striking a balance between + * uniqueness and length is important. Note that I did check & lining up with byte values + * (e.g 16 characters) does not confer any benefits. Using a CHAR field rather than VARCHAR + * may improve speed, if indexed. + * + * @return string + */ + public static function id() { + if (!isset(\Civi::$statics[__CLASS__]['id'])) { + \Civi::$statics[__CLASS__]['id'] = uniqid() . CRM_Utils_String::createRandom(CRM_Utils_String::ALPHANUMERIC, 4); + } + return \Civi::$statics[__CLASS__]['id']; + } + /** * Retrieve a value from the request (GET/POST/REQUEST) * diff --git a/civicrm/CRM/Utils/Rule.php b/civicrm/CRM/Utils/Rule.php index c3b483b9218ee0687ae2cc5088b639c7098170a4..cc7dff3e1ede1b0f01e409590d2c2519a0c24a39 100644 --- a/civicrm/CRM/Utils/Rule.php +++ b/civicrm/CRM/Utils/Rule.php @@ -812,4 +812,25 @@ class CRM_Utils_Rule { return ($key) ? CRM_Core_Key::valid($key) : FALSE; } + /** + * Check if the values in the date range are in correct chronological order. + * + * @param array $fields + * Fields of the form. + * @param $fieldName + * Name of date range field. + * @param $errors + * The error array. + * @param $title + * Title of the date range to be displayed in the error message. + */ + public static function validDateRange($fields, $fieldName, &$errors, $title) { + $lowDate = strtotime($fields[$fieldName . '_low']); + $highDate = strtotime($fields[$fieldName . '_high']); + + if ($lowDate > $highDate) { + $errors[$fieldName . '_range_error'] = ts('%1: Please check that your date range is in correct chronological order.', array(1 => $title)); + } + } + } diff --git a/civicrm/CRM/Utils/Sunlight.php b/civicrm/CRM/Utils/Sunlight.php deleted file mode 100644 index bffa1ed972d0065f79936805052d8857cdb1fadc..0000000000000000000000000000000000000000 --- a/civicrm/CRM/Utils/Sunlight.php +++ /dev/null @@ -1,185 +0,0 @@ -<?php -/* - +--------------------------------------------------------------------+ - | CiviCRM version 4.7 | - +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2015 | - +--------------------------------------------------------------------+ - | This file is a part of CiviCRM. | - | | - | CiviCRM is free software; you can copy, modify, and distribute it | - | under the terms of the GNU Affero General Public License | - | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | - | | - | CiviCRM is distributed in the hope that it will be useful, but | - | WITHOUT ANY WARRANTY; without even the implied warranty of | - | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | - | See the GNU Affero General Public License for more details. | - | | - | You should have received a copy of the GNU Affero General Public | - | License and the CiviCRM Licensing Exception along | - | with this program; if not, contact CiviCRM LLC | - | at info[AT]civicrm[DOT]org. If you have questions about the | - | GNU Affero General Public License or the licensing of CiviCRM, | - | see the CiviCRM license FAQ at http://civicrm.org/licensing | - +--------------------------------------------------------------------+ - */ - -/** - * - * @package CRM - * @copyright CiviCRM LLC (c) 2004-2015 - */ -class CRM_Utils_Sunlight { - static $_apiURL = 'http://api.sunlightlabs.com/'; - static $_apiKey = NULL; - - /** - * @param $uri - * - * @return SimpleXMLElement - * @throws Exception - */ - public static function makeAPICall($uri) { - require_once 'HTTP/Request.php'; - $params = array( - 'method' => HTTP_REQUEST_METHOD_GET, - 'allowRedirects' => FALSE, - ); - - $request = new HTTP_Request(self::$_apiURL . $uri, $params); - $result = $request->sendRequest(); - if (PEAR::isError($result)) { - CRM_Core_Error::fatal($result->getMessage()); - } - if ($request->getResponseCode() != 200) { - CRM_Core_Error::fatal(ts('Invalid response code received from Sunlight servers: %1', - array(1 => $request->getResponseCode()) - )); - } - $string = $request->getResponseBody(); - return simplexml_load_string($string); - } - - /** - * @param $zipcode - * - * @return array - */ - public static function getCityState($zipcode) { - $key = self::$_apiKey; - $uri = "places.getCityStateFromZip.php?zip={$zipcode}&apikey={$key}&output=xml"; - $xml = self::makeAPICall($uri); - - return array($xml->city, $xml->state); - } - - /** - * @param int $peopleID - * - * @return array - */ - public static function getDetailedInfo($peopleID) { - $key = self::$_apiKey; - $uri = "people.getPersonInfo.php?id={$peopleID}&apikey={$key}&output=xml"; - $xml = self::makeAPICall($uri); - - $result = array(); - $fields = array( - 'title' => 'title', - 'firstname' => 'first_name', - 'lastname' => 'last_name', - 'gender' => 'gender', - 'party' => 'party', - 'congress_office' => 'address', - 'phone' => 'phone', - 'email' => 'email', - 'congresspedia' => 'url', - 'photo' => 'image_url', - 'webform' => 'contact_url', - ); - - foreach ($fields as $old => $new) { - $result[$new] = (string ) $xml->$old; - } - - $result['image_url'] = 'http://sunlightlabs.com/widgets/popuppoliticians/resources/images/' . $result['image_url']; - - return $result; - } - - /** - * @param $uri - * - * @return array - */ - public static function getPeopleInfo($uri) { - $xml = self::makeAPICall($uri); - - $result = array(); - foreach ($xml->entity_id_list->entity_id as $key => $value) { - $result[] = self::getDetailedInfo($value); - } - return $result; - } - - /** - * @param $city - * @param $state - * - * @return array|null - */ - public static function getRepresentativeInfo($city, $state) { - if (!$city || - !$state - ) { - return NULL; - } - $key = self::$_apiKey; - $city = urlencode($city); - $uri = "people.reps.getRepsFromCityState.php?city={$city}&state={$state}&apikey={$key}&output=xml"; - return self::getPeopleInfo($uri); - } - - /** - * @param $state - * - * @return array|null - */ - public static function getSenatorInfo($state) { - if (!$state) { - return NULL; - } - - $key = self::$_apiKey; - $uri = "people.sens.getSensFromState.php?state={$state}&apikey={$key}&output=xml"; - return self::getPeopleInfo($uri); - } - - /** - * @param $city - * @param $state - * @param null $zipcode - * - * @return array - */ - public static function getInfo($city, $state, $zipcode = NULL) { - if ($zipcode) { - list($city, $state) = self::getCityState($zipcode); - } - - $reps = self::getRepresentativeInfo($city, $state); - $sens = self::getSenatorInfo($state); - - $result = array(); - if (is_array($reps)) { - $result = array_merge($result, $reps); - } - if (is_array($sens)) { - $result = array_merge($result, $sens); - } - - return $result; - } - -} diff --git a/civicrm/CRM/Utils/System/Base.php b/civicrm/CRM/Utils/System/Base.php index 292d18fa529f0eb49e62ef755fa841837ea34c04..b3f8dcb4435bd0d70dadc74ea61f3787d5e7960f 100644 --- a/civicrm/CRM/Utils/System/Base.php +++ b/civicrm/CRM/Utils/System/Base.php @@ -691,7 +691,7 @@ abstract class CRM_Utils_System_Base { public function getTimeZoneOffset() { $timezone = $this->getTimeZoneString(); if ($timezone) { - if ($timezone == 'UTC') { + if ($timezone == 'UTC' || $timezone == 'Etc/UTC') { // CRM-17072 Let's short-circuit all the zero handling & return it here! return '+00:00'; } diff --git a/civicrm/CRM/Utils/System/DrupalBase.php b/civicrm/CRM/Utils/System/DrupalBase.php index 923994fbfadcb27d17f2fe703d3dc050bfbf4314..1d4e602393fb2db489ccb3dfb64435cd203e1bb5 100644 --- a/civicrm/CRM/Utils/System/DrupalBase.php +++ b/civicrm/CRM/Utils/System/DrupalBase.php @@ -100,8 +100,12 @@ abstract class CRM_Utils_System_DrupalBase extends CRM_Utils_System_Base { // compares $url (which is some unknown/untrusted value from a third-party dev) to the CMS's base url (which is independent of civi's url) // to see if the url is within our drupal dir, if it is we are able to treated it as an internal url if (strpos($url, $base_url) === 0) { - $internal = TRUE; - $url = trim(str_replace($base_url, '', $url), '/'); + $file = trim(str_replace($base_url, '', $url), '/'); + // CRM-18130: Custom CSS URL not working if aliased or rewritten + if (file_exists(DRUPAL_ROOT . $file)) { + $url = $file; + $internal = TRUE; + } } // Handle relative urls that are within the CiviCRM module directory elseif (strpos($url, $base) === 0) { diff --git a/civicrm/CRM/Utils/System/WordPress.php b/civicrm/CRM/Utils/System/WordPress.php index 2281c6a8258e868e36a18844b52d6ee7c25547e4..355b5bc535843ba3418110557475fd52742a883e 100644 --- a/civicrm/CRM/Utils/System/WordPress.php +++ b/civicrm/CRM/Utils/System/WordPress.php @@ -431,11 +431,6 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { } require_once $cmsRootPath . DIRECTORY_SEPARATOR . 'wp-includes/pluggable.php'; $uid = CRM_Utils_Array::value('uid', $name); - - // Disable magic quotes - $wp = new CiviCRM_For_WordPress(); - $wp->remove_wp_magic_quotes(); - if (!$uid) { $name = $name ? $name : trim(CRM_Utils_Array::value('name', $_REQUEST)); $pass = $pass ? $pass : trim(CRM_Utils_Array::value('pass', $_REQUEST)); diff --git a/civicrm/api/v3/Contact.php b/civicrm/api/v3/Contact.php index 8f20591af87d03612ee6ec66d153f583b1820011..1fb51a2a736b0438290ae229a7d60f702b3530f6 100644 --- a/civicrm/api/v3/Contact.php +++ b/civicrm/api/v3/Contact.php @@ -1033,39 +1033,45 @@ function _civicrm_api3_contact_deprecation() { * @throws CiviCRM_API3_Exception */ function civicrm_api3_contact_merge($params) { - $mode = CRM_Utils_Array::value('mode', $params, 'safe'); - $autoFlip = CRM_Utils_Array::value('auto_flip', $params, TRUE); - - $dupePairs = array( - array( - 'srcID' => CRM_Utils_Array::value('main_id', $params), - 'dstID' => CRM_Utils_Array::value('other_id', $params), - ), - ); - - if (($result = CRM_Dedupe_Merger::merge($dupePairs, array(), $mode, $autoFlip)) != FALSE) { + if (($result = CRM_Dedupe_Merger::merge(array( + array( + 'srcID' => $params['to_remove_id'], + 'dstID' => $params['to_keep_id'], + ), + ), array(), $params['mode'], $params['auto_flip'])) != FALSE) { return civicrm_api3_create_success($result, $params); } throw new CiviCRM_API3_Exception('Merge failed'); } /** - * Adjust metadata for contact_proximity api function. + * Adjust metadata for contact_merge api function. * * @param array $params */ function _civicrm_api3_contact_merge_spec(&$params) { - $params['main_id'] = array( + $params['to_remove_id'] = array( 'title' => 'ID of the contact to merge & remove', 'description' => ts('Wow - these 2 params are the logical reverse of what I expect - but what to do?'), 'api.required' => 1, 'type' => CRM_Utils_Type::T_INT, + 'api.aliases' => array('main_id'), ); - $params['other_id'] = array( + $params['to_keep_id'] = array( 'title' => 'ID of the contact to keep', 'description' => ts('Wow - these 2 params are the logical reverse of what I expect - but what to do?'), 'api.required' => 1, 'type' => CRM_Utils_Type::T_INT, + 'api.aliases' => array('other_id'), + ); + $params['auto_flip'] = array( + 'title' => 'Swap destination and source to retain lowest id?', + 'api.default' => TRUE, + ); + $params['mode'] = array( + // @todo need more detail on what this means. + 'title' => 'Dedupe mode', + 'api.default' => 'safe', ); } diff --git a/civicrm/api/v3/utils.php b/civicrm/api/v3/utils.php index 1d67d9120489a4a82753e6630724401db1e2f627..3cd75f7a66c8f870d7d9f000e4c29bcf52d1afd6 100644 --- a/civicrm/api/v3/utils.php +++ b/civicrm/api/v3/utils.php @@ -131,9 +131,10 @@ function civicrm_api3_verify_mandatory($params, $daoName = NULL, $keys = array() function civicrm_api3_create_error($msg, $data = array()) { $data['is_error'] = 1; $data['error_message'] = $msg; + // we will show sql to privileged user only (not sure of a specific // security hole here but seems sensible - perhaps should apply to the trace as well?) - if (isset($data['sql']) && CRM_Core_Permission::check('Administer CiviCRM')) { + if (isset($data['sql']) && (CRM_Core_Permission::check('Administer CiviCRM') || CIVICRM_UF == 'UnitTests')) { // Isn't this redundant? $data['debug_information'] = $data['sql']; } diff --git a/civicrm/bower_components/jquery-ui/.bower.json b/civicrm/bower_components/jquery-ui/.bower.json index bdf373ab4fab201a5cc4b447df729597873b964e..a92321cfe21cc49d6922063583e5216c712d9b78 100644 --- a/civicrm/bower_components/jquery-ui/.bower.json +++ b/civicrm/bower_components/jquery-ui/.bower.json @@ -16,6 +16,6 @@ "commit": "c34f8dbf3ba57b3784b93f26119f436c0e8288e1" }, "_source": "git://github.com/components/jqueryui.git", - "_target": ">=1.9", + "_target": "~1.11", "_originalSource": "jquery-ui" } \ No newline at end of file diff --git a/civicrm/civicrm-version.php b/civicrm/civicrm-version.php index f5f9bf3b7ede5a8e16798297ddb6bf674386e252..4d30f1526c5b5919095c5f7d98e83706baa4e762 100644 --- a/civicrm/civicrm-version.php +++ b/civicrm/civicrm-version.php @@ -1,7 +1,7 @@ <?php function civicrmVersion( ) { - return array( 'version' => '4.7.3', + return array( 'version' => '4.7.4', 'cms' => 'Wordpress', - 'revision' => '7ad5c1d6a1' ); + 'revision' => '558382f783' ); } diff --git a/civicrm/civicrm.config.php b/civicrm/civicrm.config.php index 83a2ec9b734136af855aaf8a5259c8c72d405159..e073e71b42aa77ad1e200e78f736e79d25ddfc5b 100644 --- a/civicrm/civicrm.config.php +++ b/civicrm/civicrm.config.php @@ -292,8 +292,6 @@ class Bootstrap { $wpDirs = array( $cmsRoot . '/*/uploads/civicrm', $cmsRoot . '/*/plugins/civicrm', - $cmsRoot . '/*/uploads/sites/*/civicrm', - $cmsRoot . '/*/blogs.dir/*/files/civicrm', ); $settings = $this->findFirstFile($wpDirs, 'civicrm.settings.php'); break; diff --git a/civicrm/sql/civicrm.mysql b/civicrm/sql/civicrm.mysql index 756bcb1e3ec73ed5f172c55231524c849848a122..609fbd9bfa1e89c483fdd59585367f8196352cf1 100644 --- a/civicrm/sql/civicrm.mysql +++ b/civicrm/sql/civicrm.mysql @@ -4557,6 +4557,10 @@ CREATE TABLE `civicrm_contribution` ( , INDEX `UI_contrib_payment_instrument_id`( payment_instrument_id ) + , INDEX `index_total_amount_receive_date`( + total_amount + , receive_date + ) , INDEX `index_source`( source ) diff --git a/civicrm/sql/civicrm_data.mysql b/civicrm/sql/civicrm_data.mysql index 8eb116e5b61efa5e1a7e2b94d2b9f3b9186af140..ed4c6c9f78a3e4c8278b2e7348b8fbb4144c609d 100644 --- a/civicrm/sql/civicrm_data.mysql +++ b/civicrm/sql/civicrm_data.mysql @@ -4894,9 +4894,10 @@ VALUES -- for manual contact merge (@option_group_id_act, 'Contact Merged', 51, 'Contact Merged', NULL, 1, NULL, 51, 'Contact Merged',0, 1, 1, NULL, NULL), + (@option_group_id_act, 'Contact Deleted by Merge', 52, 'Contact Deleted by Merge', NULL, 1, NULL, 52, 'Contact was merged into another contact',0, 1, 1, NULL, NULL), -- Activity Type for failed payment - (@option_group_id_act, 'Failed Payment', 52, 'Failed Payment', NULL, 1, 0, 43, 'Failed Payment', 0, 1, 1, @contributeCompId, NULL), + (@option_group_id_act, 'Failed Payment', 53, 'Failed Payment', NULL, 1, 0, 53, 'Failed Payment', 0, 1, 1, @contributeCompId, NULL), (@option_group_id_gender, 'Female', 1, 'Female', NULL, 0, NULL, 1, NULL, 0, 0, 1, NULL, NULL), (@option_group_id_gender, 'Male', 2, 'Male', NULL, 0, NULL, 2, NULL, 0, 0, 1, NULL, NULL), @@ -24266,4 +24267,4 @@ INSERT INTO `civicrm_report_instance` VALUES ( @domainID, 'Survey Details', 'survey/detail', 'Detailed report for canvassing, phone-banking, walk lists or other surveys.', 'access CiviReport', 'a:39:{s:6:"fields";a:2:{s:9:"sort_name";s:1:"1";s:6:"result";s:1:"1";}s:22:"assignee_contact_id_op";s:2:"eq";s:25:"assignee_contact_id_value";s:0:"";s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:12:"survey_id_op";s:2:"in";s:15:"survey_id_value";a:0:{}s:12:"status_id_op";s:2:"eq";s:15:"status_id_value";s:1:"1";s:11:"custom_1_op";s:2:"in";s:14:"custom_1_value";a:0:{}s:11:"custom_2_op";s:2:"in";s:14:"custom_2_value";a:0:{}s:17:"custom_3_relative";s:1:"0";s:13:"custom_3_from";s:0:"";s:11:"custom_3_to";s:0:"";s:11:"description";s:75:"Detailed report for canvassing, phone-banking, walk lists or other surveys.";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviReport";s:6:"groups";s:0:"";s:9:"domain_id";i:1;}'); -UPDATE civicrm_domain SET version = '4.7.3'; +UPDATE civicrm_domain SET version = '4.7.4'; diff --git a/civicrm/sql/civicrm_generated.mysql b/civicrm/sql/civicrm_generated.mysql index b91293128e463492c9f285a636199238e754dce3..868e1db248ba5b5148661c400f6475714e5bf09f 100644 --- a/civicrm/sql/civicrm_generated.mysql +++ b/civicrm/sql/civicrm_generated.mysql @@ -399,7 +399,7 @@ UNLOCK TABLES; LOCK TABLES `civicrm_domain` WRITE; /*!40000 ALTER TABLE `civicrm_domain` DISABLE KEYS */; -INSERT INTO `civicrm_domain` (`id`, `name`, `description`, `config_backend`, `version`, `contact_id`, `locales`, `locale_custom_strings`) VALUES (1,'Default Domain Name',NULL,NULL,'4.7.3',1,NULL,'a:1:{s:5:\"en_US\";a:0:{}}'); +INSERT INTO `civicrm_domain` (`id`, `name`, `description`, `config_backend`, `version`, `contact_id`, `locales`, `locale_custom_strings`) VALUES (1,'Default Domain Name',NULL,NULL,'4.7.4',1,NULL,'a:1:{s:5:\"en_US\";a:0:{}}'); /*!40000 ALTER TABLE `civicrm_domain` ENABLE KEYS */; UNLOCK TABLES; diff --git a/civicrm/templates/CRM/Activity/Selector/Selector.tpl b/civicrm/templates/CRM/Activity/Selector/Selector.tpl index 7f569cf2107137517e5048d45712ce439156d0c7..a78c73333bb4a8ef92d21f0737c03cbe0a00a316 100644 --- a/civicrm/templates/CRM/Activity/Selector/Selector.tpl +++ b/civicrm/templates/CRM/Activity/Selector/Selector.tpl @@ -39,7 +39,7 @@ </div> </div><!-- /.crm-accordion-body --> </div><!-- /.crm-accordion-wrapper --> - <table class="contact-activity-selector-{$context} crm-ajax-table" data-order='[[5,"desc"]]'> + <table class="contact-activity-selector-{$context} crm-ajax-table" data-order='[[5,"asc"]]'> <thead> <tr> <th data-data="activity_type" class="crm-contact-activity-activity_type">{ts}Type{/ts}</th> diff --git a/civicrm/templates/CRM/Campaign/Form/Petition.tpl b/civicrm/templates/CRM/Campaign/Form/Petition.tpl index 78501501505887dcabfe49bbf8365eb762e9def9..98f4860510adc2cf9794d5e4d0bedd0677dd1ad5 100644 --- a/civicrm/templates/CRM/Campaign/Form/Petition.tpl +++ b/civicrm/templates/CRM/Campaign/Form/Petition.tpl @@ -117,6 +117,18 @@ </td> </tr> </table> + <div id="customData"></div> + {*include custom data js file*} + {include file="CRM/common/customData.tpl"} + {literal} + <script type="text/javascript"> + CRM.$(function($) { + {/literal} + CRM.buildCustomData( 'Survey' ); + {literal} + }); + </script> + {/literal} {/if} <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div> </div> diff --git a/civicrm/templates/CRM/Campaign/Form/Survey/Main.tpl b/civicrm/templates/CRM/Campaign/Form/Survey/Main.tpl index 0856d1858da2a737d6cc7217574ff7c35076ad9d..ed581701c6df9dd2ade67348ae6ebdf2dff1487c 100644 --- a/civicrm/templates/CRM/Campaign/Form/Survey/Main.tpl +++ b/civicrm/templates/CRM/Campaign/Form/Survey/Main.tpl @@ -83,6 +83,18 @@ </td> </tr> </table> + <div id="customData"></div> + {*include custom data js file*} + {include file="CRM/common/customData.tpl"} + {literal} + <script type="text/javascript"> + CRM.$(function($) { + {/literal} + CRM.buildCustomData( 'Survey' ); + {literal} + }); + </script> + {/literal} <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div> </div> diff --git a/civicrm/templates/CRM/Contact/Form/Merge.tpl b/civicrm/templates/CRM/Contact/Form/Merge.tpl index d55abc3946164b48bd21ca0e2650fb4bfbee842c..4611605994a93bb43412668d47e305734aee95a0 100644 --- a/civicrm/templates/CRM/Contact/Form/Merge.tpl +++ b/civicrm/templates/CRM/Contact/Form/Merge.tpl @@ -24,193 +24,194 @@ +--------------------------------------------------------------------+ *} <div class="crm-block crm-form-block crm-contact-merge-form-block"> -<div class="help"> -{ts}Click <strong>Merge</strong> to move data from the Duplicate Contact on the left into the Main Contact. In addition to the contact data (address, phone, email...), you may choose to move all or some of the related activity records (groups, contributions, memberships, etc.).{/ts} {help id="intro"} -</div> - -<div class="message status"> - <div class="icon inform-icon"></div> - <strong>{ts}WARNING: The duplicate contact record WILL BE DELETED after the merge is complete.{/ts}</strong> -</div> + <div class="help"> + {ts}Click <strong>Merge</strong> to move data from the Duplicate Contact on the left into the Main Contact. In addition to the contact data (address, phone, email...), you may choose to move all or some of the related activity records (groups, contributions, memberships, etc.).{/ts} {help id="intro"} + </div> -{if $user} <div class="message status"> <div class="icon inform-icon"></div> - <strong>{ts 1=$config->userFramework}WARNING: There are %1 user accounts associated with both the original and duplicate contacts. Ensure that the %1 user you want to retain is on the right - if necessary use the 'Flip between original and duplicate contacts.' option at top to swap the positions of the two records before doing the merge. -The user record associated with the duplicate contact will not be deleted, but will be unlinked from the associated contact record (which will be deleted). -You will need to manually delete that user (click on the link to open the %1 user account in new screen). You may need to give thought to how you handle any content or contents associated with that user.{/ts}</strong> + <strong>{ts}WARNING: The duplicate contact record WILL BE DELETED after the merge is complete.{/ts}</strong> </div> -{/if} -<div class="crm-submit-buttons"> - {include file="CRM/common/formButtons.tpl" location="top"} -</div> + {if $user} + <div class="message status"> + <div class="icon inform-icon"></div> + <strong>{ts 1=$config->userFramework}WARNING: There are %1 user accounts associated with both the original and duplicate contacts. Ensure that the %1 user you want to retain is on the right - if necessary use the 'Flip between original and duplicate contacts.' option at top to swap the positions of the two records before doing the merge. + The user record associated with the duplicate contact will not be deleted, but will be unlinked from the associated contact record (which will be deleted). + You will need to manually delete that user (click on the link to open the %1 user account in new screen). You may need to give thought to how you handle any content or contents associated with that user.{/ts}</strong> + </div> + {/if} + + <div class="crm-submit-buttons"> + {include file="CRM/common/formButtons.tpl" location="top"} + </div> -<div class="action-link"> - {if $prev}<a href="{$prev}" class="crm-hover-button action-item"><i class="crm-i fa-chevron-left"></i> {ts}Previous{/ts}</a>{/if} - {if $next}<a href="{$next}" class="crm-hover-button action-item">{ts}Next{/ts} <i class="crm-i fa-chevron-right"></i></a>{/if} - <a href="{$flip}" class="action-item crm-hover-button"> - <i class="crm-i fa-random"></i> - {ts}Flip between original and duplicate contacts.{/ts} - </a> -</div> + <div class="action-link"> + {if $prev}<a href="{$prev}" class="crm-hover-button action-item"><i class="crm-i fa-chevron-left"></i> {ts}Previous{/ts}</a>{/if} + {if $next}<a href="{$next}" class="crm-hover-button action-item">{ts}Next{/ts} <i class="crm-i fa-chevron-right"></i></a>{/if} + <a href="{$flip}" class="action-item crm-hover-button"> + <i class="crm-i fa-random"></i> + {ts}Flip between original and duplicate contacts.{/ts} + </a> + </div> -<div class="action-link"> - <a href="#" class="action-item crm-hover-button crm-notDuplicate" title={ts}Mark this pair as not a duplicate.{/ts} onClick="processDupes( {$main_cid}, {$other_cid}, 'dupe-nondupe', 'merge-contact', '{if $rgid}{crmURL p="civicrm/contact/dedupefind" q="reset=1&action=update&rgid=$rgid"}{/if}' );return false;"> - <i class="crm-i fa-times-circle"></i> - {ts}Mark this pair as not a duplicate.{/ts} - </a> -</div> + <div class="action-link"> + <a href="#" class="action-item crm-hover-button crm-notDuplicate" title={ts}Mark this pair as not a duplicate.{/ts} onClick="processDupes( {$main_cid}, {$other_cid}, 'dupe-nondupe', 'merge-contact', '{if $rgid}{crmURL p="civicrm/contact/dedupefind" q="reset=1&action=update&rgid=$rgid"}{/if}' );return false;"> + <i class="crm-i fa-times-circle"></i> + {ts}Mark this pair as not a duplicate.{/ts} + </a> + </div> -<div class="action-link"> - <a href="javascript:void(0);" class="action-item crm-hover-button toggle_equal_rows"> - <i class="crm-i fa-eye-slash"></i> - {ts}Show/hide rows with the same data on each contact record.{/ts} - </a> -</div> + <div class="action-link"> + <a href="javascript:void(0);" class="action-item crm-hover-button toggle_equal_rows"> + <i class="crm-i fa-eye-slash"></i> + {ts}Show/hide rows with the same data on each contact record.{/ts} + </a> + </div> -<table class="row-highlight"> - <tr class="columnheader"> - <th> </th> - <th><a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=$other_cid"}">{$other_name}</a> ({ts}duplicate{/ts})</th> - <th>{ts}Mark All{/ts}<br />=={$form.toggleSelect.html} ==></th> - <th><a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=$main_cid"}">{$main_name}</a></th> - <th width="300">Add/overwrite?</th> - </tr> - - {crmAPI var='other_result' entity='Contact' action='get' return="modified_date" id=$other_cid} - - {crmAPI var='main_result' entity='Contact' action='get' return="modified_date" id=$main_cid} - - <tr> - <td>Last modified</td> - <td>{$other_result.values.0.modified_date|crmDate} {if $other_result.values.0.modified_date gt $main_result.values.0.modified_date} (Most recent) {/if}</td> - <td></td> - <td>{$main_result.values.0.modified_date|crmDate} {if $main_result.values.0.modified_date gt $other_result.values.0.modified_date} (Most recent) {/if}</td> - <td></td> - </tr> - - {foreach from=$rows item=row key=field} - - {if !isset($row.main) && !isset($row.other)} - <tr style="background-color: #fff !important; border-bottom:1px solid #ccc !important;" class="no-data"> - <td> - <strong>{$row.title}</strong> - </td> - {else} - {if $row.main eq $row.other} - <tr class="merge-row-equal crm-row-ok {cycle values="odd-row,even-row"}"> - {else} - <tr class="crm-row-error {cycle values="odd-row,even-row"}"> - {/if} - <td> - {$row.title} - </td> - {/if} + <table class="row-highlight"> + <tr class="columnheader"> + <th> </th> + <th><a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=$other_cid"}">{$other_name}</a> ({ts}duplicate{/ts})</th> + <th>{ts}Mark All{/ts}<br />=={$form.toggleSelect.html} ==></th> + <th><a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=$main_cid"}">{$main_name}</a></th> + <th width="300">Add/overwrite?</th> + </tr> - {assign var=position value=$field|strrpos:'_'} - {assign var=blockId value=$field|substr:$position+1} - {assign var=blockName value=$field|substr:14:$position-14} + {crmAPI var='other_result' entity='Contact' action='get' return="modified_date" id=$other_cid} - <td> - {if $row.title|substr:0:7 == "Address"}<span style="white-space:pre">{else}<span>{/if}{if !is_array($row.other)}{$row.other}{elseif $row.other.fileName}{$row.other.fileName}{else}{', '|implode:$row.other}{/if}</span> - </td> + {crmAPI var='main_result' entity='Contact' action='get' return="modified_date" id=$main_cid} - <td style='white-space: nowrap'> - {if $form.$field}=={$form.$field.html|crmAddClass:"select-row"}==>{/if} - </td> + <tr> + <td>Last modified</td> + <td>{$other_result.values.0.modified_date|crmDate} {if $other_result.values.0.modified_date gt $main_result.values.0.modified_date} (Most recent) {/if}</td> + <td></td> + <td>{$main_result.values.0.modified_date|crmDate} {if $main_result.values.0.modified_date gt $other_result.values.0.modified_date} (Most recent) {/if}</td> + <td></td> + </tr> - {* For location blocks *} - {if $row.title|substr:0:5 == "Email" OR - $row.title|substr:0:7 == "Address" OR - $row.title|substr:0:2 == "IM" OR - $row.title|substr:0:7 == "Website" OR - $row.title|substr:0:5 == "Phone"} + {foreach from=$rows item=row key=field} + {if !isset($row.main) && !isset($row.other)} + <tr style="background-color: #fff !important; border-bottom:1px solid #ccc !important;" class="no-data"> <td> - {if $row.title|substr:0:7 == "Address"}<span id="main_{$blockName}_{$blockId}" style="white-space:pre">{else}<span id="main_{$blockName}_{$blockId}">{/if}{if !is_array($row.main)}{$row.main}{elseif $row.main.fileName}{$row.main.fileName}{else}{', '|implode:$row.main}{/if}</span> + <strong>{$row.title}</strong> </td> - + {else} + {if $row.main eq $row.other} + <tr class="merge-row-equal crm-row-ok {cycle values="odd-row,even-row"}"> + {else} + <tr class="crm-row-error {cycle values="odd-row,even-row"}"> + {/if} <td> - {* Display location for fields with locations *} - {if $blockName eq 'email' || $blockName eq 'phone' || $blockName eq 'address' || $blockName eq 'im' } - {$form.location.$blockName.$blockId.locTypeId.html} - {/if} - - {* Display other_type_id for websites, ims and phones *} - {if $blockName eq 'website' || $blockName eq 'im' || $blockName eq 'phone' } - {$form.location.$blockName.$blockId.typeTypeId.html} - {/if} - - {* Display the overwrite/add/add new label *} - <span id="main_{$blockName}_{$blockId}_overwrite"> - {if $row.main} - <span class="action_label">({ts}overwrite{/ts})</span> - {if $blockName eq 'email' || $blockName eq 'phone' } - {$form.location.$blockName.$blockId.operation.html} - {/if} - <br /> - {else} - <span class="action_label">({ts}add{/ts})</span> - {/if} - </span> + {$row.title} </td> + {/if} - {* For non-location blocks *} - {else} + {assign var=position value=$field|strrpos:'_'} + {assign var=blockId value=$field|substr:$position+1} + {assign var=blockName value=$field|substr:14:$position-14} <td> - <span> - {if !is_array($row.main)} - {$row.main} - {elseif $row.main.fileName} - {$row.main.fileName} - {else} - {', '|implode:$row.main} - {/if} - </span> + {if $row.title|substr:0:7 == "Address"}<span style="white-space:pre">{else}<span>{/if}{if !is_array($row.other)}{$row.other}{elseif $row.other.fileName}{$row.other.fileName}{else}{', '|implode:$row.other}{/if}</span> </td> - <td> - {if isset($row.main) || isset($row.other)} + <td style='white-space: nowrap'> + {if $form.$field}=={$form.$field.html|crmAddClass:"select-row"}==>{/if} + </td> + + {* For location blocks *} + {if $row.title|substr:0:5 == "Email" OR + $row.title|substr:0:7 == "Address" OR + $row.title|substr:0:2 == "IM" OR + $row.title|substr:0:7 == "Website" OR + $row.title|substr:0:5 == "Phone"} + + <td> + {if $row.title|substr:0:7 == "Address"}<span id="main_{$blockName}_{$blockId}" style="white-space:pre">{else}<span id="main_{$blockName}_{$blockId}">{/if}{if !is_array($row.main)}{$row.main}{elseif $row.main.fileName}{$row.main.fileName}{else}{', '|implode:$row.main}{/if}</span> + </td> + + <td> + {* Display location for fields with locations *} + {if $blockName eq 'email' || $blockName eq 'phone' || $blockName eq 'address' || $blockName eq 'im' } + {$form.location.$blockName.$blockId.locTypeId.html} + {/if} + + {* Display other_type_id for websites, ims and phones *} + {if $blockName eq 'website' || $blockName eq 'im' || $blockName eq 'phone' } + {$form.location.$blockName.$blockId.typeTypeId.html} + {/if} + + {* Display the overwrite/add/add new label *} + <span id="main_{$blockName}_{$blockId}_overwrite"> + {if $row.main} + <span class="action_label">({ts}overwrite{/ts})</span> + {if $blockName eq 'email' || $blockName eq 'phone' } + {$form.location.$blockName.$blockId.operation.html} + {/if} + <br /> + {else} + <span class="action_label">({ts}add{/ts})</span> + {/if} + </span> + </td> + + {* For non-location blocks *} + {else} + + <td> <span> - {if $row.main == $row.other} - <span class="action_label">({ts}match{/ts})</span><br /> - {elseif $row.main} - <span class="action_label">({ts}overwrite{/ts})</span><br /> - {else} - <span class="action_label">({ts}add{/ts})</span> + {if !is_array($row.main)} + {$row.main} + {elseif $row.main.fileName} + {$row.main.fileName} + {else} + {', '|implode:$row.main} {/if} </span> - {/if} - </td> + </td> + + <td> + {if isset($row.main) || isset($row.other)} + <span> + {if $row.main == $row.other} + <span class="action_label">({ts}match{/ts})</span><br /> + {elseif $row.main} + <span class="action_label">({ts}overwrite{/ts})</span><br /> + {else} + <span class="action_label">({ts}add{/ts})</span> + {/if} + </span> + {/if} + </td> - {/if} + {/if} - </tr> - {/foreach} + </tr> + {/foreach} - {foreach from=$rel_tables item=params key=paramName} - {if $paramName eq 'move_rel_table_users'} + {foreach from=$rel_tables item=params key=paramName} + {if $paramName eq 'move_rel_table_users'} + <tr class="{cycle values="even-row,odd-row"}"> + <td><strong>{ts}Move related...{/ts}</strong></td><td>{if $otherUfId}<a target="_blank" href="{$params.other_url}">{$otherUfName}</a></td><td style='white-space: nowrap'>=={$form.$paramName.html|crmAddClass:"select-row"}==>{else}<td style='white-space: nowrap'></td>{/if}</td><td>{if $mainUfId}<a target="_blank" href="{$params.main_url}">{$mainUfName}</a>{/if}</td> + <td>({ts}migrate{/ts})</td> + </tr> + {else} <tr class="{cycle values="even-row,odd-row"}"> - <td><strong>{ts}Move related...{/ts}</strong></td><td>{if $otherUfId}<a target="_blank" href="{$params.other_url}">{$otherUfName}</a></td><td style='white-space: nowrap'>=={$form.$paramName.html|crmAddClass:"select-row"}==>{else}<td style='white-space: nowrap'></td>{/if}</td><td>{if $mainUfId}<a target="_blank" href="{$params.main_url}">{$mainUfName}</a>{/if}</td> - <td>({ts}migrate{/ts})</td> - </tr> - {else} - <tr class="{cycle values="even-row,odd-row"}"> - <td><strong>{ts}Move related...{/ts}</strong></td><td><a href="{$params.other_url}">{$params.title}</a></td><td style='white-space: nowrap'>=={$form.$paramName.html|crmAddClass:"select-row"}==></td><td><a href="{$params.main_url}">{$params.title}</a>{if $form.operation.$paramName.add.html} {$form.operation.$paramName.add.html}{/if}</td> - <td>({ts}migrate{/ts})</td> - </tr> - {/if} - {/foreach} -</table> -<div class='form-item'> - <!--<p>{$form.moveBelongings.html} {$form.moveBelongings.label}</p>--> - <!--<p>{$form.deleteOther.html} {$form.deleteOther.label}</p>--> -</div> + <td><strong>{ts}Move related...{/ts}</strong></td><td><a href="{$params.other_url}">{$params.title}</a></td><td style='white-space: nowrap'>=={$form.$paramName.html|crmAddClass:"select-row"}==></td><td><a href="{$params.main_url}">{$params.title}</a>{if $form.operation.$paramName.add.html} {$form.operation.$paramName.add.html}{/if}</td> + <td>({ts}migrate{/ts})</td> + </tr> + {/if} + {/foreach} + </table> + <div class='form-item'> + <!--<p>{$form.moveBelongings.html} {$form.moveBelongings.label}</p>--> + <!--<p>{$form.deleteOther.html} {$form.deleteOther.label}</p>--> + </div> -<div class="crm-submit-buttons"> - {include file="CRM/common/formButtons.tpl" location="bottom"} + <div class="crm-submit-buttons"> + {include file="CRM/common/formButtons.tpl" location="bottom"} + </div> </div> {literal} diff --git a/civicrm/templates/CRM/Contact/Form/Search/Builder.js b/civicrm/templates/CRM/Contact/Form/Search/Builder.js index 7a246032d6b9513c2bab788afb29bfa944c71a06..171ccf39668210d122ecdf14178a9c8deb858238 100644 --- a/civicrm/templates/CRM/Contact/Form/Search/Builder.js +++ b/civicrm/templates/CRM/Contact/Form/Search/Builder.js @@ -12,7 +12,19 @@ function handleUserInputField() { var row = $(this).closest('tr'); var field = $('select[id^=mapper][id$="_1"]', row).val(); - var op = $('select[id^=operator]', row).val(); + var operator = $('select[id^=operator]', row); + var op = operator.val(); + + var patt = /_1$/; // pattern to check if the change event came from field name + if (field !== null && patt.test(this.id)) { + if ($.inArray(field, CRM.searchBuilder.stringFields) >= 0) { + // string operators + buildOperator(operator, CRM.searchBuilder.stringOperators); + } else { + // general operators + buildOperator(operator, CRM.searchBuilder.generalOperators); + } + } // These Ops don't get any input field. var noFieldOps = ['', 'IS EMPTY', 'IS NOT EMPTY', 'IS NULL', 'IS NOT NULL']; @@ -39,6 +51,20 @@ } } + /** + * Add appropriate operator to selected field + * @param operator: jQuery object + * @param options: array + */ + function buildOperator(operator, options) { + var selected = operator.val(); + operator.html(''); + $.each(options, function(value, label) { + operator.append('<option value="' + value + '">' + label + '</option>'); + }); + operator.val(selected); + } + /** * Add select list if appropriate for this operation * @param row: jQuery object @@ -123,8 +149,12 @@ } } $.each(CRM.searchBuilder.fieldOptions[field], function(key, option) { - var selected = ($.inArray(''+option.key, options) > -1) ? 'selected="selected"' : ''; - select.append('<option value="' + option.key + '"' + selected + '>' + option.value + '</option>'); + var optionKey = option.key; + if ($.inArray(field, CRM.searchBuilder.searchByLabelFields) >= 0) { + optionKey = option.value; + } + var selected = ($.inArray(''+optionKey, options) > -1) ? 'selected="selected"' : ''; + select.append('<option value="' + optionKey + '"' + selected + '>' + option.value + '</option>'); }); select.change(); } diff --git a/civicrm/templates/CRM/Contact/Page/View/Sunlight.tpl b/civicrm/templates/CRM/Contact/Page/View/Sunlight.tpl deleted file mode 100644 index af049011a323cc8483f1a6848c9fcd3c271a3cc7..0000000000000000000000000000000000000000 --- a/civicrm/templates/CRM/Contact/Page/View/Sunlight.tpl +++ /dev/null @@ -1,59 +0,0 @@ -{* - +--------------------------------------------------------------------+ - | CiviCRM version 4.7 | - +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2015 | - +--------------------------------------------------------------------+ - | This file is a part of CiviCRM. | - | | - | CiviCRM is free software; you can copy, modify, and distribute it | - | under the terms of the GNU Affero General Public License | - | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | - | | - | CiviCRM is distributed in the hope that it will be useful, but | - | WITHOUT ANY WARRANTY; without even the implied warranty of | - | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | - | See the GNU Affero General Public License for more details. | - | | - | You should have received a copy of the GNU Affero General Public | - | License and the CiviCRM Licensing Exception along | - | with this program; if not, contact CiviCRM LLC | - | at info[AT]civicrm[DOT]org. If you have questions about the | - | GNU Affero General Public License or the licensing of CiviCRM, | - | see the CiviCRM license FAQ at http://civicrm.org/licensing | - +--------------------------------------------------------------------+ -*} -<div id="electedOfficals" class="view-content"> - <p></p> - <div class="bold">{ts}Elected Officials:{/ts} {$displayName}</div> - <div class="form-item"> - {if $rowCount > 0 } - <table> - <tr class="columnheader"> - <th>{ts}Image{/ts}</th> - <th>{ts}Name{/ts}</th> - <th>{ts}Party{/ts}</th> - <th>{ts}Address{/ts}</th> - <th>{ts}Phone{/ts}</th> - <th>{ts}Email{/ts}</th> - </tr> - {foreach from=$rows item=row} - <tr class="{cycle values="odd-row,even-row"}"> - <td><a href="{$row.url}"><img src="{$row.image_url}"></a></td> - <td>{$row.title} {$row.first_name} {$row.last_name}</td> - <td>{$row.party}</td> - <td>{$row.address}</td> - <td>{$row.phone}</td> - <td>{$row.email}</td> - </tr> - {/foreach} - </table> - {else} - <div class="messages status no-popup"> - <img src="{$config->resourceBase}i/Inform.gif" alt="{ts}status{/ts}"> - {ts}No data available for this contact. Please check city/state/zipcode{/ts} - </div> - {/if} - </div> - </p> -</div> diff --git a/civicrm/templates/CRM/Contribute/Form/Selector.tpl b/civicrm/templates/CRM/Contribute/Form/Selector.tpl index ceb19bb823fce170449fe448d92f35adafed5130..8b0322074d7bc0d960a46c757d436a109bf3eec2 100644 --- a/civicrm/templates/CRM/Contribute/Form/Selector.tpl +++ b/civicrm/templates/CRM/Contribute/Form/Selector.tpl @@ -59,9 +59,11 @@ <td>{$row.contact_type} <a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=`$row.contact_id`"}">{$row.sort_name}</a></td> {/if} <td class="crm-contribution-amount"> - <a class="nowrap bold crm-expand-row" title="{ts}view payments{/ts}" href="{crmURL p='civicrm/payment' q="view=transaction&component=contribution&action=browse&cid=`$row.contact_id`&id=`$row.contribution_id`&selector=1"}"> - {if !$row.contribution_soft_credit_amount}{$row.total_amount|crmMoney:$row.currency}{/if} - </a> + {if !$row.contribution_soft_credit_amount} + <a class="nowrap bold crm-expand-row" title="{ts}view payments{/ts}" href="{crmURL p='civicrm/payment' q="view=transaction&component=contribution&action=browse&cid=`$row.contact_id`&id=`$row.contribution_id`&selector=1"}"> + {$row.total_amount|crmMoney:$row.currency} + </a> + {/if} {if $row.amount_level }<br/>({$row.amount_level}){/if} {if $row.contribution_recur_id}<br/>{ts}(Recurring Contribution){/ts}{/if} </td> @@ -104,4 +106,3 @@ {include file="CRM/common/pager.tpl" location="bottom"} {crmScript file='js/crm.expandRow.js'} - diff --git a/civicrm/templates/CRM/Contribute/Page/ContributionSoft.tpl b/civicrm/templates/CRM/Contribute/Page/ContributionSoft.tpl index 05af80f83d0eb1cf930764fa9e6e13d4213e5593..68c8363495b6ca46e683fc361be62157c64572e3 100644 --- a/civicrm/templates/CRM/Contribute/Page/ContributionSoft.tpl +++ b/civicrm/templates/CRM/Contribute/Page/ContributionSoft.tpl @@ -28,9 +28,14 @@ {if $context neq 'membership'} <table class="form-layout-compressed"> <tr> + {if $softCreditTotals.amount} <th class="contriTotalLeft">{ts}Total Soft Credits{/ts} - {$softCreditTotals.amount|crmMoney:$softCreditTotals.currency}</th> <th class="right" width="10px"> </th> <th class="right contriTotalRight"> {ts}Avg Soft Credits{/ts} - {$softCreditTotals.avg|crmMoney:$softCreditTotals.currency}</th> + {/if} + {if $softCreditTotals.cancelAmount} + <th class="right contriTotalRight"> {ts}Total Cancelled Soft Credits{/ts} - {$softCreditTotals.cancelAmount|crmMoney:$softCreditTotals.currency}</th> + {/if} </tr> </table> <p></p> diff --git a/civicrm/templates/CRM/Group/Form/Search.tpl b/civicrm/templates/CRM/Group/Form/Search.tpl index 9ed95d306c03a104ea7eb2151a6270cfba969993..6614b2bb94914d746ba0b1ae7f3dfcb4a386cf08 100644 --- a/civicrm/templates/CRM/Group/Form/Search.tpl +++ b/civicrm/templates/CRM/Group/Form/Search.tpl @@ -43,8 +43,8 @@ </span> </td> <td id="group_type-block"> - {$form.group_type.label}<br /> - {$form.group_type.html}<br /> + {$form.group_type_search.label}<br /> + {$form.group_type_search.html}<br /> <span class="description font-italic"> {ts}Filter search by group type(s).{/ts} </span> @@ -100,11 +100,11 @@ "url": {/literal}'{crmURL p="civicrm/ajax/grouplist" h=0 q="snippet=4"}'{literal}, "data": function (d) { - var groupTypes = ($('.crm-group-search-form-block #group_type_1').prop('checked')) ? '1' : ''; + var groupTypes = ($('.crm-group-search-form-block #group_type_search_1').prop('checked')) ? '1' : ''; if (groupTypes) { - groupTypes = ($('.crm-group-search-form-block #group_type_2').prop('checked')) ? groupTypes + ',2' : groupTypes; + groupTypes = ($('.crm-group-search-form-block #group_type_search_2').prop('checked')) ? groupTypes + ',2' : groupTypes; } else { - groupTypes = ($('.crm-group-search-form-block #group_type_2').prop('checked')) ? '2' : ''; + groupTypes = ($('.crm-group-search-form-block #group_type_search_2').prop('checked')) ? '2' : ''; } var groupStatus = ($('.crm-group-search-form-block #group_status_1').prop('checked')) ? 1 : ''; @@ -214,7 +214,7 @@ appendHTML += '<td class="crm-group-name crmf-title crm-editable ' + levelClass + '">' + '{/literal}<span class="collapsed show-children" title="{ts}show child groups{/ts}"/></span>{literal}' + val.title + '</td>'; } else { - appendHTML += '<td class="crm-group-name crmf-title crm-editable ' + levelClass + '"><span class="crm-no-children"></span>' + val.title + '</td>'; + appendHTML += '<td class="' + levelClass + '">' + '{/literal}<span class="collapsed show-children" title="{ts}show child groups{/ts}"/></span><span class="crm-group-name crmf-title crm-editable">{literal}' + val.title + '</span></td>'; } appendHTML += '<td class="right">' + val.count + "</td>"; appendHTML += "<td>" + val.created_by + "</td>"; diff --git a/civicrm/templates/CRM/Pledge/Form/Search/Common.tpl b/civicrm/templates/CRM/Pledge/Form/Search/Common.tpl index 119503ef5f0d93d837aed0c5709fc48fba23647d..3348db38d152dd2aef5c0d01aaee41f4d10699b0 100644 --- a/civicrm/templates/CRM/Pledge/Form/Search/Common.tpl +++ b/civicrm/templates/CRM/Pledge/Form/Search/Common.tpl @@ -88,6 +88,20 @@ {$form.pledge_frequency_unit.html} </td> </tr> +<tr> + <td colspan="2"> + {ts}Number of Installments{/ts} + {$form.pledge_installments_low.label} {$form.pledge_installments_low.html} + {$form.pledge_installments_high.label} {$form.pledge_installments_high.html} + </td> +</tr> + +<tr> + <td colspan="2"> + <br /> {$form.pledge_acknowledge_date_is_not_null.label} {$form.pledge_acknowledge_date_is_not_null.html} + + </td> +</tr> {* campaign in pledge search *} {include file="CRM/Campaign/Form/addCampaignToComponent.tpl" diff --git a/civicrm/templates/CRM/common/version.tpl b/civicrm/templates/CRM/common/version.tpl index 4178d093f02e8f38a70e7c97af3900f96a627ad3..5ca7df98c441e618846ca0b99494682ac9aea2c8 100644 --- a/civicrm/templates/CRM/common/version.tpl +++ b/civicrm/templates/CRM/common/version.tpl @@ -1 +1 @@ -4.7.3 \ No newline at end of file +4.7.4 \ No newline at end of file diff --git a/civicrm/vendor/autoload.php b/civicrm/vendor/autoload.php index d51b635dba50c6acd8c19c7d19b744dc126d55f1..3cd8ea2f9150c8435b2f09b6d3383ac81c9f1fd5 100644 --- a/civicrm/vendor/autoload.php +++ b/civicrm/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer' . '/autoload_real.php'; -return ComposerAutoloaderInitdfc5e10f6328180509f01b2da211a9d4::getLoader(); +return ComposerAutoloaderIniteb3bb96c653f131999e870853329d5ef::getLoader(); diff --git a/civicrm/vendor/composer/autoload_real.php b/civicrm/vendor/composer/autoload_real.php index be2d3420825bde4201fede61ecc7a6ff82ac5021..9b379c53ee085f47cb27670f09946f05e1850ffb 100644 --- a/civicrm/vendor/composer/autoload_real.php +++ b/civicrm/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitdfc5e10f6328180509f01b2da211a9d4 +class ComposerAutoloaderIniteb3bb96c653f131999e870853329d5ef { private static $loader; @@ -19,9 +19,9 @@ class ComposerAutoloaderInitdfc5e10f6328180509f01b2da211a9d4 return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInitdfc5e10f6328180509f01b2da211a9d4', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderIniteb3bb96c653f131999e870853329d5ef', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInitdfc5e10f6328180509f01b2da211a9d4', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderIniteb3bb96c653f131999e870853329d5ef', 'loadClassLoader')); $includePaths = require __DIR__ . '/include_paths.php'; array_push($includePaths, get_include_path()); @@ -46,14 +46,14 @@ class ComposerAutoloaderInitdfc5e10f6328180509f01b2da211a9d4 $includeFiles = require __DIR__ . '/autoload_files.php'; foreach ($includeFiles as $file) { - composerRequiredfc5e10f6328180509f01b2da211a9d4($file); + composerRequireeb3bb96c653f131999e870853329d5ef($file); } return $loader; } } -function composerRequiredfc5e10f6328180509f01b2da211a9d4($file) +function composerRequireeb3bb96c653f131999e870853329d5ef($file) { require $file; } diff --git a/includes/civicrm.basepage.php b/includes/civicrm.basepage.php index 41fe1865f3916bb96ef7903b3c835c5a593ad563..c52a49a82d13987b975ad3d5734b8105d05052b4 100644 --- a/includes/civicrm.basepage.php +++ b/includes/civicrm.basepage.php @@ -263,67 +263,24 @@ class CiviCRM_For_WordPress_Basepage { /** - * Get CiviCRM base page template. - * - * Callback method for 'template_include' hook, always called from WP front-end. + * Get CiviCRM base page template + * Callback method for 'template_include' hook, always called from WP front-end * * @param string $template The path to the existing template * @return string $template The modified path to the desired template */ public function basepage_template( $template ) { - // get template filename - $template_name = basename( $template ); - - // use the provided page template, but allow overrides. + // use the basic page template, but allow overrides $page_template = locate_template( array( - - /** - * In most cases, the logic will not progress beyond here. Shortcodes in - * posts and pages will have a template set, so we leave them alone unless - * specifically overridden by the filter. - * - * @param string $template_name The provided template name - * @return string The overridden template name - */ - apply_filters( 'civicrm_basepage_template', $template_name ) - + apply_filters( 'civicrm_basepage_template', 'page.php' ) ) ); - // if not homepage and template is found - if ( '' != $page_template && !is_front_page() ) { + if ( '' != $page_template ) { return $page_template; } - // find homepage the template - $home_template = locate_template( array( - - /** - * Override the template, but allow plugins to amend. - * - * This filter handles the scenario where no basepage has been set, in - * which case CiviCRM will try to load its content in the site's homepage. - * Many themes, however, do not have a call to "the_content()" on the - * homepage - it is often used as a gateway page to display widgets, - * archives and so forth. - * - * Be aware that if the homepage is set to show latest posts, then this - * template override will not have the desired effect. A basepage *must* - * be set if this is the case. - * - * @param string The template name (set to the default page template) - * @return string The overridden template name - */ - apply_filters( 'civicrm_basepage_home_template', 'page.php' ) - - ) ); - - // use it if found - if ( '' != $home_template ) { - return $home_template; - } - - // fall back to provided template + // fallback return $template; }