Commit 48a79882 authored by ErikHommel's avatar ErikHommel
Browse files

fix issue 6158

parent b02bc8e0
......@@ -137,6 +137,7 @@ class CRM_Nbrprojectvolunteerlist_Form_Search_VolunteerList extends CRM_Contact_
E::ts('Recall Group') => 'nvpd_recall_group',
E::ts('Status') => 'study_status',
E::ts('Inv. Date') => 'nvpd_date_invited',
E::ts('Researcher Date') => 'date_researcher',
E::ts('Case ID') => 'case_id'
];
return $columns;
......@@ -172,7 +173,7 @@ class CRM_Nbrprojectvolunteerlist_Form_Search_VolunteerList extends CRM_Contact_
DISTINCT(contact_a.id) AS contact_id, cas.id AS case_id, contact_a.sort_name, contact_a.birth_date, genderov.label AS gender,
ethnicov.label AS ethnicity, adr.city AS volunteer_address, nvpd." . $eligibleColumn . ", nvpd.". $studyParticipantIDColumn
. ", nvpd." . $recallColumn . ", stustatus.label AS study_status, nvpd."
. $dateInvitedColumn . ", nvpd." . $distanceColumn;
. $dateInvitedColumn . ", nvpd." . $distanceColumn . ", '' AS date_researcher";
}
/**
......@@ -363,6 +364,13 @@ class CRM_Nbrprojectvolunteerlist_Form_Search_VolunteerList extends CRM_Contact_
foreach ($row as $fieldName => &$field) {
// add case url
switch ($fieldName) {
case 'date_researcher':
$exportDate = CRM_Nihrbackbone_NbrVolunteerCase::getLatestExportDate($row['case_id']);
if ($exportDate) {
$row['date_researcher'] = $exportDate;
}
break;
case 'birth_date':
$birthDate = $row[$fieldName];
$row[$fieldName] = "unknown";
......
......@@ -38,7 +38,7 @@ class CRM_Nbrprojectvolunteerlist_Form_Task_ExportExternal extends CRM_Contact_F
. " AS recall_group, a." . $statusColumn . " AS study_status_id, a. " . $inviteColumn . " AS date_invited,
g.label AS study_status, c.first_name, c.last_name, h.label AS gender, d.email, e.street_address,
TIMESTAMPDIFF(YEAR, c.birth_date , CURDATE()) AS age, e.city, e.postal_code, f.name AS county,
b.contact_id, c.birth_date
b.contact_id, c.birth_date, b.case_id, b.contact_id
FROM " . $participantTable . " AS a
LEFT JOIN civicrm_case_contact AS b ON a.entity_id = b.id
LEFT JOIN civicrm_contact AS c ON b.contact_id = c.id
......@@ -70,6 +70,8 @@ class CRM_Nbrprojectvolunteerlist_Form_Task_ExportExternal extends CRM_Contact_F
'city' => $dao->city,
'county' => $dao->county,
'postal_code' => $dao->postal_code,
'case_id' => $dao->case_id,
'contact_id' => $dao->contact_id,
];
// fix dates
$this->fixDates($dao, $volunteer);
......@@ -184,7 +186,12 @@ class CRM_Nbrprojectvolunteerlist_Form_Task_ExportExternal extends CRM_Contact_F
'Mobile'];
$rows = [];
foreach ($this->_selected as $selectedId => $selectedData) {
unset($selectedData['contact_id']);
// add export activity
$caseId = $selectedData['case_id'];
$contactId = $selectedData['contact_id'];
$actTypeId = CRM_Nihrbackbone_BackboneConfig::singleton()->getExportExternalActivityTypeId();
CRM_Nihrbackbone_NbrVolunteerCase::addCaseActivity($caseId, $contactId, $actTypeId, 'Completed', 'Exported to External Researcher(s)');
unset($selectedData['contact_id'], $selectedData['case_id']);
$rows[] = $selectedData;
}
CRM_Core_Report_Excel::writeCSVFile($fileName, $headers, $rows);
......
......@@ -133,7 +133,14 @@ class CRM_Nbrprojectvolunteerlist_Form_Task_InviteByEmail extends CRM_Contact_Fo
'case_id' => $caseId,
]);
// now add the invite activity
CRM_Nihrbackbone_NbrVolunteerCase::addInviteActivity($caseId, $contactId, $this->_studyId);
$studyNumber = CRM_Nihrbackbone_NbrStudy::getStudyNumberWithId($this->_studyId);
if ($studyNumber) {
$subject = "Invited to study " . $studyNumber;
}
else {
$subject = "Invited to study " . $this->_studyId;
}
CRM_Nihrbackbone_NbrVolunteerCase::addCaseActivity($caseId, $contactId, CRM_Nihrbackbone_BackboneConfig::singleton()->getInviteProjectActivityTypeId(), 'Completed', $subject);
// change status on study to invited
$statusCustomField = "custom_" . CRM_Nihrbackbone_BackboneConfig::singleton()->getParticipationCustomField('nvpd_study_participation_status', 'id');
civicrm_api3('Case', 'create', [
......
......@@ -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-03-02</releaseDate>
<version>1.7</version>
<releaseDate>2020-03-25</releaseDate>
<version>1.8</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