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
127ca309
Commit
127ca309
authored
12 years ago
by
yashodha
Browse files
Options
Downloads
Patches
Plain Diff
CRM-12274
parent
e2c81615
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/Upgrade/Incremental/php/FourFour.php
+20
-14
20 additions, 14 deletions
CRM/Upgrade/Incremental/php/FourFour.php
with
20 additions
and
14 deletions
CRM/Upgrade/Incremental/php/FourFour.php
+
20
−
14
View file @
127ca309
...
...
@@ -78,36 +78,42 @@ class CRM_Upgrade_Incremental_php_FourFour {
*/
static
function
activityContacts
(
CRM_Queue_TaskContext
$ctx
)
{
$upgrade
=
new
CRM_Upgrade_Form
();
$activityContacts
=
CRM_Core_PseudoConstant
::
activityContacts
(
'name'
);
$sourceID
=
CRM_Utils_Array
::
key
(
'Activity Source'
,
$activityContacts
);
$assigneeID
=
CRM_Utils_Array
::
key
(
'Activity Assignees'
,
$activityContacts
);
$targetID
=
CRM_Utils_Array
::
key
(
'Activity Targets'
,
$activityContacts
);
$query
=
"
CREATE TABLE IF NOT EXISTS
`
civicrm_activity_contact
`
(
`
id
`
int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Activity contact id',
`
activity_id
`
int(10) unsigned NOT NULL COMMENT 'Foreign key to the activity for this record.',
`
contact_id
`
int(10) unsigned NOT NULL COMMENT 'Foreign key to the contact for this record.',
`
record_type
` enum('Source','Assignee','Target') COLLATE utf8_unicode_ci
DEFAULT NULL COMMENT 'The record type for this row',
PRIMARY KEY (
`
id
`
),
UNIQUE KEY
`
UI_activity_contact
_id`
(
`
contact_id
`,`
activity_id
`,`
record_type
`
),
KEY
`
FK_civicrm_activity_contact_activity_id
`
(
`
activity_id
`
)
CREATE TABLE IF NOT EXISTS civicrm_activity_contact (
id int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Activity contact id',
activity_id int(10) unsigned NOT NULL COMMENT 'Foreign key to the activity for this record.',
contact_id int(10) unsigned NOT NULL COMMENT 'Foreign key to the contact for this record.',
record_type
_id int(10) unsigned
DEFAULT NULL COMMENT 'The record type
id
for this row',
PRIMARY KEY (id),
UNIQUE KEY UI_activity_contact (contact_id
,
activity_id
,
record_type
_id
),
KEY FK_civicrm_activity_contact_activity_id (activity_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
"
;
$dao
=
CRM_Core_DAO
::
executeQuery
(
$query
);
$query
=
"
INSERT INTO civicrm_activity_contact (activity_id, contact_id, record_type)
SELECT activity_id, target_contact_id,
'T
arget
'
as record_type
INSERT INTO civicrm_activity_contact (activity_id, contact_id, record_type
_id
)
SELECT activity_id, target_contact_id,
{
$t
arget
ID
}
as record_type
_id
FROM civicrm_activity_target"
;
$dao
=
CRM_Core_DAO
::
executeQuery
(
$query
);
$query
=
"
INSERT INTO civicrm_activity_contact (activity_id, contact_id, record_type)
SELECT activity_id, assignee_contact_id,
'A
ssignee
'
as record_type
INSERT INTO civicrm_activity_contact (activity_id, contact_id, record_type
_id
)
SELECT activity_id, assignee_contact_id,
{
$a
ssignee
ID
}
as record_type
_id
FROM civicrm_activity_assignment"
;
$dao
=
CRM_Core_DAO
::
executeQuery
(
$query
);
$query
=
"
INSERT INTO civicrm_activity_contact (activity_id, contact_id, record_type)
SELECT id, source_contact_id,
'S
ource
'
as record_type
INSERT INTO civicrm_activity_contact (activity_id, contact_id, record_type
_id
)
SELECT id, source_contact_id,
{
$s
ource
ID
}
as record_type
_id
FROM civicrm_activity
WHERE source_contact_id IS NOT 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