Merge branch 'dev' into 2517-clientBalanceCompensaciones
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
6c2138a69a
File diff suppressed because it is too large
Load Diff
|
@ -59,7 +59,6 @@ IGNORETABLES=(
|
||||||
--ignore-table=vn.mail__
|
--ignore-table=vn.mail__
|
||||||
--ignore-table=vn.manaSpellers
|
--ignore-table=vn.manaSpellers
|
||||||
--ignore-table=vn.outgoingInvoiceKk
|
--ignore-table=vn.outgoingInvoiceKk
|
||||||
--ignore-table=vn.payment
|
|
||||||
--ignore-table=vn.paymentExchangeInsurance
|
--ignore-table=vn.paymentExchangeInsurance
|
||||||
--ignore-table=vn.payrollCenter
|
--ignore-table=vn.payrollCenter
|
||||||
--ignore-table=vn.plantpassport__
|
--ignore-table=vn.plantpassport__
|
||||||
|
|
|
@ -88,5 +88,7 @@
|
||||||
"Amount cannot be zero": "Amount cannot be zero",
|
"Amount cannot be zero": "Amount cannot be zero",
|
||||||
"Company has to be official": "Company has to be official",
|
"Company has to be official": "Company has to be official",
|
||||||
"A travel with this data already exists": "A travel with this data already exists",
|
"A travel with this data already exists": "A travel with this data already exists",
|
||||||
"The observation type can't be repeated": "The observation type can't be repeated"
|
"The observation type can't be repeated": "The observation type can't be repeated",
|
||||||
|
"New ticket request has been created with price": "New ticket request has been created '{{description}}' for day <strong>{{shipped}}</strong>, with a quantity of <strong>{{quantity}}</strong> and a price of <strong>{{price}} €</strong>",
|
||||||
|
"New ticket request has been created": "New ticket request has been created '{{description}}' for day <strong>{{shipped}}</strong>, with a quantity of <strong>{{quantity}}</strong>"
|
||||||
}
|
}
|
|
@ -167,5 +167,7 @@
|
||||||
"You can't upload images on the test environment": "No puedes subir imágenes en el entorno de pruebas",
|
"You can't upload images on the test environment": "No puedes subir imágenes en el entorno de pruebas",
|
||||||
"The selected ticket is not suitable for this route": "El ticket seleccionado no es apto para esta ruta",
|
"The selected ticket is not suitable for this route": "El ticket seleccionado no es apto para esta ruta",
|
||||||
"Sorts whole route": "Reordena ruta entera",
|
"Sorts whole route": "Reordena ruta entera",
|
||||||
"Invalid account": "Cuenta inválida"
|
"Invalid account": "Cuenta inválida",
|
||||||
|
"New ticket request has been created with price": "Se ha creado una nueva petición de compra '{{description}}' para el día <strong>{{shipped}}</strong>, con una cantidad de <strong>{{quantity}}</strong> y un precio de <strong>{{price}} €</strong>",
|
||||||
|
"New ticket request has been created": "Se ha creado una nueva petición de compra '{{description}}' para el día <strong>{{shipped}}</strong>, con una cantidad de <strong>{{quantity}}</strong>"
|
||||||
}
|
}
|
|
@ -24,9 +24,9 @@ exports.translateValues = async(instance, changes) => {
|
||||||
|
|
||||||
function formatDate(date) {
|
function formatDate(date) {
|
||||||
return new Intl.DateTimeFormat('es', {
|
return new Intl.DateTimeFormat('es', {
|
||||||
year: '2-digit',
|
year: 'numeric',
|
||||||
month: '2-digit',
|
month: 'numeric',
|
||||||
day: '2-digit',
|
day: 'numeric',
|
||||||
hour: '2-digit',
|
hour: '2-digit',
|
||||||
minute: '2-digit',
|
minute: '2-digit',
|
||||||
second: '2-digit'
|
second: '2-digit'
|
||||||
|
|
|
@ -8,10 +8,38 @@ module.exports = function(Self) {
|
||||||
Self.observe('before save', async function(ctx) {
|
Self.observe('before save', async function(ctx) {
|
||||||
if (ctx.isNewInstance) {
|
if (ctx.isNewInstance) {
|
||||||
const loopBackContext = LoopBackContext.getCurrentContext();
|
const loopBackContext = LoopBackContext.getCurrentContext();
|
||||||
let filter = {where: {userFk: loopBackContext.active.accessToken.userId}};
|
const filter = {where: {userFk: loopBackContext.active.accessToken.userId}};
|
||||||
let worker = await Self.app.models.Worker.findOne(filter);
|
const models = Self.app.models;
|
||||||
|
const worker = await models.Worker.findOne(filter);
|
||||||
|
|
||||||
ctx.instance.requesterFk = worker.id;
|
const instance = ctx.instance;
|
||||||
|
instance.requesterFk = worker.id;
|
||||||
|
|
||||||
|
const httpCtx = {req: loopBackContext.active};
|
||||||
|
const httpRequest = httpCtx.req.http .req;
|
||||||
|
const $t = httpRequest.__;
|
||||||
|
|
||||||
|
const attenderId = instance.attenderFk;
|
||||||
|
if (attenderId) {
|
||||||
|
const ticket = await models.Ticket.findById(instance.ticketFk);
|
||||||
|
let messageText = 'New ticket request has been created';
|
||||||
|
if (instance.price)
|
||||||
|
messageText = 'New ticket request has been created with price';
|
||||||
|
|
||||||
|
const shipped = new Intl.DateTimeFormat('es', {
|
||||||
|
year: 'numeric',
|
||||||
|
month: 'numeric',
|
||||||
|
day: 'numeric'
|
||||||
|
}).format(ticket.shipped);
|
||||||
|
|
||||||
|
const message = $t(messageText, {
|
||||||
|
description: instance.description,
|
||||||
|
shipped: shipped,
|
||||||
|
quantity: instance.quantity,
|
||||||
|
price: instance.price
|
||||||
|
});
|
||||||
|
await models.Chat.sendCheckingPresence(httpCtx, attenderId, message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue