35 lines
775 B
SQL
35 lines
775 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`myOrder_configure`(
|
|
vSelf INT,
|
|
vDelivery DATE,
|
|
vDeliveryMethod VARCHAR(45),
|
|
vAgency INT,
|
|
vAddress INT)
|
|
BEGIN
|
|
/**
|
|
* Creates an order with passed parameters. If passed parameters are wrong
|
|
* it returns an error.
|
|
*
|
|
* @param vSelf The order id
|
|
* @param vDelivery Delivery date
|
|
* @param vDeliveryMethod Delivery method code
|
|
* @param vAgency Agency id
|
|
* @param vAddress Address id, @NULL for pickup
|
|
*/
|
|
CALL myOrder_checkMine(vSelf);
|
|
|
|
IF vAddress IS NOT NULL
|
|
AND NOT (SELECT COUNT(*) FROM myAddress WHERE id = vAddress) THEN
|
|
CALL util.throw('addressNotOwnedByUser');
|
|
END IF;
|
|
|
|
CALL order_configure(
|
|
vSelf,
|
|
vDelivery,
|
|
vDeliveryMethod,
|
|
vAgency,
|
|
vAddress
|
|
);
|
|
END$$
|
|
DELIMITER ;
|