Unable to get prescriptions after 7.0.4 upgrade

PatientService.php (40.9 KB)

did the changes and I was able to get the issue fixed

1 Like

@stephenwaite thanks for your guide

please note that this is the changes that i did that worked in my case hope it help you all to solve the same issue that you are facing

1 Like

Hi,
1:tried to replace PatientService.php with the one provided, did not help
2: Edited PatientIssuesService.php and replaced
$sql .= $whereClause->getFragment() . " ORDER BY lists.begdate ";
with
$sql .= $fragment . " ORDER BY lists.begdate “;
or with
$clauses[] = “(” . $searchField->getField() . " IS NULL OR CAST(” . $searchField->getField() . " AS CHAR) = ‘’) ";
and again did not help.

If there is a solution can you pls post it again?
thank you

Hi @eumetaxas, since you’re running version 8 you should restore the original file and then make the edits to src/Services/Search/SearchFieldStatementResolver.php based off of this PR.

Thank you for your response and forgive my ignorance, i am a doctor:)

i changed these 2 lines, 227 & 232.

Now it seems to function ok.

If no other changes needed i will upgrade my actual installation, not the experimental VM and start using it .
Thank you again

Evgenios

1 Like

Confirmed Fix for Prescription Error in OpenEMR 7.0.4 on Ubuntu 24.04 with MySQL 8

Environment:

  • OpenEMR 7.0.4 upgraded from 7.0.2
  • Ubuntu 24.04
  • MySQL 8.0.45

Problem: After upgrading from 7.0.2 to 7.0.4, adding a new prescription produced a fatal SQL error involving enddate = '' being rejected by MySQL 8 strict mode.

Solution: Following Stephen Waite’s PR, edit this file: src/Services/Search/SearchFieldStatementResolver.php

Find line 227 and change:

$clauses[] = "(" . $searchField->getField() . " IS NOT NULL AND " . $searchField->getField() . " != '') ";

To:

$clauses[] = "(" . $searchField->getField() . " IS NOT NULL AND CAST(" . $searchField->getField() . " AS CHAR) != '') ";

Find line 232 and change:

$clauses[] = "(" . $searchField->getField() . " IS NULL OR " . $searchField->getField() . " = '') ";

To:

$clauses[] = "(" . $searchField->getField() . " IS NULL OR CAST(" . $searchField->getField() . " AS CHAR) = '') ";

Result: Prescriptions working normally. Thank you to Stephen Waite and Jerry P for guidance!

1 Like

Confirmed for 8.0.0.
If i change the files listed here BEFORE upgrading the database everything functions ok.
Thank you