Commit 1cdaffc9 authored by ErikHommel's avatar ErikHommel
Browse files

changes for issues 6463 and 6464

parent a33d9b82
......@@ -57,7 +57,7 @@ class CRM_Nbrprojectvolunteerlist_Form_Task_InviteByEmail extends CRM_Contact_Fo
$eligibleStatus = implode(', ', CRM_Nihrbackbone_NbrVolunteerCase::getEligibleDescriptions($dao->eligible_status_id));
$volunteer['eligible_status'] = $eligibleStatus;
// only allow invite if eligible
if ($dao->eligible_status_id == Civi::service('nbrBackbone')->getEligibleEligibilityStatusValue()) {
if ($this->isEligible($dao->eligible_status_id)) {
// add if valid email else list as invalid
if (filter_var($dao->email, FILTER_VALIDATE_EMAIL)) {
$this->_countInvited++;
......@@ -75,6 +75,31 @@ class CRM_Nbrprojectvolunteerlist_Form_Task_InviteByEmail extends CRM_Contact_Fo
}
}
/**
* Check if status of volunteer is eligible
*
* @param $statusId
* @return bool
*/
private function isEligible($statusId) {
if (empty($statusId)) {
return FALSE;
}
$parts = explode(CRM_Core_DAO::VALUE_SEPARATOR, $statusId);
foreach ($parts as $key => $value) {
if (empty($value)) {
unset($parts[$key]);
}
}
if (count($parts) == 1) {
$singleStatus = implode("", $parts);
if ($singleStatus == Civi::service('nbrBackbone')->getEligibleEligibilityStatusValue()) {
return TRUE;
}
}
return FALSE;
}
/**
* Overridden parent method om formulier op te bouwen
*/
......
......@@ -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>2020-04-29</releaseDate>
<version>1.11</version>
<releaseDate>2020-05-04</releaseDate>
<version>1.12</version>
<develStage>beta</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