Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imaging Browser: Add Caveat flag for session table: Redmine 6039 #2135

Merged
merged 4 commits into from
Sep 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions SQL/0000-00-00-schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,7 @@ CREATE TABLE `session` (
`MRIQCPending` enum('Y','N') NOT NULL default 'N',
`MRIQCFirstChangeTime` datetime default NULL,
`MRIQCLastChangeTime` datetime default NULL,
`MRICaveat` enum('true','false') NOT NULL default 'false',
PRIMARY KEY (`ID`),
KEY `session_candVisit` (`CandID`,`VisitNo`),
KEY `FK_session_2` (`CenterID`),
Expand Down
1 change: 1 addition & 0 deletions SQL/Archive/17.0/2016-08-18-AddCaveatFlag_SessionTable.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE session ADD `MRICaveat` enum('true', 'false') NOT NULL default 'false';
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,20 @@ class Imaging_Session_ControlPanel
'Y' => 'Yes',
'N' => 'No',
);
$subjectData['caveat_options'] = array(
'true' => 'True',
'false' => 'False',
);

$qcstatus = $DB->pselectRow(
"SELECT MRIQCStatus, MRIQCPending FROM session WHERE ID=:sid",
"SELECT MRIQCStatus, MRIQCPending, MRICaveat FROM session WHERE ID=:sid",
array("sid" => $this->sessionID)
);

$subjectData['mriqcstatus'] = $qcstatus['MRIQCStatus'];
$subjectData['mriqcpending'] = $qcstatus['MRIQCPending'];
$subjectData['mricaveat'] = $qcstatus['MRICaveat'];


$factory = NDB_Factory::singleton();
$subjectData['backURL'] = $factory->settings()->getBaseURL()
Expand Down
15 changes: 12 additions & 3 deletions modules/imaging_browser/php/NDB_Form_imaging_browser.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -446,10 +446,16 @@ class NDB_Form_Imaging_Browser extends NDB_Form
FROM session
WHERE ID=:SID", $params
);
$old_caveat_status = $this->DB->pselectOne(
"SELECT MRICaveat
FROM session
WHERE ID=:SID", $params
);

$updateSet = array(
'MRIQCPending' => $_POST['visit_pending'],
'MRIQCStatus' => $_POST['visit_status'],
'MRICaveat' => $_POST['visit_caveat'],
'MRIQCLastChangeTime' => date("Y-m-d H:i:s")
);
$firstChangeTime = $this->DB->pselectOne(
Expand All @@ -464,17 +470,19 @@ class NDB_Form_Imaging_Browser extends NDB_Form
$success = $this->DB->update(
'session', $updateSet, array('ID'=>$this->sessionID)
);
// sppool a message to the mri qc status rss channel
// spool a message to the mri qc status rss channel
if (($save_visit_status != $old_visit_status)
|| ($old_pending_status != $_POST['visit_pending'])
|| ($old_caveat_status != $_POST['visit_caveat'])
) {
$timePoint =& TimePoint::singleton($this->sessionID);
$candid = $timePoint->getCandID();
$candidate =& Candidate::singleton($timePoint->getCandID());
$pscid = $candidate->getPSCID();
$visit_label = $timePoint->getVisitLabel();
$not_status = ($_POST['visit_pending'] == 'Y' ? 'Pending ' : '')
. $_POST['visit_status'];
. $_POST['visit_status']
. $_POST['visit_caveat'];
$message = "$candid / $pscid $visit_label
- MRI QC status changed to $not_status";
$centerID = $timePoint->getCenterID();
Expand Down Expand Up @@ -553,12 +561,13 @@ class NDB_Form_Imaging_Browser extends NDB_Form
$subjectData['visitNo'] = $timePoint->getVisitNo();
$subjectData['site'] = $timePoint->getPSC();
$qcstatus = $this->DB->pselectRow(
"SELECT MRIQCStatus, MRIQCPending
"SELECT MRIQCStatus, MRIQCPending, MRICaveat
FROM session WHERE ID=:SID",
array('SID' => $_REQUEST['sessionID'])
);
$subjectData['mriqcstatus'] = $qcstatus['MRIQCStatus'];
$subjectData['mriqcpending'] = $qcstatus['MRIQCPending'];
$subjectData['mricaveat'] = $qcstatus['MRICaveat'];
$subjectData['candid'] = $timePoint->getCandID();
$subjectData['scanner'] = $this->scanner;

Expand Down
14 changes: 10 additions & 4 deletions modules/imaging_browser/templates/imaging_session_controlpanel.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,21 @@
</a>
</div>

<br>

<div class='div-controlpanel-bottom'>
<div class="form-group">
<label>QC Status</label>
{if $subject.has_permission}{html_options options=$subject.status_options selected=$subject.mriqcstatus name=visit_status tabindex=1 class="form-control input-sm" style="width:100px"}{else}{$subject.mriqcstatus}{/if}
</div>
<label>QC Pending</label>
{if $subject.has_permission}{html_options options=$subject.pending_options selected=$subject.mriqcpending name=visit_pending tabindex=2 class="form-control input-sm" style="width:100px"}{else}{if $subject.mriqcpending=='Y'}Yes{else}No{/if}{/if}
<br>
{if $subject.has_permission}<input class="btn btn-default" type="submit" accesskey="s" value="Save" name="save_changes">{/if}
<label>QC Pending</label>
{if $subject.has_permission}{html_options options=$subject.pending_options selected=$subject.mriqcpending name=visit_pending tabindex=2 class="form-control input-sm" style="width:100px"}{else}{if $subject.mriqcpending=='Y'}Yes{else}No{/if}{/if}
<br>
<label>Visit Level Caveat</label>
{if $subject.has_permission}{html_options options=$subject.caveat_options selected=$subject.mricaveat name=visit_caveat tabindex=3 class="form-control input-sm" style="width:100px"}{else}{if $subject.mricaveat=='true'}True{else}False{/if}{/if}
<br>
{if $subject.has_permission}<input class="btn btn-default" type="submit" accesskey="s" value="Save" name="save_changes">{/if}
</div>
</div>
</td>
<td class='td-cpanel-fake'><table class='table-cpanel-fake'></table>
Expand Down