7489-testToMaster #2515
|
@ -11,11 +11,13 @@ BEGIN
|
||||||
*/
|
*/
|
||||||
DECLARE vHasPda BOOLEAN;
|
DECLARE vHasPda BOOLEAN;
|
||||||
DECLARE vIsFreelance BOOLEAN;
|
DECLARE vIsFreelance BOOLEAN;
|
||||||
|
DECLARE vMaxDevicesPerUser INT;
|
||||||
|
|
||||||
SELECT COUNT(*) INTO vHasPda FROM deviceProductionUser WHERE userFk = vSelf;
|
SELECT COUNT(*) INTO vHasPda FROM deviceProductionUser WHERE userFk = vSelf;
|
||||||
SELECT isFreelance INTO vIsFreelance FROM worker WHERE id = vSelf;
|
SELECT IFNULL(isFreelance, FALSE) INTO vIsFreelance FROM worker WHERE id = vSelf;
|
||||||
|
SELECT IFNULL(maxDevicesPerUser, FALSE) INTO vMaxDevicesPerUser FROM deviceProductionConfig LIMIT 1;
|
||||||
|
|
||||||
IF NOT vIsFreelance AND vHasPda > 1 THEN
|
IF NOT vIsFreelance AND vHasPda > vMaxDevicesPerUser THEN
|
||||||
CALL util.throw('You can only have one PDA');
|
CALL util.throw('You can only have one PDA');
|
||||||
END IF;
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -12,3 +12,6 @@ ALTER TABLE vn.deviceProductionUser ADD CONSTRAINT deviceProductionUser_unique U
|
||||||
|
|
||||||
ALTER TABLE vn.deviceProduction ADD simSerialNumber TEXT NULL;
|
ALTER TABLE vn.deviceProduction ADD simSerialNumber TEXT NULL;
|
||||||
|
|
||||||
|
ALTER TABLE vn.deviceProductionConfig ADD maxDevicesPerUser INT UNSIGNED NULL;
|
||||||
|
|
||||||
|
UPDATE vn.deviceProductionConfig SET maxDevicesPerUser=1 WHERE id=1;
|
||||||
|
|
Loading…
Reference in New Issue