Merge pull request 'Hotfix payments ticket 188787' (!2521) from Hotfix-payments-Ticket-#188787 into master
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #2521 Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
commit
aefe6dc4f4
|
@ -42,8 +42,9 @@ BEGIN
|
||||||
JOIN entry e ON e.invoiceInFk = ii.id
|
JOIN entry e ON e.invoiceInFk = ii.id
|
||||||
JOIN duaEntry de ON de.entryFk = e.id
|
JOIN duaEntry de ON de.entryFk = e.id
|
||||||
JOIN dua d ON d.id = de.duaFk
|
JOIN dua d ON d.id = de.duaFk
|
||||||
WHERE d.id = vDuaFk;
|
WHERE d.id = vDuaFk
|
||||||
CALL ledger_next(vFiscalYear, vBookEntry);
|
LIMIT 1;
|
||||||
|
CALL ledger_next(vFiscalYear, FALSE, vBookEntry);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
OPEN vInvoicesIn;
|
OPEN vInvoicesIn;
|
||||||
|
@ -62,7 +63,7 @@ l: LOOP
|
||||||
CLOSE vInvoicesIn;
|
CLOSE vInvoicesIn;
|
||||||
|
|
||||||
UPDATE dua
|
UPDATE dua
|
||||||
SET ASIEN = vASIEN
|
SET ASIEN = vBookEntry
|
||||||
WHERE id = vDuaFk;
|
WHERE id = vDuaFk;
|
||||||
|
|
||||||
UPDATE invoiceIn ii
|
UPDATE invoiceIn ii
|
||||||
|
|
|
@ -12,7 +12,7 @@ BEGIN
|
||||||
WHERE id = vDuaFk;
|
WHERE id = vDuaFk;
|
||||||
|
|
||||||
IF vBookNumber IS NULL OR NOT vBookNumber THEN
|
IF vBookNumber IS NULL OR NOT vBookNumber THEN
|
||||||
CALL ledger_next(YEAR(vBookDated), vBookNumber);
|
CALL ledger_next(YEAR(vBookDated), FALSE, vBookNumber);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- Apunte de la aduana
|
-- Apunte de la aduana
|
||||||
|
|
|
@ -70,7 +70,7 @@ BEGIN
|
||||||
SELECT YEAR(bookEntried) INTO vFiscalYear FROM tInvoiceIn LIMIT 1;
|
SELECT YEAR(bookEntried) INTO vFiscalYear FROM tInvoiceIn LIMIT 1;
|
||||||
|
|
||||||
IF vBookNumber IS NULL THEN
|
IF vBookNumber IS NULL THEN
|
||||||
CALL ledger_next(vFiscalYear, vBookNumber);
|
CALL ledger_next(vFiscalYear, FALSE, vBookNumber);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- Apunte del proveedor
|
-- Apunte del proveedor
|
||||||
|
|
|
@ -61,7 +61,7 @@ BEGIN
|
||||||
WHERE io.id = vInvoice;
|
WHERE io.id = vInvoice;
|
||||||
|
|
||||||
SELECT YEAR(FECHA) INTO vFiscalYear FROM rs LIMIT 1;
|
SELECT YEAR(FECHA) INTO vFiscalYear FROM rs LIMIT 1;
|
||||||
CALL ledger_next(vFiscalYear, vBookNumber);
|
CALL ledger_next(vFiscalYear, FALSE, vBookNumber);
|
||||||
-- Linea del cliente
|
-- Linea del cliente
|
||||||
INSERT INTO XDiario(
|
INSERT INTO XDiario(
|
||||||
ASIEN,
|
ASIEN,
|
||||||
|
|
|
@ -28,7 +28,7 @@ BEGIN
|
||||||
DECLARE vIsOriginalAClient BOOL;
|
DECLARE vIsOriginalAClient BOOL;
|
||||||
DECLARE vPayMethodCompensation INT;
|
DECLARE vPayMethodCompensation INT;
|
||||||
|
|
||||||
CALL ledger_next(YEAR(vDated), vNewBookEntry);
|
CALL ledger_next(YEAR(vDated), FALSE, vNewBookEntry);
|
||||||
|
|
||||||
SELECT COUNT(id) INTO vIsOriginalAClient
|
SELECT COUNT(id) INTO vIsOriginalAClient
|
||||||
FROM client
|
FROM client
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ledger_next`(
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ledger_next`(
|
||||||
IN vFiscalYear INT,
|
IN vFiscalYear INT,
|
||||||
|
IN vIsManageTransaction BOOLEAN,
|
||||||
OUT vLastBookEntry INT
|
OUT vLastBookEntry INT
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
|
@ -22,13 +23,15 @@ BEGIN
|
||||||
CALL util.throw('Fiscal year is required');
|
CALL util.throw('Fiscal year is required');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
SELECT @@in_transaction INTO vHasStartTransaction;
|
IF NOT vIsManageTransaction THEN
|
||||||
|
SELECT @@in_transaction INTO vHasStartTransaction;
|
||||||
|
|
||||||
IF NOT vHasStartTransaction THEN
|
IF NOT vHasStartTransaction THEN
|
||||||
START TRANSACTION;
|
START TRANSACTION;
|
||||||
ELSE
|
ELSE
|
||||||
SAVEPOINT sp;
|
SAVEPOINT sp;
|
||||||
END IF;
|
END IF;
|
||||||
|
END IF;
|
||||||
|
|
||||||
SELECT bookEntry + 1 INTO vLastBookEntry
|
SELECT bookEntry + 1 INTO vLastBookEntry
|
||||||
FROM ledgerCompany
|
FROM ledgerCompany
|
||||||
|
@ -46,10 +49,12 @@ BEGIN
|
||||||
SET bookEntry = vLastBookEntry
|
SET bookEntry = vLastBookEntry
|
||||||
WHERE fiscalYear = vFiscalYear;
|
WHERE fiscalYear = vFiscalYear;
|
||||||
|
|
||||||
IF vHasStartTransaction THEN
|
IF NOT vIsManageTransaction THEN
|
||||||
RELEASE SAVEPOINT sp;
|
IF vHasStartTransaction THEN
|
||||||
ELSE
|
RELEASE SAVEPOINT sp;
|
||||||
COMMIT;
|
ELSE
|
||||||
END IF;
|
COMMIT;
|
||||||
|
END IF;
|
||||||
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
|
@ -39,7 +39,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`xdiario_new`(
|
||||||
*/
|
*/
|
||||||
BEGIN
|
BEGIN
|
||||||
IF vBookNumber IS NULL THEN
|
IF vBookNumber IS NULL THEN
|
||||||
CALL ledger_next(YEAR(vDated), vBookNumber);
|
CALL ledger_next(YEAR(vDated), FALSE, vBookNumber);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
INSERT INTO XDiario
|
INSERT INTO XDiario
|
||||||
|
|
|
@ -9,13 +9,12 @@ BEGIN
|
||||||
DECLARE vIsCash BOOLEAN;
|
DECLARE vIsCash BOOLEAN;
|
||||||
DECLARE vIsSupplierActive 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
|
SELECT (at2.code = 'cash') INTO vIsCash
|
||||||
FROM accounting a
|
FROM accounting a
|
||||||
JOIN accountingType at2 ON at2.id = a.accountingTypeFk
|
JOIN accountingType at2 ON at2.id = a.accountingTypeFk
|
||||||
WHERE a.id = NEW.bankFk;
|
WHERE a.id = NEW.bankFk;
|
||||||
|
|
||||||
IF vIsCash THEN
|
IF vIsCash THEN
|
||||||
SELECT account INTO vBankAccount
|
SELECT account INTO vBankAccount
|
||||||
FROM accounting
|
FROM accounting
|
||||||
WHERE id = NEW.bankFk;
|
WHERE id = NEW.bankFk;
|
||||||
|
@ -24,7 +23,7 @@ BEGIN
|
||||||
FROM supplier
|
FROM supplier
|
||||||
WHERE id = NEW.supplierFk;
|
WHERE id = NEW.supplierFk;
|
||||||
|
|
||||||
CALL ledger_next(YEAR(NEW.received), NEW.companyFk, vNewBookEntry);
|
CALL ledger_next(YEAR(NEW.received), TRUE, vNewBookEntry);
|
||||||
|
|
||||||
INSERT INTO XDiario (
|
INSERT INTO XDiario (
|
||||||
ASIEN,
|
ASIEN,
|
||||||
|
|
Loading…
Reference in New Issue