Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
CiviCRM Core
Commits
443b070f
Commit
443b070f
authored
4 years ago
by
eileen
Browse files
Options
Downloads
Patches
Plain Diff
#2047
[REF] Move calculation of 'type' to copyDataToNewBlockDAO
parent
c3ea05e1
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CRM/Dedupe/MergeHandler.php
+22
-13
22 additions, 13 deletions
CRM/Dedupe/MergeHandler.php
with
22 additions
and
13 deletions
CRM/Dedupe/MergeHandler.php
+
22
−
13
View file @
443b070f
...
...
@@ -205,20 +205,11 @@ class CRM_Dedupe_MergeHandler {
* @throws \CRM_Core_Exception
*/
public
function
copyDataToNewBlockDAO
(
$otherBlockId
,
$name
,
$blkCount
)
{
$locationBlocks
=
CRM_Dedupe_Merger
::
getLocationBlockInfo
();
$migrationInfo
=
$this
->
getMigrationInfo
();
// For the block which belongs to other-contact, link the location block to main-contact
$otherBlockDAO
=
$this
->
getDAOForLocationEntity
(
$name
,
$this
->
getSelectedLocationType
(
$name
,
$blkCount
));
$otherBlockDAO
=
$this
->
getDAOForLocationEntity
(
$name
,
$this
->
getSelectedLocationType
(
$name
,
$blkCount
),
$this
->
getSelectedType
(
$name
,
$blkCount
));
$otherBlockDAO
->
contact_id
=
$this
->
getToKeepID
();
// Get the ID of this block on the 'other' contact, otherwise skip
$otherBlockDAO
->
id
=
$otherBlockId
;
// Add/update location and type information from the form, if applicable
if
(
$locationBlocks
[
$name
][
'hasType'
])
{
$typeTypeId
=
$migrationInfo
[
'location_blocks'
][
$name
][
$blkCount
][
'typeTypeId'
]
??
NULL
;
$otherBlockDAO
->
{
$locationBlocks
[
$name
][
'hasType'
]}
=
$typeTypeId
;
}
return
$otherBlockDAO
;
}
...
...
@@ -227,12 +218,13 @@ class CRM_Dedupe_MergeHandler {
*
* @param string $entity
*
* @param null $locationTypeID
* @param int|null $locationTypeID
* @param int|null $typeID
*
* @return CRM_Core_DAO_Address|CRM_Core_DAO_Email|CRM_Core_DAO_IM|CRM_Core_DAO_Phone|CRM_Core_DAO_Website
* @throws \CRM_Core_Exception
*/
public
function
getDAOForLocationEntity
(
$entity
,
$locationTypeID
=
NULL
)
{
public
function
getDAOForLocationEntity
(
$entity
,
$locationTypeID
=
NULL
,
$typeID
=
NULL
)
{
switch
(
$entity
)
{
case
'email'
:
$dao
=
new
CRM_Core_DAO_Email
();
...
...
@@ -247,10 +239,13 @@ class CRM_Dedupe_MergeHandler {
case
'phone'
:
$dao
=
new
CRM_Core_DAO_Phone
();
$dao
->
location_type_id
=
$locationTypeID
;
$dao
->
phone_type_id
=
$typeID
;
return
$dao
;
case
'website'
:
return
new
CRM_Core_DAO_Website
();
$dao
=
new
CRM_Core_DAO_Website
();
$dao
->
website_type_id
=
$typeID
;
return
$dao
;
case
'im'
:
$dao
=
new
CRM_Core_DAO_IM
();
...
...
@@ -277,4 +272,18 @@ class CRM_Dedupe_MergeHandler {
return
$this
->
getMigrationInfo
()[
'location_blocks'
][
$entity
][
$blockIndex
][
'locTypeId'
]
??
NULL
;
}
/**
* Get the selected type for the given location block.
*
* This will retrieve any user selection if they specified which type to move a block to (e.g 'Mobile' for phone).
*
* @param string $entity
* @param int $blockIndex
*
* @return int|null
*/
protected
function
getSelectedType
(
$entity
,
$blockIndex
)
{
return
$this
->
getMigrationInfo
()[
'location_blocks'
][
$entity
][
$blockIndex
][
'typeTypeId'
]
??
NULL
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment