4791-refactor-sendsms #1160
|
@ -32,7 +32,7 @@ module.exports = Self => {
|
||||||
let message = $t(`There's a new urgent ticket:`);
|
let message = $t(`There's a new urgent ticket:`);
|
||||||
const ostUri = 'https://cau.verdnatura.es/scp/tickets.php?id=';
|
const ostUri = 'https://cau.verdnatura.es/scp/tickets.php?id=';
|
||||||
tickets.forEach(ticket => {
|
tickets.forEach(ticket => {
|
||||||
message += `\r\n[ID: *${ticket.number}* - ${ticket.subject} (@${ticket.username})](${ostUri + ticket.id})`;
|
message += `\r\n[ID: *${ticket.number}* - ${ticket.subject} @${ticket.username}](${ostUri + ticket.id})`;
|
||||||
});
|
});
|
||||||
|
|
||||||
const department = await models.Department.findOne({
|
const department = await models.Department.findOne({
|
||||||
|
@ -42,7 +42,5 @@ module.exports = Self => {
|
||||||
|
|
||||||
if (channelName)
|
if (channelName)
|
||||||
return Self.send(ctx, `#${channelName}`, `@all ➔ ${message}`);
|
return Self.send(ctx, `#${channelName}`, `@all ➔ ${message}`);
|
||||||
|
|
||||||
return;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,4 +4,21 @@ module.exports = Self => {
|
||||||
require('../methods/chat/sendCheckingPresence')(Self);
|
require('../methods/chat/sendCheckingPresence')(Self);
|
||||||
require('../methods/chat/notifyIssues')(Self);
|
require('../methods/chat/notifyIssues')(Self);
|
||||||
require('../methods/chat/sendQueued')(Self);
|
require('../methods/chat/sendQueued')(Self);
|
||||||
|
|
||||||
|
Self.observe('before save', async function(ctx) {
|
||||||
|
if (!ctx.isNewInstance) return;
|
||||||
|
|
||||||
|
let {message} = ctx.instance;
|
||||||
|
if (!message) return;
|
||||||
|
|
||||||
|
const parts = message.match(/(?<=\[).*(?=])/g);
|
||||||
|
const replacedParts = parts.map(part => {
|
||||||
|
return part.replace(/[*()]/g, '');
|
||||||
|
});
|
||||||
|
|
||||||
|
for (const [index, part] of parts.entries())
|
||||||
|
message = message.replace(part, replacedParts[index]);
|
||||||
|
|
||||||
|
ctx.instance.message = message;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
UPDATE `vn`.`client`
|
|
||||||
set hasElectronicInvoice = TRUE
|
|
||||||
where buisnessTypeFk = 'officialOrganism'
|
|
|
@ -0,0 +1 @@
|
||||||
|
Delete this file
|
Loading…
Reference in New Issue