Bug in list update

Situation
Duplicate item in List w/ Add truncates the list

OpenEMR Version
I’m using OpenEMR version 5.0.1 (3)

Browser:
I’m using: Firefox x64 61.0.1

Operating System
I’m using: Win 7 Ultimate x64

Logs – no help

Thank you for offering the option to display the entries of a Listbox with Add field in alphabetical order in the ordinary user interface. That is a very useful feature.

I maintained a long list of patient occupations, but it was cluttered with near duplicate entries.

Unfortunately, the Administration > Lists > Occupations function does not display the list items in alphabetical order. I was cleaning up the list of occupations, and inadvertently created a duplicate entry of “Accountant”.

When I saved the updated list, MySQL threw a duplicate field error, and all of the entries following the second instance of “Accountant” were deleted, losing a hundred or so occupations.

It would be good the change the syntax of the update routine to avoid that problem. Ideally, the “save” function would skip the duplicate entry, but leave the rest of the unique entries untouched.

It would be nice to have the list editing page offer the option of showing the entries in alphabetical order as well as field numeric order.

Now, I need to figure out how to import the previous list from yesterday’s backup.