Title: Fix: Messages — Forward message blocked when message body is empty
OpenEMR Version: 7.0.4 Server: Ubuntu Linux / Apache / PHP 8.2 / MySQL 8
Problem: When forwarding a message from the Messages, Reminders, Recalls page, the form blocks sending if the message body (note) is empty. A red border appears around the message field with “is not valid.” The only workaround was typing something (like a period) in the message body before forwarding. This is problematic because sometimes you just want to forward a message to the correct recipient without adding any commentary.
Root Cause: The validation rules for the messages page are stored in the database in list_options where option_id = 'messages#new_note'. The notes field contains a JSON validation rule requiring the note field to have a presence (non-empty value):
json
{"form_datetime":{"futureDate":{"message": "Must be future date"}}, "reply_to":{"presence": {"message": "Please choose a patient"}}, "note":{"presence": {"message": "Please enter a note"}}}
Fix: Remove the note presence requirement from the validation rules while keeping the date and recipient validations intact. Run this SQL query:
sql
UPDATE list_options
SET notes='{"form_datetime":{"futureDate":{"message": "Must be future date"}}, "reply_to":{"presence": {"message": "Please choose a patient"}}}'
WHERE option_id='messages#new_note';
Result: Messages can now be forwarded with an empty message body. The recipient validation still works correctly.