Commit 0f0b822e authored by ErikHommel's avatar ErikHommel
Browse files

fix issue 6690

parent 3e48eac8
......@@ -541,6 +541,9 @@ class CRM_Nbrprojectvolunteerlist_Form_Search_VolunteerList extends CRM_Contact_
if ($this->_studyId) {
$defaults['study_id'] = $this->_studyId;
}
// if qfKey in request, clear prevnext (ugly hack)
}
return $defaults;
}
......
......@@ -23,9 +23,9 @@ class CRM_Nbrprojectvolunteerlist_Form_Task_InviteByEmail extends CRM_Contact_Fo
*/
private function getInvitedData() {
$this->_invited = [];
$this->_countInvalid = 0;
$this->_invalids = [];
$this->_countInvited = 0;
$this->_countInvalid = 0;
$studyParticipantColumn = CRM_Nihrbackbone_BackboneConfig::singleton()->getParticipationCustomField('nvpd_study_participant_id', 'column_name');
$eligiblesColumn = CRM_Nihrbackbone_BackboneConfig::singleton()->getParticipationCustomField('nvpd_eligible_status_id', 'column_name');
$studyColumn = CRM_Nihrbackbone_BackboneConfig::singleton()->getParticipationCustomField('nvpd_study_id', 'column_name');
......@@ -72,29 +72,39 @@ class CRM_Nbrprojectvolunteerlist_Form_Task_InviteByEmail extends CRM_Contact_Fo
$volunteer['reason'] = E::ts("Not eligible");
$this->_invalids[$dao->contact_id] = $volunteer;
}
// do not allow if deceased
elseif (CRM_Nihrbackbone_NihrVolunteer::isDeceased($dao->contact_id)) {
$this->_countInvalid++;
$volunteer['reason'] = E::ts("Deceased");
$this->_invalids[$dao->contact_id] = $volunteer;
}
// do not allow if email is empty
elseif (empty($dao->email)) {
$this->_countInvalid++;
$volunteer['reason'] = E::ts("Does not have an active primary email address");
$this->_invalids[$dao->contact_id] = $volunteer;
}
// do not allow if contact has no_email flag
elseif (!CRM_Nihrbackbone_NihrVolunteer::allowsEmail($dao->contact_id)) {
$this->_countInvalid++;
$volunteer['reason'] = E::ts("Does not want to be emailed");
$this->_invalids[$dao->contact_id] = $volunteer;
}
// do not allow if invalid email
elseif (!filter_var($dao->email, FILTER_VALIDATE_EMAIL)) {
$this->_countInvalid++;
$volunteer['reason'] = E::ts("Invalid email address");
$this->_invalids[$dao->contact_id] = $volunteer;
}
// do not allow more than 50 invitations
elseif ($this->_countInvited >= 50) {
$this->_countInvalid++;
$volunteer['reason'] = E::ts("Can not mail more than 50");
$this->_invalids[$dao->contact_id] = $volunteer;
}
else {
$this->_countInvited++;
$this->_invited[$dao->contact_id] = $volunteer;
$this->_countInvited++;
$this->_invited[$dao->contact_id] = $volunteer;
}
}
......@@ -194,7 +204,7 @@ class CRM_Nbrprojectvolunteerlist_Form_Task_InviteByEmail extends CRM_Contact_Fo
$contactIds[] = $invitedId;
}
$elements = CRM_Nbrprojectvolunteerlist_Utils::processContactQueryElements($contactIds, $i, $queryParams);
$query .= implode("," , $elements) . ")";
$query .= implode("," , $elements) . ") LIMIT 50";
$dao = CRM_Core_DAO::executeQuery($query, $queryParams);
while ($dao->fetch()) {
$caseIds[$dao->case_id] = $dao->contact_id;
......
......@@ -106,7 +106,7 @@ class CRM_Nbrprojectvolunteerlist_SearchTasks {
private static function setProjectVolunteerListTasks(&$tasks) {
$nbrTasks = [
[
'title' => "Invite Volunteer(s) by Email",
'title' => "Invite Volunteer(s) by Email (max. 50)",
'class' => "CRM_Nbrprojectvolunteerlist_Form_Task_InviteByEmail",
],
[
......
{* Confirm contacts and select template for InviteByEmail *}
<h2>{ts}Invite by Email{/ts}</h2>
<div class="messages status no-popup">
<div class="help-block" id="help">
{ts}You can invite a maximum of 50 volunteers in 1 batch. If you selected more volunteers one the Manage Study Participation page only 50 will actually be used!{/ts}
</div>
<div class="crm-form-block">
<h3>{$template_txt}</h3>
<div class="crm-section">
......
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