[ic] How to "lock" a record?

DB DB at M-and-D.com
Wed Jun 23 09:29:58 EDT 2004

>> I'm developing a 5.2/foundation based catalog to allow several people to
>> collaborate on order processing. The order data is stored in a mysql
>> table. I'm nearly finished except for one issue. I need to be sure that
>> only one person at a time is working on a given order.
>> My first thought is to add a new column to the table that holds the
>> order records, and have users "sign out" the records they're working on
>> by entering their initials into that field.
>> Does anyone have a better way or any other suggestions? Maybe there is
>> an existing mechanism that addresses this problem? All suggestions are
>> welcome.
> I would probably set a new lock-column and a edited_by column, and add a
> timestamp + the username when a user starts editing it (check the code that
> is found in the UI for activating and deactivating a customer). When the
> user is ready with his/her editing, then It would clear the timestamp from
> the lock-column. You should then also remeber to have a cron-job that
> auto-clears the lock-field if the timestamp is older that x-minutes. The
> username would help the same user to return to his/her unfinished record
> before the cron resets the field (if eg. browser crashese etc.)
> Rene

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="
                   <option value="[loop-data MDorders order_number]"> 
[loop-data MDorders order_number]</option>
     <INPUT TYPE=SUBMIT name="mv_submit"  Value="Go">

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.


More information about the interchange-users mailing list