Skip to content

Commit

Permalink
Resolve civicrm#533 by ensuring entity details are correctly loaded f…
Browse files Browse the repository at this point in the history
…or use by the interactive profile editor
  • Loading branch information
seamuslee001 committed Mar 16, 2020
1 parent 982ece6 commit 202aafe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
8 changes: 8 additions & 0 deletions CRM/Volunteer/Angular/Tab/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public static function prepareTab($eventId) {
$event = $project->getEntityAttributes();
$entityTitle = $event['title'];

CRM_UF_Page_ProfileEditor::registerProfileScripts();
extract(CRM_Volunteer_Form_IncludeProfile::getProfileSelectorTypes());
CRM_UF_Page_ProfileEditor::registerSchemas(CRM_Utils_Array::collect('entity_type', $profileEntities));
CRM_Core_Resources::singleton()
->addStyleFile('org.civicrm.volunteer', 'css/volunteer_app.css')
->addStyleFile('org.civicrm.volunteer', 'css/volunteer_events.css')
Expand All @@ -54,6 +57,11 @@ public static function prepareTab($eventId) {
'entityId' => $project->entity_id,
'entityTitle' => $entityTitle,
'context' => 'eventTab',
'dataGroupType' => CRM_Core_BAO_UFGroup::encodeGroupType($allowCoreTypes, $allowSubTypes, ';;'),
'dataEntities' => json_encode($profileEntities),
'dataDefault' => FALSE,
'dataUsedFor' => json_encode($usedFor),

));
}

Expand Down
4 changes: 2 additions & 2 deletions ang/volunteer/Project.html
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@
<label>{{ts("Profile:")}}</label>
</div>
<div class="content">
<input ng-if="supporting_data.use_profile_editor" crm-profile-selector="{}"
ng-model="profile.uf_group_id" ng-change="validateProfileSelections()"/>
<input ng-if="supporting_data.use_profile_editor"
ng-model="profile.uf_group_id" ng-change="validateProfileSelections()" class="crm-profile-selector" id="profile-field" data-entities="{{data_entities}}" data-default="{{data_default}}" data-usedfor="{{data_used_for}}" data-group-type="{{data_group_type}}"/>

<select ng-if="!supporting_data.use_profile_editor" class="big crm-form-select crm-vol-simple-profile-selector"
crm-ui-select="{placeholder: '', allowClear:true}" ng-change="validateProfileSelections()"
Expand Down
8 changes: 6 additions & 2 deletions ang/volunteer/Project.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(function(angular, $, _) {
(function(angular, $, _, CRM) {

angular.module('volunteer').config(function($routeProvider) {
$routeProvider.when('/volunteer/manage/:projectId', {
Expand Down Expand Up @@ -176,6 +176,10 @@
$scope.phone_types = supporting_data.values.phone_types;
$scope.supporting_data = supporting_data.values;
$scope.profile_status = profile_status;
$scope.data_entities = CRM.vars['org.civicrm.volunteer'].dataEntities;
$scope.data_used_for = CRM.vars['org.civicrm.volunteer'].dataUsedFor;
$scope.data_default = CRM.vars['org.civicrm.volunteer'].dataDefault;
$scope.data_group_type = CRM.vars['org.civicrm.volunteer'].dataGroupType;
project.is_active = (project.is_active == "1");
$scope.project = project;
$scope.profiles = $scope.project.profiles;
Expand Down Expand Up @@ -454,4 +458,4 @@

});

})(angular, CRM.$, CRM._);
})(angular, CRM.$, CRM._, CRM);

0 comments on commit 202aafe

Please sign in to comment.