Commit c4a1a73b authored by ErikHommel's avatar ErikHommel

fix issue4594 - add volunteer relationship to form

parent 06281288
......@@ -22,6 +22,7 @@ class CRM_Aivlbasicsignup_BasicSignupConfig {
// properties for relationship type ids
private $_employeeRelationshipTypeId = NULL;
private $_volunteerRelationshipTypeId = NULL;
// properties for activity types
private $_webformResponseActivityTypeId = NULL;
......@@ -75,6 +76,7 @@ class CRM_Aivlbasicsignup_BasicSignupConfig {
return $this->_basicSignupSourcesOptionGroupId;
}
/**
* Getter for employer/employee relationship type id
*
......@@ -84,6 +86,15 @@ class CRM_Aivlbasicsignup_BasicSignupConfig {
return $this->_employeeRelationshipTypeId;
}
/**
* Getter for volunteer relationship type id
*
* @return array|null
*/
public function getVolunteerRelationshipTypId() {
return $this->_volunteerRelationshipTypeId;
}
/**
* Getter for basic sign up custom group
*
......@@ -193,8 +204,8 @@ class CRM_Aivlbasicsignup_BasicSignupConfig {
$result = civicrm_api3('RelationshipType', 'get', [
'sequential' => 1,
'return' => ["id", "name_a_b", "name_b_a"],
'name_a_b' => ['IN' => ["Employee of"]],
'name_b_a' => ['IN' => ["Employer of"]],
'name_a_b' => ['IN' => ["Employee of", "Vrijwilliger"]],
'name_b_a' => ['IN' => ["Employer of", "Secretariaat ten opzichte van vrijwilligers"]],
'options' => ['limit' => 0],
]);
foreach ($result['values'] as $relType) {
......@@ -202,6 +213,9 @@ class CRM_Aivlbasicsignup_BasicSignupConfig {
case 'Employee of':
$this->_employeeRelationshipTypeId = $relType['id'];
break;
case "Vrijwilliger":
$this->_volunteerRelationshipTypeId = $relType['id'];
}
}
}
......
......@@ -36,13 +36,16 @@ class CRM_Aivlbasicsignup_Form_BasicSignupSetting extends CRM_Core_Form {
* Method to get the aivl employees
*/
private function getAivlEmployees() {
$aivlId = CRM_Aivlbasicsignup_BasicSignupConfig::singleton()->getAivlContactId();
$employeeRelTypeId = CRM_Aivlbasicsignup_BasicSignupConfig::singleton()->getEmployeeRelationshipTypId();
$volunteerRelTypeId = CRM_Aivlbasicsignup_BasicSignupConfig::singleton()->getVolunteerRelationshipTypId();
$this->_aivlEmployees[0] = ' - select - ';
try {
$result = civicrm_api3('Relationship', 'get', [
'sequential' => 1,
'return' => ["contact_id_a", "contact_id_a.display_name"],
'relationship_type_id' => 4,
'contact_id_b' => 35,
'relationship_type_id' => ['IN' => [$volunteerRelTypeId, $employeeRelTypeId]],
'contact_id_b' => $aivlId,
'options' => ['limit' => 0],
]);
foreach ($result['values'] as $relationship) {
......
......@@ -14,8 +14,8 @@
<url desc="Support">https://civicoop.org</url>
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2019-07-18</releaseDate>
<version>1.0</version>
<releaseDate>2019-11-04</releaseDate>
<version>1.1</version>
<develStage>alpha</develStage>
<compatibility>
<ver>4.7</ver>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment