How specific is the lock file?
- Contact Number
- Port #
- Port Marker
- Operator (Blank if the customer himself)
- Type
- FileName
- FileKey
When contact logs in:
Lock on Login:
- Prevent the more than 1 customer login per contact. Multiple CE users can be in at the same time.
- Lock active cart because Jen can open Bob’s cart.
LOGIN*CONTACT.NBR – Some customer user logged in as this contact.
- No UD lock Needed
CART*OWNER.CONTACT.NBR*CART.NAME*PORT.NUMBER*PORT.MARKER
- No UD lock Needed
When activating/deleting carts:
Locking Carts:
- Whenever a cart is activated, we lock the newly activated cart, and release the previously locked cart. *** 4/29 - Whenever you receive a CART lock type, release any other CART lock that you have in XRF before locking the new cart.
- When an order is created, release the lock.
- When a cart is deleted release the lock.
- Set Weblock
- 5/6/14 - Whenever you are locking a cart, lock all Quote Numbers in the cart ... do this within the global locking program:
- When LOCK.TYPE = 'CART', read SHOPPINGCART.USR record with key of contact*cart name. Loop through field 6 looking for quote numbers (there may be none if there are no MOD items in the cart). When you find a quote#, lock it in weblocks and UD.
When going into My Account area:
Lock Profile:
- Up to only 1 CE user OR customer user.(only 1 person at a time)
- CONTACT*PROFILE
- When leaving the profile area, release the profile locks. (4/29 - RPC$UTILITY_RELEASEPROFILE)
- Set UD lock.
PROFILE*CONTACT.NBR – Some user logged into this contact’s profile area
- Sets UD lock for CONTACT.NBR on SLSCONTACT.USR *** check UD lock first
Lock profile on bundling step???
When editing global/individual location customer preferences:
CUSTOMER*CUST.NO – Stops 2 web contacts from accessing the same customer at the same time.
- Needs to lock CUSTMST for CUST.NO - NEEDS UD LOCK
- *** 4/29 - Whenever you receive a CUSTOMER lock type, release any other customer lock that you have in XRF first before locking the new customer
5/6/14 - Saved Items:
SAVEDITEM*Contact#*CPN or MOD Item# - stops 2 people from accessing the same saved item. This only requires a Weblock (no UD lock because these items can't be accessed from Avante). Everytime a saved item is locked, all previous SAVEDITEM locks will be unset. This is because we never actually leave the screen after 'save' so that isn't a good time to unlock.
5/6/14 - Quotes:
QUOTE*Quote# - stops 2 people from accessing the same quote when changing an existing quote. This requires a Weblock and a UD Lock
Detail WEBLOCKS record:
F1: Locking Contact Number
F2: Locking Contact Name (slscontact.usr)
F3: Locking CE operator
F4: Lock Date (Internal)
F5: Lock Time (Internal)
F6: UD Lock Key (if any) *** 4/29 - if a UD lock is required, write the UD lock key here so that we know to release it later
Header WEBLOCKS record:
Lock Xref record in WEBLOCKS – Tells us what locks belong to the given contact / operator combo
Key: XRF*CONTACT.NBR*OPERATOR
F1: WEBLOCK record ids
Leaving the site:
- UI will call new RPC$UTILITY_RELEASEALL, passing CONTACT.NBR and OPERATOR.
- Write RPC$UTILITY_RELEASEALL (see 4/29 notes below) to call the WEB.LK program with lock action = 3 (release all locks)
- Release ALL locks.
- Read XRF weblock record for list of weblock records to delete.
- Loop through F1 in Xref Weblock record
- Delete weblock record
- Release corresponding UD lock (Only profile or Customer mentioned above) (4/29 - if there's a UD key in the WEBLOCKS record)
- Delete XRF weblock record
Leaving Profile Area - how do we know that tabs have changed???? UI will call new RPC$UTILITY_RELEASEPROFILE)
Switching customer in profile area or working with ALL Locations - call lock when loading preference array and 4/29-everytime a customer is locked, all previous CUSTOMER locks will be unset. This is because we never actually leave the screen after 'save' so that isn't a good time to unlock.unlock when saving preferences.
Locking Routine: WEB.LK(LOCK.TYPE, XRF.KEY, LOCK.ACTION, ERR.MSG)
- Input Params: 4 item argument list.
- First argument:
- Lock Type (PROFILE, CART, LOGIN, CUSTOMER)
- Second argument: Contact # * Operator – for finding XRF lock record.
- Third argument: 1=Lock; 2=Release Individual Lock; 3=Release all locks; 4=Release all Profile Locks (release all locks with Lock Type of "PROFILE" or "CUSTOMER") 4/29-will be called when user leaves Profile tab to release all contact & customer locks
- Fourth argument: Error message to display “” means no error
- IF locking
- Check for UD locks (Someone has the record up in Avante) Build loop to check x times every y milli-seconds.
- Check for WEBLOCK existence.
- If WEBLOCK exists locate key in your XREF weblock record.
- If not found someone else has the record build error message based on lock contents XXXX has this record locked. Return in ERR.MSG.
- If WEBLOCK exists locate key in your XREF weblock record.
- Case statement to set UD locks based on type and key elements.
- Update Xref WEBLOCK record. If lock record does not exist.
- Write out the lock record.
- If releasing
- Delete the lock record
- Delete the key to the locked record from XRF record field 1.
- Release UD lock if applicable.
- If XRF<1> = “” delete XRF lock record.
- If Release All
- Argument 1 = “”
- Read XRF based on argument 2
- Same as releasing but in a loop through the XRF<1>
To test contact locking:
Call WEB.LK from RPC$CONTACT_VALIDATE
Contact preferences accounted for in CRM9000?
Inactivity timer for lock releasing, nice to have CE sets a flag that asks the customer if they are still there.
When redback is restarted we need to go through all the locks in weblocks and relock the records.
Lock messages should tell the user that this area is in use by XXXXX.
No shared Contact records. 2 customer employees cannot log into the site at the same time using the same contact number.
When the user goes to Profile:
- In the profile, only lock the customer records on the screen. The contact profile stays locked the entire time.
4/29/14 - new RPC's to RELEASE ALL LOCKS and RELEASE PROFILE LOCKS:
- New RPC$UTILITY_RELEASEALL - The UI will call this program when the user is leaving the site. All locks will be released (timeline 77-5)
- Input params: CONTACT.NBR, OPERATOR
- Read WEBLOCKS: XRF*CONTACT.NBR*OPERATOR
- Loop through field 1 and delete all WEBLOCKS detail records. If there is a UD lock key in the weblocks detail record, release the UD lock
- Delete the XRF record
- 5/6/14 - Add add'l logic to release all SAVEDITEM and QUOTE locks
- New RPC$UTILITY_RELEASEPROFILE - The UI will call this program when the user is leaving the Profile tab. PROFILE and CUSTOMER locks will be released (timeline 77-6)
- Input params: CONTACT.NBR, OPERATOR
- Read WEBLOCKS: XRF*CONTACT.NBR*OPERATOR
- Loop through field 1 looking for keys with lock type of "PROFILE" or "CUSTOMER" and delete the associated WEBLOCKS detail record. Delete the multi-value from XRF<1>. If there is a UD lock key in the weblocks detail record, release the UD lock
- 5/6/14 - May need a change to this program for Quotes and/or saved items - will speak with John *** DON'T NEED TO DO THIS HERE. WHEN A CART UNLOCK IS ASKED FOR, THIS PROGRAM WILL UNLOCK ALL QUOTES IN THE CART.
- Save the XRF record
- 5/6/14 - Whenever you are unlocking a cart, unlock all Quote Numbers in the cart ... do this within the global locking program:
- When LOCK.TYPE = 'CART', read SHOPPINGCART.USR record with key of contact*cart name. Loop through field 6 looking for quote numbers (there may be none if there are no MOD items in the cart). When you find a quote#, unlock it in weblocks and UD.
4/29/14:
- Calling programs - create a new named param "LOCKYN" that the UI can use to send to the backend a 0/1 flag when locking is required. If LOCKYN=1, call WEB.LK and pass appropriate LOCK TYPE, KEY etc
- How will we rebuild UD locks when redback is restarted? Will the DEV area have a separate redback restart so that we don't effect the live site? How will we know web port# so we can rebuild UD locks from WEBLOCKS???
5/9/14 - Programs that will call the WEB.LK program to set/release locks:
- Change name of program to from WEB.LCK to WEB.LK ???
- Change WEB.LK program to return to UI an error code of 90 when a record is locked. Continue to send SERVER.STATUS = 1 regardless of locks.
When to Lock/Unlock Shopping Carts (timeline 77-8):
- The active cart will always be locked when the contact logs into the site. Modify RPC$SHOPPINGCART_GETBYID to call WEB.LK passing a LOCK.TYPE of "CART" and a LOCK.KEY of the active cart name. Logic within WEB.LK should set the cart lock (WEBLOCKS) and also lock all quotes (WEBLOCKS & UD) within the cart. The active cart and associated quotes stay locked the entire time that the user is logged into the site, unless they switch carts.
- In case the active cart is deleted, modify RPC$SHOPPINGCART_DELETE to unset the cart locks by passing a LOCK.TYPE of "CART" and set the lock release flag. All associated quotes in the cart should be unlocked (use SHOPPINGCART.USR to determine which quote(s) to release)
When to Lock/Unlock Login Contact (timeline 77-9):
- When the contact (or ce) first logs into the site, lock the contact with a LOGIN lock type. This will stay locked the entire time so that only one customer can be using that contact# at a time. Modify RPC$CONTACT_VALIDATE to call WEB.LK with a LOCK.TYPE of LOGIN. This should set only a WEBLOCKS lock.
- The lock release on a LOGIN lock only occurs when they leave the site (and the UI calls the RELEASE ALL LOCKS program)
When to Lock/Unlock Profile (Contact/Customer) (timeline 77-10):
- There is currently no RPC called by the UI when the user enters the 'My Account' area. the UI side is handling the display of the contact info on the Profile screen using what was read in CONTACT.READ when they first logged into the site. Create a new RPC$UTILITY_PROFILELOCK program that can be called by the UI. LOCK.TYPE = PROFILE. IN WEB.LK, set the PROFILE lock for the contact. In addition, whenever LOCK.TYPE=PROFILE, set CUSTOMER WEBLOCK and UD lock for the Billto customer# (BILLTO.NBR). We've decided to keep the billto# locked as long as they are in the My Account area (profile screen, user preferences screen, avatar screen, etc).
- Profile (and billto customer) locks will be released when the UI calls the RELEASE PROFILE LOCKS program (when they leave this tab and return to widget) or if they leave the site (RELEASE ALL LOCKS)
When to lock/unlock Customers (My Account Shipping/CE Preferences) (timeline 77-11):
- In the Shipping Preferences or CE Preferences screens, we will lock the shipto customer selected when in the 'Individual Locations' area. When working on All Locations, the data is written to the billto customer, which was already locked when first entering the My Account area (in Profile locks above). If the individual customer that they are working on is the billto customer, there is no need to lock it again. Modify RPC$CUSTOMER_GETBYID to set a customer lock under the following condition (LOCK.TYPE=CUSTOMER):
- Only set the customer lock if the UI sends LOCKYN as true (not sure if UI is sending this as a "1" or "true"). There are my programs calling GETBYID that do not require a lock.
- When unlocking all customers prior to setting the new lock, don't unlock the CUSTOMER*billto# if you have a PROFILE lock in your XRF. We want to leave the billto customer locked while in the My Account area.
- Unlocking of each individual customer occurs when they select the next customer to work on (or when they leave the My Account area by release profile locks or if they leave the site by release all locks)
5/20/14 - Locking new Quotes (timeline 77-12):
In BP WEB.CREATE.QUOTE, when creating a new quote (STATUS = 1 or 2), call the locking program to set a WEBLOCK and UD lock on the quote. Right now, the thought is that this quote will stay locked the whole time the user is on the site (until release all locks program is called by the UI).
5/21/14 - New screen to unlock WEBLOCK/UD Locks:
Write a new Avante screen that will release individual or ALL locks for a contact (and optional operator code):
Prompt for:
- Company (reqd) - use std validation and F3
- Contact Nbr (reqd) - use existing validation and F3 (look at CRM9000)
- Operator Code (optional)
Display in a multi-line format:
- Lock Type (ie, Cart, Profile, Customer)
- Lock Name (ie, Cart Name, Contact Name, Customer Name)
- Lock Date & Time
- UD Lock info
- Unlock? ... this will be an entry column allowing "Y" where the user can indicate that they wish to unlock this individual lock
F2-Save (do the unlocks)
F5-Release All Locks (this will release all locks for the contact). If this is chosen, set the "Unlock?" column to Y for every lock and REFRESH -2 so they display on screen.
Remove the F4-Del function key
Function Key should display vertically (default is horizontal)
Updating:
- Loop through looking for "Y" in the Unlock column:
- If there's a "Y" in every row, call your unlock routine with "release all locks" option
- If there are individual "Y" (not all rows selected), release these individual locks
ALTERNATE METHOD OF 'RELEASE ALL':
When F5 is chosen to release all locks, display a dialog box asking: Are you sure you wish to release all locks for this Individual? With the default option being "No" (so they have to choose Yes to continue. If Yes, do all releases as stated above, then clear the screen.
Tech Notes:
- Call it SYS9030 (iiprocess will be SYS9030, screen name would be SYSI9030.N)
- It will go on the SOP/Custom/Custom Admin menu
- Off the top of my head I can’t think of any screen where we prompt for contact# and have a multi-valued list of things in column format.
- You can look at CRM9000 to see how we prompt for company# and contact#
- Paint this screen against WEBLOCK.USR. All fields on the screen will be WORK fields
- Write Record? will be set to “N”
- Set Control/Dep/Read to “R” on the Operator field. This establishes that the ‘key’ portion of the screen is complete
- Your program should be put into the PROCESS AT ACCEPT slot
- See CRM9000 for function keys and F6-params screen std setup
- For Function Keys: Copy STD_SAVE_ARM to SYSF9030.N using FNKEY.DEFN (file IIDEFN). Add F5-Release All. Use this as your function key set on F6-params
5/22/14 - new master Unlock RPC that UI can call (timeline 77-17):
Write a new RPC program that the UI can call whenever unlocking is required:
Named Params: UI will use named param FLAG to pass you the type of unlock it's requesting
- New RPC$UTILITY_RELEASELOCK(PARAMS, UNUSED, RETURN.VALUE)
- $INCLUDE BP.INCLUDES LAD.COMMON
- $INCLUDE LD.INCLUDES LD.CONSTANTS
- If FLAG = "ALL", execute RPC$UTILITY_RELEASEALL
- If FLAG = "PROFILE", execute RPC$UTILITY_RELEASEPROFILE
- RETURN.VALUE should be pass along from each of the called routines, then pass back to UI via this program
7/18/14 - Locking Quotes pulled through widget from Saved Items:
When a MOD item is selected in Saved Items, the quote (either individual quote that was selected from the Price History $ or the most recent quote if click on MOD Item#), it is pulled back through the widget. The quote being accessed should be locked, even though at this time we don't know if the user is going to:
- Do nothing
- Change the quote quantity, zip code, or freight option (allowed only if 'open' quote: unexpired and unconverted)
- Create a new quote from this existing quote (ashad)
Regardless of what the user ends up doing with this quote, we want to keep the quote they started with locked for the time they are on the site. Unlocks will happen via release all locks when they leave the site. At this point, the lock logic is handling the creation of a new quote as well as locking all existing quotes in the active cart. This last change should close the loop on quote locking by taking care of the 'change quote' event. As long as we lock the quote when it is pulled back through the widget, that should be all that we have to do.
Somewhere between MODPRODUCTITEM_GETBYFILTER (which is called when pulling quote back through the widget) and INCLUDES MODPRODUCTITEM.READ, you have to lock this quote. Lock the quote if:
- QUOTE.NBR # ''
- LOCK.YN = 1 (true) *** MAKE SURE YOU ARE CHECKING THIS EVERYWHERE WHEN LOCKING
- Quote is open:
- QUHDR<167,1> # 5 (5 means converted)
- QUHDR<9> + SYSCON QUOTE.TERMS.LAD,6> >= TODAY (not expired yet)
Set a WEBLOCK as well as a UD lock on QUHDR.
While you are in this area, I found a bug in LD.INCLUDES MODPRODUCTITEM.READ. The EXP.DATE has a hardcoded 14 days. Please change the hardcoding to read SYSCON QUOTE.TERMS.LAD<6> instead. Strip off any comments that may be on that field. Make sure that all programs that include this have a SYSCON OPEN FILE.