From 7dd8d16a54245abe460c7e7e4a6fa8458f8a06cc Mon Sep 17 00:00:00 2001 From: bradymiller Date: Thu, 8 Apr 2010 06:08:46 +0000 Subject: [PATCH] bug fix for Windows to allow moving of documents between patients --- controllers/C_Document.class.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/controllers/C_Document.class.php b/controllers/C_Document.class.php index b534c7e8c..392cabd59 100644 --- a/controllers/C_Document.class.php +++ b/controllers/C_Document.class.php @@ -222,8 +222,13 @@ class C_Document extends Controller { //change full path to current webroot. this is for documents that may have //been moved from a different filesystem and the full path in the database - //is not current. - $temp_url = $GLOBALS["fileroot"].'/documents/'.$_SESSION["pid"].'/'.basename($url); + //is not current. this is also for documents that may of been moved to + //different patients + // NOTE that $from_filename and basename($url) are the same thing + $from_all = explode("/",$url); + $from_filename = array_pop($from_all); + $from_patientid = array_pop($from_all); + $temp_url = $GLOBALS["fileroot"].'/documents/'.$from_patientid.'/'.$from_filename; if (file_exists($temp_url)) { $url = $temp_url; } @@ -246,7 +251,7 @@ class C_Document extends Controller { else { //special case when retrieving a document that has been converted to a jpg and not directly referenced in database $convertedFile = substr(basename($url), 0, strrpos(basename($url), '.')) . '_converted.jpg'; - $url = $GLOBALS["fileroot"].'/documents/'.$_SESSION["pid"].'/'.$convertedFile; + $url = $GLOBALS["fileroot"].'/documents/'.$from_patientid.'/'.$convertedFile; header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); -- 2.11.4.GIT