There already was a bug (Bug 32676) that should have addressed this. The initial commit looks ok, but the final one, which seems be the one that have been pushed is missing the .lower on edi_order.status.
Created attachment 179792 [details] [review] Bug 39468: EDI message status should be case insensitive Make edi_order lowercase so that matching is case insensitive.
I now saw both patches (that for some reason are absolute) contains the .lower change), but the commit in the Koha repo is missing it.