Skip to content

Commit

Permalink
6.20.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Ehaic committed Feb 25, 2025
1 parent c41caf3 commit 447d707
Show file tree
Hide file tree
Showing 15 changed files with 45 additions and 26 deletions.
6 changes: 5 additions & 1 deletion classes/CronManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ public function runBatchJobs($numRunBeforeInCron = 0) {
&& ($numRunBeforeInCron <= self::MAX_BATCHES_IN_ONE_CRON)
) {
sleep(1);
Application::log("Flight Tracker repeating cron", $firstBatchQueue['pid']);
Application::log("Flight Tracker repeating cron $this->title", $firstBatchQueue['pid']);
$this->runBatchJobs($numRunBeforeInCron);
}
} else {
Expand All @@ -762,6 +762,10 @@ public function runBatchJobs($numRunBeforeInCron = 0) {
$this->saveBatchQueueToDB($batchQueue);
return;
}
if (!$queueHasRun) {
sleep(60);
Application::log("End of CronManager.php While Loop $this->title");
}
} while (!$queueHasRun);
} else if (!in_array($firstBatchQueue['status'], $validBatchStatuses)) {
throw new \Exception("Improper batch status ".$firstBatchQueue['status']);
Expand Down
1 change: 1 addition & 0 deletions classes/DateManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ public static function getMonthNumber($monthStr) {
"FALL" => "09",
"AUTUMN" => "09",
"WINTER" => "12",
"SPECIAL" => "01"
];
for ($i = 1; $i <= 12; $i++) {
$month = REDCapManagement::padInteger($i, 2);
Expand Down
28 changes: 18 additions & 10 deletions classes/FileManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@
use Dompdf\Dompdf;
use Dompdf\Options;


require_once(__DIR__ . '/ClassLoader.php');
if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
require_once(__DIR__ . '/../vendor/autoload.php');
}

class FileManagement {

public CONST MAX_DOWNLOAD_FILE_SIZE = 20000000; //20 Megabytes

public static function makePDFToTempFile($html) {
$options = new Options();
$options->set('tempDir', preg_replace("/\/$/", "", APP_PATH_TEMP)); // for images
Expand Down Expand Up @@ -158,19 +162,23 @@ public static function getMimeSuffix($mimeType) {
public static function getEdocBase64($id) {
if (is_numeric($id)) {
$module = Application::getModule();
$sql = "SELECT stored_name, mime_type FROM redcap_edocs_metadata WHERE doc_id = ?";
$sql = "SELECT stored_name, mime_type, doc_size FROM redcap_edocs_metadata WHERE doc_id = ?";
$q = $module->query($sql, [$id]);
if ($row = $q->fetch_assoc()) {
$filename = EDOC_PATH . $row['stored_name'];
$mimeType = $row['mime_type'];
if ($mimeType == "application/octet-stream") {
if (preg_match("/\.svg$/", $row['stored_name'])) {
$mimeType = "image/svg+xml";
} else {
$mimeType = mime_content_type($row['stored_name']) ?: $mimeType;
}
}
return self::getBase64OfFile($filename, $mimeType);
$fileSize = $row['doc_size'];
if ($fileSize <= self::MAX_DOWNLOAD_FILE_SIZE) {
if ($mimeType == "application/octet-stream") {
if (preg_match("/\.svg$/", $row['stored_name'])) {
$mimeType = "image/svg+xml";
} else {
$mimeType = mime_content_type($row['stored_name']) ?: $mimeType;
}
}
return self::getBase64OfFile($filename, $mimeType);
}
return "";
}
}
throw new \Exception("Invalid Edoc ID!");
Expand All @@ -193,4 +201,4 @@ public static function getEdoc($id) {
return ["error" => "Could not find entry"];
}
}
}
}
File renamed without changes.
7 changes: 5 additions & 2 deletions classes/Portal.php
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,8 @@ public function getStoredData() {
}
} else if (!empty($storedData) && !self::isValidStoredDate($storedDate)) {
Application::saveSystemSetting($this->username, []);
} else {
return $storedData;
}
}
return [];
Expand Down Expand Up @@ -952,8 +954,9 @@ public function getModifyPhotoPage() {
}
$html .= "<form action='{$this->driverURL}' method='POST' enctype='multipart/form-data' id='photoForm'>";
$html .= "<input type='hidden' name='action' value='upload_photo' />";
$html .= "<p class='centered'><label for='photoFile'>Photo:</label> <input type='file' id='photoFile' name='photoFile' onchange='portal.validateFile(this);' /><br/>";
$html .= self::makePortalButton("portal.uploadPhoto(\"#photoForm\");", "Upload");
$html .= "<p class='centered'><label for='photoFile'>Photo:</label> <input type='file' id='photoFile' name='photoFile' onchange='portal.validateFile(this);' /><br/>";
$html .= Application::generateCSRFTokenHTML();
$html .= self::makePortalButton("portal.uploadPhoto(\"#photoForm\");", "Upload");
$html .= "</form>";
return $html;
}
Expand Down
2 changes: 1 addition & 1 deletion classes/Publications.php
Original file line number Diff line number Diff line change
Expand Up @@ -2489,7 +2489,7 @@ public static function getCitationsFromPubMed(array $pmids, array $metadata, str
$upload[$j]["citation_field_citation_rate"] = $iCite->getVariable($pmid, "field_citation_rate");
$upload[$j]["citation_nih_percentile"] = $iCite->getVariable($pmid, "nih_percentile");
$upload[$j]["citation_rcr"] = $iCite->getVariable($pmid, "relative_citation_ratio");
if (in_array("citation_referencing", $metadataFields)) {
if (in_array("citation_icite_referencing", $metadataFields)) {
$sep = ", ";
$upload[$j]["citation_icite_cited_by_clinical"] = implode($sep, $iCite->getVariable($pmid, "cited_by_clin") ?: []);
$upload[$j]["citation_icite_cited_by"] = implode($sep, $iCite->getVariable($pmid, "cited_by") ?: []);
Expand Down
10 changes: 7 additions & 3 deletions classes/RePORTER.php
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ public static function updateEndDates($token, $server, $pid, $records, $prefix,
$awardNoWithInstances = [];
$redcapData = Download::fieldsForRecords($token, $server, $fieldsToDownload, [$recordId]);
foreach ($redcapData as $row) {
if ($row["redcap_repeat_instrument"] == $instrument) {
if (array_key_exists("redcap_repeat_instrument", $row) && $row["redcap_repeat_instrument"] == $instrument) {
if (!isset($awardNoWithInstances[$row[$awardNoField]])) {
$awardNoWithInstances[$row[$awardNoField]] = [];
}
Expand Down Expand Up @@ -825,8 +825,12 @@ private function filterForExcludeList() {
$pi['last_name']." ".$pi['first_name'],
$pi['last_name'].", ".$pi['first_name'],
];
if ($pi['middle_name'] ?? FALSE) {
$piNames[] = $pi['first_name']." ".$pi['middle_name']." ".$pi['last_name'];
$piNames[] = $pi['last_name'].", ".$pi['first_name']." ".$pi['middle_name'];
}
foreach ($piNames as $piName) {
if ($piName == $excludeName) {
if (strtolower($piName) == strtolower($excludeName)) {
$excludeThisItem = TRUE;
break;
}
Expand Down Expand Up @@ -890,4 +894,4 @@ private function isFederal() {
private $category;
private $includeFields;
private $excludeList;
}
}
2 changes: 1 addition & 1 deletion classes/ReactNIHTables.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private function makeModificationsArray($lookupValues, $data, $headers, $tableNu
public function sendVerificationEmail($post, &$nihTables) {
$email = strtolower(Sanitizer::sanitize($post['email']));
$scholarEmail = strtolower(Sanitizer::sanitize($post['scholarEmail']));
if (!REDCapManagement::isEmailOrEmails($email) || !REDCapManagement::isEmailOrEmails($scholarEmail)) {
if (!REDCapManagement::isEmailOrEmails($email) && !REDCapManagement::isEmailOrEmails($scholarEmail)) {
return ["error" => "Improper email"];
}
$name = Sanitizer::sanitize($post['name'] ?? "");
Expand Down

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion reporting/tables2-4/run/js/main.79ff1d4b.js.map

This file was deleted.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions reporting/upload_react/run/main.5515bcae.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion reporting/upload_react/run/main.8b24d58b.js.map

This file was deleted.

0 comments on commit 447d707

Please sign in to comment.