refactor(origin): .origin por getUrl()
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
f832c1d9ec
commit
033c02750b
|
@ -45,11 +45,11 @@ module.exports = Self => {
|
|||
i.longName,
|
||||
i.size,
|
||||
ic.color,
|
||||
o.code url,
|
||||
o.code origin,
|
||||
ish.packing,
|
||||
ish.grouping,
|
||||
s.isAdded,
|
||||
s.urlalQuantity,
|
||||
s.originalQuantity,
|
||||
s.quantity saleQuantity,
|
||||
iss.quantity reservedQuantity,
|
||||
SUM(iss.quantity) OVER (PARTITION BY s.id ORDER BY ish.id) accumulatedQuantity,
|
||||
|
@ -73,7 +73,7 @@ module.exports = Self => {
|
|||
LEFT JOIN shelving sh ON sh.code = ish.shelvingFk
|
||||
LEFT JOIN parking p ON p.id = sh.parkingFk
|
||||
LEFT JOIN itemColor ic ON ic.itemFk = s.itemFk
|
||||
LEFT JOIN url o ON o.id = i.urlFk
|
||||
LEFT JOIN origin o ON o.id = i.originFk
|
||||
WHERE tc.collectionFk = ?
|
||||
GROUP BY ish.id, p.code, p2.code
|
||||
ORDER BY pickingOrder;`, [id], myOptions);
|
||||
|
@ -91,7 +91,7 @@ module.exports = Self => {
|
|||
promises.push(Self.app.models.Chat.send(ctx, observation,
|
||||
$t('The ticket is in preparation', {
|
||||
ticketId: ticketId,
|
||||
ticketUrl: `${url}/#!/ticket/${ticketId}/summary`,
|
||||
ticketUrl: `${url}ticket/${ticketId}/summary`,
|
||||
salesPersonId: ticket.salesPersonFk
|
||||
})));
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
const vnModel = require('vn-loopback/common/models/vn-model');
|
||||
const LoopBackContext = require('loopback-context');
|
||||
const {Email} = require('vn-print');
|
||||
|
||||
module.exports = function(Self) {
|
||||
|
@ -90,11 +89,7 @@ module.exports = function(Self) {
|
|||
};
|
||||
|
||||
Self.on('resetPasswordRequest', async function(info) {
|
||||
const loopBackContext = LoopBackContext.getCurrentContext();
|
||||
const httpCtx = {req: loopBackContext.active};
|
||||
const httpRequest = httpCtx.req.http.req;
|
||||
const headers = httpRequest.headers;
|
||||
const origin = headers.origin;
|
||||
const url = await Self.app.models.Application.getUrl();
|
||||
|
||||
const defaultHash = '/reset-password?access_token=$token$';
|
||||
const recoverHashes = {
|
||||
|
@ -110,7 +105,7 @@ module.exports = function(Self) {
|
|||
const params = {
|
||||
recipient: info.email,
|
||||
lang: user.lang,
|
||||
url: origin + '/#!' + recoverHash
|
||||
url: url.slice(0, -1) + recoverHash
|
||||
};
|
||||
|
||||
const options = Object.assign({}, info.options);
|
||||
|
@ -177,46 +172,4 @@ module.exports = function(Self) {
|
|||
Self.sharedClass._methods.find(method => method.name == 'changePassword').ctor.settings.acls =
|
||||
Self.sharedClass._methods.find(method => method.name == 'changePassword').ctor.settings.acls
|
||||
.filter(acl => acl.property != 'changePassword');
|
||||
|
||||
// FIXME: https://redmine.verdnatura.es/issues/5761
|
||||
// Self.afterRemote('prototype.patchAttributes', async(ctx, instance) => {
|
||||
// if (!ctx.args || !ctx.args.data.email) return;
|
||||
|
||||
// const loopBackContext = LoopBackContext.getCurrentContext();
|
||||
// const httpCtx = {req: loopBackContext.active};
|
||||
// const httpRequest = httpCtx.req.http.req;
|
||||
// const headers = httpRequest.headers;
|
||||
// const origin = headers.origin;
|
||||
// const url = origin.split(':');
|
||||
|
||||
// class Mailer {
|
||||
// async send(verifyOptions, cb) {
|
||||
// const params = {
|
||||
// url: verifyOptions.verifyHref,
|
||||
// recipient: verifyOptions.to,
|
||||
// lang: ctx.req.getLocale()
|
||||
// };
|
||||
|
||||
// const email = new Email('email-verify', params);
|
||||
// email.send();
|
||||
|
||||
// cb(null, verifyOptions.to);
|
||||
// }
|
||||
// }
|
||||
|
||||
// const options = {
|
||||
// type: 'email',
|
||||
// to: instance.email,
|
||||
// from: {},
|
||||
// redirect: `${origin}/#!/account/${instance.id}/basic-data?emailConfirmed`,
|
||||
// template: false,
|
||||
// mailer: new Mailer,
|
||||
// host: url[1].split('/')[2],
|
||||
// port: url[2],
|
||||
// protocol: url[0],
|
||||
// user: Self
|
||||
// };
|
||||
|
||||
// await instance.verify(options);
|
||||
// });
|
||||
};
|
||||
|
|
|
@ -53,7 +53,8 @@ describe('ticket ticketCalculateClon()', () => {
|
|||
expect(result[orderIndex][0].ticketFk).toBeGreaterThan(newestTicketIdInFixtures);
|
||||
});
|
||||
|
||||
it('should add the ticket to the order containing the original ticket and generate landed value if it was null', async() => {
|
||||
it('should add the ticket to the order containing the original ' +
|
||||
'ticket and generate landed value if it was null', async() => {
|
||||
let stmts = [];
|
||||
let stmt;
|
||||
|
||||
|
|
|
@ -18,7 +18,8 @@ module.exports = Self => {
|
|||
}
|
||||
});
|
||||
Self.getUrl = async(appName = 'salix') => {
|
||||
const {url} = Self.app.models.Url.findOne({
|
||||
const {url} = await Self.app.models.Url.findOne({
|
||||
|
||||
where: {
|
||||
appName,
|
||||
enviroment: process.env.NODE_ENV || 'development'
|
||||
|
|
|
@ -94,13 +94,13 @@ module.exports = Self => {
|
|||
|
||||
const salesPerson = ticket.client().salesPersonUser();
|
||||
if (salesPerson) {
|
||||
const origin = ctx.req.headers.origin;
|
||||
const url = await Self.app.models.Application.getUrl();
|
||||
|
||||
const message = $t('Created claim', {
|
||||
claimId: newClaim.id,
|
||||
ticketId: ticketId,
|
||||
ticketUrl: `${origin}/#!/ticket/${ticketId}/sale`,
|
||||
claimUrl: `${origin}/#!/claim/${newClaim.id}/summary`,
|
||||
ticketUrl: `${url}/ticket/${ticketId}/sale`,
|
||||
claimUrl: `${url}/claim/${newClaim.id}/summary`,
|
||||
changes: changesMade
|
||||
});
|
||||
await models.Chat.sendCheckingPresence(ctx, salesPerson.id, message);
|
||||
|
|
|
@ -56,15 +56,15 @@ module.exports = Self => {
|
|||
const salesPerson = sale.ticket().client().salesPersonUser();
|
||||
if (salesPerson) {
|
||||
const nickname = address && address.nickname || destination.description;
|
||||
const origin = ctx.req.headers.origin;
|
||||
const url = await Self.app.models.Application.getUrl();
|
||||
const message = $t('Sent units from ticket', {
|
||||
quantity: sale.quantity,
|
||||
concept: sale.concept,
|
||||
itemId: sale.itemFk,
|
||||
ticketId: sale.ticketFk,
|
||||
nickname: nickname,
|
||||
ticketUrl: `${origin}/#!/ticket/${sale.ticketFk}/sale`,
|
||||
itemUrl: `${origin}/#!/item/${sale.itemFk}/summary`
|
||||
ticketUrl: `${url}ticket/${sale.ticketFk}/sale`,
|
||||
itemUrl: `${url}item/${sale.itemFk}/summary`
|
||||
});
|
||||
await models.Chat.sendCheckingPresence(ctx, salesPerson.id, message);
|
||||
}
|
||||
|
|
|
@ -250,7 +250,12 @@ module.exports = Self => {
|
|||
const loopBackContext = LoopBackContext.getCurrentContext();
|
||||
const accessToken = {req: loopBackContext.active.accessToken};
|
||||
|
||||
const editVerifiedDataWithoutTaxDataChecked = models.ACL.checkAccessAcl(accessToken, 'Client', 'editVerifiedDataWithoutTaxDataCheck', 'WRITE');
|
||||
const editVerifiedDataWithoutTaxDataChecked = models.ACL.checkAccessAcl(
|
||||
accessToken,
|
||||
'Client',
|
||||
'editVerifiedDataWithoutTaxDataCheck',
|
||||
'WRITE'
|
||||
);
|
||||
const hasChanges = orgData && changes;
|
||||
|
||||
const isTaxDataChecked = hasChanges && (changes.isTaxDataChecked || orgData.isTaxDataChecked);
|
||||
|
@ -263,7 +268,9 @@ module.exports = Self => {
|
|||
const sageTransactionTypeChanged = hasChanges && orgData.sageTransactionTypeFk != sageTransactionType;
|
||||
|
||||
const cantEditVerifiedData = isTaxDataCheckedChanged && !editVerifiedDataWithoutTaxDataChecked;
|
||||
const cantChangeSageData = (sageTaxTypeChanged || sageTransactionTypeChanged) && !editVerifiedDataWithoutTaxDataChecked;
|
||||
const cantChangeSageData = (sageTaxTypeChanged ||
|
||||
sageTransactionTypeChanged
|
||||
) && !editVerifiedDataWithoutTaxDataChecked;
|
||||
|
||||
if (cantEditVerifiedData || cantChangeSageData)
|
||||
throw new UserError(`You don't have enough privileges`);
|
||||
|
@ -346,8 +353,7 @@ module.exports = Self => {
|
|||
const httpCtx = {req: loopBackContext.active};
|
||||
const httpRequest = httpCtx.req.http.req;
|
||||
const $t = httpRequest.__;
|
||||
const headers = httpRequest.headers;
|
||||
const origin = headers.origin;
|
||||
const url = await Self.app.models.Application.getUrl();
|
||||
|
||||
const salesPersonId = instance.salesPersonFk;
|
||||
|
||||
|
@ -366,7 +372,7 @@ module.exports = Self => {
|
|||
await email.send();
|
||||
}
|
||||
|
||||
const fullUrl = `${origin}/#!/client/${instance.id}/billing-data`;
|
||||
const fullUrl = `${url}client/${instance.id}/billing-data`;
|
||||
const message = $t('Changed client paymethod', {
|
||||
clientId: instance.id,
|
||||
clientName: instance.name,
|
||||
|
@ -389,8 +395,7 @@ module.exports = Self => {
|
|||
const httpCtx = {req: loopBackContext.active};
|
||||
const httpRequest = httpCtx.req.http.req;
|
||||
const $t = httpRequest.__;
|
||||
const headers = httpRequest.headers;
|
||||
const origin = headers.origin;
|
||||
const url = await Self.app.models.Application.getUrl();
|
||||
const models = Self.app.models;
|
||||
|
||||
let previousWorker = {name: $t('None')};
|
||||
|
@ -411,7 +416,7 @@ module.exports = Self => {
|
|||
currentWorker.name = worker && worker.user().nickname;
|
||||
}
|
||||
|
||||
const fullUrl = `${origin}/#!/client/${client.id}/basic-data`;
|
||||
const fullUrl = `${url}client/${client.id}/basic-data`;
|
||||
const message = $t('Client assignment has changed', {
|
||||
clientId: client.id,
|
||||
clientName: client.name,
|
||||
|
|
|
@ -57,8 +57,8 @@ module.exports = function(Self) {
|
|||
|
||||
const httpRequest = httpCtx.req.http.req;
|
||||
const $t = httpRequest.__;
|
||||
const origin = httpRequest.headers.origin;
|
||||
const fullPath = `${origin}/#!/client/${client.id}/credit-insurance/index`;
|
||||
const url = await Self.app.models.Application.getUrl();
|
||||
const fullPath = `${url}client/${client.id}/credit-insurance/index`;
|
||||
const message = $t('MESSAGE_INSURANCE_CHANGE', {
|
||||
clientId: client.id,
|
||||
clientName: client.name,
|
||||
|
|
|
@ -59,10 +59,10 @@ module.exports = Self => {
|
|||
};
|
||||
await Self.invoiceEmail(ctx, ref);
|
||||
} catch (err) {
|
||||
const origin = ctx.req.headers.origin;
|
||||
const url = await Self.app.models.Application.getUrl();
|
||||
const message = ctx.req.__('Mail not sent', {
|
||||
clientId: client.id,
|
||||
clientUrl: `${origin}/#!/claim/${id}/summary`
|
||||
clientUrl: `${url}claim/${id}/summary`
|
||||
});
|
||||
const salesPersonId = client.salesPersonFk;
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
let UserError = require('vn-loopback/util/user-error');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('deleteSales', {
|
||||
description: 'Deletes the selected sales',
|
||||
|
@ -70,11 +68,11 @@ module.exports = Self => {
|
|||
|
||||
const salesPerson = ticket.client().salesPersonUser();
|
||||
if (salesPerson) {
|
||||
const origin = ctx.req.headers.origin;
|
||||
const url = await Self.app.models.Application.getUrl();
|
||||
|
||||
const message = $t('Deleted sales from ticket', {
|
||||
ticketId: ticketId,
|
||||
ticketUrl: `${origin}/#!/ticket/${ticketId}/sale`,
|
||||
ticketUrl: `${url}ticket/${ticketId}/sale`,
|
||||
deletions: deletions
|
||||
});
|
||||
await models.Chat.sendCheckingPresence(ctx, salesPerson.id, message, myOptions);
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
|
||||
let UserError = require('vn-loopback/util/user-error');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('reserve', {
|
||||
description: 'Change the state of a ticket',
|
||||
|
@ -65,7 +62,8 @@ module.exports = Self => {
|
|||
|
||||
promises.push(reservedSale);
|
||||
|
||||
changesMade += `\r\n-${sale.itemFk}: ${sale.concept} (${sale.quantity}) ${$t('State')}: ${$t(oldState)} ➔ *${$t(newState)}*`;
|
||||
changesMade += `\r\n-${sale.itemFk}: ${sale.concept} (${sale.quantity})
|
||||
${$t('State')}: ${$t(oldState)} ➔ *${$t(newState)}*`;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,11 +85,11 @@ module.exports = Self => {
|
|||
|
||||
const salesPerson = ticket.client().salesPersonUser();
|
||||
if (salesPerson) {
|
||||
const origin = ctx.req.headers.origin;
|
||||
const url = await Self.app.models.Application.getUrl();
|
||||
|
||||
const message = $t('Changed sale reserved state', {
|
||||
ticketId: ticketId,
|
||||
ticketUrl: `${origin}/#!/ticket/${ticketId}/sale`,
|
||||
ticketUrl: `${url}ticket/${ticketId}/sale`,
|
||||
changes: changesMade
|
||||
});
|
||||
await models.Chat.sendCheckingPresence(ctx, salesPerson.id, message, myOptions);
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
let UserError = require('vn-loopback/util/user-error');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('updatePrice', {
|
||||
description: 'Changes the price of a sale',
|
||||
|
@ -100,7 +98,7 @@ module.exports = Self => {
|
|||
|
||||
const salesPerson = sale.ticket().client().salesPersonUser();
|
||||
if (salesPerson) {
|
||||
const origin = ctx.req.headers.origin;
|
||||
const url = await Self.app.models.Application.getUrl();
|
||||
const message = $t('Changed sale price', {
|
||||
ticketId: sale.ticket().id,
|
||||
itemId: sale.itemFk,
|
||||
|
@ -108,8 +106,8 @@ module.exports = Self => {
|
|||
quantity: sale.quantity,
|
||||
oldPrice: oldPrice,
|
||||
newPrice: newPrice,
|
||||
ticketUrl: `${origin}/#!/ticket/${sale.ticket().id}/sale`,
|
||||
itemUrl: `${origin}/#!/item/${sale.itemFk}/summary`
|
||||
ticketUrl: `${url}ticket/${sale.ticket().id}/sale`,
|
||||
itemUrl: `${url}item/${sale.itemFk}/summary`
|
||||
});
|
||||
await models.Chat.sendCheckingPresence(ctx, salesPerson.id, message, myOptions);
|
||||
}
|
||||
|
|
|
@ -80,15 +80,16 @@ module.exports = Self => {
|
|||
|
||||
const salesPerson = sale.ticket().client().salesPersonUser();
|
||||
if (salesPerson) {
|
||||
const url = await models.Application.getUrl();
|
||||
const url = await Self.app.models.Application.getUrl();
|
||||
console.log(url);
|
||||
const message = $t('Changed sale quantity', {
|
||||
ticketId: sale.ticket().id,
|
||||
itemId: sale.itemFk,
|
||||
concept: sale.concept,
|
||||
oldQuantity: oldQuantity,
|
||||
newQuantity: newQuantity,
|
||||
ticketUrl: `${url}/ticket/${sale.ticket().id}/sale`,
|
||||
itemUrl: `${url}/item/${sale.itemFk}/summary`
|
||||
ticketUrl: `${url}ticket/${sale.ticket().id}/sale`,
|
||||
itemUrl: `${url}item/${sale.itemFk}/summary`
|
||||
});
|
||||
|
||||
await models.Chat.sendCheckingPresence(ctx, salesPerson.id, message, myOptions);
|
||||
|
|
|
@ -84,7 +84,7 @@ module.exports = Self => {
|
|||
const query = `CALL vn.sale_calculateComponent(?, NULL)`;
|
||||
await Self.rawSql(query, [sale.id], myOptions);
|
||||
|
||||
const origin = ctx.req.headers.origin;
|
||||
const url = await Self.app.models.Application.getUrl();
|
||||
const requesterId = request.requesterFk;
|
||||
|
||||
const message = $t('Bought units from buy request', {
|
||||
|
@ -92,8 +92,8 @@ module.exports = Self => {
|
|||
concept: sale.concept,
|
||||
itemId: sale.itemFk,
|
||||
ticketId: sale.ticketFk,
|
||||
url: `${origin}/#!/ticket/${sale.ticketFk}/summary`,
|
||||
urlItem: `${origin}/#!/item/${sale.itemFk}/summary`
|
||||
url: `${url}ticket/${sale.ticketFk}/summary`,
|
||||
urlItem: `${url}item/${sale.itemFk}/summary`
|
||||
});
|
||||
await models.Chat.sendCheckingPresence(ctx, requesterId, message, myOptions);
|
||||
|
||||
|
|
|
@ -50,12 +50,12 @@ module.exports = Self => {
|
|||
const request = await Self.app.models.TicketRequest.findById(ctx.args.id, null, myOptions);
|
||||
await request.updateAttributes(params, myOptions);
|
||||
|
||||
const origin = ctx.req.headers.origin;
|
||||
const url = await Self.app.models.Application.getUrl();
|
||||
const requesterId = request.requesterFk;
|
||||
|
||||
const message = $t('Deny buy request', {
|
||||
ticketId: request.ticketFk,
|
||||
url: `${origin}/#!/ticket/${request.ticketFk}/request/index`,
|
||||
url: `${url}ticket/${request.ticketFk}/request/index`,
|
||||
observation: params.response
|
||||
});
|
||||
|
||||
|
|
|
@ -94,11 +94,11 @@ module.exports = Self => {
|
|||
|
||||
const salesPerson = ticket.client().salesPersonUser();
|
||||
if (salesPerson) {
|
||||
const origin = ctx.req.headers.origin;
|
||||
const url = await Self.app.models.Application.getUrl();
|
||||
|
||||
const message = $t('Added sale to ticket', {
|
||||
ticketId: id,
|
||||
ticketUrl: `${origin}/#!/ticket/${id}/sale`,
|
||||
ticketUrl: `${url}ticket/${id}/sale`,
|
||||
addition: addition
|
||||
});
|
||||
await models.Chat.sendCheckingPresence(ctx, salesPerson.id, message);
|
||||
|
|
|
@ -237,7 +237,7 @@ module.exports = Self => {
|
|||
|
||||
const salesPersonId = originalTicket.client().salesPersonFk;
|
||||
if (salesPersonId) {
|
||||
const origin = ctx.req.headers.origin;
|
||||
const url = await Self.app.models.Application.getUrl();
|
||||
|
||||
let changesMade = '';
|
||||
for (let change in newProperties) {
|
||||
|
@ -249,7 +249,7 @@ module.exports = Self => {
|
|||
|
||||
const message = $t('Changed this data from the ticket', {
|
||||
ticketId: args.id,
|
||||
ticketUrl: `${origin}/#!/ticket/${args.id}/sale`,
|
||||
ticketUrl: `${url}ticket/${args.id}/sale`,
|
||||
changes: changesMade
|
||||
});
|
||||
await models.Chat.sendCheckingPresence(ctx, salesPersonId, message);
|
||||
|
|
|
@ -25,7 +25,7 @@ module.exports = Self => {
|
|||
Self.merge = async(ctx, tickets, options) => {
|
||||
const httpRequest = ctx.req;
|
||||
const $t = httpRequest.__;
|
||||
const origin = httpRequest.headers.origin;
|
||||
const url = await Self.app.models.Application.getUrl();
|
||||
const models = Self.app.models;
|
||||
const myOptions = {};
|
||||
let tx;
|
||||
|
@ -40,8 +40,8 @@ module.exports = Self => {
|
|||
|
||||
try {
|
||||
for (let ticket of tickets) {
|
||||
const originFullPath = `${origin}/#!/ticket/${ticket.originId}/summary`;
|
||||
const destinationFullPath = `${origin}/#!/ticket/${ticket.destinationId}/summary`;
|
||||
const originFullPath = `${url}ticket/${ticket.originId}/summary`;
|
||||
const destinationFullPath = `${url}ticket/${ticket.destinationId}/summary`;
|
||||
const message = $t('Ticket merged', {
|
||||
originDated: dateUtil.toString(new Date(ticket.originShipped)),
|
||||
destinationDated: dateUtil.toString(new Date(ticket.destinationShipped)),
|
||||
|
|
|
@ -48,10 +48,10 @@ module.exports = Self => {
|
|||
// Send notification to salesPerson
|
||||
const salesPersonId = ticket.client().salesPersonFk;
|
||||
if (salesPersonId) {
|
||||
const origin = ctx.req.headers.origin;
|
||||
const url = await Self.app.models.Application.getUrl();
|
||||
const message = $t(`I have restored the ticket id`, {
|
||||
id: id,
|
||||
url: `${origin}/#!/ticket/${id}/summary`
|
||||
url: `${url}ticket/${id}/summary`
|
||||
});
|
||||
await models.Chat.sendCheckingPresence(ctx, salesPersonId, message);
|
||||
}
|
||||
|
|
|
@ -119,10 +119,10 @@ module.exports = Self => {
|
|||
// Send notification to salesPerson
|
||||
const salesPersonUser = ticket.client().salesPersonUser();
|
||||
if (salesPersonUser && sales.length) {
|
||||
const origin = ctx.req.headers.origin;
|
||||
const url = await Self.app.models.Application.getUrl();
|
||||
const message = $t(`I have deleted the ticket id`, {
|
||||
id: id,
|
||||
url: `${origin}/#!/ticket/${id}/summary`
|
||||
url: `${url}ticket/${id}/summary`
|
||||
});
|
||||
await models.Chat.send(ctx, `@${salesPersonUser.name}`, message);
|
||||
}
|
||||
|
@ -146,7 +146,8 @@ module.exports = Self => {
|
|||
JOIN vn.sectorCollection sc ON sc.id = scsg.sectorCollectionFk
|
||||
JOIN vn.saleGroupDetail sgd ON sgd.saleGroupFk = sg.id
|
||||
JOIN vn.sale s ON s.id = sgd.saleFk
|
||||
WHERE s.ticketFk = ?;`, [ticket.id], myOptions);
|
||||
WHERE s.ticketFk = ?;`, [ticket.id], myOptions
|
||||
);
|
||||
|
||||
if (tx) await tx.commit();
|
||||
|
||||
|
|
|
@ -165,11 +165,10 @@ module.exports = Self => {
|
|||
|
||||
const salesPerson = ticket.client().salesPersonUser();
|
||||
if (salesPerson) {
|
||||
const origin = ctx.req.headers.origin;
|
||||
|
||||
const url = await Self.app.models.Application.getUrl();
|
||||
const message = $t('Changed sale discount', {
|
||||
ticketId: id,
|
||||
ticketUrl: `${origin}/#!/ticket/${id}/sale`,
|
||||
ticketUrl: `${url}ticket/${id}/sale`,
|
||||
changes: changesMade
|
||||
});
|
||||
await models.Chat.sendCheckingPresence(ctx, salesPerson.id, message, myOptions);
|
||||
|
|
|
@ -109,13 +109,13 @@ module.exports = Self => {
|
|||
const absenceType = await models.AbsenceType.findById(args.absenceTypeId, null, myOptions);
|
||||
const account = await models.VnUser.findById(userId, null, myOptions);
|
||||
const subordinated = await models.VnUser.findById(id, null, myOptions);
|
||||
const origin = ctx.req.headers.origin;
|
||||
const url = await Self.app.models.Application.getUrl();
|
||||
const body = $t('Created absence', {
|
||||
author: account.nickname,
|
||||
employee: subordinated.nickname,
|
||||
absenceType: absenceType.name,
|
||||
dated: formatDate(args.dated),
|
||||
workerUrl: `${origin}/#!/worker/${id}/calendar`
|
||||
workerUrl: `${url}worker/${id}/calendar`
|
||||
});
|
||||
await models.Mail.create({
|
||||
subject: $t('Absence change notification on the labour calendar'),
|
||||
|
|
|
@ -60,13 +60,13 @@ module.exports = Self => {
|
|||
const absenceType = await models.AbsenceType.findById(absence.dayOffTypeFk, null, myOptions);
|
||||
const account = await models.VnUser.findById(userId, null, myOptions);
|
||||
const subordinated = await models.VnUser.findById(labour.workerFk, null, myOptions);
|
||||
const origin = ctx.req.headers.origin;
|
||||
const url = await Self.app.models.Application.getUrl();
|
||||
const body = $t('Deleted absence', {
|
||||
author: account.nickname,
|
||||
employee: subordinated.nickname,
|
||||
absenceType: absenceType.name,
|
||||
dated: formatDate(absence.dated),
|
||||
workerUrl: `${origin}/#!/worker/${id}/calendar`
|
||||
workerUrl: `${url}worker/${id}/calendar`
|
||||
});
|
||||
await models.Mail.create({
|
||||
subject: $t('Absence change notification on the labour calendar'),
|
||||
|
|
Loading…
Reference in New Issue