feat: refs #7921 refs#7921 sendLostExpedition #3149
|
@ -240,6 +240,7 @@
|
||||||
"There is already a tray with the same height": "There is already a tray with the same height",
|
"There is already a tray with the same height": "There is already a tray with the same height",
|
||||||
"The height must be greater than 50cm": "The height must be greater than 50cm",
|
"The height must be greater than 50cm": "The height must be greater than 50cm",
|
||||||
"The maximum height of the wagon is 200cm": "The maximum height of the wagon is 200cm",
|
"The maximum height of the wagon is 200cm": "The maximum height of the wagon is 200cm",
|
||||||
"The quantity claimed cannot be greater than the quantity of the line": "The quantity claimed cannot be greater than the quantity of the line",
|
"The quantity claimed cannot be greater than the quantity of the line": "The quantity claimed cannot be greater than the quantity of the line",
|
||||||
"There are tickets for this area, delete them first": "There are tickets for this area, delete them first"
|
"There are tickets for this area, delete them first": "There are tickets for this area, delete them first",
|
||||||
}
|
"ticketLostExpedition": "The ticket [{{ticketId}}]({{{ticketUrl}}}) has the following lost expedition:{{ expeditionId }}"
|
||||||
|
}
|
|
@ -385,5 +385,6 @@
|
||||||
"The quantity claimed cannot be greater than the quantity of the line": "La cantidad reclamada no puede ser mayor que la cantidad de la línea",
|
"The quantity claimed cannot be greater than the quantity of the line": "La cantidad reclamada no puede ser mayor que la cantidad de la línea",
|
||||||
"type cannot be blank": "Se debe rellenar el tipo",
|
"type cannot be blank": "Se debe rellenar el tipo",
|
||||||
"There are tickets for this area, delete them first": "Hay tickets para esta sección, borralos primero",
|
"There are tickets for this area, delete them first": "Hay tickets para esta sección, borralos primero",
|
||||||
"There is no company associated with that warehouse": "No hay ninguna empresa asociada a ese almacén"
|
"There is no company associated with that warehouse": "No hay ninguna empresa asociada a ese almacén",
|
||||||
|
"ticketLostExpedition": "El ticket [{{ticketId}}]({{{ticketUrl}}}) tiene la siguiente expedición perdida:{{ expeditionId }}"
|
||||||
}
|
}
|
|
@ -123,8 +123,8 @@
|
||||||
"Added sale to ticket": "J'ai ajouté la ligne suivante au ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}",
|
"Added sale to ticket": "J'ai ajouté la ligne suivante au ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}",
|
||||||
"Changed sale discount": "J'ai changé le rabais des lignes suivantes du ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
"Changed sale discount": "J'ai changé le rabais des lignes suivantes du ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
||||||
"Created claim": "J'ai créé la réclamation [{{claimId}}]({{{claimUrl}}}) des lignes suivantes du ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
"Created claim": "J'ai créé la réclamation [{{claimId}}]({{{claimUrl}}}) des lignes suivantes du ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
||||||
"Changed sale price": " le prix de [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* du ticket [{{ticketId}}]({{{ticketUrl}}})",,
|
"Changed sale price": " le prix de [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* du ticket [{{ticketId}}]({{{ticketUrl}}})",
|
||||||
"Changed sale quantity": "J'ai changé {{changes}} du ticket [{{ticketId}}]({{{ticketUrl}}})",
|
"Changed sale quantity": "J'ai changé {{changes}} du ticket [{{ticketId}}]({{{ticketUrl}}})",
|
||||||
"Changes in sales": "la quantité de {{itemId}} {{concept}} de {{oldQuantity}} ➔ {{newQuantity}}",
|
"Changes in sales": "la quantité de {{itemId}} {{concept}} de {{oldQuantity}} ➔ {{newQuantity}}",
|
||||||
"State": "État",
|
"State": "État",
|
||||||
"regular": "normal",
|
"regular": "normal",
|
||||||
|
@ -362,6 +362,7 @@
|
||||||
"The invoices have been created but the PDFs could not be generated": "La facture a été émise mais le PDF n'a pas pu être généré",
|
"The invoices have been created but the PDFs could not be generated": "La facture a été émise mais le PDF n'a pas pu être généré",
|
||||||
"It has been invoiced but the PDF of refund not be generated": "Il a été facturé mais le PDF de remboursement n'a pas été généré",
|
"It has been invoiced but the PDF of refund not be generated": "Il a été facturé mais le PDF de remboursement n'a pas été généré",
|
||||||
"Cannot send mail": "Impossible d'envoyer le mail",
|
"Cannot send mail": "Impossible d'envoyer le mail",
|
||||||
"Original invoice not found": "Facture originale introuvable",
|
"Original invoice not found": "Facture originale introuvable",
|
||||||
"The quantity claimed cannot be greater than the quantity of the line": "Le montant réclamé ne peut pas être supérieur au montant de la ligne"
|
"The quantity claimed cannot be greater than the quantity of the line": "Le montant réclamé ne peut pas être supérieur au montant de la ligne",
|
||||||
}
|
"ticketLostExpedition": "Le ticket [{{ticketId}}]({{{ticketUrl}}}) a l'expédition perdue suivante : {{expeditionId}}"
|
||||||
|
}
|
|
@ -124,7 +124,7 @@
|
||||||
"Changed sale discount": "Desconto da venda alterado no ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
"Changed sale discount": "Desconto da venda alterado no ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
||||||
"Created claim": "Reclamação criada [{{claimId}}]({{{claimUrl}}}) no ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
"Created claim": "Reclamação criada [{{claimId}}]({{{claimUrl}}}) no ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
||||||
"Changed sale price": "Preço da venda alterado para [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* no ticket [{{ticketId}}]({{{ticketUrl}}})",
|
"Changed sale price": "Preço da venda alterado para [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* no ticket [{{ticketId}}]({{{ticketUrl}}})",
|
||||||
"Changed sale quantity": "Quantidade da venda alterada para {{changes}} no ticket [{{ticketId}}]({{{ticketUrl}}})",
|
"Changed sale quantity": "Quantidade da venda alterada para {{changes}} no ticket [{{ticketId}}]({{{ticketUrl}}})",
|
||||||
"Changes in sales": " [{{itemId}} {{concept}}]({{{itemUrl}}}) de {{oldQuantity}} ➔ *{{newQuantity}}* ",
|
"Changes in sales": " [{{itemId}} {{concept}}]({{{itemUrl}}}) de {{oldQuantity}} ➔ *{{newQuantity}}* ",
|
||||||
"State": "Estado",
|
"State": "Estado",
|
||||||
"regular": "normal",
|
"regular": "normal",
|
||||||
|
@ -361,7 +361,8 @@
|
||||||
"It was not able to create the invoice": "Não foi possível criar a fatura",
|
"It was not able to create the invoice": "Não foi possível criar a fatura",
|
||||||
"The invoices have been created but the PDFs could not be generated": "Foi faturado, mas o PDF não pôde ser gerado",
|
"The invoices have been created but the PDFs could not be generated": "Foi faturado, mas o PDF não pôde ser gerado",
|
||||||
"It has been invoiced but the PDF of refund not be generated": "Foi faturado mas não foi gerado o PDF do reembolso",
|
"It has been invoiced but the PDF of refund not be generated": "Foi faturado mas não foi gerado o PDF do reembolso",
|
||||||
"Original invoice not found": "Fatura original não encontrada",
|
"Original invoice not found": "Fatura original não encontrada",
|
||||||
"Cannot send mail": "Não é possível enviar o email",
|
"Cannot send mail": "Não é possível enviar o email",
|
||||||
"The quantity claimed cannot be greater than the quantity of the line": "O valor reclamado não pode ser superior ao valor da linha"
|
"The quantity claimed cannot be greater than the quantity of the line": "O valor reclamado não pode ser superior ao valor da linha",
|
||||||
}
|
"ticketLostExpedition": "O ticket [{{ticketId}}]({{{ticketUrl}}}) tem a seguinte expedição perdida: {{expeditionId}}"
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
describe('expeditionState addExpeditionState()', () => {
|
describe('expeditionState addExpeditionState()', () => {
|
||||||
const ctx = beforeAll.getCtx();
|
const ctx = beforeAll.getCtx();
|
||||||
|
beforeAll.mockLoopBackContext();
|
||||||
it('should update the expedition states', async() => {
|
it('should update the expedition states', async() => {
|
||||||
const tx = await models.ExpeditionState.beginTransaction({});
|
const tx = await models.ExpeditionState.beginTransaction({});
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,4 +1,66 @@
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
module.exports = function(Self) {
|
module.exports = function(Self) {
|
||||||
require('../methods/expedition-state/filter')(Self);
|
require('../methods/expedition-state/filter')(Self);
|
||||||
require('../methods/expedition-state/addExpeditionState')(Self);
|
require('../methods/expedition-state/addExpeditionState')(Self);
|
||||||
|
|
||||||
|
Self.observe('before save', async ctx => {
|
||||||
|
const models = Self.app.models;
|
||||||
|
const changes = ctx.data || ctx.instance;
|
||||||
|
const instance = ctx.currentInstance;
|
||||||
|
const loopBackContext = LoopBackContext.getCurrentContext();
|
||||||
|
const httpCtx = {req: loopBackContext.active};
|
||||||
|
const httpRequest = httpCtx.req.http.req;
|
||||||
|
const $t = httpRequest.__;
|
||||||
jgallego marked this conversation as resolved
|
|||||||
|
const myOptions = {};
|
||||||
|
|
||||||
|
if (ctx.options && ctx.options.transaction)
|
||||||
|
myOptions.transaction = ctx.options.transaction;
|
||||||
|
|
||||||
|
const newStateType = changes?.typeFk;
|
||||||
|
if (newStateType == null) return;
|
||||||
sergiodt marked this conversation as resolved
jgallego
commented
açò no cal de fet canvia en açò no cal de fet canvia en https://gitea.verdnatura.es/verdnatura/salix/src/commit/268c0a984cfb9e4b0b2b1b8c0db12fe51bd34480/modules/ticket/back/models/expedition-state.json#L18
que la columna siga required i si no pasen el valor fallarà.
|
|||||||
|
|
||||||
|
const expeditionId = changes?.expeditionFk || instance?.expeditionFk;
|
||||||
|
|
||||||
|
const {code} = await models.ExpeditionStateType.findById(
|
||||||
|
newStateType,
|
||||||
|
{
|
||||||
|
fields: ['code']
|
||||||
|
},
|
||||||
|
myOptions);
|
||||||
|
|
||||||
|
if (code !== 'LOST') return;
|
||||||
|
|
||||||
|
const dataExpedition = await models.Expedition.findById(
|
||||||
|
expeditionId, {
|
||||||
|
fields: ['ticketFk'],
|
||||||
|
include: [{
|
||||||
|
relation: 'ticket',
|
||||||
|
scope: {
|
||||||
|
fields: ['clientFk'],
|
||||||
|
include: [{
|
||||||
|
relation: 'client',
|
||||||
|
scope: {
|
||||||
|
fields: ['name', 'salesPersonFk']
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
|
||||||
|
}, myOptions);
|
||||||
|
|
||||||
|
const salesPersonFk = dataExpedition.toJSON().ticket?.client?.salesPersonFk;
|
||||||
sergiodt marked this conversation as resolved
Outdated
jgallego
commented
https://gitea.verdnatura.es/verdnatura/salix/src/commit/64bddd4f63273063b7d35f63c993a0c491f62836/back/models/mrw-config.js#L39
exemple sense el toJSON
|
|||||||
|
|
||||||
|
if (salesPersonFk) {
|
||||||
|
const url = await Self.app.models.Url.getUrl();
|
||||||
|
const fullUrl = `${url}ticket/${dataExpedition.ticketFk}/expedition`;
|
||||||
|
const message = $t('ticketLostExpedition', {
|
||||||
|
ticketId: dataExpedition.ticketFk,
|
||||||
|
expeditionId: expeditionId,
|
||||||
|
url: fullUrl
|
||||||
|
});
|
||||||
|
await models.Chat.sendCheckingPresence(httpCtx, salesPersonFk, message);
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
altres arxius fan const { t } = useI18n();
En back no he trobat res ....és del front