diff --git a/CRM/Contact/Form/DedupeRules.php b/CRM/Contact/Form/DedupeRules.php index c99ea8195e6f..1d6d2eb50771 100644 --- a/CRM/Contact/Form/DedupeRules.php +++ b/CRM/Contact/Form/DedupeRules.php @@ -140,11 +140,11 @@ public static function formRule($fields, $files, $self) { for ($count = 0; $count < self::RULES_COUNT; $count++) { if (!empty($fields["where_$count"]) || (isset($self->_defaults['is_reserved']) && !empty($self->_defaults["where_$count"]))) { $fieldSelected = TRUE; + if (!empty($fields["weight_$count"])) { + $actualThreshold += $fields["weight_$count"]; + } break; } - if (!empty($self->_defaults["weight_$count"])) { - $actualThreshold += $self->_defaults["weight_$count"]; - } } if (empty($fields['threshold'])) { // CRM-20607 - Don't validate the threshold of hard-coded rules diff --git a/CRM/Contact/Form/Task.php b/CRM/Contact/Form/Task.php index 6dd27e02479e..67b7f2be125f 100644 --- a/CRM/Contact/Form/Task.php +++ b/CRM/Contact/Form/Task.php @@ -86,7 +86,7 @@ public static function preProcessCommon(&$form) { $form->_contactIds = []; $form->_contactTypes = []; - $isStandAlone = in_array('task', $form->urlPath) || in_array('standalone', $form->urlPath); + $isStandAlone = in_array('task', $form->urlPath) || in_array('standalone', $form->urlPath) || in_array('map', $form->urlPath); if ($isStandAlone) { [$form->_task, $title] = CRM_Contact_Task::getTaskAndTitleByClass(get_class($form)); if (!array_key_exists($form->_task, CRM_Contact_Task::permissionedTaskTitles(CRM_Core_Permission::getPermission()))) { diff --git a/CRM/Contact/Form/Task/Useradd.php b/CRM/Contact/Form/Task/Useradd.php index 385405c6a2e1..d75239adac34 100644 --- a/CRM/Contact/Form/Task/Useradd.php +++ b/CRM/Contact/Form/Task/Useradd.php @@ -64,14 +64,20 @@ public function setDefaultValues() { * Build the form object. */ public function buildQuickForm() { + $config = CRM_Core_Config::singleton(); + $element = $this->add('text', 'name', ts('Full Name'), ['class' => 'huge']); $element->freeze(); $this->add('text', 'cms_name', ts('Username'), ['class' => 'huge']); $this->addRule('cms_name', 'Username is required', 'required'); - $this->add('password', 'cms_pass', ts('Password'), ['class' => 'huge']); - $this->add('password', 'cms_confirm_pass', ts('Confirm Password'), ['class' => 'huge']); - $this->addRule('cms_pass', 'Password is required', 'required'); - $this->addRule(['cms_pass', 'cms_confirm_pass'], 'ERROR: Password mismatch', 'compare'); + + if (!$config->userSystem->isUserRegistrationPermitted()) { + $this->add('password', 'cms_pass', ts('Password'), ['class' => 'huge']); + $this->add('password', 'cms_confirm_pass', ts('Confirm Password'), ['class' => 'huge']); + $this->addRule('cms_pass', 'Password is required', 'required'); + $this->addRule(['cms_pass', 'cms_confirm_pass'], 'ERROR: Password mismatch', 'compare'); + } + $this->add('text', 'email', ts('Email:'), ['class' => 'huge'])->freeze(); $this->addRule('email', 'Email is required', 'required'); $this->add('hidden', 'contactID'); diff --git a/CRM/Contact/Task.php b/CRM/Contact/Task.php index 4c3ac29c81c0..3597e319c991 100644 --- a/CRM/Contact/Task.php +++ b/CRM/Contact/Task.php @@ -228,6 +228,8 @@ public static function tasks() { 'title' => ts('Map contacts'), 'class' => 'CRM_Contact_Form_Task_Map', 'result' => FALSE, + 'url' => 'civicrm/contact/map', + 'icon' => 'fa-map', ); } diff --git a/CRM/Contribute/BAO/ContributionPage.php b/CRM/Contribute/BAO/ContributionPage.php index 271d0e70a88e..c15e5c3d10d0 100644 --- a/CRM/Contribute/BAO/ContributionPage.php +++ b/CRM/Contribute/BAO/ContributionPage.php @@ -483,7 +483,7 @@ protected static function getProfileNameAndFields($gid, $cid, $params, $fieldTyp $fields = CRM_Core_BAO_UFGroup::getFields($gid, FALSE, CRM_Core_Action::VIEW, NULL, NULL, FALSE, NULL, FALSE, NULL, CRM_Core_Permission::CREATE, NULL); foreach ($fields as $k => $v) { if (!$groupTitle) { - $groupTitle = $v['groupTitle']; + $groupTitle = $v['groupDisplayTitle']; } // suppress all file fields from display and formatting fields if ( diff --git a/CRM/Dedupe/MergeHandler.php b/CRM/Dedupe/MergeHandler.php index cb0d64ebacdc..7d8ad7ca2f6c 100644 --- a/CRM/Dedupe/MergeHandler.php +++ b/CRM/Dedupe/MergeHandler.php @@ -359,4 +359,113 @@ protected function getSelectedType($entity, $blockIndex) { return $this->getMigrationInfo()['location_blocks'][$entity][$blockIndex]['typeTypeId'] ?? NULL; } + /** + * Merge location. + * + * Based on the data in the $locationMigrationInfo merge the locations for 2 contacts. + * + * The data is in the format received from the merge form (which is a fairly confusing format). + * + * It is converted into an array of DAOs which is passed to the alterLocationMergeData hook + * before saving or deleting the DAOs. A new hook is added to allow these to be altered after they have + * been calculated and before saving because + * - the existing format & hook combo is so confusing it is hard for developers to change & inherently fragile + * - passing to a hook right before save means calculations only have to be done once + * - the existing pattern of passing dissimilar data to the same (merge) hook with a different 'type' is just + * ugly. + * + * The use of the new hook is tested, including the fact it is called before contributions are merged, as this + * is likely to be significant data in merge hooks. + * + * @throws \CRM_Core_Exception + */ + public function mergeLocations(): void { + $mergeHandler = $this; + $locBlocks = $mergeHandler->getLocationBlocksToMerge(); + $blocksDAO = []; + $migrationInfo = $mergeHandler->getMigrationInfo(); + + // @todo Handle OpenID (not currently in API). + if (!empty($locBlocks)) { + $locationBlocks = CRM_Dedupe_Merger::getLocationBlockInfo(); + + $primaryBlockIds = CRM_Contact_BAO_Contact::getLocBlockIds($mergeHandler->getToKeepID(), ['is_primary' => 1]); + $billingBlockIds = CRM_Contact_BAO_Contact::getLocBlockIds($mergeHandler->getToKeepID(), ['is_billing' => 1]); + + foreach ($locBlocks as $name => $block) { + $blocksDAO[$name] = ['delete' => [], 'update' => []]; + $daoName = 'CRM_Core_DAO_' . $locationBlocks[$name]['label']; + $changePrimary = FALSE; + $primaryDAOId = (array_key_exists($name, $primaryBlockIds)) ? array_pop($primaryBlockIds[$name]) : NULL; + $billingDAOId = (array_key_exists($name, $billingBlockIds)) ? array_pop($billingBlockIds[$name]) : NULL; + + foreach ($block as $blkCount => $values) { + $otherBlockId = $migrationInfo['other_details']['location_blocks'][$name][$blkCount]['id'] ?? NULL; + $mainBlockId = CRM_Utils_Array::value('mainContactBlockId', $migrationInfo['location_blocks'][$name][$blkCount], 0); + if (!$otherBlockId) { + continue; + } + $otherBlockDAO = $mergeHandler->copyDataToNewBlockDAO($otherBlockId, $name, $blkCount); + + // If we're deliberately setting this as primary then add the flag + // and remove it from the current primary location (if there is one). + // But only once for each entity. + $set_primary = $migrationInfo['location_blocks'][$name][$blkCount]['set_other_primary'] ?? NULL; + if (!$changePrimary && $set_primary == "1") { + $otherBlockDAO->is_primary = 1; + if ($primaryDAOId) { + $removePrimaryDAO = $mergeHandler->getDAOForLocationEntity($name); + $removePrimaryDAO->id = $primaryDAOId; + $removePrimaryDAO->is_primary = 0; + $blocksDAO[$name]['update'][$primaryDAOId] = $removePrimaryDAO; + } + $changePrimary = TRUE; + } + // Otherwise, if main contact already has primary, set it to 0. + elseif ($primaryDAOId) { + $otherBlockDAO->is_primary = 0; + } + + // If the main contact already has a billing location, set this to 0. + if ($billingDAOId) { + $otherBlockDAO->is_billing = 0; + } + + // overwrite - need to delete block which belongs to main-contact. + if (!empty($mainBlockId) && $values['is_replace']) { + $deleteDAO = $mergeHandler->getDAOForLocationEntity($name); + $deleteDAO->id = $mainBlockId; + $deleteDAO->find(TRUE); + + // if we about to delete a primary / billing block, set the flags for new block + // that we going to assign to main-contact + if ($primaryDAOId && ($primaryDAOId == $deleteDAO->id)) { + $otherBlockDAO->is_primary = 1; + } + if ($billingDAOId && ($billingDAOId == $deleteDAO->id)) { + $otherBlockDAO->is_billing = 1; + } + $blocksDAO[$name]['delete'][$deleteDAO->id] = $deleteDAO; + } + $blocksDAO[$name]['update'][$otherBlockDAO->id] = $otherBlockDAO; + } + $blocksDAO[$name]['update'] += $mergeHandler->getBlocksToUpdateForDeletedContact($name); + } + } + + CRM_Utils_Hook::alterLocationMergeData($blocksDAO, $mergeHandler->getToKeepID(), $mergeHandler->getToRemoveID(), $migrationInfo); + foreach ($blocksDAO as $blockDAOs) { + if (!empty($blockDAOs['update'])) { + foreach ($blockDAOs['update'] as $blockDAO) { + $blockDAO->save(); + } + } + if (!empty($blockDAOs['delete'])) { + foreach ($blockDAOs['delete'] as $blockDAO) { + $blockDAO->delete(); + } + } + } + } + } diff --git a/CRM/Dedupe/Merger.php b/CRM/Dedupe/Merger.php index 579cb31da950..8c19989164f6 100644 --- a/CRM/Dedupe/Merger.php +++ b/CRM/Dedupe/Merger.php @@ -657,7 +657,7 @@ protected static function createContact($contactID, $params) { // This parameter causes blank fields to be be emptied out. // We can probably remove. $params['updateBlankLocInfo'] = TRUE; - list($data) = CRM_Contact_BAO_Contact::formatProfileContactParams($params, [], $contactID); + [$data] = CRM_Contact_BAO_Contact::formatProfileContactParams($params, [], $contactID); CRM_Contact_BAO_Contact::create($data); } @@ -994,7 +994,7 @@ public static function merge($dupePairs = [], $cacheParams = [], $mode = 'safe', */ public static function skipMerge($mainId, $otherId, &$migrationInfo, $mode = 'safe', &$conflicts = []) { - $conflicts = self::getConflicts($migrationInfo, $mainId, $otherId, $mode)['conflicts']; + $conflicts = self::getConflicts($migrationInfo, (int) $mainId, (int) $otherId, $mode)['conflicts']; // A hook could have set skip_merge in order to alter merge behaviour. // This is a something we might ideally deprecate since they really 'should' // mess with the conflicts array instead. @@ -1209,7 +1209,7 @@ public static function getRowsElementsAndInfo($mainId, $otherId, $checkPermissio $locations = ['main' => [], 'other' => []]; foreach ($locationBlocks as $blockName => $blockInfo) { - list($locations, $rows, $elements, $migrationInfo) = self::addLocationFieldInfo($mainId, $otherId, $blockInfo, $blockName, $locations, $rows, $elements, $migrationInfo); + [$locations, $rows, $elements, $migrationInfo] = self::addLocationFieldInfo($mainId, $otherId, $blockInfo, $blockName, $locations, $rows, $elements, $migrationInfo); } // End loop through each location block entity // add the related tables and unset the ones that don't sport any of the duplicate contact's info @@ -1374,7 +1374,7 @@ public static function moveAllBelongings($mainId, $otherId, $migrationInfo, $che } $mergeHandler = new CRM_Dedupe_MergeHandler((int) $mainId, (int) $otherId); $mergeHandler->setMigrationInfo($migrationInfo); - self::mergeLocations($mergeHandler); + $mergeHandler->mergeLocations(); // **** Do contact related migrations // @todo - move all custom field processing to the move class & eventually have an @@ -1427,7 +1427,7 @@ public static function moveAllBelongings($mainId, $otherId, $migrationInfo, $che $submitted = []; } foreach ($submitted as $key => $value) { - list($cFields, $submitted) = self::processCustomFields($mainId, $key, $cFields, $submitted, $value); + [$cFields, $submitted] = self::processCustomFields($mainId, $key, $cFields, $submitted, $value); } // move view only custom fields CRM-5362 @@ -1743,114 +1743,6 @@ public static function getMergeContactDetails($contact_id) { return $result['values'][$contact_id]; } - /** - * Merge location. - * - * Based on the data in the $locationMigrationInfo merge the locations for 2 contacts. - * - * The data is in the format received from the merge form (which is a fairly confusing format). - * - * It is converted into an array of DAOs which is passed to the alterLocationMergeData hook - * before saving or deleting the DAOs. A new hook is added to allow these to be altered after they have - * been calculated and before saving because - * - the existing format & hook combo is so confusing it is hard for developers to change & inherently fragile - * - passing to a hook right before save means calculations only have to be done once - * - the existing pattern of passing dissimilar data to the same (merge) hook with a different 'type' is just - * ugly. - * - * The use of the new hook is tested, including the fact it is called before contributions are merged, as this - * is likely to be significant data in merge hooks. - * - * @param \CRM_Dedupe_MergeHandler $mergeHandler - */ - public static function mergeLocations($mergeHandler) { - $locBlocks = $mergeHandler->getLocationBlocksToMerge(); - $blocksDAO = []; - $migrationInfo = $mergeHandler->getMigrationInfo(); - - // @todo Handle OpenID (not currently in API). - if (!empty($locBlocks)) { - $locationBlocks = self::getLocationBlockInfo(); - - $primaryBlockIds = CRM_Contact_BAO_Contact::getLocBlockIds($mergeHandler->getToKeepID(), ['is_primary' => 1]); - $billingBlockIds = CRM_Contact_BAO_Contact::getLocBlockIds($mergeHandler->getToKeepID(), ['is_billing' => 1]); - - foreach ($locBlocks as $name => $block) { - $blocksDAO[$name] = ['delete' => [], 'update' => []]; - $daoName = 'CRM_Core_DAO_' . $locationBlocks[$name]['label']; - $changePrimary = FALSE; - $primaryDAOId = (array_key_exists($name, $primaryBlockIds)) ? array_pop($primaryBlockIds[$name]) : NULL; - $billingDAOId = (array_key_exists($name, $billingBlockIds)) ? array_pop($billingBlockIds[$name]) : NULL; - - foreach ($block as $blkCount => $values) { - $otherBlockId = $migrationInfo['other_details']['location_blocks'][$name][$blkCount]['id'] ?? NULL; - $mainBlockId = CRM_Utils_Array::value('mainContactBlockId', $migrationInfo['location_blocks'][$name][$blkCount], 0); - if (!$otherBlockId) { - continue; - } - $otherBlockDAO = $mergeHandler->copyDataToNewBlockDAO($otherBlockId, $name, $blkCount); - - // If we're deliberately setting this as primary then add the flag - // and remove it from the current primary location (if there is one). - // But only once for each entity. - $set_primary = $migrationInfo['location_blocks'][$name][$blkCount]['set_other_primary'] ?? NULL; - if (!$changePrimary && $set_primary == "1") { - $otherBlockDAO->is_primary = 1; - if ($primaryDAOId) { - $removePrimaryDAO = $mergeHandler->getDAOForLocationEntity($name); - $removePrimaryDAO->id = $primaryDAOId; - $removePrimaryDAO->is_primary = 0; - $blocksDAO[$name]['update'][$primaryDAOId] = $removePrimaryDAO; - } - $changePrimary = TRUE; - } - // Otherwise, if main contact already has primary, set it to 0. - elseif ($primaryDAOId) { - $otherBlockDAO->is_primary = 0; - } - - // If the main contact already has a billing location, set this to 0. - if ($billingDAOId) { - $otherBlockDAO->is_billing = 0; - } - - // overwrite - need to delete block which belongs to main-contact. - if (!empty($mainBlockId) && $values['is_replace']) { - $deleteDAO = $mergeHandler->getDAOForLocationEntity($name); - $deleteDAO->id = $mainBlockId; - $deleteDAO->find(TRUE); - - // if we about to delete a primary / billing block, set the flags for new block - // that we going to assign to main-contact - if ($primaryDAOId && ($primaryDAOId == $deleteDAO->id)) { - $otherBlockDAO->is_primary = 1; - } - if ($billingDAOId && ($billingDAOId == $deleteDAO->id)) { - $otherBlockDAO->is_billing = 1; - } - $blocksDAO[$name]['delete'][$deleteDAO->id] = $deleteDAO; - } - $blocksDAO[$name]['update'][$otherBlockDAO->id] = $otherBlockDAO; - } - $blocksDAO[$name]['update'] += $mergeHandler->getBlocksToUpdateForDeletedContact($name); - } - } - - CRM_Utils_Hook::alterLocationMergeData($blocksDAO, $mergeHandler->getToKeepID(), $mergeHandler->getToRemoveID(), $migrationInfo); - foreach ($blocksDAO as $blockDAOs) { - if (!empty($blockDAOs['update'])) { - foreach ($blockDAOs['update'] as $blockDAO) { - $blockDAO->save(); - } - } - if (!empty($blockDAOs['delete'])) { - foreach ($blockDAOs['delete'] as $blockDAO) { - $blockDAO->delete(); - } - } - } - } - /** * Dedupe a pair of contacts. * @@ -2092,7 +1984,7 @@ protected static function getCustomFieldMetadata($contactType) { * @throws \CRM_Core_Exception * @throws \CiviCRM_API3_Exception */ - public static function getConflicts(&$migrationInfo, $mainId, $otherId, $mode) { + public static function getConflicts(array &$migrationInfo, int $mainId, int $otherId, string $mode): array { $conflicts = []; // Generate var $migrationInfo. The variable structure is exactly same as // $formValues submitted during a UI merge for a pair of contacts. @@ -2111,8 +2003,8 @@ public static function getConflicts(&$migrationInfo, $mainId, $otherId, $mode) { continue; } elseif ((in_array(substr($key, 5), CRM_Dedupe_Merger::getContactFields()) or - substr($key, 0, 12) === 'move_custom_' - ) and $val != NULL + strpos($key, 'move_custom_') === 0 + ) and $val !== NULL ) { // Rule: If both main-contact, and other-contact have a field with a // different value, then let $mode decide if to merge it or not diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index 015b2e96609c..267a00644f37 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -1320,7 +1320,7 @@ public static function buildCustomDisplay( $groupTitle = NULL; foreach ($fields as $k => $v) { if (!$groupTitle) { - $groupTitle = $v['groupTitle']; + $groupTitle = $v['groupDisplayTitle']; } // suppress all file fields from display if ( diff --git a/CRM/Export/BAO/ExportProcessor.php b/CRM/Export/BAO/ExportProcessor.php index c3b0dd24bf6c..fff50a8dad1e 100644 --- a/CRM/Export/BAO/ExportProcessor.php +++ b/CRM/Export/BAO/ExportProcessor.php @@ -1458,7 +1458,9 @@ public function getSqlColumnDefinition($fieldName, $columnName) { if (in_array(CRM_Utils_Array::value('data_type', $fieldSpec), ['Country', 'StateProvince', 'ContactReference'])) { return "`$fieldName` varchar(255)"; } - return "`$fieldName` varchar(16)"; + // some of those will be exported as a (localisable) string + // @see https://lab.civicrm.org/dev/core/-/issues/2164 + return "`$fieldName` varchar(64)"; case CRM_Utils_Type::T_STRING: if (isset($fieldSpec['maxlength'])) { diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index b3f6b63bf33c..a074540ff9de 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -991,7 +991,7 @@ public function submit(): void { $this->storeContactFields($this->_params); $this->beginPostProcess(); $endDate = NULL; - $membership = $calcDate = []; + $membership = []; $params = $softParams = $ids = []; @@ -1014,15 +1014,9 @@ public function submit(): void { $formValues ); $formValues['financial_type_id'] = $this->getFinancialTypeID(); - $membershipTypeValues = []; - foreach ($this->_memTypeSelected as $memType) { - $membershipTypeValues[$memType]['membership_type_id'] = $memType; - } $isQuickConfig = $this->_priceSet['is_quick_config']; - $termsByType = []; - $lineItem = [$this->order->getPriceSetID() => $this->order->getLineItems()]; $params['tax_amount'] = $this->order->getTotalTaxAmount(); @@ -1031,36 +1025,7 @@ public function submit(): void { $params = array_merge($params, $this->getFormMembershipParams()); - $joinDate = $formValues['join_date']; - $startDate = $formValues['start_date']; - $endDate = $formValues['end_date']; - - $calcDates = []; - foreach ($this->order->getMembershipLineItems() as $membershipLineItem) { - $memTypeNumTerms = $this->getSubmittedValue('num_terms') ?: $membershipLineItem['membership_num_terms']; - $calcDates[$membershipLineItem['membership_type_id']] = CRM_Member_BAO_MembershipType::getDatesForMembershipType($membershipLineItem['membership_type_id'], - $joinDate, $startDate, $endDate, $memTypeNumTerms - ); - } - - foreach ($calcDates as $memType => $calcDate) { - foreach (['join_date', 'start_date', 'end_date'] as $d) { - //first give priority to form values then calDates. - $date = $formValues[$d] ?? NULL; - if (!$date) { - $date = $calcDate[$d] ?? NULL; - } - - $membershipTypeValues[$memType][$d] = CRM_Utils_Date::processDate($date); - } - } - - foreach ($this->_memTypeSelected as $memType) { - if (array_key_exists('max_related', $formValues)) { - // max related memberships - take from form or inherit from membership type - $membershipTypeValues[$memType]['max_related'] = $formValues['max_related'] ?? NULL; - } - } + $membershipTypeValues = $this->getMembershipParameters($formValues); // Retrieve the name and email of the current user - this will be the FROM for the receipt email [$userName] = CRM_Contact_BAO_Contact_Location::getEmailDetails(CRM_Core_Session::getLoggedInContactID()); @@ -1131,7 +1096,7 @@ public function submit(): void { } if ($this->_mode) { - $params['total_amount'] = CRM_Utils_Array::value('total_amount', $formValues, 0); + $params['total_amount'] = $this->order->getTotalAmount(); //CRM-20264 : Store CC type and number (last 4 digit) during backoffice or online payment $params['card_type_id'] = $this->_params['card_type_id'] ?? NULL; @@ -1204,7 +1169,7 @@ public function submit(): void { if ($softParams) { $softParams['contribution_id'] = $contribution->id; $softParams['currency'] = $this->getCurrency(); - $softParams['amount'] = $contribution->total_amount; + $softParams['amount'] = $this->order->getTotalAmount(); CRM_Contribute_BAO_ContributionSoft::add($softParams); } @@ -1217,14 +1182,12 @@ public function submit(): void { } $paymentStatus = NULL; - if ($params['total_amount'] > 0.0) { + if ($this->order->getTotalAmount() > 0.0) { $payment = $this->_paymentProcessor['object']; try { $result = $payment->doPayment($paymentParams); $formValues = array_merge($formValues, $result); $paymentStatus = CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $formValues['payment_status_id']); - // Assign amount to template if payment was successful. - $this->assign('amount', $params['total_amount']); } catch (\Civi\Payment\Exception\PaymentProcessorException $e) { if (!empty($paymentParams['contributionID'])) { @@ -1381,9 +1344,6 @@ public function submit(): void { } } - $this->assign('totalTaxAmount', $this->order->getTotalTaxAmount()); - // Not sure why would need this on Submit.... unless it's being used when sending mails in which case this is the wrong place - $this->assign('taxTerm', $this->getSalesTaxTerm()); $this->assign('dataArray', $dataArray); } } @@ -1632,10 +1592,14 @@ protected function isUpdateToExistingRecurringMembership() { * * @return bool * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception */ protected function emailMembershipReceipt($formValues, $membership) { $customValues = $this->getCustomValuesForReceipt($formValues, $membership); $this->assign('customValues', $customValues); + $this->assign('total_amount', $this->order->getTotalAmount()); + $this->assign('totalTaxAmount', $this->order->getTotalTaxAmount()); + $this->assign('taxTerm', $this->getSalesTaxTerm()); if ($this->_mode) { // @todo move this outside shared code as Batch entry just doesn't @@ -1894,4 +1858,48 @@ protected function getCreatedMemberships(): array { return civicrm_api3('Membership', 'get', ['id' => ['IN' => $this->_membershipIDs]])['values']; } + /** + * @param array $formValues + * + * @return array + * @throws \CiviCRM_API3_Exception + */ + protected function getMembershipParameters(array $formValues): array { + $membershipTypeValues = []; + foreach ($this->_memTypeSelected as $memType) { + $membershipTypeValues[$memType]['membership_type_id'] = $memType; + } + $joinDate = $formValues['join_date']; + $startDate = $formValues['start_date']; + $endDate = $formValues['end_date']; + + $calcDates = []; + foreach ($this->order->getMembershipLineItems() as $membershipLineItem) { + $memTypeNumTerms = $this->getSubmittedValue('num_terms') ?: $membershipLineItem['membership_num_terms']; + $calcDates[$membershipLineItem['membership_type_id']] = CRM_Member_BAO_MembershipType::getDatesForMembershipType($membershipLineItem['membership_type_id'], + $joinDate, $startDate, $endDate, $memTypeNumTerms + ); + } + + foreach ($calcDates as $memType => $calcDate) { + foreach (['join_date', 'start_date', 'end_date'] as $d) { + //first give priority to form values then calDates. + $date = $formValues[$d] ?? NULL; + if (!$date) { + $date = $calcDate[$d] ?? NULL; + } + + $membershipTypeValues[$memType][$d] = CRM_Utils_Date::processDate($date); + } + } + + foreach ($this->_memTypeSelected as $memType) { + if (array_key_exists('max_related', $formValues)) { + // max related memberships - take from form or inherit from membership type + $membershipTypeValues[$memType]['max_related'] = $formValues['max_related'] ?? NULL; + } + } + return $membershipTypeValues; + } + } diff --git a/CRM/Price/BAO/LineItem.php b/CRM/Price/BAO/LineItem.php index dfaf89f0639d..0f0b3815ca9c 100644 --- a/CRM/Price/BAO/LineItem.php +++ b/CRM/Price/BAO/LineItem.php @@ -529,7 +529,7 @@ public static function getLineItemArray(&$params, $entityId = NULL, $entityTable $params['is_quick_config'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $setID, 'is_quick_config'); } if (!empty($params['is_quick_config']) && array_key_exists('total_amount', $params) - && $totalEntityId == 1 + && $totalEntityId == 1 && count($lineItems) == 1 ) { $values['line_total'] = $values['unit_price'] = $params['total_amount']; } diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index f9b776a33662..a20ca0d8de3b 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -4004,7 +4004,9 @@ public function addCustomDataToColumns($addFields = TRUE, $permCustomGroupIds = case 'Money': $curFilters[$fieldName]['operatorType'] = CRM_Report_Form::OP_FLOAT; $curFilters[$fieldName]['type'] = CRM_Utils_Type::T_MONEY; - $curFields[$fieldName]['type'] = CRM_Utils_Type::T_MONEY; + // Use T_FLOAT instead of T_MONEY as the money number format happens + // by calling CRM_Core_BAO_CustomField::displayValue in alterCustomDataDisplay + $curFields[$fieldName]['type'] = CRM_Utils_Type::T_FLOAT; break; case 'Float': diff --git a/CRM/Utils/Money.php b/CRM/Utils/Money.php index acf785d20115..e81330950b2a 100644 --- a/CRM/Utils/Money.php +++ b/CRM/Utils/Money.php @@ -192,7 +192,12 @@ protected static function formatUSLocaleNumericRounded($amount, int $numberOfPla if (!extension_loaded('intl') || !is_numeric($amount)) { // @todo - we should not attempt to format non-numeric strings. For now // these will not fail but will give notices on php 7.4 - self::missingIntlNotice(); + if (!is_numeric($amount)) { + CRM_Core_Error::deprecatedWarning('Formatting non-numeric values is no longer supported: ' . htmlspecialchars($amount)); + } + else { + self::missingIntlNotice(); + } return self::formatNumericByFormat($amount, '%!.' . $numberOfPlaces . 'i'); } $money = Money::of($amount, CRM_Core_Config::singleton()->defaultCurrency, new CustomContext($numberOfPlaces), RoundingMode::HALF_UP); diff --git a/CRM/Utils/System/WordPress.php b/CRM/Utils/System/WordPress.php index fa8518bc21e4..52070fa22c26 100644 --- a/CRM/Utils/System/WordPress.php +++ b/CRM/Utils/System/WordPress.php @@ -767,7 +767,6 @@ public function cmsRootPath() { public function createUser(&$params, $mail) { $user_data = [ 'ID' => '', - 'user_pass' => $params['cms_pass'], 'user_login' => $params['cms_name'], 'user_email' => $params[$mail], 'nickname' => $params['cms_name'], @@ -785,15 +784,22 @@ public function createUser(&$params, $mail) { } } + $this->hooks_core_remove(); $uid = wp_insert_user($user_data); $creds = []; $creds['user_login'] = $params['cms_name']; - $creds['user_password'] = $params['cms_pass']; $creds['remember'] = TRUE; - $user = wp_signon($creds, FALSE); - wp_new_user_notification($uid, $user_data['user_pass']); + // Call wp_signon if we aren't already logged in + // For example, we might be creating a new user from the Contact record. + if (!current_user_can('create_users')) { + wp_signon($creds, FALSE); + } + + do_action('register_new_user', $uid); + $this->hooks_core_add(); + return $uid; } @@ -872,7 +878,7 @@ public function isUserRegistrationPermitted() { * @inheritDoc */ public function isPasswordUserGenerated() { - return TRUE; + return FALSE; } /** @@ -992,6 +998,13 @@ public function alterAssetUrl(\Civi\Core\Event\GenericHookEvent $e) { } } + /** + * @inheritDoc + */ + public function checkPermissionAddUser() { + return current_user_can('create_users'); + } + /** * @inheritDoc */ @@ -1254,4 +1267,38 @@ public function getCMSPermissionsUrlParams() { return ['ufAccessURL' => CRM_Utils_System::url('civicrm/admin/access/wp-permissions', 'reset=1')]; } + /** + * Remove CiviCRM's callbacks. + * + * These may cause recursive updates when creating or editing a WordPress + * user. This doesn't seem to have been necessary in the past, but seems + * to be causing trouble when newer versions of BuddyPress and CiviCRM are + * active. + * + * Based on the civicrm-wp-profile-sync plugin by Christian Wach. + * + * @see self::hooks_core_add() + */ + public function hooks_core_remove() { + $civicrm = civi_wp(); + + // Remove current CiviCRM plugin filters. + remove_action('user_register', [$civicrm->users, 'update_user']); + remove_action('profile_update', [$civicrm->users, 'update_user']); + } + + /** + * Add back CiviCRM's callbacks. + * This method undoes the removal of the callbacks above. + * + * @see self::hooks_core_remove() + */ + public function hooks_core_add() { + $civicrm = civi_wp(); + + // Re-add current CiviCRM plugin filters. + add_action('user_register', [$civicrm->users, 'update_user']); + add_action('profile_update', [$civicrm->users, 'update_user']); + } + } diff --git a/api/v3/Contact.php b/api/v3/Contact.php index 8217b646d1a2..2b82060958b8 100644 --- a/api/v3/Contact.php +++ b/api/v3/Contact.php @@ -1228,7 +1228,7 @@ function civicrm_api3_contact_get_merge_conflicts($params) { foreach ((array) $params['mode'] as $mode) { $result[$mode] = CRM_Dedupe_Merger::getConflicts( $migrationInfo, - $params['to_remove_id'], $params['to_keep_id'], + (int) $params['to_remove_id'], (int) $params['to_keep_id'], $mode ); } diff --git a/templates/CRM/Contact/Form/Task/Map/OpenStreetMaps.tpl b/templates/CRM/Contact/Form/Task/Map/OpenStreetMaps.tpl index 6fd10e2c9734..d2fed321438d 100644 --- a/templates/CRM/Contact/Form/Task/Map/OpenStreetMaps.tpl +++ b/templates/CRM/Contact/Form/Task/Map/OpenStreetMaps.tpl @@ -153,11 +153,12 @@ popup.create(evt); } - if (window.addEventListener) { - window.addEventListener("load", initMap, false); - } else if (window.attachEvent) { - document.attachEvent("onreadystatechange", initMap); - } + var checkExist = setInterval(function() { + if (typeof OpenLayers !== 'undefined') { + clearInterval(checkExist); + initMap(); + } + }, 100); // check every 100ms function gpopUp() { var from = document.getElementById('from').value; diff --git a/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php b/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php index 9e05b4684e51..65611892fcf7 100644 --- a/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php +++ b/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php @@ -1688,4 +1688,136 @@ public function testCancelOrderWithPledge(): void { $this->assertCount(0, $payments); } + /** + * Test contribution update when more than one quick + * config line item is linked to contribution. + * + * @throws CRM_Core_Exception + * @throws \CiviCRM_API3_Exception + * @throws \API_Exception + */ + public function testContributionQuickConfigTwoLineItems(): void { + $contactId1 = $this->individualCreate(); + $contactId2 = $this->individualCreate(); + $membershipOrganizationId = $this->organizationCreate(); + + // Created new contribution to bypass the deprecated error + // 'Per https://lab.civicrm.org/dev/core/issues/15 this data fix should not be required.' + // in CRM_Price_BAO_LineItem::processPriceSet(); + $this->callAPISuccess('Contribution', 'create', [ + 'contact_id' => $contactId1, + 'receive_date' => '2010-01-20', + 'financial_type_id' => 'Member Dues', + 'contribution_status_id' => 'Completed', + 'total_amount' => 150, + ]); + $this->callAPISuccess('Contribution', 'create', [ + 'contact_id' => $contactId1, + 'receive_date' => '2010-01-20', + 'financial_type_id' => 'Member Dues', + 'contribution_status_id' => 'Completed', + 'total_amount' => 150, + ]); + + // create membership type + $membershipTypeId1 = $this->callAPISuccess('MembershipType', 'create', [ + 'domain_id' => 1, + 'member_of_contact_id' => $membershipOrganizationId, + 'financial_type_id' => 'Member Dues', + 'duration_unit' => 'month', + 'duration_interval' => 1, + 'period_type' => 'rolling', + 'minimum_fee' => 100, + 'name' => 'Parent', + ])['id']; + + $membershipTypeId2 = $this->callAPISuccess('MembershipType', 'create', [ + 'domain_id' => 1, + 'member_of_contact_id' => $membershipOrganizationId, + 'financial_type_id' => 'Member Dues', + 'duration_unit' => 'month', + 'duration_interval' => 1, + 'period_type' => 'rolling', + 'minimum_fee' => 50, + 'name' => 'Child', + ])['id']; + + $contactIds = [ + $contactId1 => $membershipTypeId1, + $contactId2 => $membershipTypeId2, + ]; + + $priceFields = CRM_Price_BAO_PriceSet::getDefaultPriceSet('membership'); + + // prepare order api params. + $p = [ + 'contact_id' => $contactId1, + 'receive_date' => '2010-01-20', + 'financial_type_id' => 'Member Dues', + 'contribution_status_id' => 'Pending', + 'total_amount' => 150, + 'api.Payment.create' => ['total_amount' => 150], + ]; + + $now = date('Ymd'); + foreach ($priceFields as $priceField) { + $lineItems = []; + $contactId = array_search($priceField['membership_type_id'], $contactIds); + $lineItems[1] = [ + 'price_field_id' => $priceField['priceFieldID'], + 'price_field_value_id' => $priceField['priceFieldValueID'], + 'label' => $priceField['label'], + 'field_title' => $priceField['label'], + 'qty' => 1, + 'unit_price' => $priceField['amount'], + 'line_total' => $priceField['amount'], + 'financial_type_id' => $priceField['financial_type_id'], + 'entity_table' => 'civicrm_membership', + 'membership_type_id' => $priceField['membership_type_id'], + ]; + $p['line_items'][] = [ + 'line_item' => $lineItems, + 'params' => [ + 'contact_id' => $contactId, + 'membership_type_id' => $priceField['membership_type_id'], + 'source' => 'Payment', + 'join_date' => '2020-04-28', + 'start_date' => '2020-04-28', + 'status_id' => 'Pending', + 'is_override' => 1, + ], + ]; + } + $order = $this->callAPISuccess('order', 'create', $p); + $contributionId = $order['id']; + + $count = CRM_Core_DAO::singleValueQuery(' + SELECT count(*), total_amount + FROM civicrm_contribution cc + INNER JOIN civicrm_line_item cli + ON cli.contribution_id = cc.id + AND cc.id = %1 + GROUP BY cc.id, total_amount + HAVING SUM(cli.line_total) != total_amount + ', [1 => [$contributionId, 'Integer']]); + + $this->assertEquals(0, $count); + + $this->callAPISuccess('Contribution', 'create', [ + 'id' => $contributionId, + 'total_amount' => 150, + ]); + $count = CRM_Core_DAO::singleValueQuery(' + SELECT count(*), total_amount + FROM civicrm_contribution cc + INNER JOIN civicrm_line_item cli + ON cli.contribution_id = cc.id + AND cc.id = %1 + GROUP BY cc.id, total_amount + HAVING SUM(cli.line_total) != total_amount + ', [1 => [$contributionId, 'Integer']]); + + $this->assertEquals(0, $count); + } + } diff --git a/tests/phpunit/CRM/Core/Smarty/plugins/CrmMoneyTest.php b/tests/phpunit/CRM/Core/Smarty/plugins/CrmMoneyTest.php index c170adcb5522..e7e111a1b662 100644 --- a/tests/phpunit/CRM/Core/Smarty/plugins/CrmMoneyTest.php +++ b/tests/phpunit/CRM/Core/Smarty/plugins/CrmMoneyTest.php @@ -22,10 +22,6 @@ public function moneyCases() { $cases = []; $cases[] = ['$ 4.00', '{assign var="amount" value="4.00"}{$amount|crmMoney:USD}']; $cases[] = ['€ 1,234.00', '{assign var="amount" value="1234.00"}{$amount|crmMoney:EUR}']; - $cases[] = [ - '$ ', - '{assign var="amount" value=\'\'}{$amount|crmMoney:USD}', - ]; return $cases; } diff --git a/tests/phpunit/CRM/Export/BAO/ExportTest.php b/tests/phpunit/CRM/Export/BAO/ExportTest.php index 9bc95db1d9cf..1c8dd99a8b2e 100644 --- a/tests/phpunit/CRM/Export/BAO/ExportTest.php +++ b/tests/phpunit/CRM/Export/BAO/ExportTest.php @@ -1014,7 +1014,7 @@ public function testExportAddressData(): void { } $this->assertEquals([ - 'contact_id' => '`contact_id` varchar(16)', + 'contact_id' => '`contact_id` varchar(64)', 'billing_city' => '`billing_city` varchar(64)', 'billing_street_address' => '`billing_street_address` varchar(96)', 'billing_postal_code' => '`billing_postal_code` varchar(64)', @@ -1968,14 +1968,14 @@ public function getAllSpecifiableReturnFields(): array { */ public function getAllSpecifiableParticipantReturnColumns(): array { return [ - 'participant_campaign_id' => '`participant_campaign_id` varchar(16)', - 'participant_contact_id' => '`participant_contact_id` varchar(16)', + 'participant_campaign_id' => '`participant_campaign_id` varchar(64)', + 'participant_contact_id' => '`participant_contact_id` varchar(64)', 'componentpaymentfield_contribution_status' => '`componentpaymentfield_contribution_status` varchar(255)', 'currency' => '`currency` varchar(3)', 'componentpaymentfield_received_date' => '`componentpaymentfield_received_date` varchar(32)', - 'default_role_id' => '`default_role_id` varchar(16)', - 'participant_discount_name' => '`participant_discount_name` varchar(16)', - 'event_id' => '`event_id` varchar(16)', + 'default_role_id' => '`default_role_id` varchar(64)', + 'participant_discount_name' => '`participant_discount_name` varchar(64)', + 'event_id' => '`event_id` varchar(64)', 'event_end_date' => '`event_end_date` varchar(32)', 'event_start_date' => '`event_start_date` varchar(32)', 'template_title' => '`template_title` varchar(255)', @@ -1984,20 +1984,20 @@ public function getAllSpecifiableParticipantReturnColumns(): array { 'participant_fee_currency' => '`participant_fee_currency` varchar(3)', 'fee_label' => '`fee_label` varchar(255)', 'participant_fee_level' => '`participant_fee_level` longtext', - 'participant_is_pay_later' => '`participant_is_pay_later` varchar(16)', - 'participant_id' => '`participant_id` varchar(16)', + 'participant_is_pay_later' => '`participant_is_pay_later` varchar(64)', + 'participant_id' => '`participant_id` varchar(64)', 'participant_note' => '`participant_note` longtext', 'participant_role_id' => '`participant_role_id` varchar(128)', 'participant_role' => '`participant_role` varchar(255)', 'participant_source' => '`participant_source` varchar(128)', - 'participant_status_id' => '`participant_status_id` varchar(16)', + 'participant_status_id' => '`participant_status_id` varchar(64)', 'participant_status' => '`participant_status` varchar(255)', 'participant_register_date' => '`participant_register_date` varchar(32)', - 'participant_registered_by_id' => '`participant_registered_by_id` varchar(16)', - 'participant_is_test' => '`participant_is_test` varchar(16)', + 'participant_registered_by_id' => '`participant_registered_by_id` varchar(64)', + 'participant_is_test' => '`participant_is_test` varchar(64)', 'componentpaymentfield_total_amount' => '`componentpaymentfield_total_amount` varchar(32)', 'componentpaymentfield_transaction_id' => '`componentpaymentfield_transaction_id` varchar(255)', - 'transferred_to_contact_id' => '`transferred_to_contact_id` varchar(16)', + 'transferred_to_contact_id' => '`transferred_to_contact_id` varchar(64)', ]; } @@ -2537,15 +2537,15 @@ protected function getPledgeHeaderDefinition(): array { */ protected function getBasicSqlColumnDefinition($isContactExport): array { $columns = [ - 'civicrm_primary_id' => '`civicrm_primary_id` varchar(16)', + 'civicrm_primary_id' => '`civicrm_primary_id` varchar(64)', 'contact_type' => '`contact_type` varchar(64)', 'contact_sub_type' => '`contact_sub_type` varchar(255)', - 'do_not_email' => '`do_not_email` varchar(16)', - 'do_not_phone' => '`do_not_phone` varchar(16)', - 'do_not_mail' => '`do_not_mail` varchar(16)', - 'do_not_sms' => '`do_not_sms` varchar(16)', - 'do_not_trade' => '`do_not_trade` varchar(16)', - 'is_opt_out' => '`is_opt_out` varchar(16)', + 'do_not_email' => '`do_not_email` varchar(64)', + 'do_not_phone' => '`do_not_phone` varchar(64)', + 'do_not_mail' => '`do_not_mail` varchar(64)', + 'do_not_sms' => '`do_not_sms` varchar(64)', + 'do_not_trade' => '`do_not_trade` varchar(64)', + 'is_opt_out' => '`is_opt_out` varchar(64)', 'legal_identifier' => '`legal_identifier` varchar(32)', 'external_identifier' => '`external_identifier` varchar(64)', 'sort_name' => '`sort_name` varchar(128)', @@ -2565,20 +2565,20 @@ protected function getBasicSqlColumnDefinition($isContactExport): array { 'suffix_id' => '`suffix_id` varchar(255)', 'formal_title' => '`formal_title` varchar(64)', 'communication_style_id' => '`communication_style_id` varchar(255)', - 'email_greeting_id' => '`email_greeting_id` varchar(16)', - 'postal_greeting_id' => '`postal_greeting_id` varchar(16)', - 'addressee_id' => '`addressee_id` varchar(16)', + 'email_greeting_id' => '`email_greeting_id` varchar(64)', + 'postal_greeting_id' => '`postal_greeting_id` varchar(64)', + 'addressee_id' => '`addressee_id` varchar(64)', 'job_title' => '`job_title` varchar(255)', 'gender_id' => '`gender_id` varchar(255)', 'birth_date' => '`birth_date` varchar(32)', - 'is_deceased' => '`is_deceased` varchar(16)', + 'is_deceased' => '`is_deceased` varchar(64)', 'deceased_date' => '`deceased_date` varchar(32)', 'household_name' => '`household_name` varchar(128)', 'organization_name' => '`organization_name` varchar(128)', 'sic_code' => '`sic_code` varchar(8)', 'user_unique_id' => '`user_unique_id` varchar(255)', - 'current_employer_id' => '`current_employer_id` varchar(16)', - 'contact_is_deleted' => '`contact_is_deleted` varchar(16)', + 'current_employer_id' => '`current_employer_id` varchar(64)', + 'contact_is_deleted' => '`contact_is_deleted` varchar(64)', 'created_date' => '`created_date` varchar(32)', 'modified_date' => '`modified_date` varchar(32)', 'addressee' => '`addressee` varchar(255)', @@ -2586,9 +2586,9 @@ protected function getBasicSqlColumnDefinition($isContactExport): array { 'postal_greeting' => '`postal_greeting` varchar(255)', 'current_employer' => '`current_employer` varchar(255)', 'location_type' => '`location_type` varchar(255)', - 'address_id' => '`address_id` varchar(16)', + 'address_id' => '`address_id` varchar(64)', 'street_address' => '`street_address` varchar(96)', - 'street_number' => '`street_number` varchar(16)', + 'street_number' => '`street_number` varchar(64)', 'street_number_suffix' => '`street_number_suffix` varchar(8)', 'street_name' => '`street_name` varchar(64)', 'street_unit' => '`street_unit` varchar(16)', @@ -2600,7 +2600,7 @@ protected function getBasicSqlColumnDefinition($isContactExport): array { 'postal_code' => '`postal_code` varchar(64)', 'geo_code_1' => '`geo_code_1` varchar(32)', 'geo_code_2' => '`geo_code_2` varchar(32)', - 'manual_geo_code' => '`manual_geo_code` varchar(16)', + 'manual_geo_code' => '`manual_geo_code` varchar(64)', 'address_name' => '`address_name` varchar(255)', 'master_id' => '`master_id` varchar(128)', 'county' => '`county` varchar(64)', @@ -2608,10 +2608,10 @@ protected function getBasicSqlColumnDefinition($isContactExport): array { 'country' => '`country` varchar(64)', 'phone' => '`phone` varchar(32)', 'phone_ext' => '`phone_ext` varchar(16)', - 'phone_type_id' => '`phone_type_id` varchar(16)', + 'phone_type_id' => '`phone_type_id` varchar(64)', 'email' => '`email` varchar(254)', - 'on_hold' => '`on_hold` varchar(16)', - 'is_bulkmail' => '`is_bulkmail` varchar(16)', + 'on_hold' => '`on_hold` varchar(64)', + 'is_bulkmail' => '`is_bulkmail` varchar(64)', 'signature_text' => '`signature_text` longtext', 'signature_html' => '`signature_html` longtext', 'im_provider' => '`im_provider` varchar(255)', @@ -2644,17 +2644,17 @@ protected function getCaseSqlColumns(): array { 'case_subject' => '`case_subject` varchar(128)', 'case_source_contact_id' => '`case_source_contact_id` varchar(255)', 'case_activity_status' => '`case_activity_status` varchar(255)', - 'case_activity_duration' => '`case_activity_duration` varchar(16)', - 'case_activity_medium_id' => '`case_activity_medium_id` varchar(16)', + 'case_activity_duration' => '`case_activity_duration` varchar(64)', + 'case_activity_medium_id' => '`case_activity_medium_id` varchar(64)', 'case_activity_details' => '`case_activity_details` longtext', - 'case_activity_is_auto' => '`case_activity_is_auto` varchar(16)', - 'contact_id' => '`contact_id` varchar(16)', - 'case_id' => '`case_id` varchar(16)', + 'case_activity_is_auto' => '`case_activity_is_auto` varchar(64)', + 'contact_id' => '`contact_id` varchar(64)', + 'case_id' => '`case_id` varchar(64)', 'case_activity_subject' => '`case_activity_subject` varchar(255)', 'case_status' => '`case_status` text', 'case_type' => '`case_type` text', 'case_role' => '`case_role` text', - 'case_deleted' => '`case_deleted` varchar(16)', + 'case_deleted' => '`case_deleted` varchar(64)', 'case_activity_date_time' => '`case_activity_date_time` varchar(32)', 'case_activity_type' => '`case_activity_type` varchar(255)', ]; @@ -2667,22 +2667,22 @@ protected function getCaseSqlColumns(): array { */ protected function getActivitySqlColumns(): array { return [ - 'activity_id' => '`activity_id` varchar(16)', + 'activity_id' => '`activity_id` varchar(64)', 'activity_type' => '`activity_type` varchar(255)', - 'activity_type_id' => '`activity_type_id` varchar(16)', + 'activity_type_id' => '`activity_type_id` varchar(64)', 'activity_subject' => '`activity_subject` varchar(255)', 'activity_date_time' => '`activity_date_time` varchar(32)', - 'activity_duration' => '`activity_duration` varchar(16)', + 'activity_duration' => '`activity_duration` varchar(64)', 'activity_location' => '`activity_location` varchar(255)', 'activity_details' => '`activity_details` longtext', 'activity_status' => '`activity_status` varchar(255)', 'activity_priority' => '`activity_priority` varchar(255)', 'source_contact' => '`source_contact` varchar(255)', 'source_record_id' => '`source_record_id` varchar(255)', - 'activity_is_test' => '`activity_is_test` varchar(16)', - 'activity_campaign_id' => '`activity_campaign_id` varchar(16)', + 'activity_is_test' => '`activity_is_test` varchar(64)', + 'activity_campaign_id' => '`activity_campaign_id` varchar(64)', 'result' => '`result` text', - 'activity_engagement_level' => '`activity_engagement_level` varchar(16)', + 'activity_engagement_level' => '`activity_engagement_level` varchar(64)', 'parent_id' => '`parent_id` varchar(255)', ]; } @@ -2694,27 +2694,27 @@ protected function getActivitySqlColumns(): array { */ protected function getParticipantSqlColumns(): array { return [ - 'event_id' => '`event_id` varchar(16)', + 'event_id' => '`event_id` varchar(64)', 'event_title' => '`event_title` varchar(255)', 'event_start_date' => '`event_start_date` varchar(32)', 'event_end_date' => '`event_end_date` varchar(32)', 'event_type' => '`event_type` varchar(255)', - 'participant_id' => '`participant_id` varchar(16)', + 'participant_id' => '`participant_id` varchar(64)', 'participant_status' => '`participant_status` varchar(255)', - 'participant_status_id' => '`participant_status_id` varchar(16)', + 'participant_status_id' => '`participant_status_id` varchar(64)', 'participant_role' => '`participant_role` varchar(255)', 'participant_role_id' => '`participant_role_id` varchar(128)', 'participant_note' => '`participant_note` longtext', 'participant_register_date' => '`participant_register_date` varchar(32)', 'participant_source' => '`participant_source` varchar(128)', 'participant_fee_level' => '`participant_fee_level` longtext', - 'participant_is_test' => '`participant_is_test` varchar(16)', - 'participant_is_pay_later' => '`participant_is_pay_later` varchar(16)', + 'participant_is_test' => '`participant_is_test` varchar(64)', + 'participant_is_pay_later' => '`participant_is_pay_later` varchar(64)', 'participant_fee_amount' => '`participant_fee_amount` varchar(32)', - 'participant_discount_name' => '`participant_discount_name` varchar(16)', + 'participant_discount_name' => '`participant_discount_name` varchar(64)', 'participant_fee_currency' => '`participant_fee_currency` varchar(3)', - 'participant_registered_by_id' => '`participant_registered_by_id` varchar(16)', - 'participant_campaign_id' => '`participant_campaign_id` varchar(16)', + 'participant_registered_by_id' => '`participant_registered_by_id` varchar(64)', + 'participant_campaign_id' => '`participant_campaign_id` varchar(64)', ]; } @@ -2725,15 +2725,15 @@ protected function getParticipantSqlColumns(): array { */ public function getContributionSqlColumns(): array { return [ - 'civicrm_primary_id' => '`civicrm_primary_id` varchar(16)', + 'civicrm_primary_id' => '`civicrm_primary_id` varchar(64)', 'contact_type' => '`contact_type` varchar(64)', 'contact_sub_type' => '`contact_sub_type` varchar(255)', - 'do_not_email' => '`do_not_email` varchar(16)', - 'do_not_phone' => '`do_not_phone` varchar(16)', - 'do_not_mail' => '`do_not_mail` varchar(16)', - 'do_not_sms' => '`do_not_sms` varchar(16)', - 'do_not_trade' => '`do_not_trade` varchar(16)', - 'is_opt_out' => '`is_opt_out` varchar(16)', + 'do_not_email' => '`do_not_email` varchar(64)', + 'do_not_phone' => '`do_not_phone` varchar(64)', + 'do_not_mail' => '`do_not_mail` varchar(64)', + 'do_not_sms' => '`do_not_sms` varchar(64)', + 'do_not_trade' => '`do_not_trade` varchar(64)', + 'is_opt_out' => '`is_opt_out` varchar(64)', 'legal_identifier' => '`legal_identifier` varchar(32)', 'external_identifier' => '`external_identifier` varchar(64)', 'sort_name' => '`sort_name` varchar(128)', @@ -2753,20 +2753,20 @@ public function getContributionSqlColumns(): array { 'suffix_id' => '`suffix_id` varchar(255)', 'formal_title' => '`formal_title` varchar(64)', 'communication_style_id' => '`communication_style_id` varchar(255)', - 'email_greeting_id' => '`email_greeting_id` varchar(16)', - 'postal_greeting_id' => '`postal_greeting_id` varchar(16)', - 'addressee_id' => '`addressee_id` varchar(16)', + 'email_greeting_id' => '`email_greeting_id` varchar(64)', + 'postal_greeting_id' => '`postal_greeting_id` varchar(64)', + 'addressee_id' => '`addressee_id` varchar(64)', 'job_title' => '`job_title` varchar(255)', 'gender_id' => '`gender_id` varchar(255)', 'birth_date' => '`birth_date` varchar(32)', - 'is_deceased' => '`is_deceased` varchar(16)', + 'is_deceased' => '`is_deceased` varchar(64)', 'deceased_date' => '`deceased_date` varchar(32)', 'household_name' => '`household_name` varchar(128)', 'organization_name' => '`organization_name` varchar(128)', 'sic_code' => '`sic_code` varchar(8)', 'user_unique_id' => '`user_unique_id` varchar(255)', - 'current_employer_id' => '`current_employer_id` varchar(16)', - 'contact_is_deleted' => '`contact_is_deleted` varchar(16)', + 'current_employer_id' => '`current_employer_id` varchar(64)', + 'contact_is_deleted' => '`contact_is_deleted` varchar(64)', 'created_date' => '`created_date` varchar(32)', 'modified_date' => '`modified_date` varchar(32)', 'addressee' => '`addressee` varchar(255)', @@ -2775,7 +2775,7 @@ public function getContributionSqlColumns(): array { 'current_employer' => '`current_employer` varchar(255)', 'location_type' => '`location_type` varchar(255)', 'street_address' => '`street_address` varchar(96)', - 'street_number' => '`street_number` varchar(16)', + 'street_number' => '`street_number` varchar(64)', 'street_number_suffix' => '`street_number_suffix` varchar(8)', 'street_name' => '`street_name` varchar(64)', 'street_unit' => '`street_unit` varchar(16)', @@ -2795,8 +2795,8 @@ public function getContributionSqlColumns(): array { 'phone' => '`phone` varchar(32)', 'phone_ext' => '`phone_ext` varchar(16)', 'email' => '`email` varchar(254)', - 'on_hold' => '`on_hold` varchar(16)', - 'is_bulkmail' => '`is_bulkmail` varchar(16)', + 'on_hold' => '`on_hold` varchar(64)', + 'is_bulkmail' => '`is_bulkmail` varchar(64)', 'signature_text' => '`signature_text` longtext', 'signature_html' => '`signature_html` longtext', 'im_provider' => '`im_provider` varchar(255)', @@ -2804,7 +2804,7 @@ public function getContributionSqlColumns(): array { 'openid' => '`openid` varchar(255)', 'world_region' => '`world_region` varchar(128)', 'url' => '`url` varchar(128)', - 'phone_type_id' => '`phone_type_id` varchar(16)', + 'phone_type_id' => '`phone_type_id` varchar(64)', 'financial_type' => '`financial_type` varchar(255)', 'contribution_source' => '`contribution_source` varchar(255)', 'receive_date' => '`receive_date` varchar(32)', @@ -2813,7 +2813,7 @@ public function getContributionSqlColumns(): array { 'total_amount' => '`total_amount` varchar(32)', 'accounting_code' => '`accounting_code` varchar(64)', 'payment_instrument' => '`payment_instrument` varchar(255)', - 'payment_instrument_id' => '`payment_instrument_id` varchar(16)', + 'payment_instrument_id' => '`payment_instrument_id` varchar(64)', 'contribution_check_number' => '`contribution_check_number` varchar(255)', 'non_deductible_amount' => '`non_deductible_amount` varchar(32)', 'fee_amount' => '`fee_amount` varchar(32)', @@ -2824,20 +2824,20 @@ public function getContributionSqlColumns(): array { 'currency' => '`currency` varchar(3)', 'cancel_reason' => '`cancel_reason` longtext', 'receipt_date' => '`receipt_date` varchar(32)', - 'is_test' => '`is_test` varchar(16)', - 'is_pay_later' => '`is_pay_later` varchar(16)', + 'is_test' => '`is_test` varchar(64)', + 'is_pay_later' => '`is_pay_later` varchar(64)', 'contribution_status' => '`contribution_status` varchar(255)', - 'contribution_recur_id' => '`contribution_recur_id` varchar(16)', + 'contribution_recur_id' => '`contribution_recur_id` varchar(64)', 'amount_level' => '`amount_level` longtext', 'contribution_note' => '`contribution_note` longtext', 'contribution_batch' => '`contribution_batch` text', 'contribution_campaign_title' => '`contribution_campaign_title` varchar(255)', - 'contribution_campaign_id' => '`contribution_campaign_id` varchar(16)', + 'contribution_campaign_id' => '`contribution_campaign_id` varchar(64)', 'contribution_soft_credit_name' => '`contribution_soft_credit_name` varchar(255)', 'contribution_soft_credit_amount' => '`contribution_soft_credit_amount` varchar(32)', 'contribution_soft_credit_type' => '`contribution_soft_credit_type` varchar(255)', - 'contribution_soft_credit_contact_id' => '`contribution_soft_credit_contact_id` varchar(16)', - 'contribution_soft_credit_contribution_id' => '`contribution_soft_credit_contribution_id` varchar(16)', + 'contribution_soft_credit_contact_id' => '`contribution_soft_credit_contact_id` varchar(64)', + 'contribution_soft_credit_contribution_id' => '`contribution_soft_credit_contribution_id` varchar(64)', ]; } @@ -2848,7 +2848,7 @@ public function getContributionSqlColumns(): array { */ public function getPledgeSqlColumns(): array { return [ - 'pledge_id' => '`pledge_id` varchar(16)', + 'pledge_id' => '`pledge_id` varchar(64)', 'pledge_amount' => '`pledge_amount` varchar(32)', 'pledge_total_paid' => '`pledge_total_paid` text', 'pledge_create_date' => '`pledge_create_date` varchar(32)', @@ -2856,21 +2856,21 @@ public function getPledgeSqlColumns(): array { 'pledge_next_pay_date' => '`pledge_next_pay_date` text', 'pledge_next_pay_amount' => '`pledge_next_pay_amount` text', 'pledge_status' => '`pledge_status` varchar(255)', - 'pledge_is_test' => '`pledge_is_test` varchar(16)', - 'pledge_contribution_page_id' => '`pledge_contribution_page_id` varchar(16)', + 'pledge_is_test' => '`pledge_is_test` varchar(64)', + 'pledge_contribution_page_id' => '`pledge_contribution_page_id` varchar(64)', 'pledge_financial_type' => '`pledge_financial_type` text', - 'pledge_frequency_interval' => '`pledge_frequency_interval` varchar(16)', + 'pledge_frequency_interval' => '`pledge_frequency_interval` varchar(64)', 'pledge_frequency_unit' => '`pledge_frequency_unit` varchar(255)', 'pledge_currency' => '`pledge_currency` text', - 'pledge_campaign_id' => '`pledge_campaign_id` varchar(16)', + 'pledge_campaign_id' => '`pledge_campaign_id` varchar(64)', 'pledge_balance_amount' => '`pledge_balance_amount` text', - 'pledge_payment_id' => '`pledge_payment_id` varchar(16)', + 'pledge_payment_id' => '`pledge_payment_id` varchar(64)', 'pledge_payment_scheduled_amount' => '`pledge_payment_scheduled_amount` varchar(32)', 'pledge_payment_scheduled_date' => '`pledge_payment_scheduled_date` varchar(32)', 'pledge_payment_paid_amount' => '`pledge_payment_paid_amount` text', 'pledge_payment_paid_date' => '`pledge_payment_paid_date` text', 'pledge_payment_reminder_date' => '`pledge_payment_reminder_date` varchar(32)', - 'pledge_payment_reminder_count' => '`pledge_payment_reminder_count` varchar(16)', + 'pledge_payment_reminder_count' => '`pledge_payment_reminder_count` varchar(64)', 'pledge_payment_status' => '`pledge_payment_status` varchar(255)', ]; } @@ -2883,19 +2883,19 @@ public function getPledgeSqlColumns(): array { public function getMembershipSqlColumns(): array { return [ 'membership_type' => '`membership_type` varchar(128)', - 'member_is_test' => '`member_is_test` varchar(16)', - 'member_is_pay_later' => '`member_is_pay_later` varchar(16)', + 'member_is_test' => '`member_is_test` varchar(64)', + 'member_is_pay_later' => '`member_is_pay_later` varchar(64)', 'membership_join_date' => '`membership_join_date` varchar(32)', 'membership_start_date' => '`membership_start_date` varchar(32)', 'membership_end_date' => '`membership_end_date` varchar(32)', 'membership_source' => '`membership_source` varchar(128)', 'membership_status' => '`membership_status` varchar(255)', - 'membership_id' => '`membership_id` varchar(16)', - 'owner_membership_id' => '`owner_membership_id` varchar(16)', - 'max_related' => '`max_related` varchar(16)', - 'membership_recur_id' => '`membership_recur_id` varchar(16)', - 'member_campaign_id' => '`member_campaign_id` varchar(16)', - 'member_is_override' => '`member_is_override` varchar(16)', + 'membership_id' => '`membership_id` varchar(64)', + 'owner_membership_id' => '`owner_membership_id` varchar(64)', + 'max_related' => '`max_related` varchar(64)', + 'membership_recur_id' => '`membership_recur_id` varchar(64)', + 'member_campaign_id' => '`member_campaign_id` varchar(64)', + 'member_is_override' => '`member_is_override` varchar(64)', ]; }