Scanned Encounters Code Woes

aethelwulffe wrote on Friday, March 18, 2011:

I have a version of the scanned encounters form that worked quite decently in 3.2.  This is no longer the case in 4.0.

I checked the code, looked to see what was actually written to the DB, and all that.  The database has the data, but report.php and print.php won’t display the file.  The path is in the DB, and the file name is there, and the following code puts them together as should be.  (Note: view.php just includes print.php for this form to make it non-editable)

<?
# print scanned documents
include("../../../library/api.inc");
formHeader("Patient's Scanned Documents");
$row = formFetch('form_documents', $_GET['id']);
$doc=$row["document_path"]."/".$row["document_image"];
$thatfile=$row["document_image"];
$localpath="../../forms/documents/scanned/".$GLOBALS['pid'];
$relink=$localpath."/".$thatfile;
echo ("<span class=text>Document path on server is: $doc ");
echo ("<br>");
echo ("Document Source is: ");
echo $row["document_source"];
echo ("<br>");
echo $row["document_description"];
echo ("<br>");
echo ("<IFRAME SRC=\"$relink\"width=\"90%\"height=\"90%\"></iframe>");
//echo ("<IMG SRC=\"$relink\" ALT=\"$relink\">");
?>
<hr>
<a href="<?php echo $GLOBALS['form_exit_url']; ?>" onclick="top.restoreSession()">Done</a>
<?php
formFooter();
?>[code]
I am using an IFRAME to display the files (in report and print).  The frame doesn't show at all in report (just a gray bar) and in print, it does not display the file, only an index page for the file path.  In report.php, I am using:[code]echo ("<iframe src=\"../../forms/documents/scanned/${pid}/${doc_image}\"width=\"85%\"height=\"50%\"></iframe>");[/code]
  It does not seem to be that the code is in error.
Here is a chunk of encounter\forms.php that I think displays the wonderful gray bar I see:
[code]
        // Use the form's report.php for display.  Forms with names starting with LBF
        // are list-based forms sharing a single collection of code.
        //
        if (substr($formdir,0,3) == 'LBF') {
          include_once($GLOBALS['incdir'] . "/forms/LBF/report.php");
          call_user_func("lbf_report", $pid, $encounter, 2, $iter['form_id'], $formdir);
        }
        else  {
          include_once($GLOBALS['incdir'] . "/forms/$formdir/report.php");
          call_user_func($formdir . "_report", $pid, $encounter, 2, $iter['form_id']);
        }
        echo "</div></td></tr>";
		$divnos=$divnos+1;
    }
    echo "</table>";[/code]
I don't see an issue there either.
I have looked in dozens of files for a hint as to what is going on (and what changed in 4.0).  Anyone have any hints as to why the change in behavior when it executes view or report now?  Does the new "expand/collapse" code use something that nests or otherwise snuffs it?

aethelwulffe wrote on Friday, March 18, 2011:

Does the normal imported documents system store the document location as a URL for a reason related to why this form isn’t working? ref Document.class.php

aethelwulffe wrote on Wednesday, March 23, 2011:

*solved*
-Looks like Rod (or someone) got to this form and did it up VERY NICELY.

sunsetsystems wrote on Wednesday, March 23, 2011:

contrib/forms has a “documents” encounter form and a “scanned_notes” encounter form.  Mine is the second one, and it has not changed in several months.

Rod
www.sunsetsystems.com

aethelwulffe wrote on Wednesday, March 23, 2011:

Verifying this….It DID work for me ONE TIME!  Now I just get the mkdir returned 1 message!  OK, maybe I never actually UPLOADED anything with it….Yeah.  Crappy play-testing on my part.  I boned it up here.  It sure did look good to me for a minute there though!
  I thought that your scanned_notes form was the same one that was in 3.2 (there were two in there as well, both by the same authors at different time periods)…which is the one that I modified myself.  I had not seen your version (I don’t believe) until I just tried it.  Just seeing the upload interface convinced me that it worked I suppose (after someone else in the help forums posted that it was working again).  I am trying to do too many things all at once.