[ic] How to "lock" a record?

DB DB at M-and-D.com
Wed Jun 23 14:59:00 EDT 2004


>> Thanks... that sounds like what I had in mind and I have added the two
>> columns. Here is how I currently link to the page where the order
>> data is edited:
>>
>>     <FORM METHOD=POST ACTION="[process]">
>>      <INPUT TYPE=HIDDEN name="mv_doit" value="return">
>>      <INPUT TYPE=HIDDEN name="mv_nextpage" value="update_order">
>>                Update Order<br> <select name=update_code>
>>                    [loop option=order_number search="
>>                          st=db
>>                          ra=yes
>>                          fi=MDorders
>>                          rf=order_number
>>                          ml=1000
>>                          tf=order_number
>>                          to=n
>>                    "]
>>                    <option value="[loop-data MDorders order_number]">
>> [loop-data MDorders order_number]</option>
>>                    [/loop]
>>                </select><br>
>>      <INPUT TYPE=SUBMIT name="mv_submit"  Value="Go"> </FORM>
>>
>> I want to to add a timestamp to the "locked" field when the "go"
>> button on the above form is clicked. Can that be done somehow or
>> would I have to use two steps: 1) add the timestamp, then 2) open the
>> page where the edits are made.
>>
>> DB
> 
> I would point that form to a special_pages page that has some logic. The logic
> would do a query to first check if it is locked already. If it is locked,
> bounce the user to a suitable notice page, and if not locked, immediately
> insert the users "username" into your lock_column field.
> 
> Also, on your "this record is locked page" I would show who last took control,
> and at what time. This way, the user could decide if they want to terminate the
> lock, and place their own lock. For example, a browser may crash, and you may
> have your cron set to 30 minutes (sometimes people work slow :). So, Sally can
> say, hmm Bill just left for lunch, so I know he is not working on this, I will
> terminate it. Or maybe Sally's browser crashed. she get get back on real quick,
> and terminate/initiate herself a new lock.
> 
> You should also compare the usernames just before you write to the record. If
> they don't match, you need a backup plan. Maybe write the info into scratch, or
> a new record or whatever.
> 
> This should work *most of the time. It should work really well in small
> offices. Also, if the crew is using a mandatory IM, then they can message each
> other... "are you working on this record? it had been a while...", that is, if
> it is really important.
> 
> My system allows for very very loooong edits, and also allows for extreme
> incompetence, so that is necessary.
> 
> 
> Paul


Hi - that's basically what I have done and it seem like it will do the 
trcik. Can someone give me an example of how to expire a lock using a 
cron job? What actually updates the record... a shell script with mysql 
commands?

DB


More information about the interchange-users mailing list