fix: check for empty array before looking for offsite document (#7391)
commita7a58d3ab3fd44970b6e59909ef0ac9a7b8e8f99
authorstephen waite <stephen.waite@cmsvt.com>
Wed, 24 Apr 2024 17:45:40 +0000 (24 13:45 -0400)
committerGitHub <noreply@github.com>
Wed, 24 Apr 2024 17:45:40 +0000 (24 13:45 -0400)
tree23f2373824f0d798498c9a4e6a5954b4c255ba3b
parent899ffee171d969128bed4ba4353e4fe1a8e3a68c
fix: check for empty array before looking for offsite document (#7391)

* fix: check for empty array before looking for offsite document

* silence php warning

* Changed up event logic,fixed bugs

Instead of having the url splitting and parsing in the document class,
I pass the file path into the PatientRetrieveOffsiteDocument event and
let the module writer be responsible for parsing the url.  This ensures
that we handle any kind of url variety that is needed.

Fixed up the event dispatcher throwing an error because it wasn't even
set in the class...

Fixed the setter in the event and exposed the URL property.  No idea how
this was even working in the module.

* Bug fix prevent firing events if empty file

Made it so that if the filename is empty that the event will not be
fired.

Changed up the URL so you can get the entire URL schema (which is what I
thought was originally happening but apparently it wasn't).  This means
schemas such as s3:// ftp:// webdav:// etc can be handled by the class
properly.

Also changed up the event so you can get the entire saved document as an
object if additional meta information is needed by the offsite document
event handler.

---------

Co-authored-by: Stephen Nielson <snielson@discoverandchange.com>
controllers/C_Document.class.php
library/htmlspecialchars.inc.php
src/Events/PatientDocuments/PatientRetrieveOffsiteDocument.php