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
65ebc887
Commit
65ebc887
authored
12 years ago
by
yashodha
Browse files
Options
Downloads
Patches
Plain Diff
more-CRM-12274
parent
5e75052e
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/Activity/BAO/Activity.php
+22
-5
22 additions, 5 deletions
CRM/Activity/BAO/Activity.php
with
22 additions
and
5 deletions
CRM/Activity/BAO/Activity.php
+
22
−
5
View file @
65ebc887
...
...
@@ -117,15 +117,19 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
else
{
$defaults
[
'target_contact_value'
]
=
ts
(
'(recipients)'
);
}
$activityContacts
=
CRM_Core_PseudoConstant
::
activityContacts
(
'name'
);
$sourceID
=
CRM_Utils_Array
::
key
(
'Activity Source'
,
$activityContacts
);
$sourceContactId
=
self
::
getActivityContact
(
$activity
->
id
,
$sourceID
);
if
(
$
activity
->
source
_c
ontact
_i
d
&&
if
(
$source
C
ontact
I
d
&&
!
CRM_Core_DAO
::
getFieldValue
(
'CRM_Contact_DAO_Contact'
,
$
activity
->
source
_c
ontact
_i
d
,
$source
C
ontact
I
d
,
'is_deleted'
)
)
{
$defaults
[
'source_contact'
]
=
CRM_Core_DAO
::
getFieldValue
(
'CRM_Contact_DAO_Contact'
,
$
activity
->
source
_c
ontact
_i
d
,
$source
C
ontact
I
d
,
'sort_name'
);
}
...
...
@@ -2259,7 +2263,6 @@ AND contact_id <> %2
return
$allow
;
}
//first check the component permission.
$sql
=
"
SELECT component_id
...
...
@@ -2294,7 +2297,10 @@ INNER JOIN civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n
//check for source contact.
if
(
!
$componentId
||
$allow
)
{
$allow
=
CRM_Contact_BAO_Contact_Permission
::
allow
(
$activity
->
source_contact_id
,
$permission
);
$activityContacts
=
CRM_Core_PseudoConstant
::
activityContacts
(
'name'
);
$sourceID
=
CRM_Utils_Array
::
key
(
'Activity Source'
,
$activityContacts
);
$sourceContactId
=
self
::
getActivityContact
(
$activity
->
id
,
$sourceID
);
$allow
=
CRM_Contact_BAO_Contact_Permission
::
allow
(
$sourceContactId
,
$permission
);
}
//check for target and assignee contacts.
...
...
@@ -2532,5 +2538,16 @@ INNER JOIN civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n
// copy activity attachments ( if any )
CRM_Core_BAO_File
::
copyEntityFile
(
'civicrm_activity'
,
$params
[
'activityID'
],
'civicrm_activity'
,
$params
[
'mainActivityId'
]);
}
public
static
function
getActivityContact
(
$activityId
,
$recordTypeID
=
NULL
,
$column
=
'contact_id'
)
{
$activityContact
=
new
CRM_Activity_BAO_ActivityContact
();
$activityContact
->
activity_id
=
$activityId
;
if
(
$recordTypeID
)
{
$activityContact
->
record_type_id
=
$recordTypeID
;
}
if
(
$activityContact
->
find
(
TRUE
))
{
return
$activityContact
->
$column
;
}
}
}
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