Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Activity Profile
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Extensions
Activity Profile
Commits
2c48d1a2
Commit
2c48d1a2
authored
4 years ago
by
bgm
Committed by
Aegir user
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add support for setting the contact type/subtype even if not using activities
parent
0482777c
Branches
master
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
activityprofile.php
+26
-0
26 additions, 0 deletions
activityprofile.php
with
26 additions
and
0 deletions
activityprofile.php
+
26
−
0
View file @
2c48d1a2
...
...
@@ -189,4 +189,30 @@ function activityprofile_civicrm_post($op, $objectName, $objectId, &$objectRef)
}
}
}
// This is a bit redundant with the APIWrapper code for Profile submission
// but that code only kicks-in when using remoteform and Activity fields.
// This makes it possible to set the contact-type/subtype if using just a plain profile.
if
(
$objectName
==
'Profile'
&&
$op
==
'create'
)
{
$profile_id
=
$objectRef
[
'uf_group_id'
];
$ctype
=
Civi
::
settings
()
->
get
(
'activityprofile_'
.
$profile_id
.
'_ctype'
);
$csubtype
=
Civi
::
settings
()
->
get
(
'activityprofile_'
.
$profile_id
.
'_csubtype'
);
if
(
$ctype
||
$csubtype
)
{
$api
=
\Civi\Api4\Contact
::
update
(
false
)
->
addWhere
(
'id'
,
'='
,
$objectId
);
if
(
$ctype
)
{
$api
->
addValue
(
'contact_type'
,
$ctype
);
}
if
(
$csubtype
)
{
$api
->
addValue
(
'contact_sub_type'
,
[
$csubtype
,
]);
}
$api
->
execute
();
}
}
}
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