refactor: refs #6276 drop sendRocket method
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-03-01 13:35:07 +01:00
parent 7d8d31022b
commit 97f76c64ff
1 changed files with 9 additions and 11 deletions

View File

@ -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 = {