Skip to content

Commit

Permalink
6.10.2
Browse files Browse the repository at this point in the history
  • Loading branch information
scottjpearson committed May 6, 2024
1 parent d98d4c6 commit 67789bd
Show file tree
Hide file tree
Showing 37 changed files with 273 additions and 1,539 deletions.
2 changes: 1 addition & 1 deletion CareerDev.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class CareerDev {
public static $passedModule = NULL;

public static function getVersion() {
return "6.10.1";
return "6.10.2";
}

public static function getLocalhostPluginPid() {
Expand Down
4 changes: 2 additions & 2 deletions FlightTrackerExternalModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ private static function getNumberOfEmailAddresses($infoAry) {
return count($emails);
}

private function alertForBlankEmails($infoArray) {
private function alertForBlankEmails(array $infoArray) : array {
$hasEmails = [];
$missingEmails = [];
foreach ($infoArray as $info) {
Expand Down Expand Up @@ -719,7 +719,7 @@ private function alertForBlankEmails($infoArray) {
}
return $returnItems;
} else {
return FALSE;
return [];
}
}

Expand Down
14 changes: 14 additions & 0 deletions bulkImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,20 @@
<p class='centered'><input type='submit' name='submit' value='Upload'></p>
</form>

<h4>Notes</h4>
<p class="centered max-width">When brackets are specified in the spreadsheet headers, the value of each cell needs to be one of those options exactly -or- blank. A full description of the Grant Types is below.</p>
<ul class="left-align max-width-600">
<li><strong>Internal K</strong> awards are funding from your own institution that’s not a K12 or KL2.</li>
<li><strong>K12/KL2</strong> grants have their own class. Note that these are for trainees, and for a PI, this would count as a Mentoring/Traiing Grant Admin award.</li>
<li><strong>Individual K</strong> grants are career development awards by the NIH (only).</li>
<li><strong>K Equivalent</strong> grants are career development awards not by the NIH and not by your institution. (The VA, the American Cancer Society, and the Doris Duke Charitable Fellowship have awards that would fall into this category.)</li>
<li><strong>R01</strong> awards use the R01 mechanism from the NIH.</li>
<li><strong>R01 Equivalent</strong> awards are large awards that are basically the equivalent of an R01, but does not use the R01 mechanism. We try to use the loose definition of $250,000 per year for 3+ years because this is the current median value of an R01.</li>
<li><strong>Research Fellowship</strong> awards are project-based grants that are too small to be R01 Equivalents.</li>
<li><strong>Mentoring/Training Grant Admin</strong> grants are leadership awards for training or mentoring others.</li>
<li><strong>Bridge Award</strong> grants span more than one category. K99/R00 and T99/K00 awards are the primary two examples.</li>
</ul>

<?php
function verifyFile($fileinfo, $importFile, $expectedItems) {
$error = detectFirstError($fileinfo, $importFile, $expectedItems);
Expand Down
3 changes: 2 additions & 1 deletion charts/grantTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
$end = $grant->getVariable("end");
$grantTs = $start ? strtotime($start) : FALSE;
$grantEndTs = $end ? strtotime($end) : FALSE;
$awardNo = $grant->getBaseNumber();
if (
$grantTs
&& ($grantTs >= $startTs)
Expand All @@ -118,10 +119,10 @@
&& ($grantEndTs >= $startTs)
&& ($grantEndTs <= $endTs)
)
|| !$grantEndTs
)
) {
$row = [];
$awardNo = $grant->getNumber();
$row[] = $names[$recordId] ?? "";
$row[] = $awardNo;
$row[] = Grant::getActivityCode($awardNo);
Expand Down
6 changes: 6 additions & 0 deletions classes/DataDictionaryManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,9 @@ public static function findChangedFieldsInMetadata($projectMetadata, $files, $de
if (Application::isLocalhost()) {
$metadata['file'] = self::filterOutForms($metadata['file'], self::getCoeusForms());
}
if (MMAHelper::canConfigureCustomAgreement($pid)) {
$metadata['file'] = self::filterOutForms($metadata['file'], ["mentoring_agreement"]);
}

$choices = [];
foreach ($metadata as $type => $md) {
Expand Down Expand Up @@ -1167,6 +1170,9 @@ public static function mergeMetadataAndUploadNew($originalMetadata, $fileMetadat
|| REDCapManagement::arraysEqual($fileFields, $originalFormsAndFields[$form])
) {
self::addFields($mergedMetadata, $fileMetadata, $fileFields);
} else if (MMAHelper::canConfigureCustomAgreement($pid) && ($form == "mentoring_agreement")) {
$originalMentoringFields = self::getFieldsFromMetadata($originalMetadata, $form);
self::addFields($mergedMetadata, $originalMetadata, $originalMentoringFields);
} else {
$originalFields = $originalFormsAndFields[$form];
$mergedOrderForForm = self::mergeFields($fileFields, $originalFields);
Expand Down
23 changes: 22 additions & 1 deletion classes/GrantFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ public function processRow($row, $otherRows, $token = "") {
}
$costs = Grant::removeCommas($row[$prefix.'_grant'.$i.'_costs']);
$grant->setVariable('budget', $costs);
$grant->setVariable('total_budget', $costs);
$grant->setVariable('direct_budget', $costs);
// $grant->setVariable('fAndA', Grants::getFAndA($awardno, $row['check_grant'.$i.'_start']));
$grant->setVariable('finance_type', Grants::getFinanceType($awardno));
Expand Down Expand Up @@ -359,6 +360,7 @@ public function processRow($row, $otherRows, $token = "") {
$grant->setVariable('source', "followup");
$costs = Grant::removeCommas($row['followup_grant'.$i.'_costs']);
$grant->setVariable('budget', $costs);
$grant->setVariable('total_budget', $costs);
// $grant->setVariable('fAndA', Grants::getFAndA($awardno, $row['followup_grant'.$i.'_start']));
$grant->setVariable('finance_type', Grants::getFinanceType($awardno));
$grant->setVariable('direct_budget', $costs);
Expand Down Expand Up @@ -437,6 +439,7 @@ private function processNewmanData($row) {
$grant->setVariable('start', $date1);
$grant->setVariable('project_start', $date1);
$grant->setVariable('budget', 0);
$grant->setVariable('total_budget', 0);
$grant->setVariable('direct_budget', 0);
$grant->setVariable('source', "data");
$grant->setVariable('sponsor_type', $type);
Expand Down Expand Up @@ -493,6 +496,7 @@ private function processNewmanData($row) {
$grant->setVariable('end', $endDate);
$grant->setVariable('project_end', $endDate);
$grant->setVariable('budget', 0);
$grant->setVariable('total_budget', 0);
$grant->setVariable('direct_budget', 0);
$grant->setVariable('sponsor_type', $type);
if ($type) {
Expand Down Expand Up @@ -521,6 +525,7 @@ private function processNewmanData($row) {
$grant->setVariable('end', "");
$grant->setVariable('project_end', "");
$grant->setVariable('budget', 0);
$grant->setVariable('total_budget', 0);
$grant->setVariable('direct_budget', 0);
$grant->setVariable('source', "data");
$grant->setVariable('url', $url);
Expand Down Expand Up @@ -600,6 +605,7 @@ private function processSheet2($row) {
$grant->setVariable('url', $url);
$grant->setVariable('link', Links::makeLink($url, "See Grant"));
$grant->setVariable('budget', 0);
$grant->setVariable('total_budget', 0);
$grant->setVariable('direct_budget', 0);
$grant->setVariable('sponsor_type', $type);

Expand Down Expand Up @@ -655,6 +661,7 @@ private function processSheet2($row) {
$grant->setVariable('url', $url);
$grant->setVariable('link', Links::makeLink($url, "See Grant"));
$grant->setVariable('budget', 0);
$grant->setVariable('total_budget', 0);
$grant->setVariable('direct_budget', 0);
$grant->setVariable('pi_flag', "Y");
# for this, the type = the award no
Expand Down Expand Up @@ -689,6 +696,7 @@ private function processSheet2($row) {
$grant->setVariable('url', $url);
$grant->setVariable('link', Links::makeLink($url, "See Grant"));
$grant->setVariable('budget', 0);
$grant->setVariable('total_budget', 0);
$grant->setVariable('direct_budget', 0);

$previous = $row['newman_sheet2_previous_funding'];
Expand Down Expand Up @@ -729,6 +737,7 @@ private function processNew2017($row) {
$grant->setVariable('url', $url);
$grant->setVariable('link', Links::makeLink($url, "See Grant"));
$grant->setVariable('budget', 0);
$grant->setVariable('total_budget', 0);
$grant->setVariable('direct_budget', 0);
$sponsorType = $row["newman_new_current_program_funding"];
$grant->setVariable('sponsor_type', $sponsorType);
Expand Down Expand Up @@ -783,6 +792,7 @@ private function processNew2017($row) {
$grant->setVariable('url', $url);
$grant->setVariable('link', Links::makeLink($url, "See Grant"));
$grant->setVariable('budget', 0);
$grant->setVariable('total_budget', 0);
$grant->setVariable('direct_budget', 0);
$grant->setVariable('pi_flag', "Y");
# for this, the type = the award no
Expand Down Expand Up @@ -853,6 +863,7 @@ public function processRow($row, $otherRows, $token = "") {
$totalBudget = $directBudget + $indirectBudget;
$grant->setVariable('title', $row['coeussubmission_title']);
$grant->setVariable('budget', $totalBudget);
$grant->setVariable('total_budget', $totalBudget);
$grant->setVariable('direct_budget', $directBudget);

$grant->setVariable('source', "coeus");
Expand Down Expand Up @@ -909,6 +920,7 @@ public function processRow($row, $otherRows, $token = "") {
$grant->setVariable('subproject', $isSubproject);
if (preg_match("/[Kk]12/", $awardNo) && !in_array($row['coeus_pi_flag'], ["N", "0"])) {
$grant->setVariable('budget', '0');
$grant->setVariable('total_budget', '0');
$grant->setVariable('direct_budget', '0');
$grant->setVariable("role", "");
} else {
Expand All @@ -924,6 +936,7 @@ public function processRow($row, $otherRows, $token = "") {
$grant->setVariable("role", self::$defaultRole);
}
$grant->setVariable('budget', $row['coeus_total_cost_budget_period']);
$grant->setVariable('total_budget', $row['coeus_total_cost_budget_period']);
$grant->setVariable('direct_budget', $row['coeus_direct_cost_budget_period']);
}
$grant->setVariable('title', $row['coeus_title']);
Expand Down Expand Up @@ -1148,6 +1161,7 @@ public function processRow($row, $otherRows, $token = "") {
$grant->setVariable('end', REDCapManagement::datetime2Date($row['coeus2_current_period_end']));
$grant->setVariable('title', $row['coeus2_title']);
$grant->setVariable('budget', $row['coeus2_current_period_total_funding']);
$grant->setVariable('total_budget', $row['coeus2_current_period_total_funding']);
$grant->setVariable('direct_budget', $row['coeus2_current_period_direct_funding']);
$grant->setVariable('last_update', $row['coeus2_last_update']);
$grant->setVariable('flagged', $row['coeus2_flagged'] ?? "");
Expand Down Expand Up @@ -1199,6 +1213,7 @@ public function processRow($row, $otherRows, $token = "") {
$grant->setVariable('project_end', self::getReporterDate($row['reporter_projectenddate']));
$grant->setVariable('title', $row['reporter_title']);
$grant->setVariable('budget', $row['reporter_totalcostamount']);
$grant->setVariable('total_budget', $row['reporter_totalcostamount']);
$grant->setVariable('direct_budget', Grants::directCostsFromTotal($row['reporter_totalcostamount'], $awardNo, self::getReporterDate($row['reporter_budgetstartdate'])));
// $grant->setVariable('fAndA', Grants::getFAndA($awardNo, self::getReporterDate($row['reporter_budgetstartdate'])));
$grant->setVariable('finance_type', Grants::getFinanceType($awardNo));
Expand Down Expand Up @@ -1263,7 +1278,8 @@ public function processRow($row, $otherRows, $token = "")
$grant->setVariable('start', $row['nih_budget_start'] ?: $budgetStartDate);
$grant->setVariable('end', $row['nih_budget_end'] ?: $budgetEndDate);
$grant->setVariable('title', $row['nih_project_title']);
$grant->setVariable('budget', $row['nih_direct_cost_amt'] ?: $row['nih_award_amount']);
$grant->setVariable('budget', $row['nih_award_amount'] ?: $row['nih_direct_cost_amt']);
$grant->setVariable('direct_budget', $row['nih_direct_cost_amt']);
$grant->setVariable('total_budget', $row['nih_award_amount']);
$grant->setVariable('sponsor', $row['nih_agency_ic_admin']);
$grant->setVariable('sponsor_type', $row['nih_agency_ic_admin']);
Expand Down Expand Up @@ -1364,6 +1380,7 @@ public function processRow($row, $otherRows, $token = "")
$grant->setVariable('project_end', RePORTERGrantFactory::getReporterDate($row['exporter_project_end']));
$grant->setVariable('title', $row['exporter_project_title']);
$grant->setVariable('budget', $totalCosts);
$grant->setVariable('total_budget', $totalCosts);
$grant->setVariable('direct_budget', $row['exporter_direct_cost_amt']);
$grant->setVariable('sponsor', $row['exporter_ic_name']);
$grant->setVariable('sponsor_type', $row['exporter_ic_name']);
Expand Down Expand Up @@ -1433,6 +1450,7 @@ public function processRow($row, $otherRows, $token = "") {
$grant->setVariable('project_end', $row['custom_end']);
$grant->setVariable('title', $row['custom_title']);
$grant->setVariable('budget', $totalCosts);
$grant->setVariable('total_budget', $totalCosts);
// $grant->setVariable('fAndA', Grants::getFAndA($awardNo, $row['custom_start']));
$grant->setVariable('finance_type', Grants::getFinanceType($awardNo));
$grant->setVariable('direct_budget', $directCosts);
Expand Down Expand Up @@ -1513,6 +1531,7 @@ public function processRow($row, $otherRows, $token = "") {
$grant->setVariable('last_update', $row['summary_award_last_update_'.$i]);
$grant->setVariable('title', $row['summary_award_title_'.$i]);
$grant->setVariable('budget', $row['summary_award_total_budget_'.$i]);
$grant->setVariable('total_budget', $row['summary_award_total_budget_'.$i]);
$grant->setVariable('direct_budget', $row['summary_award_direct_budget_'.$i]);
$grant->setNumber($row['summary_award_sponsorno_'.$i]);
$grant->setVariable('source', $row['summary_award_source_'.$i]);
Expand Down Expand Up @@ -1564,6 +1583,7 @@ public function processRow($row, $otherRows, $token = "")
$grant->setVariable('project_end', $row['nsf_expdate']);
$grant->setVariable('title', $title);
$grant->setVariable('budget', $dollars);
$grant->setVariable('total_budget', $dollars);
$grant->setVariable('direct_budget', $dollars);
$grant->setVariable('sponsor', $row['nsf_agency']);
$grant->setVariable("institution", $row['nsf_awardeename']);
Expand Down Expand Up @@ -1624,6 +1644,7 @@ public function processRow($row, $otherRows, $token = "")
$grant->setVariable('project_end', $row['ies_end']);
$grant->setVariable('title', $row['ies_title']);
$grant->setVariable('budget', $dollars);
$grant->setVariable('total_budget', $dollars);
$grant->setVariable('direct_budget', $dollars);
$grant->setVariable('sponsor', $row['ies_centername']);
$grant->setVariable('original_award_number', $awardNo);
Expand Down
17 changes: 15 additions & 2 deletions classes/MMAHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,10 @@ public static function makePrefillDropdownHTML($surveysAvailableToPrefill, $uidS
return $html;
}

public static function canConfigureCustomAgreement($pid) {
return (Application::isVanderbilt() && in_array($pid, [175974, 175975]));
}

private static function makeStepsHTML($selectedSteps, $currStep) {
$stepHTML = [];
$allSections = self::getAllSections();
Expand Down Expand Up @@ -1325,6 +1329,9 @@ public static function makeStepHTML($metadata, $step, $redcapData, $menteeRecord
$id = $name."___".$key;
$html .= "<div class='form-check'><input class='form-check-input' type='radio' onclick='doMMABranching();' name='$name' id='$id' value='$key' ".(($value == $key) ? "checked" : "")."><label class='form-check-label' for='$id'>$label</label></div>";
}
if ($row['field_note']) {
$html .= "<p class='smaller'>".$row['field_note']."</p>";
}
$html .= "</td>".self::makeNotesHTML($fieldName, $redcapData, $menteeRecordId, $currInstance, $notesFields)."
</tr>";

Expand All @@ -1343,6 +1350,9 @@ public static function makeStepHTML($metadata, $step, $redcapData, $menteeRecord

$html .= "<div class='form-check'><input class='form-check-input' onclick='doMMABranching();' type='checkbox' name='$name' id='$id' $isChecked ><label class='form-check-label' for='$id'>$label</label></div>";
}
if ($row['field_note']) {
$html .= "<p class='smaller'>".$row['field_note']."</p>";
}
$html .="</td>".self::makeNotesHTML($fieldName, $redcapData, $menteeRecordId, $currInstance, $notesFields)."
</tr>";
} else if (($row['field_type'] == "notes") && (!in_array($fieldName, $notesFields))) {
Expand Down Expand Up @@ -1371,8 +1381,11 @@ public static function makeStepHTML($metadata, $step, $redcapData, $menteeRecord
if ($surveyLink) {
$text = str_replace("[this REDCap Survey]", "<a href='$surveyLink'>this REDCap Survey</a>", $row['field_label']);
$html .="<tr id='$rowName' $rowCSSStyle>
<td colspan='3'>$text</td>
</tr>";
<td colspan='3'>$text";
if ($row['field_note']) {
$html .= "<p class='smaller'>".$row['field_note']."</p>";
}
$html .= "</td></tr>";
}
} else {
$html .= "<tr id='$rowName' $rowCSSStyle>
Expand Down
2 changes: 1 addition & 1 deletion classes/NIHTables.php
Original file line number Diff line number Diff line change
Expand Up @@ -2751,7 +2751,7 @@ public function get8Data($table, $records = []) {

$customGrantStartDate = self::getEarliestStartDate($currentTrainingGrants, $recordId);
$initSurveyStartDate = Download::oneFieldForRecordByPid($this->pid, "check_degree0_start", $recordId);
$initImportStartDate = Download::oneFieldForRecordByPid($this->pid, "init_import_degree0_start", $recordId);
$initImportStartDate = Download::oneFieldForRecordByPid($this->pid, "check_degree0_start", $recordId);
if (!$customGrantStartDate && !$initSurveyStartDate && !$initImportStartDate) {
$countingStartDate = $baseLineStart;
} else {
Expand Down
7 changes: 4 additions & 3 deletions classes/Publications.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,17 +198,18 @@ public static function filterExcludeList($rows, $recordExcludeLists, $recordId)

private static function makePubMedNameClause($unexplodedFirst, $unexplodedLast, $middle = "") {
$suffix = "%5Bau%5D";
$quote = "%22";
$nameClauses = [];
foreach (NameMatcher::explodeFirstName($unexplodedFirst) as $first) {
foreach (NameMatcher::explodeLastName($unexplodedLast) as $last) {
if ($first && $last) {
$first = preg_replace("/\s+/", "+", $first);
$last = preg_replace("/\s+/", "+", $last);
if ($middle) {
$nameClauses[] = $first . "+" . $middle . "+" . $last . $suffix;
$nameClauses[] = $quote . $last . ",+" . $first . "+" . $middle . $quote . $suffix;
}
$nameClauses[] = $first . "+" . $last . $suffix;
}
$nameClauses[] = $quote . $last . ",+" . $first . $quote . $suffix;
}
}
if (!empty($nameClauses)) {
Expand Down Expand Up @@ -340,7 +341,7 @@ public static function searchPubMedForTitleAndJournal($title, $journal, $pid) {
}

public static function searchPubMedForAuthorAndJournal($firstName, $lastName, $journal, $pid) {
$term = "%28".urlencode($firstName." ".$lastName)."%5BAuthor%5D%29+AND+%28\"".urlencode($journal)."\"%5Bjournal%5D%29";
$term = "%28".urlencode('"'.$lastName.", ".$firstName.'"')."%5BAuthor%5D%29+AND+%28\"".urlencode($journal)."\"%5Bjournal%5D%29";
return self::queryPubMed($term, $pid);
}

Expand Down
Loading

0 comments on commit 67789bd

Please sign in to comment.