7152-devToTest_2414 #2228
|
@ -58,24 +58,22 @@ module.exports = Self => {
|
||||||
|
|
||||||
if (print) await Self.rawSql('CALL vn.collection_printSticker(?,NULL)', [id], myOptions);
|
if (print) await Self.rawSql('CALL vn.collection_printSticker(?,NULL)', [id], myOptions);
|
||||||
|
|
||||||
if (tickets.length) await sendRocketTickets(tickets, $t);
|
|
||||||
|
|
||||||
return getCollection(id, tickets, sales, placements, myOptions);
|
|
||||||
};
|
|
||||||
async function sendRocketTickets(tickets, $t) {
|
|
||||||
for (let ticket of tickets) {
|
for (let ticket of tickets) {
|
||||||
let observations = ticket.observaciones.split(' ');
|
let observations = ticket.observaciones.split(' ');
|
||||||
|
|
||||||
for (let observation of observations) {
|
for (let observation of observations) {
|
||||||
const salesPerson = ticket.salesPersonFk;
|
const salesPerson = ticket.salesPersonFk;
|
||||||
if (!observation.startsWith('#') && !observation.startsWith('@')) return;
|
if (observation.startsWith('#') || observation.startsWith('@')) {
|
||||||
await models.Chat.send(ctx,
|
await models.Chat.send(ctx,
|
||||||
observation,
|
observation,
|
||||||
$t('ticketCommercial', {ticket: ticket.ticketFk, salesPerson})
|
$t('ticketCommercial', {ticket: ticket.ticketFk, salesPerson})
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
return getCollection(id, tickets, sales, placements, myOptions);
|
||||||
|
};
|
||||||
|
|
||||||
async function getCollection(id, tickets, sales, placements, options) {
|
async function getCollection(id, tickets, sales, placements, options) {
|
||||||
const collection = {
|
const collection = {
|
||||||
|
|
Loading…
Reference in New Issue