Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6942-improveInvoiceIn
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-05-27 14:36:18 +02:00
commit 7cc86d5af0
9 changed files with 19 additions and 22 deletions

View File

@ -22,6 +22,7 @@ BEGIN
BEGIN BEGIN
IF vLockName IS NOT NULL THEN IF vLockName IS NOT NULL THEN
DO RELEASE_LOCK(vLockName); DO RELEASE_LOCK(vLockName);
CALL util.debugAdd('releaseLock', vLockName); -- Tmp
END IF; END IF;
RESIGNAL; RESIGNAL;

View File

@ -49,6 +49,7 @@ BEGIN
BEGIN BEGIN
IF vLockName IS NOT NULL THEN IF vLockName IS NOT NULL THEN
DO RELEASE_LOCK(vLockName); DO RELEASE_LOCK(vLockName);
CALL util.debugAdd('releaseLock', vLockName); -- Tmp
END IF; END IF;
RESIGNAL; RESIGNAL;

View File

@ -1,18 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketRefund_beforeUpsert`(vRefundTicketFk INT, vOriginalTicketFk INT)
BEGIN
DECLARE vAlreadyExists BOOLEAN DEFAULT FALSE;
IF vRefundTicketFk = vOriginalTicketFk THEN
CALL util.throw('Original ticket and refund ticket has same id');
END IF;
SELECT COUNT(*) INTO vAlreadyExists
FROM ticketRefund
WHERE refundTicketFk = vOriginalTicketFk;
IF vAlreadyExists > 0 THEN
CALL util.throw('This ticket is already a refund');
END IF;
END$$
DELIMITER ;

View File

@ -4,6 +4,5 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketRefund_beforeIn
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();
CALL ticketRefund_beforeUpsert(NEW.refundTicketFk, NEW.originalTicketFk);
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -4,6 +4,5 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketRefund_beforeUp
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();
CALL ticketRefund_beforeUpsert(NEW.refundTicketFk, NEW.originalTicketFk);
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -0,0 +1,5 @@
-- Auto-generated SQL script. Actual values for binary/complex data types may differ - what you see is the default string representation of values.
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('RoadmapStop','*','*','ALLOW','ROLE','production');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('RoadmapStop','*','*','ALLOW','ROLE','productionBoss');

View File

@ -25,5 +25,8 @@
}, },
"RoutesMonitor": { "RoutesMonitor": {
"dataSource": "vn" "dataSource": "vn"
},
"ExpeditionTruck": {
"dataSource": "vn"
} }
} }

View File

@ -0,0 +1,9 @@
{
"name": "ExpeditionTruck",
"base": "RoadmapStop",
"options": {
"mysql": {
"table": "expeditionTruck"
}
}
}

View File

@ -13,8 +13,6 @@ module.exports = async function(ctx, Self, tickets, reqArgs = {}) {
const failedtickets = []; const failedtickets = [];
for (const ticket of tickets) { for (const ticket of tickets) {
try { try {
await Self.rawSql(`CALL util.debugAdd('invoicingTicket', ?)`, [ticket.id], {userId});
await Self.app.models.InvoiceOut.getSerial(ticket.clientFk, ticket.companyFk, ticket.addressFk, 'M'); await Self.app.models.InvoiceOut.getSerial(ticket.clientFk, ticket.companyFk, ticket.addressFk, 'M');
await Self.rawSql( await Self.rawSql(
`CALL vn.ticket_closeByTicket(?)`, `CALL vn.ticket_closeByTicket(?)`,