Skip to content

Commit

Permalink
fixes for prior commit - moved Documents menu item to Procedures->Lab…
Browse files Browse the repository at this point in the history
… documents
  • Loading branch information
bradymiller committed Oct 26, 2014
1 parent ddcd7e6 commit e7306bd
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 48 deletions.
10 changes: 5 additions & 5 deletions controllers/C_Document.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ function view_action($patient_id="",$doc_id) {
if ( sqlNumRows($result_docs) > 0)
while($row_result_docs = sqlFetchArray($result_docs)) {
$sel_enc = ($row_result_docs['encounter'] == $d->get_encounter_id()) ? ' selected' : '';
$encOptions .= "<option value='" . $row_result_docs['encounter'] . "' $sel_enc>". oeFormatShortDate(date('Y-m-d', strtotime($row_result_docs['date']))) . "-" . $row_result_docs['pc_catname']."</option>";
$encOptions .= "<option value='" . attr($row_result_docs['encounter']) . "' $sel_enc>". oeFormatShortDate(date('Y-m-d', strtotime($row_result_docs['date']))) . "-" . text($row_result_docs['pc_catname'])."</option>";
}
$this->assign("ENC_LIST", $encOptions);

Expand All @@ -278,7 +278,7 @@ function view_action($patient_id="",$doc_id) {
while ($crow = sqlFetchArray($cres)) {
$catid = $crow['pc_catid'];
if ($catid < 9 && $catid != 5) continue; // Applying same logic as in new encounter page.
$visit_category_list .="<option value='$catid'>" . text(xl_appt_category($crow['pc_catname'])) . "</option>\n";
$visit_category_list .="<option value='".attr($catid)."'>" . text(xl_appt_category($crow['pc_catname'])) . "</option>\n";
}
$this->assign("VISIT_CATEGORY_LIST", $visit_category_list);

Expand Down Expand Up @@ -1036,7 +1036,7 @@ function document_upload_download_log($patientid,$content){
// Function to tag a document to an encounter.
function tag_action_process($patient_id="", $document_id) {
if ($_POST['process'] != "true") {
die("process is '" . $_POST['process'] . "', expected 'true'");
die("process is '" . text($_POST['process']) . "', expected 'true'");
return;
}

Expand All @@ -1059,7 +1059,7 @@ function tag_action_process($patient_id="", $document_id) {
$provider_id = $_SESSION['authUserID'] ;

// Get the logged in user's facility
$facilityRow = sqlQuery("SELECT username, facility, facility_id FROM users WHERE id = '" . $provider_id . "'");
$facilityRow = sqlQuery("SELECT username, facility, facility_id FROM users WHERE id = ?", array("$provider_id"));
$username = $facilityRow['username'];
$facility = $facilityRow['facility'];
$facility_id = $facilityRow['facility_id'];
Expand Down Expand Up @@ -1091,7 +1091,7 @@ function tag_action_process($patient_id="", $document_id) {
$d->set_encounter_check($encounter_check);
$d->persist();

$messages .= xl('Document tagged to Encounter successfully') . "<br>";
$messages .= xlt('Document tagged to Encounter successfully') . "<br>";
}

$this->_state = false;
Expand Down
52 changes: 27 additions & 25 deletions interface/main/display_documents.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
require_once("$srcdir/patient.inc");
require_once("$srcdir/payment_jav.inc.php");

//ini_set("display_errors","on");

$DateFormat = DateFormatRead();
$curdate = date_create(date("Y-m-d"));
date_sub($curdate, date_interval_create_from_date_string("7 days"));
Expand Down Expand Up @@ -160,25 +158,25 @@ function expandOrCollapse(type,prefixString) {
<div id='docfilterdiv'<?php echo $display_div; ?>>
<table style="margin-left:10px; " width='40%'>
<tr>
<td scope="row" class='label'><?php echo text('From'); ?>:</td>
<td scope="row" class='label'><?php echo xlt('From'); ?>:</td>
<td><input type='text' name='form_from_doc_date' id="form_from_doc_date"
size='10' value='<?php echo $form_from_doc_date ?>' readonly="readonly" title='<?php echo $title_tooltip ?>'>
<img alt="Date Selector" src='../pic/show_calendar.gif' align='absbottom' width='24' height='22' id='img_from_doc_date'
border='0' alt='[?]' style='cursor: pointer' title='<?php echo text('Click here to choose a date'); ?>'></td>
size='10' value='<?php echo attr($form_from_doc_date) ?>' readonly="readonly" title='<?php echo attr($title_tooltip) ?>'>
<img alt="<?php echo xla("Date Selector"); ?>" src='../pic/show_calendar.gif' align='absbottom' width='24' height='22' id='img_from_doc_date'
border='0' alt='[?]' style='cursor: pointer' title='<?php echo xla('Click here to choose a date'); ?>'></td>
<script>
Calendar.setup({inputField:"form_from_doc_date", ifFormat:global_date_format, button:"img_from_doc_date"});
</script>
<td class='label'><?php echo text('To'); ?>:</td>
<td class='label'><?php echo xlt('To'); ?>:</td>
<td><input type='text' name='form_to_doc_date' id="form_to_doc_date"
size='10' value='<?php echo $form_to_doc_date ?>' readonly="readonly" title='<?php echo $title_tooltip ?>'>
<img alt="Date Selector" src='../pic/show_calendar.gif' align='absbottom' width='24' height='22' id='img_to_doc_date'
border='0' alt='[?]' style='cursor: pointer' title='<?php echo text('Click here to choose a date'); ?>'></td>
size='10' value='<?php echo attr($form_to_doc_date) ?>' readonly="readonly" title='<?php echo attr($title_tooltip) ?>'>
<img alt="<?php xla("Date Selector"); ?>" src='../pic/show_calendar.gif' align='absbottom' width='24' height='22' id='img_to_doc_date'
border='0' alt='[?]' style='cursor: pointer' title='<?php echo xla('Click here to choose a date'); ?>'></td>
<script>
Calendar.setup({inputField:"form_to_doc_date", ifFormat:global_date_format, button:"img_to_doc_date"});
</script>
<td>
<span style='float: left;' id="docrefresh">
<a href='#' class='css_button' onclick='return validateDate("form_from_doc_date","form_to_doc_date")'> <span><?php echo text('Refresh'); ?> </span></a>
<a href='#' class='css_button' onclick='return validateDate("form_from_doc_date","form_to_doc_date")'> <span><?php echo xlt('Refresh'); ?> </span></a>
</span>
</td>
</tr>
Expand All @@ -190,13 +188,16 @@ function expandOrCollapse(type,prefixString) {
<?php
$current_user = $_SESSION["authId"];
$date_filter = '';
$query_array = array();
if ($form_from_doc_date) {
$form_from_doc_date = DateToYYYYMMDD($form_from_doc_date);
$date_filter = " DATE(d.date) >= '$form_from_doc_date' ";
$date_filter = " DATE(d.date) >= ? ";
array_push($query_array,$form_from_doc_date);
}
if ($form_to_doc_date) {
$form_to_doc_date = DateToYYYYMMDD($form_to_doc_date);
$date_filter .= " AND DATE(d.date) <= '$form_to_doc_date'";
$date_filter .= " AND DATE(d.date) <= ? ";
array_push($query_array,$form_to_doc_date);
}
// Get the category ID for lab reports.
$query = "SELECT rght FROM categories WHERE name = ?";
Expand All @@ -206,24 +207,25 @@ function expandOrCollapse(type,prefixString) {
$query = "SELECT d.*,CONCAT(pd.fname,' ',pd.lname) AS pname,GROUP_CONCAT(n.note ORDER BY n.date DESC SEPARATOR '|') AS docNotes,
GROUP_CONCAT(n.date ORDER BY n.date DESC SEPARATOR '|') AS docDates FROM documents d
INNER JOIN patient_data pd ON d.foreign_id = pd.pid
INNER JOIN categories_to_documents ctd ON d.id = ctd.document_id AND ctd.category_id = " . $catID . "
INNER JOIN categories_to_documents ctd ON d.id = ctd.document_id AND ctd.category_id = ?
LEFT JOIN notes n ON d.id = n.foreign_id
WHERE " . $date_filter . " GROUP BY d.id ORDER BY date DESC";
$resultSet = sqlStatement($query);
array_unshift($query_array,$catID);
$resultSet = sqlStatement($query,$query_array);
?>

<table border="1" cellpadding=3 cellspacing=0>
<tr class='text bold'>
<th align="left" width="10%"><?php echo text('Date'); ?></th>
<th align="left" class="linkcell" width="20%" ><?php echo text('Name'); ?></th>
<th align="left" width="10%"><?php echo xlt('Date'); ?></th>
<th align="left" class="linkcell" width="20%" ><?php echo xlt('Name'); ?></th>
<th align="left" width="20%"><?php echo xlt('Patient'); ?></th>
<th align="left" width="30%"><?php echo text('Note'); ?></th>
<th width="10%"><?php echo text('Encounter#'); ?></th>
<th align="left" width="30%"><?php echo xlt('Note'); ?></th>
<th width="10%"><?php echo xlt('Encounter ID'); ?></th>
</tr>
<?php
if (sqlNumRows($resultSet)) {
while ( $row = sqlFetchArray($resultSet) ) {
$url = $GLOBALS['webroot'] . "/controller.php?document&retrieve&patient_id=" . $row["foreign_id"] . "&document_id=" . $row["id"] . '&as_file=false';
$url = $GLOBALS['webroot'] . "/controller.php?document&retrieve&patient_id=" . attr($row["foreign_id"]) . "&document_id=" . attr($row["id"]) . '&as_file=false';
// Get the notes for this document.
$notes = array();
$note = '';
Expand All @@ -232,20 +234,20 @@ function expandOrCollapse(type,prefixString) {
$dates = explode("|", $row['docDates']);
}
for ( $i = 0 ; $i < count($notes) ; $i++ )
$note .= oeFormatShortDate(date('Y-m-d', strtotime($dates[$i]))) . " : " . $notes[$i] . "<br />";
$note .= oeFormatShortDate(date('Y-m-d', strtotime($dates[$i]))) . " : " . text($notes[$i]) . "<br />";
?>
<tr class="text">
<td><?php echo oeFormatShortDate(date('Y-m-d', strtotime($row['date']))); ?> </td>
<td class="linkcell">
<a id="<?php echo $row['id']; ?>" title='<?php echo $url; ?>'><?php echo basename($row['url']); ?></a>
<a id="<?php echo attr($row['id']); ?>" title='<?php echo $url; ?>' onclick='top.restoreSession()'><?php echo text(basename($row['url'])); ?></a>
</td>
<td><?php echo attr($row['pname']); ?> </td>
<td><?php echo text($row['pname']); ?> </td>
<td><?php echo $note; ?> &nbsp;</td>
<td align="center"><?php echo ( $row['encounter_id'] ) ? $row['encounter_id'] : ''; ?> </td>
<td align="center"><?php echo ( $row['encounter_id'] ) ? text($row['encounter_id']) : ''; ?> </td>
</tr>
<?php } ?>
<?php } ?>
</table>
</div>
</body>
</html>
</html>
2 changes: 1 addition & 1 deletion interface/main/left_nav.php
Original file line number Diff line number Diff line change
Expand Up @@ -1259,7 +1259,6 @@ function selpopup(selobj) {
<?php if (!$GLOBALS['disable_calendar'] && !$GLOBALS['ippf_specific']) genTreeLink('RTop','cal',xl('Calendar')); ?>
<?php genTreeLink('RBot','msg',xl('Messages')); ?>
<?php if ($GLOBALS['lab_exchange_enable']) genTreeLink('RTop', 'lab', xl('Check Lab Results'));?>
<?php genTreeLink('RTop', 'dld', xl('Documents'));?>
<?php if($GLOBALS['portal_offsite_enable'] && $GLOBALS['portal_offsite_address'] && acl_check('patientportal','portal')) genTreeLink('RTop','app',xl('Portal Activity')); ?>
<?php
if ($GLOBALS['gbl_portal_cms_enable'] && acl_check('patientportal','portal')) {
Expand Down Expand Up @@ -1397,6 +1396,7 @@ function selpopup(selobj) {
<?php genTreeLink('RTop','lda',xl('Lab Overview')); ?>
<?php genTreeLink('RTop','orb',xl('Batch Results')); ?>
<?php genTreeLink('RTop','ore',xl('Electronic Reports')); ?>
<?php genTreeLink('RTop','dld',xl('Lab Documents'));?>
</ul>
</li>
<?php
Expand Down
6 changes: 3 additions & 3 deletions interface/patient_file/encounter/forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,11 @@ function divtoggle(spanid, divid) {
if(count($docs_list) > 0 ) {
?>
<div class='enc_docs'>
<span class="bold"><?php echo text("Document(s)"); ?>:</span>
<span class="bold"><?php echo xlt("Document(s)"); ?>:</span>
<?php
$doc = new C_Document();
foreach ($docs_list as $doc_iter) {
$doc_url = $doc->_tpl_vars[CURRENT_ACTION]. "&view&patient_id=".$pid."&document_id=" . $doc_iter[id] . "&";
$doc_url = $doc->_tpl_vars[CURRENT_ACTION]. "&view&patient_id=".attr($pid)."&document_id=" . attr($doc_iter[id]) . "&";
// Get notes for this document.
$queryString = "SELECT GROUP_CONCAT(note ORDER BY date DESC SEPARATOR '|') AS docNotes, GROUP_CONCAT(date ORDER BY date DESC SEPARATOR '|') AS docDates
FROM notes WHERE foreign_id = ? GROUP BY foreign_id";
Expand All @@ -360,7 +360,7 @@ function divtoggle(spanid, divid) {
}
?>
<br>
<a title="<?php echo text($note);?>" href="<?php echo $doc_url;?>" style="font-size:small;"><?php echo oeFormatShortDate($doc_iter[docdate]) . ": " . basename($doc_iter[url]);?></a>
<a title="<?php echo attr($note);?>" href="<?php echo $doc_url;?>" style="font-size:small;" onsubmit="return top.restoreSession()"><?php echo oeFormatShortDate($doc_iter[docdate]) . ": " . text(basename($doc_iter[url]));?></a>
<?php } ?>
</div>
<?php } ?>
Expand Down
12 changes: 4 additions & 8 deletions interface/patient_file/history/encounters.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function getDocListByEncID($encounter,$raw_encounter_date,$pid){
}
}
else {
echo "(" . text('No access') . ")";
echo "(" . xlt('No access') . ")";
}

// Get the notes for this document and display as title for the link.
Expand All @@ -104,11 +104,11 @@ function getDocListByEncID($encounter,$raw_encounter_date,$pid){
while ( $row = sqlFetchArray($noteResultSet)) {
$note .= oeFormatShortDate(date('Y-m-d', strtotime($row['date']))) . " : " . attr($row['note']) . "\n";
}
$docTitle = ( $note ) ? $note : attr("View document");
$docTitle = ( $note ) ? $note : xla("View document");

$docHref = $GLOBALS['webroot']."/controller.php?document&view&patient_id=".$pid."&doc_id=".$documentrow['id'];
$docHref = $GLOBALS['webroot']."/controller.php?document&view&patient_id=".attr($pid)."&doc_id=".attr($documentrow['id']);
echo "<div class='text docrow' id='" . attr($documentrow['id'])."' title='". $docTitle . "'>\n";
echo "<a href=$docHref>". text('Document') . ": " . basename($documentrow['url']) . ' (' . xl_document_category($documentrow['name']) . ')' . "</a>";
echo "<a href='$docHref' onclick='top.restoreSession()' >". xlt('Document') . ": " . text(basename($documentrow['url'])) . ' (' . text(xl_document_category($documentrow['name'])) . ')' . "</a>";
echo "</div>";
}
}
Expand Down Expand Up @@ -500,10 +500,6 @@ function efmouseover(elem, ptid, encid, formname, formid) {
// Show billing note that you can click on to edit.
$feid = $result4['id'] ? htmlspecialchars( $result4['id'], ENT_QUOTES) : 0; // form_encounter id
echo "<td valign='top'>";

//Display the documents tagged to this encounter
getDocListByEncID($result4['encounter'],$raw_encounter_date,$pid);

echo "<div id='note_$feid'>";
//echo "<div onclick='editNote($feid)' title='Click to edit' class='text billing_note_text'>";
echo "<div id='$feid' title='". htmlspecialchars( xl('Click to edit'), ENT_QUOTES) . "' class='text billing_note_text'>";
Expand Down
4 changes: 2 additions & 2 deletions sql/4_1_2-to-4_1_3_upgrade.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2933,10 +2933,10 @@ UPDATE `clinical_rules` SET `amc_2014_flag` = 1 , `amc_code_2014` = '170.314(g)(
#EndIf

#IfMissingColumn documents encounter_id
ALTER TABLE `documents` ADD `encounter_id` bigint(20) NULL DEFAULT '0';
ALTER TABLE `documents` ADD `encounter_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'Encounter id if tagged';
#EndIf

#IfMissingColumn documents encounter_check
ALTER TABLE `documents` ADD `encounter_check` TINYINT(1) NULL DEFAULT 0;
ALTER TABLE `documents` ADD `encounter_check` TINYINT(1) NOT NULL DEFAULT '0' COMMENT 'If encounter is created while tagging';
#EndIf

4 changes: 2 additions & 2 deletions sql/database.sql
Original file line number Diff line number Diff line change
Expand Up @@ -718,8 +718,8 @@ CREATE TABLE `documents` (
`storagemethod` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '0->Harddisk,1->CouchDB',
`path_depth` TINYINT DEFAULT '1' COMMENT 'Depth of path to use in url to find document. Not applicable for CouchDB.',
`imported` TINYINT DEFAULT 0 NULL COMMENT 'Parsing status for CCR/CCD/CCDA importing',
`encounter_id` bigint(20) NULL DEFAULT '0' COMMENT 'Encounter id if tagged',
`encounter_check` TINYINT(1) NULL DEFAULT 0 COMMENT 'If encounter is created while tagging',
`encounter_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'Encounter id if tagged',
`encounter_check` TINYINT(1) NOT NULL DEFAULT '0' COMMENT 'If encounter is created while tagging',
PRIMARY KEY (`id`),
KEY `revision` (`revision`),
KEY `foreign_id` (`foreign_id`),
Expand Down
2 changes: 1 addition & 1 deletion templates/documents/general_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@

<div>
<select id="encounter_id" name="encounter_id" >{$ENC_LIST}</select>&nbsp;
<input type="checkbox" name="encounter_check" id="encounter_check" onclick='set_checkbox(this)'/> <label for="encounter_check"><b>Create Encounter</b></label>&nbsp;&nbsp;
<input type="checkbox" name="encounter_check" id="encounter_check" onclick='set_checkbox(this)'/> <label for="encounter_check"><b>{xl t='Create Encounter'}</b></label>&nbsp;&nbsp;
{xl t='Visit Category'} : &nbsp;<select id="visit_category_id" name="visit_category_id" disabled>{$VISIT_CATEGORY_LIST}</select>&nbsp;

</div>
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// is a database change in the course of development. It is used
// internally to determine when a database upgrade is needed.
//
$v_database = 119;
$v_database = 120;

// Access control version identifier, this is to be incremented whenever there
// is a access control change in the course of development. It is used
Expand Down

0 comments on commit e7306bd

Please sign in to comment.