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
e60bcca6
Commit
e60bcca6
authored
5 years ago
by
eileen
Browse files
Options
Downloads
Patches
Plain Diff
Follow up by making more generic
parent
50182f0e
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/Core/DAO.php
+13
-10
13 additions, 10 deletions
CRM/Core/DAO.php
with
13 additions
and
10 deletions
CRM/Core/DAO.php
+
13
−
10
View file @
e60bcca6
...
...
@@ -1680,21 +1680,24 @@ FROM civicrm_domain
}
/**
* Method that copies custom fields values from an old event to a new one. Fixes bug CRM-19302,
* Method that copies custom fields values from an old entity to a new one.
*
* Fixes bug CRM-19302,
* where if a custom field of File type was present, left both events using the same file,
* breaking download URL's for the old event.
*
* @todo the goal here is to clean this up so that it works for any entity. Copy Generic already DOES some custom field stuff
* so it's not clear why this is needed - best guess is the custom fields are not handled - this is ALSO the
* situation with the dedupe.
* but it seems to be bypassed & perhaps less good than this (or this just duplicates it...)
*
* @param int $
oldEv
entID
* @param int $new
Cop
yID
* @param int $ent
ity
ID
* @param int $new
Entit
yID
*/
public
function
copyCustomFields
(
$oldEventID
,
$newCopyID
)
{
public
function
copyCustomFields
(
$entityID
,
$newEntityID
)
{
$entity
=
CRM_Core_DAO_AllCoreTables
::
getBriefName
(
get_class
(
$this
));
$tableName
=
CRM_Core_DAO_AllCoreTables
::
getTableForClass
(
get_class
(
$this
));
// Obtain custom values for old event
$customParams
=
$htmlType
=
[];
$customValues
=
CRM_Core_BAO_CustomValueTable
::
getEntityValues
(
$
oldEventID
,
'Event'
);
$customValues
=
CRM_Core_BAO_CustomValueTable
::
getEntityValues
(
$
entityID
,
$entity
);
// If custom values present, we copy them
if
(
!
empty
(
$customValues
))
{
...
...
@@ -1713,7 +1716,7 @@ FROM civicrm_domain
if
(
$value
!==
NULL
)
{
// Handle File type attributes
if
(
in_array
(
$field
,
$htmlType
))
{
$fileValues
=
CRM_Core_BAO_File
::
path
(
$value
,
$
oldEv
entID
);
$fileValues
=
CRM_Core_BAO_File
::
path
(
$value
,
$ent
ity
ID
);
$customParams
[
"custom_
{
$field
}
_-1"
]
=
[
'name'
=>
CRM_Utils_File
::
duplicate
(
$fileValues
[
0
]),
'type'
=>
$fileValues
[
1
],
...
...
@@ -1727,11 +1730,11 @@ FROM civicrm_domain
}
// Save Custom Fields for new Event
CRM_Core_BAO_CustomValueTable
::
postProcess
(
$customParams
,
'civicrm_event'
,
$newCopyID
,
'Event'
);
CRM_Core_BAO_CustomValueTable
::
postProcess
(
$customParams
,
$tableName
,
$newEntityID
,
$entity
);
}
// copy activity attachments ( if any )
CRM_Core_BAO_File
::
copyEntityFile
(
'civicrm_event'
,
$oldEventID
,
'civicrm_event'
,
$new
Cop
yID
);
CRM_Core_BAO_File
::
copyEntityFile
(
$tableName
,
$entityID
,
$tableName
,
$new
Entit
yID
);
}
/**
...
...
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