SunCoastConnection / TheRealLibreEHR

SunCoast Connection - QA reporting LibreEHR system
Other
0 stars 0 forks source link

Starting PID is 156351 #476

Closed aethelwulffe closed 5 years ago

aethelwulffe commented 5 years ago

Starting patient ID is 156351. Obviously this got set in the database somewhere as an autoincrement value. This needs fixing right now.

muarachmann commented 5 years ago

Where is that? cant find that in the interface/new/new_comprehensive_save.php

aethelwulffe commented 5 years ago

That would be in /SQL/database.sql in the patient_data table creation with an AUTOINCREMENT setting.

aethelwulffe commented 5 years ago

OK, not an autoincrement.

Take a look at libraries/patient.inc at function updatePatientData starting at line 1180.

I just remove a call next to there, and there is a big block of comment from an old failed method, and this is where the fun with the variable $pid all starts.

aethelwulffe commented 5 years ago

OK, found the real issue and where it came from: https://github.com/LibreHealthIO/lh-ehr/commit/5590d0d510e0314a62a271f551ddc038d19af509

This was when the recycle bin came into creation. That bit wasn't reviewed for the possible effects thereof. It would be great if @teryhill or Naveen had any feedback on what would happen to the recycle bin if we got our normal PID method back. I am willing to try it out. I suppose the +2 was to prevent a deleted and restored patient from doing an overwrite if you delete and re-enable the last patient...but it is making a mess. Using $pid = patient_data.id would have been a better method, along with warning that you can't add the latest PID to the recycle bin.

aethelwulffe commented 5 years ago

OK, it really was in new/new_comprehensive_save.php line 32 and 44. Line 32 was changed from +1 to +2 Line 44 was added. Killing line 44 and changing 32 to +1 fixed all associated issues. we can figure something else out for the recycle bin functions, but the way it is right now it dorks up too much other stuff.

aethelwulffe commented 5 years ago

Closing this as fixed in a PR. I have dev notes to check the recycle bin function.