Module Skeleton Package

As to the InstModuleTable suggestions, I had considered doing everything via the table.sql route however I elected to do it my way so as to keep the various stages of installation as delineated in the registry table on a level in keeping with those in the modules table (i.e., unpackaged=?, sql_run=sql_run, state=mod_active - if I recall correctly and if that makes any sense). I suppose it really doesn’t make any difference, however, as long as nobody’s looking at and attempting to manage the module-based forms through Admin>Forms>Forms Administration. There could be problems if someone were to start the installation through Install Modules but not finish up there and try to complete it through Forms Administration. One could probably then mark the form as being enabled in Forms Administration without having it enabled yet through Modules. Maybe I’m overthinking this.

Never mind, it appears that you’re suggesting that it be that way. Something along the lines of completing the installation through Modules and then enabling it for actual use as a form through Form Administration. Please disregard the ramblings of this madman. I’ll work on it some more and let you know if things don’t work out.

Well, I’ve coded a new event (CustomFormEvent.php) and stashed it in a newly created openemr/src/Events/Forms/ folder. When I attempt to use it (in load_form.php, for example) is first name it as a resource (use OpenEMR\Events\Forms) but when I attempt to instantiate a new object ($event = new CustomFormEvent($_GET[‘forename’]):wink: all of a sudden all of my other previously functioning forms (the stock SOAP, Dictation, etc. forms) stop working. Specifically, I get nothing but a blank page when I attempt to create a new SOAP note. Actually, there’s a tab that says ‘SOAP’ but nothing beneath it.

I’ve tried remarking out the code within the event definition under the presumption that it was some coding error however I’m rewarded with the same behavior.

So my question is, how does OEMR know that a new event is available? Is it entered in a registry somewhere? If so, where? Of is it automatically gleaned from the directory structure? Any help?

Check to make sure you setup your namespaces correctly. Your CustomFormEvent needs to be in the OpenEMR\Events\Forms namespace. The OpenEMR namespace is mapped via the Composer AutoLoader to the openemr/src/ So the namespace definition needs to match the directory structure.

1 Like