Merge branch '4700-split-tour' of https://gitea.verdnatura.es/verdnatura/salix into 3963-ticket-advance
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alexandre Riera 2022-11-21 11:44:53 +01:00
commit 4c21ffac3b
6 changed files with 16 additions and 11 deletions

View File

@ -7,3 +7,8 @@ BEGIN
CALL vn.ticket_canbePostponed(vDated,TIMESTAMPADD(DAY, vScopeDays, vDated),vLitersMax,vLinesMax,vWarehouseFk); CALL vn.ticket_canbePostponed(vDated,TIMESTAMPADD(DAY, vScopeDays, vDated),vLitersMax,vLinesMax,vWarehouseFk);
END $$ END $$
DELIMITER ; DELIMITER ;
INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
VALUES
('Ticket', 'getTicketsFuture', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Ticket', 'merge', 'WRITE', 'ALLOW', 'ROLE', 'employee');

View File

@ -76,3 +76,4 @@ BEGIN
HAVING liters <= IFNULL(vLitersMax, 9999) AND `lines` <= IFNULL(vLinesMax, 9999) AND ticketFuture; HAVING liters <= IFNULL(vLitersMax, 9999) AND `lines` <= IFNULL(vLinesMax, 9999) AND ticketFuture;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -137,6 +137,6 @@
"Claim pickup order sent": "Claim pickup order sent [({{claimId}})]({{{claimUrl}}}) to client *{{clientName}}*", "Claim pickup order sent": "Claim pickup order sent [({{claimId}})]({{{claimUrl}}}) to client *{{clientName}}*",
"You don't have grant privilege": "You don't have grant privilege", "You don't have grant privilege": "You don't have grant privilege",
"You don't own the role and you can't assign it to another user": "You don't own the role and you can't assign it to another user", "You don't own the role and you can't assign it to another user": "You don't own the role and you can't assign it to another user",
"MOVE_TICKET_CONFIRMATION": "Ticket [{{id}}]({{{fullPath}}}) ({{{originDated}}}) merged with [{{tfId}}]({{{fullPathFuture}}}) ({{{futureDated}}})", "Ticket merged": "Ticket [{{id}}]({{{fullPath}}}) ({{{originDated}}}) merged with [{{tfId}}]({{{fullPathFuture}}}) ({{{futureDated}}})",
"The sales of the receiver ticket can't be modified": "The sales of the receiver ticket can't be modified" "The sales of the receiver ticket can't be modified": "The sales of the receiver ticket can't be modified"
} }

View File

@ -240,5 +240,5 @@
"Claim pickup order sent": "Reclamación Orden de recogida enviada [({{claimId}})]({{{claimUrl}}}) al cliente *{{clientName}}*", "Claim pickup order sent": "Reclamación Orden de recogida enviada [({{claimId}})]({{{claimUrl}}}) al cliente *{{clientName}}*",
"You don't have grant privilege": "No tienes privilegios para dar privilegios", "You don't have grant privilege": "No tienes privilegios para dar privilegios",
"You don't own the role and you can't assign it to another user": "No eres el propietario del rol y no puedes asignarlo a otro usuario", "You don't own the role and you can't assign it to another user": "No eres el propietario del rol y no puedes asignarlo a otro usuario",
"MOVE_TICKET_CONFIRMATION": "Ticket [{{id}}]({{{fullPath}}}) ({{{originDated}}}) fusionado con [{{tfId}}]({{{fullPathFuture}}}) ({{{futureDated}}})" "Ticket merged": "Ticket [{{id}}]({{{fullPath}}}) ({{{originDated}}}) fusionado con [{{tfId}}]({{{fullPathFuture}}}) ({{{futureDated}}})"
} }

View File

@ -22,7 +22,7 @@ module.exports = Self => {
} }
}); });
Self.merge = async (ctx, tickets, options) => { Self.merge = async(ctx, tickets, options) => {
const httpRequest = ctx.req; const httpRequest = ctx.req;
const $t = httpRequest.__; const $t = httpRequest.__;
const origin = httpRequest.headers.origin; const origin = httpRequest.headers.origin;
@ -42,7 +42,7 @@ module.exports = Self => {
for (let ticket of tickets) { for (let ticket of tickets) {
const fullPath = `${origin}/#!/ticket/${ticket.id}/summary`; const fullPath = `${origin}/#!/ticket/${ticket.id}/summary`;
const fullPathFuture = `${origin}/#!/ticket/${ticket.ticketFuture}/summary`; const fullPathFuture = `${origin}/#!/ticket/${ticket.ticketFuture}/summary`;
const message = $t('MOVE_TICKET_CONFIRMATION', { const message = $t('Ticket merged', {
originDated: dateUtil.toString(new Date(ticket.originETD)), originDated: dateUtil.toString(new Date(ticket.originETD)),
futureDated: dateUtil.toString(new Date(ticket.destETD)), futureDated: dateUtil.toString(new Date(ticket.destETD)),
id: ticket.id, id: ticket.id,
@ -51,13 +51,12 @@ module.exports = Self => {
fullPathFuture fullPathFuture
}); });
if (!ticket.id || !ticket.ticketFuture) continue; if (!ticket.id || !ticket.ticketFuture) continue;
await models.Sale.updateAll({ ticketFk: ticket.id }, { ticketFk: ticket.ticketFuture }, myOptions); await models.Sale.updateAll({ticketFk: ticket.id}, {ticketFk: ticket.ticketFuture}, myOptions);
await models.Ticket.setDeleted(ctx, ticket.id, myOptions); await models.Ticket.setDeleted(ctx, ticket.id, myOptions);
await models.Chat.sendCheckingPresence(ctx, ticket.workerFk, message); await models.Chat.sendCheckingPresence(ctx, ticket.workerFk, message);
};
if (tx) {
await tx.commit();
} }
if (tx)
await tx.commit();
} catch (e) { } catch (e) {
if (tx) await tx.rollback(); if (tx) await tx.rollback();
throw e; throw e;

View File

@ -5,7 +5,7 @@
{ {
"accessType": "READ", "accessType": "READ",
"principalType": "ROLE", "principalType": "ROLE",
"principalId": "$authenticated", "principalId": "employee",
"permission": "ALLOW" "permission": "ALLOW"
} }
] ]