Merge pull request 'Hotfix payments ticket 188787' (!2521) from Hotfix-payments-Ticket-#188787 into master
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #2521
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
Carlos Andrés 2024-05-28 13:01:47 +00:00
commit aefe6dc4f4
8 changed files with 27 additions and 22 deletions

View File

@ -42,8 +42,9 @@ BEGIN
JOIN entry e ON e.invoiceInFk = ii.id
JOIN duaEntry de ON de.entryFk = e.id
JOIN dua d ON d.id = de.duaFk
WHERE d.id = vDuaFk;
CALL ledger_next(vFiscalYear, vBookEntry);
WHERE d.id = vDuaFk
LIMIT 1;
CALL ledger_next(vFiscalYear, FALSE, vBookEntry);
END IF;
OPEN vInvoicesIn;
@ -62,7 +63,7 @@ l: LOOP
CLOSE vInvoicesIn;
UPDATE dua
SET ASIEN = vASIEN
SET ASIEN = vBookEntry
WHERE id = vDuaFk;
UPDATE invoiceIn ii

View File

@ -12,7 +12,7 @@ BEGIN
WHERE id = vDuaFk;
IF vBookNumber IS NULL OR NOT vBookNumber THEN
CALL ledger_next(YEAR(vBookDated), vBookNumber);
CALL ledger_next(YEAR(vBookDated), FALSE, vBookNumber);
END IF;
-- Apunte de la aduana

View File

@ -70,7 +70,7 @@ BEGIN
SELECT YEAR(bookEntried) INTO vFiscalYear FROM tInvoiceIn LIMIT 1;
IF vBookNumber IS NULL THEN
CALL ledger_next(vFiscalYear, vBookNumber);
CALL ledger_next(vFiscalYear, FALSE, vBookNumber);
END IF;
-- Apunte del proveedor

View File

@ -61,7 +61,7 @@ BEGIN
WHERE io.id = vInvoice;
SELECT YEAR(FECHA) INTO vFiscalYear FROM rs LIMIT 1;
CALL ledger_next(vFiscalYear, vBookNumber);
CALL ledger_next(vFiscalYear, FALSE, vBookNumber);
-- Linea del cliente
INSERT INTO XDiario(
ASIEN,

View File

@ -28,7 +28,7 @@ BEGIN
DECLARE vIsOriginalAClient BOOL;
DECLARE vPayMethodCompensation INT;
CALL ledger_next(YEAR(vDated), vNewBookEntry);
CALL ledger_next(YEAR(vDated), FALSE, vNewBookEntry);
SELECT COUNT(id) INTO vIsOriginalAClient
FROM client

View File

@ -1,6 +1,7 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ledger_next`(
IN vFiscalYear INT,
IN vIsManageTransaction BOOLEAN,
OUT vLastBookEntry INT
)
BEGIN
@ -22,6 +23,7 @@ BEGIN
CALL util.throw('Fiscal year is required');
END IF;
IF NOT vIsManageTransaction THEN
SELECT @@in_transaction INTO vHasStartTransaction;
IF NOT vHasStartTransaction THEN
@ -29,6 +31,7 @@ BEGIN
ELSE
SAVEPOINT sp;
END IF;
END IF;
SELECT bookEntry + 1 INTO vLastBookEntry
FROM ledgerCompany
@ -46,10 +49,12 @@ BEGIN
SET bookEntry = vLastBookEntry
WHERE fiscalYear = vFiscalYear;
IF NOT vIsManageTransaction THEN
IF vHasStartTransaction THEN
RELEASE SAVEPOINT sp;
ELSE
COMMIT;
END IF;
END IF;
END$$
DELIMITER ;

View File

@ -39,7 +39,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`xdiario_new`(
*/
BEGIN
IF vBookNumber IS NULL THEN
CALL ledger_next(YEAR(vDated), vBookNumber);
CALL ledger_next(YEAR(vDated), FALSE, vBookNumber);
END IF;
INSERT INTO XDiario

View File

@ -9,7 +9,6 @@ BEGIN
DECLARE vIsCash BOOLEAN;
DECLARE vIsSupplierActive BOOLEAN;
-- PAK 10/02/15 No se asientan los pagos directamente, salvo en el caso de las cajas de CASH
SELECT (at2.code = 'cash') INTO vIsCash
FROM accounting a
JOIN accountingType at2 ON at2.id = a.accountingTypeFk
@ -24,7 +23,7 @@ BEGIN
FROM supplier
WHERE id = NEW.supplierFk;
CALL ledger_next(YEAR(NEW.received), NEW.companyFk, vNewBookEntry);
CALL ledger_next(YEAR(NEW.received), TRUE, vNewBookEntry);
INSERT INTO XDiario (
ASIEN,