Overview: When the user is adding stock items to the cart and the cart already has that particular stock item, we just add the quantity to the existing quantity in the cart for that item. We cannot do this for MOD items. So, to accommodate this business requirement, we are going to prevent the user from adding the same MOD item to the same cart a second time.
Process:
We've added a new database routine for this very purpose.
Database Spec:
Routine Name: RPC$MODITEM_VALIDATETOCART
Parameters:
- QUOTE.NBR
- PART.NBR
- CART.NAME
- CONTACT.NBR
- BILLTO.NBR
- OPERATOR
Middle Tier:
- Add ValidateAddToCart to the ProductModItemService, ProductModItemRepository, and their interfaces.
- Parameters:
- QuoteNbr - The quote for the item being added.
- PartNbr - The MOD part number being added.
- CartName - The name of the cart the item is trying to be added to.
- BilltoNbr - The current billto customer from the AuthenticatedUser cookie.
- Operator - The operator code from the AuthenticatedUser cookie if it is set.
- Output:
- String
- Processing
- Make the DB call
- if ERROR.CODE <> 0 then return ERR.MSG.
When the user chooses ADD to cart for a MOD item. The first thing we do is run the new ValidateAddToCart.
If the previous call returns anything, show a popup telling the user what the ERR.MSG said, and disable the add button.