Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix into test
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2022-09-30 13:55:53 +02:00
commit 4005d6f82a
4 changed files with 10 additions and 3 deletions

View File

@ -210,6 +210,9 @@
</slot-table> </slot-table>
</smart-table> </smart-table>
</vn-card> </vn-card>
<vn-ticket-descriptor-popover
vn-id="ticketDescriptor">
</vn-ticket-descriptor-popover>
<vn-worker-descriptor-popover <vn-worker-descriptor-popover
vn-id="workerDescriptor"> vn-id="workerDescriptor">
</vn-worker-descriptor-popover> </vn-worker-descriptor-popover>

View File

@ -29,7 +29,7 @@ module.exports = {
for (let attachment of options.attachments) { for (let attachment of options.attachments) {
const fileName = attachment.filename; const fileName = attachment.filename;
const filePath = attachment.path; const filePath = attachment.path;
if (fileName.includes('.png')) return; if (fileName.includes('.png')) continue;
if (fileName || filePath) if (fileName || filePath)
attachments.push(filePath ? filePath : fileName); attachments.push(filePath ? filePath : fileName);

View File

@ -11,15 +11,17 @@ module.exports = async function(request, response, next) {
if (reqArgs.to) toDate = reqArgs.to; if (reqArgs.to) toDate = reqArgs.to;
const todayMinDate = new Date(); const todayMinDate = new Date();
minDate.setHours(0, 0, 0, 0); todayMinDate.setHours(0, 0, 0, 0);
const todayMaxDate = new Date(); const todayMaxDate = new Date();
maxDate.setHours(23, 59, 59, 59); todayMinDate.setHours(23, 59, 59, 59);
// Prevent closure for current day // Prevent closure for current day
if (toDate >= todayMinDate && toDate <= todayMaxDate) if (toDate >= todayMinDate && toDate <= todayMaxDate)
throw new Error('You cannot close tickets for today'); throw new Error('You cannot close tickets for today');
console.log(`Making closure up to ${toDate}...`);
const tickets = await db.rawSql(` const tickets = await db.rawSql(`
SELECT SELECT
t.id, t.id,

View File

@ -7,11 +7,13 @@ const storage = require('vn-print/core/storage');
module.exports = { module.exports = {
async start(tickets, reqArgs) { async start(tickets, reqArgs) {
console.log(tickets);
if (tickets.length == 0) return; if (tickets.length == 0) return;
const failedtickets = []; const failedtickets = [];
for (const ticket of tickets) { for (const ticket of tickets) {
try { try {
console.log(`Closing ticket id ${ticket.id}...`);
await db.rawSql(`CALL vn.ticket_closeByTicket(?)`, [ticket.id]); await db.rawSql(`CALL vn.ticket_closeByTicket(?)`, [ticket.id]);
const invoiceOut = await db.findOne(` const invoiceOut = await db.findOne(`