diff --git a/CRM/Volunteer/Form/Settings.php b/CRM/Volunteer/Form/Settings.php
index 273658db..89dafd1b 100644
--- a/CRM/Volunteer/Form/Settings.php
+++ b/CRM/Volunteer/Form/Settings.php
@@ -135,6 +135,13 @@ function buildQuickForm() {
array("placeholder" => ts("- none -", array('domain' => 'org.civicrm.volunteer')), "multiple" => "multiple", "class" => "crm-select2")
);
+ //Add field for Displaying project location to opportunities page
+ $this->addYesNo(
+ 'volunteer_general_show_project_location_public',
+ ts('Display Project Location', array('domain' => 'org.civicrm.volunteer'))
+ );
+
+
$this->addButtons(array(
array(
'type' => 'submit',
@@ -188,6 +195,7 @@ function setDefaultValues() {
//General Settings
$defaults['volunteer_general_campaign_filter_type'] = CRM_Utils_Array::value('volunteer_general_campaign_filter_type', $this->_settings);
$defaults['volunteer_general_campaign_filter_list'] = CRM_Utils_Array::value('volunteer_general_campaign_filter_list', $this->_settings);
+ $defaults['volunteer_general_show_project_location_public'] = CRM_Utils_Array::value('volunteer_general_show_project_location_public', $this->_settings);
return $defaults;
}
@@ -242,6 +250,11 @@ function postProcess() {
"volunteer_general_campaign_filter_list" => CRM_Utils_Array::value('volunteer_general_campaign_filter_list', $values, array())
));
+ //Display Project Location
+ civicrm_api3('Setting', 'create', array(
+ "volunteer_general_show_project_location_public" => CRM_Utils_Array::value('volunteer_general_show_project_location_public', $values, false)
+ ));
+
CRM_Core_Session::setStatus(ts("Changes Saved", array('domain' => 'org.civicrm.volunteer')), "Saved", "success");
parent::postProcess();
}
diff --git a/ang/volunteer/VolOppsCtrl.html b/ang/volunteer/VolOppsCtrl.html
index f6bf9f2c..b8bee1f1 100644
--- a/ang/volunteer/VolOppsCtrl.html
+++ b/ang/volunteer/VolOppsCtrl.html
@@ -206,6 +206,7 @@
{{ts('Available Volunteer Opportunities')}}
{{ts('Project')}} |
+ {{ts('Location')}} |
{{ts('With')}} |
{{ts('Role')}} |
{{ts('Time')}} |
@@ -222,6 +223,7 @@ {{ts('Available Volunteer Opportunities')}}
ng-click="showProjectDescription(need.project)">
+ {{formatLocation(need.project.location)}} |
{{ben.display_name}}
|
diff --git a/ang/volunteer/VolOppsCtrl.js b/ang/volunteer/VolOppsCtrl.js
index 42dc1f02..80b98447 100644
--- a/ang/volunteer/VolOppsCtrl.js
+++ b/ang/volunteer/VolOppsCtrl.js
@@ -57,6 +57,9 @@
}
+ //VOL-216: Conditionally show a location column
+ $scope.showLocationColumn = supporting_data.values.show_location || false;
+
$scope.countries = countries;
$scope.roles = supporting_data.values.roles;
$scope.searchParams = volOppSearch.getParams;
@@ -212,6 +215,29 @@
}
});
}
+
+ //This function is used to visually format address/location data
+ $scope.formatLocation = function(location) {
+ var locString = "";
+
+ if (location.street_address) {
+ locString = locString + location.street_address + ", ";
+ }
+
+ if (location.city) {
+ locString = locString + location.city + ", ";
+ }
+
+ if (location.state_province) {
+ locString = locString + location.state_province;
+ }
+
+ if(!locString && location.postal_code) {
+ locString = location.postal_code;
+ }
+
+ return locString;
+ };
});
})(angular, CRM.$, CRM._);
diff --git a/api/v3/VolunteerUtil.php b/api/v3/VolunteerUtil.php
index 873c3a2b..02b940e6 100644
--- a/api/v3/VolunteerUtil.php
+++ b/api/v3/VolunteerUtil.php
@@ -158,6 +158,9 @@ function civicrm_api3_volunteer_util_getsupportingdata($params) {
if ($controller === 'VolOppsCtrl') {
$results['roles'] = CRM_Core_OptionGroup::values('volunteer_role', FALSE, FALSE, TRUE);
+ $results['show_location'] = civicrm_api3('Setting', 'getvalue', array(
+ 'name' => 'volunteer_general_show_project_location_public',
+ ));
}
$results['use_profile_editor'] = CRM_Volunteer_Permission::check(array("access CiviCRM","profile listings and forms"));
diff --git a/settings/volunteer.setting.php b/settings/volunteer.setting.php
index a9754a11..78aedcad 100644
--- a/settings/volunteer.setting.php
+++ b/settings/volunteer.setting.php
@@ -103,5 +103,17 @@
'description' => 'Campaign Type(s)',
'help_text' => 'Depending on the value of the Campaign Filter Whitelist/Blacklist setting, the campaign types in this list will either be shown or hidden from CiviVolunteer screens.',
),
+ 'volunteer_general_show_project_location_public' => array(
+ 'group_name' => 'CiviVolunteer Global Settings',
+ 'group' => 'org.civicrm.volunteer',
+ 'name' => 'volunteer_general_show_project_location_public',
+ 'type' => 'Boolean',
+ 'default' => false,
+ 'add' => '4.5',
+ 'is_domain' => 1,
+ 'is_contact' => 0,
+ 'description' => 'Show Opportunity Location Column',
+ 'help_text' => 'When searching for Volunteer Opportunities, display a location column.',
+ ),
);