diff --git a/db/changes/10503-november/00-ticket_canMerge.sql b/db/changes/10503-november/00-ticket_canMerge.sql index cb0e5cfe8..843237b64 100644 --- a/db/changes/10503-november/00-ticket_canMerge.sql +++ b/db/changes/10503-november/00-ticket_canMerge.sql @@ -7,3 +7,8 @@ BEGIN CALL vn.ticket_canbePostponed(vDated,TIMESTAMPADD(DAY, vScopeDays, vDated),vLitersMax,vLinesMax,vWarehouseFk); END $$ DELIMITER ; + +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) +VALUES + ('Ticket', 'getTicketsFuture', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('Ticket', 'merge', 'WRITE', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/changes/10503-november/00-ticket_canbePostposed.sql b/db/changes/10503-november/00-ticket_canbePostponed.sql similarity index 99% rename from db/changes/10503-november/00-ticket_canbePostposed.sql rename to db/changes/10503-november/00-ticket_canbePostponed.sql index 905d267a4..c691fa4bd 100644 --- a/db/changes/10503-november/00-ticket_canbePostposed.sql +++ b/db/changes/10503-november/00-ticket_canbePostponed.sql @@ -76,3 +76,4 @@ BEGIN HAVING liters <= IFNULL(vLitersMax, 9999) AND `lines` <= IFNULL(vLinesMax, 9999) AND ticketFuture; END$$ DELIMITER ; + diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 94dfcbb5c..ed9c4606b 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -137,6 +137,6 @@ "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 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}}})", - "The sales of the receiver ticket can't be modified": "The sales of the receiver ticket can't be modified" -} \ No newline at end of file + "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" +} diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 634cb8e53..1dc862952 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -240,5 +240,5 @@ "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 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}}})" } diff --git a/modules/ticket/back/methods/ticket/merge.js b/modules/ticket/back/methods/ticket/merge.js index 0f1fa38bf..04f8d83af 100644 --- a/modules/ticket/back/methods/ticket/merge.js +++ b/modules/ticket/back/methods/ticket/merge.js @@ -22,7 +22,7 @@ module.exports = Self => { } }); - Self.merge = async (ctx, tickets, options) => { + Self.merge = async(ctx, tickets, options) => { const httpRequest = ctx.req; const $t = httpRequest.__; const origin = httpRequest.headers.origin; @@ -42,7 +42,7 @@ module.exports = Self => { for (let ticket of tickets) { const fullPath = `${origin}/#!/ticket/${ticket.id}/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)), futureDated: dateUtil.toString(new Date(ticket.destETD)), id: ticket.id, @@ -51,13 +51,12 @@ module.exports = Self => { fullPathFuture }); 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.Chat.sendCheckingPresence(ctx, ticket.workerFk, message); - }; - if (tx) { - await tx.commit(); } + if (tx) + await tx.commit(); } catch (e) { if (tx) await tx.rollback(); throw e; diff --git a/modules/ticket/back/models/ticket-future.json b/modules/ticket/back/models/ticket-future.json index 2a1b45def..00277ab8a 100644 --- a/modules/ticket/back/models/ticket-future.json +++ b/modules/ticket/back/models/ticket-future.json @@ -5,7 +5,7 @@ { "accessType": "READ", "principalType": "ROLE", - "principalId": "$authenticated", + "principalId": "employee", "permission": "ALLOW" } ]