This commit is contained in:
Pablo Natek 2023-07-03 14:08:50 +02:00
parent be1c145d9a
commit 9fe7024d17
2 changed files with 12 additions and 11 deletions

View File

@ -76,12 +76,14 @@ BEGIN
hasCoreVnl = vHasCoreVnl,
isActive = TRUE;
IF (SELECT COUNT(*)
INSERT INTO mandate (clientFk, companyFk, mandateTypeFk)
SELECT vUserFk, vCompanyFk, vMandateTypeFk
WHERE NOT EXISTS (
SELECT id
FROM mandate
WHERE clientFk = vUserFk
AND companyFk = vCompanyFk
AND mandateTypeFk = vMandateTypeFk) = 0 THEN
INSERT INTO mandate (clientFk, companyFk, mandateTypeFk)
VALUES (vUserFk, vCompanyFk, vMandateTypeFk);
AND mandateTypeFk = vMandateTypeFk
);
END$$
DELIMITER ;

View File

@ -1,5 +1,3 @@
DROP PROCEDURE IF EXISTS vn.clientCreate;
ALTER TABLE vn.clientConfig ADD defaultPayMethodFk tinyint(3) unsigned NULL;
ALTER TABLE vn.clientConfig ADD defaultDueDay int unsigned NULL;
ALTER TABLE vn.clientConfig ADD defaultCredit decimal(10, 2) NULL;
@ -9,10 +7,11 @@ ALTER TABLE vn.clientConfig ADD defaultMandateTypeFk smallint(5) NULL;
ALTER TABLE vn.clientConfig ADD CONSTRAINT clientNewConfigPayMethod_FK FOREIGN KEY (dafaultPayMethodFk) REFERENCES vn.payMethod(id);
ALTER TABLE vn.clientConfig ADD CONSTRAINT clientNewConfigMandateType_FK FOREIGN KEY (defaultMandateTypeFk) REFERENCES vn.mandateType(id);
UPDATE vn.clientConfig
INSERT IGNORE INTO vn.clientConfig
SET defaultPayMethodFk = 4,
defaultDueDay = 5,
defaultCredit = 300.0,
defaultIsTaxDataChecked = 1,
defaultHasCoreVnl = 1,
defaultMandateTypeFk = 2;
defaultMandateTypeFk = 2
WHERE id = 1;