Stack Overflow error when updating facility with not-unique code
I noticed an issue when I was testing OLMIS-3240.
After creating a facility with a not-unique code (i.e. the same as that of an already-existing facility but with different casing), going to the facility's edition and trying to update the facility's code, the facility was not updated. Instead, an Internal Server error cause by Stack Overflow was returned. The error does not occur after each save. Sometimes, one has to update the facility's code more than once for it to occur. The facility's data before the attempt to update them were as on the attached screenshots.
Log into the application as administrator.
Go to Administration > Facilities.
Create a facility with any data but with a not-unique code, e.g. hc01 (the same as for Comfort Health Clinic but with different casing).
Go to facility's edition and change the facility's code.
Save the changes.
The Internal Server Error occurs because of Stack Overflow.
The facility code must be unique regardless of casing. The facility code hc01 and HC01 are the same, and not unique. If the admin enters in a facility code that is not unique, then they should receive an error message stating that the Facility code must be unique.
I checked and everything works correctly.
1. Log into the application as administrator.
2. Go to Administration > Facilities.
3. Click the "Edit" button next to any facility.
4. Change Facility Code, e.g. delete one character or add.
5. Click the “Save” button.
The information appears: “There was an error with this request, please contact the server administrator. No message available” and "Internal Server Error" in Response.
I don’t think so. Please add repro steps and assign it to me.
When I checked this ticket I noticed that when I change the Facility Code for an existing one in the system, "Internal Server Error" appears, in the case of the newly created facility this is not happening. Is this the correct behavior?
It appears that the validation for the uniqueness of the facility code doesn't work 100% correctly, as it's possible to create a facility with a not unique code when different casing is used. When the same casing is used, the validation works correctly - a proper error message appears, and the facility is not created. So yes, if the validation for the facility code starts working correctly and takes into account also casing, the bug won't be occurring.