refs #6842 sql mod sage #2050

Merged
carlossa merged 13 commits from 6842-sageMod into dev 2024-03-15 08:45:06 +00:00
2 changed files with 44 additions and 25 deletions
Showing only changes of commit 59a0cb3f4a - Show all commits

View File

@ -17,16 +17,16 @@ BEGIN
DECLARE vRefLen INT;
DECLARE vRefPrefix VARCHAR(255);
DECLARE vLastRef VARCHAR(255);
DECLARE vSage200Company INT;
DECLARE vCompanyCode INT;
DECLARE vYearLen INT DEFAULT 2;
DECLARE vPrefixLen INT;
SELECT sage200Company INTO vSage200Company
SELECT companyCode INTO vCompanyCode
FROM company
WHERE id = NEW.companyFk;
IF vSage200Company IS NULL THEN
CALL util.throw('vSage200CompanyNotDefined');
IF vCompanyCode IS NULL THEN
CALL util.throw('vCompanyCodeNotDefined');
END IF;
SELECT MAX(i.ref) INTO vLastRef
@ -36,7 +36,7 @@ BEGIN
AND i.companyFk = NEW.companyFk;
IF vLastRef IS NOT NULL THEN
SET vPrefixLen = LENGTH(NEW.serial) + LENGTH(vSage200Company) + vYearLen;
SET vPrefixLen = LENGTH(NEW.serial) + LENGTH(vCompanyCode) + vYearLen;
SET vRefLen = LENGTH(vLastRef) - vPrefixLen;
SET vRefPrefix = LEFT(vLastRef, vPrefixLen);
SET vRef = RIGHT(vLastRef, vRefLen);
@ -44,7 +44,7 @@ BEGIN
SELECT refLen INTO vRefLen FROM invoiceOutConfig;
SET vRefPrefix = CONCAT(
NEW.serial,
vSage200Company,
vCompanyCode,
RIGHT(YEAR(NEW.issued), vYearLen)
);
END IF;

View File

@ -1,35 +1,54 @@
-- Auto-generated SQL script #202402151810
-- Auto-generated SQL script #202403061303
UPDATE vn.company
carlossa marked this conversation as resolved
Review

El mateix companyCode 0 no es posible que tinguen els 2, comprova en producció

El mateix companyCode 0 no es posible que tinguen els 2, comprova en producció
SET companyGroupFk=NULL
SET companyCode=0
WHERE id=69;
UPDATE vn.company
SET companyGroupFk=NULL
WHERE id=567;
UPDATE vn.company
SET companyGroupFk=NULL
SET companyCode=0
WHERE id=791;
UPDATE vn.company
SET companyGroupFk=NULL
SET companyCode=3
WHERE id=792;
UPDATE vn.company
SET companyGroupFk=NULL
SET companyCode=5
WHERE id=965;
UPDATE vn.company
SET companyGroupFk=NULL
SET companyCode=7
WHERE id=1381;
UPDATE vn.company
SET companyGroupFk=NULL
SET companyCode=3
WHERE id=1463;
UPDATE vn.company
SET companyGroupFk=NULL
WHERE id=2142;
UPDATE vn.company
SET companyGroupFk=NULL
WHERE id=2292;
UPDATE vn.company
SET companyGroupFk=NULL
SET companyCode=6
WHERE id=2393;
UPDATE vn.company
SET companyGroupFk=NULL
SET companyCode=9
WHERE id=3869;
ALTER TABLE vn.company MODIFY COLUMN sage200Company int(2) DEFAULT NULL NULL COMMENT 'Campo para la serie InvoiceOut';
-- Auto-generated SQL script #202403061303
UPDATE vn.company
SET companyCode=0
WHERE id=69;
UPDATE vn.company
SET companyCode=0
WHERE id=791;
UPDATE vn.company
SET companyCode=3
WHERE id=792;
UPDATE vn.company
SET companyCode=5
WHERE id=965;
UPDATE vn.company
SET companyCode=7
WHERE id=1381;
UPDATE vn.company
SET companyCode=3
WHERE id=1463;
UPDATE vn.company
SET companyCode=6
WHERE id=2393;
UPDATE vn.company
SET companyCode=9
WHERE id=3869;
ALTER TABLE vn.company CHANGE sage200Company sage200Company__ int(2) DEFAULT NULL NULL COMMENT '@deprecated 06/03/2024';
ALTER TABLE vn.company MODIFY COLUMN sage200Company__ int(2) DEFAULT NULL NULL COMMENT '@deprecated 06/03/2024';