This new program will be called directly from the UI whenever a MOD item is being added to a cart (results/order history). Its purpose is to do the following validations and to tell the UI if the validations passed or failed:
- Validate that the Quote isn't already in a cart. This validation will only occur if QUOTE.NBR # "".
- Validate that the MOD Item# that this quote is associated with isn't already in the cart that they are adding to (ie, there are 2 active quotes for the MOD Item, and one of the quotes is already in this cart).
You will have the following named params available:
- QUOTE.NBR (Quote#)
- PART.NBR (MOD Item#)
- CART.NAME (Cart that they are trying to add this quote to)
- CONTACT.NBR (contact number)
- BILLTO.NBR (billto customer#)
New LDLIB RPC$MODITEM_VALIDATETOCART (timeline 26-1):
- SELECT all SHOPPINGCART.USR records for the BILLTO.NBR
- If you find the QUOTE.NBR in field 6 of any of the shopping cart records:
- Set ERROR.CODE = 1
- ERROR.MSG = "This has already been added to Cart ":cart name from shoppingcart.usr key
- If you find the MOD Item# (PART.NBR) in field 1 of the cart that they are trying to add this quote to (CONTACT.NBR:"*":CART.NAME - disregard any ce initials at the end of the key):
- Set ERROR.CODE = 2
- ERROR.MSG = "Made on Demand Item " : PART.NBR "is already in this cart"
- If you don't find any errors:
- Set ERROR.CODE = 0
- ERROR.MSG = ''
- Return ERROR.CODE and ERROR.MSG to UI in RETURN.VALUE