Note the upgraded forum! If you are experiencing issues logging in, you may need to reset your password which should send an email. If the email doesn't arrive, be sure to check your spam folder just in case.

Record Locking

Do we currently have a build-in method of locking a record when opened by one user to stop another user from simultaneously opening and editing it? Or at least warning that someone else has it open?

Cheers

Comments

  • edited 2:58PM
    There currently is not a built in way to do that.
  • Thought so. It would be nice to have and should be easy to implement.

    On opening the form view, we could look to see if a "lock" field is present in the table (ie. locking is implemented) and if so, if the lock is enabled (lock <> ''), open the form and display a status at the top of the screen to say who it's open by (status = 'admin' eg.). If the record is not locked (lock = '') then update the field with the current user name - effectively taking ownership of the record.

    We could get cleverer and add read-only support (ie. cannot save locked record) using a variable in the module (eg. 'lock_readonly) - we can then prevent saves if the variable is set and you're not the current owner.

    The tricky bit would be unlocking once done. Not sure how we could do that off the top of my head but I'm sure google will know... Perhaps it would need to be a manual lock/unlock button?

    If this sounds like a reasonable solution, I'll add it to my todo list and offer a git push request at some point...
  • edited 2:58PM
    That unlocking does seem to be a bit tricky and knowing when a user has actually left the page (or has just left it open in their hidden browser window). It seems like there would need to be some more complicated Session handling to constantly monitor who is in and out of the system. I haven't done much research on that so I'd be curious to know what you find out because it would be a nice feature if implemented properly.
Sign In or Register to comment.