7430_devToTest #2490

Merged
alexm merged 306 commits from 7430_devToTest into test 2024-05-21 09:15:04 +00:00
2 changed files with 7 additions and 2 deletions
Showing only changes of commit f2d4283304 - Show all commits

View File

@ -11,11 +11,13 @@ BEGIN
*/
DECLARE vHasPda BOOLEAN;
DECLARE vIsFreelance BOOLEAN;
DECLARE vMaxDevicesPerUser INT;
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');
END IF;
END$$

View File

@ -12,3 +12,6 @@ ALTER TABLE vn.deviceProductionUser ADD CONSTRAINT deviceProductionUser_unique U
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;