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

(Rick) #41

The original source file is in place … no luck, the same warning still exist.

(Jerry P) #42

I don’t know what to tell you. There’s an issue with the server Imo. Will send you a PM

(Jerry P) #43

I’m going to mod the script to display php errors to the screen. Add a few other error traps and temp save to sites/default/documents. soon

(Rick) #44

Following …
In stead of FF I tried Edge …
The uploaded document via “document templates” I used looks like: testdoc.txt (84 Bytes)
And the downloaded document via the client looks like: testdoc_Testaccount_570.txt (88 Bytes)

At least in Edge it’s possible to download, however the document has unreadable characters!
Does this help?

Note: I used Notepad

(Rick) #45

Thank you …

(Rick) #46

Same result in Chrome!

(Jerry P) #47

Following script turns on all php errors(if any) to show on display and I made the directory path for the temp file at

This way you can go to Miscellaneous->Document Templates to download/view the temp document before it was sent to browser and compare. I patched out the temp file delete so be sure to clean up temp files from the doctemplates when done!

download_template.php (14.0 KB)

(Rick) #48

I put the download_template.php in place.
The following document is added to doctemplates: OEDwgLKZF (9.8 KB)

No PHP errors are shown

(Jerry P) #49

File is corrupted! Can you just do a simple test.txt(notepad) with
This is patient {PatientName} or something. Send me that OED temp file

(Rick) #50

The OED temp file will only be added to doctemplates after I have fetched the PatientName document via the patients account.
Patientname doc: Patientname.txt (29 Bytes)

The OED doc fetched from Patientname doc: OEDLxAhKV (48 Bytes)

No PHP errors are shown

(Rick) #51

Two other OED documents are added: (they look promising)
OEDvqO4Ct (30 Bytes)
OEDvqO4Ct (30 Bytes)

(Rick) #52

They appeared a couple of minutes later!

(Jerry P) #53

Can you view the file OEDLxAhKV from FTP. I need to make sure the file is written incorrectly and not from download!
Also do you know what php version you are using? This may be an encoding issue.

(Rick) #54

PHP version 5.6 …

(Rick) #55

I had to make a new one (already deleted the previous one):
New one: OEDvqO4Ct (30 Bytes)
This one is from the FTP

(Jerry P) #56

Okay, looks like the app is parsing and writing to drive correctly. Nice to know!
Remember you can’t use word docx but saved as odt.
I’d check several templates downloaded with FTP to ensure we’re okay to that point. PHP 5.6 sets encoding auto so should be utf8.
Can you download the uploaded main template file okay from Document Template Management. Should look same as what was uploaded. If not then i’m befuddled and may need to get somebody that deals with this IT stuff. From what I can see, the software works. Must be environment…

(Rick) #57

In the Document Template management is the uploaded document readable via the FTP, the download option, in the Document Template management, for the Patientname as well the OED document are unreadable.

(Rick) #58

All the uploaded docs via Document Template management are in the FTP readable.

(Jerry P) #59

So it’s the download. About the only thing left for me to do is try sending with some additional headers. I’ll send another file here shortly.
You might try Googling issues with corrupt downloads from PHP, encoding and/or locales. Try http or https. I just don’t know w/o duplicating issue myself so I can do debug magic…

(Rick) #60

Corrupt downloads from php happens more often, A common solution mentioned on the internet: https://stackoverflow.com/questions/29906595/laravel-5-file-downloads-invalid, OR https://stackoverflow.com/questions/8853568/downloading-file-is-corrupted-header
Note: the server is not properly cleaning the output buffer, especially the code"ob_end_clean();" works well!

However, I don’t know in which file I have to add the lines. Download_template.php?