The automatic creation of encounters from the calendar appts is hard setting the Onset date to be the “event date”, ie the appting date. This is bad, Onset/Hospitalization date must be blank unless it really is a one of those, and that should be set by the user not by the calendar tool.
I’m going to fix this and commit it tonight unless someone thinks otherwise …
I agree that not setting the onset date automatically in this situation is the correct thing to do. I’d like to suggest that while you are making this change it might be a good time to write a new function to create an encounter as a step towards modularizing this functionality.
Though it doesn’t look like it ‘addForm()’ is a common function, from forms.inc. The third argument returns the form_id of the “header” that was created in form_encounter by the imbedded SQL. While I think this is cute, it’s a tad hard to follow.
That said, I have the time to delete one line of code from that SQL statement. Which will fix this issue, I don’t have the time to come up with a better, more elegant solution at this moment…
So, I’ll fix it the simple way, an perhaps, in a moment of inspiration some evening in the future I’ll do some modularizing…
We (ie MI2) have a very modified version of this file that can call the Letter Template popup to produce a appointment notice that can be saved to the document tree, printed or emailed … It needs some prettying up and permission from the customer to share, but perhaps when we get to share that code we’ll do some other clean up work.
Tony, why don’t you discuss code sharing with your customers up front. In my experience, after talking with them a bit about the GPL and advantages of upgrading without having to port a lot of custom code, most are happy to give blanket permission.
I always do and they almost always agree. In this case it’s a “old world” kind of company and they agreed that it might be OK, but not until we finished the project, which has been ongoing for 6 months and will be for a while yet.
In this case it’s not an ordinary OpenEMR medical practice use case, it reusing OpenEMR as a part of a much bigger service and quite of lot of OpenEMR code has been removed or repurposed, so it’s not a simple upgrade issue, but some real gems are coming out of it and I do want to share them.
Remember… my company name is Medical Information Integration … not OpenEMR Sales, Inc…