Skip to content

Commit

Permalink
Merge pull request #7 from IQSS/report_annual_survey_date
Browse files Browse the repository at this point in the history
Added author annual survey date to PPR report
  • Loading branch information
abujeda authored May 30, 2024
2 parents cffbb36 + d6d0a27 commit 4ca4720
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ function createReport($file, $contextId) {
}

//PRINT HEADERS
$headers = ['OJS ID', 'Authors Name', 'Title of Document', 'Authors Email', 'Authors Category', 'Authors Institution', 'Authors Department', 'Research Document Type', 'Associate Editor', 'Review Status', 'Author - Paper Received'];
$headers = ['OJS ID', 'Authors Name', 'Title of Document', 'Authors Email', 'Authors Category', 'Authors Institution', 'Authors Department', 'Research Document Type'];
$headers = array_merge($headers, ['Associate Editor', 'Review Status', 'Author - Paper Received', 'Annual Survey']);
$headers = array_merge($headers, ['Coauthors Name', 'Coauthors Institute', 'Coauthors Email', 'Coauthors Category', 'Coauthors Department']);
$headers = array_merge($headers, ['Reviewer', 'Reviewer Email', 'Reviewer Institution', 'Reviewer - 1st Email', 'Reviewer - Sent for Review', 'Reviewer - Response Time', 'Reviewer - Due Date']);
$headers = array_merge($headers, ['Reviewer - Paper Returned', 'Reviewer - Time (days)', 'Author - Date Returned', 'Author - Review Time (days)']);
Expand Down Expand Up @@ -96,6 +97,7 @@ function createReport($file, $contextId) {
$row[] = $editor ? $editor->getFullName() : self::PPR_MISSING_DATA;
$row[] = $reportUtil->getStatusText($submissionSentToReview, $review ? $review->getStatus(): null);
$row[] = $reportUtil->formatDate($submission->getDateSubmitted());
$row[] = $reportUtil->formatDate($this->getAnnualSurveyNotificationDate($contextId, $submission->getId()));

$contributors = $publication->getData('authors');
$coauthors = $coauthorsInstitution = $coauthorsEmail = $coauthorsCategory = $coauthorsDepartment = [];
Expand Down Expand Up @@ -186,5 +188,20 @@ private function getUser($userId) {
return $this->userCache[$userId];
}

private function getAnnualSurveyNotificationDate($contextId, $submissionId) {
//THESE IDs ARE TAKEN FROM pprOjsPlugin/tasks/PPRTaskNotificationRegistry.inc.php
// ANNUAL SURVEY IS SENT IN THE SUBMISSION CLOSED NOTIFICATION
$NOTIFICATION_TYPE_PPR_PLUGIN = 80880000;
$SUBMISSION_CLOSED_AUTHOR_NOTIFICATION = 80880900;
$notificationDao = DAORegistry::getDAO('NotificationDAO');
$notificationsIterator = $notificationDao->getByAssoc($SUBMISSION_CLOSED_AUTHOR_NOTIFICATION,
$submissionId,
$submissionId,
$NOTIFICATION_TYPE_PPR_PLUGIN,
$contextId);
$notifications = $notificationsIterator->toArray();
return empty($notifications) ? null : reset($notifications)->getDateCreated();
}

}

0 comments on commit 4ca4720

Please sign in to comment.