I created a new extension which should be easy to implement: SingleEdit
Purpose: Prevent concurrent edits on records.
As AppGini (AG) in the current version 5.92 does not support locking records for user B if user A currently edits them, I decided to make a start.
From the docs:
Introduction
A common problem working with online-databases is, that it’s almost impossible to handle concurrent edits on the same record.
If user UA has record RA open in the browser, nothing prevents user UB from opening that same record RA in his browser. So far there is no problem, as user UA and user UB are only viewing the record. A problem arises, once both users start editing the record.
This might seem not so common, but people might keep their browser window open, do something else and try to save an edited record 30 minutes after they opened it. We, as developers, just do not know if the user is viewing, editing, has his browser closed etc.
Let’s make an example and assume the records shows customer’s C1 data: Customer’s C1 lastname, firstname and street address. The data in the database reads as follows:
Code: Select all
Lastname: Noehring
Firstname: Olaf
Streetaddress: Somestreet 3
Code: Select all
Lastname: Merkel <--- the value has been changed by UA
Firstname: Olaf
Streetaddress: Somestreet 3
Code: Select all
Lastname: Noehring
Firstname: Olaf
Streetaddress: Countryside 99 <--- the value has been changed by UB
UA now presses the save changes button in the browser window. The values that will be written to the database, overwriting existing values, are:
Code: Select all
Lastname: Merkel <--- the value that has been changed by UA
Firstname: Olaf
Streetaddress: Somestreet 3
Code: Select all
Lastname: Noehring
Firstname: Olaf
Streetaddress: Countryside 99 <--- the value that has been changed by UB
User UB should not have been able to save his edits, but should have been notified, that the records has been changed in the meantime.
This script solves this problem.
It can look like this: Download v0.9
(.ZIP, size 237kb, including files and documentation)
https://dl.olaf-noehring.de/?t=167959be ... 3be10084cb
Comments? Ideas? Suggestions?
Olaf