I have a strange problem in 5.0.1 (6)
When I go to Fax/Scan and select a fax or a scanned document to upload to a patients chart, the document saves in documents root folder;
/openemr/sites/default/documents/
instead of
/openemr /sites/default/document/214 (where 214 is the PID)
and the URL inserted into the documents table has a double forward slash and no PID. The documents pull up fine in the patients chart since the URL works but my
/openemr/sites/default/documents folder is completely disorganized.
Any ideas on how to fix this in fax_dispatch.php ?
Hi, iâll take a quick look at this. I canât imagine why this hasnât come up before unless folks donât realize it is broken. Whatâs the chances huh
cool ! tbanks for looking into this.
I am wondering if this problem is tied into the issue of not being able to rename the file to be dispatched. Not being able to rename the file is a major nuisance when dispatching faxes especially.
Okay so looking at code when the file path is built the first test is if a pid is present and then is sanitized. So to fall through to get saved without a pid is odd. Workflow is to throw an exception or die.
This troubles me exec("mkdir -p " . escapeshellarg($docdir)); still I canât immediately see how the file path can get built w/o the pid and not die.
You might try changing the conditional if (!$patient_id) around L118 to maybe `if ($patient_id < 1)â or not cast the $patient_id to (int) in a prior statement. Still it should work as written but I canât test as I donât have halifax set up.
Do you have an ide w/ debug you can step through code to see how path is built? Or you could add a die after the path is built like die(âHere is my path:â . $docdir); to just verify that pathâŚ
Thanks Jerry
I will test out.
You donât need hylafax to test.
The same errant behavior can be observed in the âScanner Inâ section of Scan/Fax tab.
OK it seems fixed; I followed your suggestions and looked at those lines and asked the die after returning the path.
The PID was not being returned. So I took the function check_file_dir_name out and now the files save as expected in the pid folder!
I dont seem to have broken anything.
The documents save in the correct PID folder if folder exists and if not, it creates a pid folder and puts document in it.
Makes sense but I think the real fix is with where the $patient_id is type cast to an integer. Windows wonât mind much but linux may not like passing an int around however I am a bit surprised the validation didnât die! This works as written on my windows machine so draw from that what you will.
Would be very curious if you go back to original code and took out the casting to int of patient_id if that is indeed the true fixâŚ
L105 $patient_id = (int) $_POST[âform_pidâ]; take away the (int).
Also note all of this is broken in v502 due to something amiss with new verifyCsrfToken security modifications. So there is that!
Hi Brady,
I went to fix my dev version of 501 and this fix is already there so either I back ported and forgot to put in patch 7 or iâm sleep coding again.
Does/should this need to go in Patch 8? @brady.miller
@sjpadgett , Yep,
Not sure why I didnât flag that fix on my end either(guessing I was running low on coffee ). Agree to bring fix into patch 8.
-brady