Templates for Patient Documents: Site ID is missing from session data!

(Rick) #21

Hi Jerry,
Started to figure out the temp file part.

  • .part extensie is added by Firefox, in case of: a partly download or the right sources are not installed on the computer or a virus or the file is damaged. In this case the right app is on my computer: firefox. So naming and add the .part extensie (gaSCA65C.odt.part) does Firefox.

  • Cleared the local temp folder. The issue still exist after clearing temp folder.

I prepared the server for error logs using the instructions mentioned https://perishablepress.com/advanced-php-error-handling-via-htaccess/#comments].
Later today, I hope to have a PHP error log …

I will keep you posted, thank you very much for helping!

(Jerry P) #22

Yes but FF/browser should not be changing temp file name! Those are set in the header for the download.
Also remember that you need to create an empty file in the log directory for the php error file name you setup. Apache won’t create for you and will appear as if php logs aren’t turned on(I believe)…

Bring up your browser console then download template and checkout the request url header to see exactly what is being sent to browser. See screenshot below.

(Rick) #23

Is there a way to alter this temp filename in FF, without the.part?

I have created an empty file in the log folder. Should there any code in there, or just complete empty?

Below the print-screens including the browser console info:
1st: info only when the warning appears;
2nd: info after the warning is turned off.

AD 1. afbeelding
AD 2.

Can you make something out of it?

(Rick) #24

Question regarding …
You could try hard coding a known good path for temp files in source file interface/patient_file/download_template.php $fname = tempnam($someknownpath, ‘OED’);
You mean to change ($GLOBALS[‘temporary_files_dir’] into a path to the local temp folder on my computer? Absolute path?

(Jerry P) #25

No that file path is temp directory on server. Forget the browser because looks like the download header is setup for chunk file transfer thus because we get an alert in the middle of the transfer that stops download then i’d expect to see a .part.

It may be that the servers temp directory is invalid or lacking permission for write. If you can replace files on your server i’ll send you a patched script to see what’s up.

The php error file you create is just an empty file so server doesn’t have to create it(don’t think it will anyway).

(Jerry P) #26

If you feel comfortable editing files add this line to interface/patient_file/download_template.php L-366
die("*Temp file and path: " . $fname . " *Template path: " . $templatepath);

Here is patched file if you just want to replace existing:
download_template.php (14.0 KB)

and here is untouched if needed:
download_template.php (13.9 KB)

Do patch then download template. You’ll see the info in the document frame. This way we can tell what the app is dealing with…

(Rick) #27

I have also tried the permission settings 777: without any luck.

(Rick) #28

The patch file is in place with the following result:
*Temp file and path: /tmp/OEDPAhgte *Template path: /www/htdocs/mannenkliniekde/openemr/sites/default/documents/doctemplates/Aanvraagformulier MRI onderzoek.odt

Does this give you a clue?

(Jerry P) #29

hmm, is there indeed a directory off root named tmp? Also i’d expect an extension. Check FTP.

Does this file name have underscores when uploaded? Linux is very strict with naming conventions ie spaces in a filename/directory is windows convention! not sure linux handles well.
Any rate we’re getting close.

(Rick) #30

There are no underscores and I also tried single name documents.

(Rick) #31

I see no temp directory in the directory list, only one called tmpbAAhziQ2, however this one is used by a different app.

Or is it possible that the temp directory is hidden?

(Jerry P) #32

Just to be sure you are looking on the server and there is not a directory /tmp ? How about /var/tmp?
/tmp is fairly standard and this surprises me.
Maybe create one with 777 permissions

(Rick) #33

I’m looking via FTP on the server where also the openemr directory is in the list.
i have created a (empty) temp directory in the root with permission 777.

Does the temp directory be placed in the openemr folder or just in the root?

(Jerry P) #34

The root and the directory name is tmp not temp

(Rick) #35

Good one, I changed it in tmp

(Jerry P) #36

I’m guessing you’ll put back the original source file and try it.

(Ralf Lukner MD PhD) #37

See below after letting the Chrome browser tab sit “for a long time (10 min or so)” while using other tabs, even other OpenEMR sessions and then returning and trying to type something in the search field for this tab and … got Site ID is missing. I suspect that “something” timed out … but not to the point that I was logged out of that session … because I was able to go to the flow board and get a screen full of data as expected.


(Jerry P) #38

Did you log into another openemr session or open another patient via open in new window in patient finder?
Brady just did a fix for login session problem a couple days ago. Very broke on FF but not as obvious on Chrome.

(Ralf Lukner MD PhD) #39


I thought the fix was checked into 5.0.2 …

(Jerry P) #40

I saw it go in master but I don’t know if its in 502 yet.