From 226439b5ad71d7206ed0f6042914b35f78e2b2b6 Mon Sep 17 00:00:00 2001 From: MounaSafiHarab Date: Thu, 18 Aug 2016 16:53:39 -0400 Subject: [PATCH 1/4] Imaging Browser: Add Caveat flag for session table: Redmine 6039 --- SQL/0000-00-00-schema.sql | 1 + SQL/Archive/17.0/2016-08-18-AddCaveatFlag_SessionTable.sql | 1 + .../php/Imaging_Session_ControlPanel.class.inc | 7 ++++++- .../templates/imaging_session_controlpanel.tpl | 3 +++ 4 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 SQL/Archive/17.0/2016-08-18-AddCaveatFlag_SessionTable.sql diff --git a/SQL/0000-00-00-schema.sql b/SQL/0000-00-00-schema.sql index 9f673d03f09..f3a188d35dd 100644 --- a/SQL/0000-00-00-schema.sql +++ b/SQL/0000-00-00-schema.sql @@ -1040,6 +1040,7 @@ CREATE TABLE `session` ( `MRIQCPending` enum('Y','N') NOT NULL default 'N', `MRIQCFirstChangeTime` datetime default NULL, `MRIQCLastChangeTime` datetime default NULL, + `Caveat` enum('true','false') NOT NULL default 'false', PRIMARY KEY (`ID`), KEY `session_candVisit` (`CandID`,`VisitNo`), KEY `FK_session_2` (`CenterID`), diff --git a/SQL/Archive/17.0/2016-08-18-AddCaveatFlag_SessionTable.sql b/SQL/Archive/17.0/2016-08-18-AddCaveatFlag_SessionTable.sql new file mode 100644 index 00000000000..0813cf3b8e1 --- /dev/null +++ b/SQL/Archive/17.0/2016-08-18-AddCaveatFlag_SessionTable.sql @@ -0,0 +1 @@ +ALTER TABLE session ADD `Caveat` enum('true', 'false') NOT NULL default 'false'; diff --git a/modules/imaging_browser/php/Imaging_Session_ControlPanel.class.inc b/modules/imaging_browser/php/Imaging_Session_ControlPanel.class.inc index 16d389a1482..d53d23babab 100644 --- a/modules/imaging_browser/php/Imaging_Session_ControlPanel.class.inc +++ b/modules/imaging_browser/php/Imaging_Session_ControlPanel.class.inc @@ -118,14 +118,19 @@ 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, Caveat FROM session WHERE ID=:sid", array("sid" => $this->sessionID) ); $subjectData['mriqcstatus'] = $qcstatus['MRIQCStatus']; $subjectData['mriqcpending'] = $qcstatus['MRIQCPending']; + $subjectData['mricaveat'] = $qcstatus['Caveat']; $factory = NDB_Factory::singleton(); $subjectData['backURL'] = $factory->settings()->getBaseURL() diff --git a/modules/imaging_browser/templates/imaging_session_controlpanel.tpl b/modules/imaging_browser/templates/imaging_session_controlpanel.tpl index ec50a2f7ee1..14d2fc62618 100644 --- a/modules/imaging_browser/templates/imaging_session_controlpanel.tpl +++ b/modules/imaging_browser/templates/imaging_session_controlpanel.tpl @@ -59,6 +59,9 @@ {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} +
+ + {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}
{if $subject.has_permission}{/if} From 424639040c99f24a4e9279236f5a8b574a3ee984 Mon Sep 17 00:00:00 2001 From: MounaSafiHarab Date: Fri, 19 Aug 2016 13:44:40 -0400 Subject: [PATCH 2/4] Now visit-level caveat saves --- .../php/Imaging_Session_ControlPanel.class.inc | 1 + .../php/NDB_Form_imaging_browser.class.inc | 15 ++++++++++++--- .../templates/imaging_session_controlpanel.tpl | 15 +++++++++------ 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/modules/imaging_browser/php/Imaging_Session_ControlPanel.class.inc b/modules/imaging_browser/php/Imaging_Session_ControlPanel.class.inc index d53d23babab..fedf287a9ed 100644 --- a/modules/imaging_browser/php/Imaging_Session_ControlPanel.class.inc +++ b/modules/imaging_browser/php/Imaging_Session_ControlPanel.class.inc @@ -132,6 +132,7 @@ class Imaging_Session_ControlPanel $subjectData['mriqcpending'] = $qcstatus['MRIQCPending']; $subjectData['mricaveat'] = $qcstatus['Caveat']; + $factory = NDB_Factory::singleton(); $subjectData['backURL'] = $factory->settings()->getBaseURL() . urldecode($_REQUEST['backURL']); diff --git a/modules/imaging_browser/php/NDB_Form_imaging_browser.class.inc b/modules/imaging_browser/php/NDB_Form_imaging_browser.class.inc index 109ab82eb21..7bc7dfe8a2c 100644 --- a/modules/imaging_browser/php/NDB_Form_imaging_browser.class.inc +++ b/modules/imaging_browser/php/NDB_Form_imaging_browser.class.inc @@ -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 Caveat + FROM session + WHERE ID=:SID", $params + ); $updateSet = array( 'MRIQCPending' => $_POST['visit_pending'], 'MRIQCStatus' => $_POST['visit_status'], + 'Caveat' => $_POST['visit_caveat'], 'MRIQCLastChangeTime' => date("Y-m-d H:i:s") ); $firstChangeTime = $this->DB->pselectOne( @@ -464,9 +470,10 @@ 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(); @@ -474,7 +481,8 @@ class NDB_Form_Imaging_Browser extends NDB_Form $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(); @@ -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, Caveat FROM session WHERE ID=:SID", array('SID' => $_REQUEST['sessionID']) ); $subjectData['mriqcstatus'] = $qcstatus['MRIQCStatus']; $subjectData['mriqcpending'] = $qcstatus['MRIQCPending']; + $subjectData['mricaveat'] = $qcstatus['Caveat']; $subjectData['candid'] = $timePoint->getCandID(); $subjectData['scanner'] = $this->scanner; diff --git a/modules/imaging_browser/templates/imaging_session_controlpanel.tpl b/modules/imaging_browser/templates/imaging_session_controlpanel.tpl index 14d2fc62618..17e660c9faa 100644 --- a/modules/imaging_browser/templates/imaging_session_controlpanel.tpl +++ b/modules/imaging_browser/templates/imaging_session_controlpanel.tpl @@ -52,18 +52,21 @@ +
+
{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} -
- - {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}
- - {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} + + {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} +
+ + {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}
- {if $subject.has_permission}{/if} + {if $subject.has_permission}{/if} +
From f5f818184f07a11988380225fa3284fb666ac0c6 Mon Sep 17 00:00:00 2001 From: MounaSafiHarab Date: Thu, 1 Sep 2016 12:24:59 -0400 Subject: [PATCH 3/4] renamed mricaveat to caveat to make it more generic and not specific to MRI --- .../imaging_browser/php/Imaging_Session_ControlPanel.class.inc | 2 +- modules/imaging_browser/php/NDB_Form_imaging_browser.class.inc | 2 +- .../imaging_browser/templates/imaging_session_controlpanel.tpl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/imaging_browser/php/Imaging_Session_ControlPanel.class.inc b/modules/imaging_browser/php/Imaging_Session_ControlPanel.class.inc index fedf287a9ed..f0859ce9e32 100644 --- a/modules/imaging_browser/php/Imaging_Session_ControlPanel.class.inc +++ b/modules/imaging_browser/php/Imaging_Session_ControlPanel.class.inc @@ -130,7 +130,7 @@ class Imaging_Session_ControlPanel $subjectData['mriqcstatus'] = $qcstatus['MRIQCStatus']; $subjectData['mriqcpending'] = $qcstatus['MRIQCPending']; - $subjectData['mricaveat'] = $qcstatus['Caveat']; + $subjectData['caveat'] = $qcstatus['Caveat']; $factory = NDB_Factory::singleton(); diff --git a/modules/imaging_browser/php/NDB_Form_imaging_browser.class.inc b/modules/imaging_browser/php/NDB_Form_imaging_browser.class.inc index 7bc7dfe8a2c..fc38f48db8e 100644 --- a/modules/imaging_browser/php/NDB_Form_imaging_browser.class.inc +++ b/modules/imaging_browser/php/NDB_Form_imaging_browser.class.inc @@ -567,7 +567,7 @@ class NDB_Form_Imaging_Browser extends NDB_Form ); $subjectData['mriqcstatus'] = $qcstatus['MRIQCStatus']; $subjectData['mriqcpending'] = $qcstatus['MRIQCPending']; - $subjectData['mricaveat'] = $qcstatus['Caveat']; + $subjectData['caveat'] = $qcstatus['Caveat']; $subjectData['candid'] = $timePoint->getCandID(); $subjectData['scanner'] = $this->scanner; diff --git a/modules/imaging_browser/templates/imaging_session_controlpanel.tpl b/modules/imaging_browser/templates/imaging_session_controlpanel.tpl index 17e660c9faa..7476d099b1a 100644 --- a/modules/imaging_browser/templates/imaging_session_controlpanel.tpl +++ b/modules/imaging_browser/templates/imaging_session_controlpanel.tpl @@ -63,7 +63,7 @@ {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}
- {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} + {if $subject.has_permission}{html_options options=$subject.caveat_options selected=$subject.caveat name=visit_caveat tabindex=3 class="form-control input-sm" style="width:100px"}{else}{if $subject.caveat=='true'}True{else}False{/if}{/if}
{if $subject.has_permission}{/if} From a1df42eaae3507ff08205d8bb683392e10a43688 Mon Sep 17 00:00:00 2001 From: MounaSafiHarab Date: Wed, 7 Sep 2016 11:47:38 -0400 Subject: [PATCH 4/4] MRICaveat is more appropriate I think --- SQL/0000-00-00-schema.sql | 2 +- .../17.0/2016-08-18-AddCaveatFlag_SessionTable.sql | 2 +- .../php/Imaging_Session_ControlPanel.class.inc | 4 ++-- .../php/NDB_Form_imaging_browser.class.inc | 8 ++++---- .../templates/imaging_session_controlpanel.tpl | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/SQL/0000-00-00-schema.sql b/SQL/0000-00-00-schema.sql index f3a188d35dd..cb0d6349e14 100644 --- a/SQL/0000-00-00-schema.sql +++ b/SQL/0000-00-00-schema.sql @@ -1040,7 +1040,7 @@ CREATE TABLE `session` ( `MRIQCPending` enum('Y','N') NOT NULL default 'N', `MRIQCFirstChangeTime` datetime default NULL, `MRIQCLastChangeTime` datetime default NULL, - `Caveat` enum('true','false') NOT NULL default 'false', + `MRICaveat` enum('true','false') NOT NULL default 'false', PRIMARY KEY (`ID`), KEY `session_candVisit` (`CandID`,`VisitNo`), KEY `FK_session_2` (`CenterID`), diff --git a/SQL/Archive/17.0/2016-08-18-AddCaveatFlag_SessionTable.sql b/SQL/Archive/17.0/2016-08-18-AddCaveatFlag_SessionTable.sql index 0813cf3b8e1..480d55165b3 100644 --- a/SQL/Archive/17.0/2016-08-18-AddCaveatFlag_SessionTable.sql +++ b/SQL/Archive/17.0/2016-08-18-AddCaveatFlag_SessionTable.sql @@ -1 +1 @@ -ALTER TABLE session ADD `Caveat` enum('true', 'false') NOT NULL default 'false'; +ALTER TABLE session ADD `MRICaveat` enum('true', 'false') NOT NULL default 'false'; diff --git a/modules/imaging_browser/php/Imaging_Session_ControlPanel.class.inc b/modules/imaging_browser/php/Imaging_Session_ControlPanel.class.inc index f0859ce9e32..035c2a10273 100644 --- a/modules/imaging_browser/php/Imaging_Session_ControlPanel.class.inc +++ b/modules/imaging_browser/php/Imaging_Session_ControlPanel.class.inc @@ -124,13 +124,13 @@ class Imaging_Session_ControlPanel ); $qcstatus = $DB->pselectRow( - "SELECT MRIQCStatus, MRIQCPending, Caveat 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['caveat'] = $qcstatus['Caveat']; + $subjectData['mricaveat'] = $qcstatus['MRICaveat']; $factory = NDB_Factory::singleton(); diff --git a/modules/imaging_browser/php/NDB_Form_imaging_browser.class.inc b/modules/imaging_browser/php/NDB_Form_imaging_browser.class.inc index fc38f48db8e..cff7593a95c 100644 --- a/modules/imaging_browser/php/NDB_Form_imaging_browser.class.inc +++ b/modules/imaging_browser/php/NDB_Form_imaging_browser.class.inc @@ -447,7 +447,7 @@ class NDB_Form_Imaging_Browser extends NDB_Form WHERE ID=:SID", $params ); $old_caveat_status = $this->DB->pselectOne( - "SELECT Caveat + "SELECT MRICaveat FROM session WHERE ID=:SID", $params ); @@ -455,7 +455,7 @@ class NDB_Form_Imaging_Browser extends NDB_Form $updateSet = array( 'MRIQCPending' => $_POST['visit_pending'], 'MRIQCStatus' => $_POST['visit_status'], - 'Caveat' => $_POST['visit_caveat'], + 'MRICaveat' => $_POST['visit_caveat'], 'MRIQCLastChangeTime' => date("Y-m-d H:i:s") ); $firstChangeTime = $this->DB->pselectOne( @@ -561,13 +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, Caveat + "SELECT MRIQCStatus, MRIQCPending, MRICaveat FROM session WHERE ID=:SID", array('SID' => $_REQUEST['sessionID']) ); $subjectData['mriqcstatus'] = $qcstatus['MRIQCStatus']; $subjectData['mriqcpending'] = $qcstatus['MRIQCPending']; - $subjectData['caveat'] = $qcstatus['Caveat']; + $subjectData['mricaveat'] = $qcstatus['MRICaveat']; $subjectData['candid'] = $timePoint->getCandID(); $subjectData['scanner'] = $this->scanner; diff --git a/modules/imaging_browser/templates/imaging_session_controlpanel.tpl b/modules/imaging_browser/templates/imaging_session_controlpanel.tpl index 7476d099b1a..17e660c9faa 100644 --- a/modules/imaging_browser/templates/imaging_session_controlpanel.tpl +++ b/modules/imaging_browser/templates/imaging_session_controlpanel.tpl @@ -63,7 +63,7 @@ {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}
- {if $subject.has_permission}{html_options options=$subject.caveat_options selected=$subject.caveat name=visit_caveat tabindex=3 class="form-control input-sm" style="width:100px"}{else}{if $subject.caveat=='true'}True{else}False{/if}{/if} + {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}
{if $subject.has_permission}{/if}