diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql
index 04878be69..7f7305133 100644
--- a/db/dump/fixtures.sql
+++ b/db/dump/fixtures.sql
@@ -62,13 +62,13 @@ INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`,
(19,'Francia', 1, 'FR', 1, 27),
(30,'Canarias', 1, 'IC', 1, 24);
-INSERT INTO `vn`.`warehouse`(`id`, `name`, `isComparative`, `isInventory`, `hasAvailable`, `isManaged`, `hasStowaway`, `hasDms`)
+INSERT INTO `vn`.`warehouse`(`id`, `name`, `isComparative`, `isInventory`, `hasAvailable`, `isManaged`, `hasStowaway`, `hasDms`, `hasComission`)
VALUES
- (1, 'Warehouse One', 1, 1, 1, 1, 1, 1),
- (2, 'Warehouse Two', 1, 1, 1, 1, 0, 0),
- (3, 'Warehouse Three', 1, 1, 1, 1, 0, 0),
- (4, 'Warehouse Four', 1, 1, 1, 1, 0, 0),
- (5, 'Warehouse Five', 1, 1, 1, 1, 0, 0);
+ (1, 'Warehouse One', 1, 1, 1, 1, 1, 1, 1),
+ (2, 'Warehouse Two', 1, 1, 1, 1, 0, 0, 1),
+ (3, 'Warehouse Three', 1, 1, 1, 1, 0, 0, 0),
+ (4, 'Warehouse Four', 1, 1, 1, 1, 0, 0, 0),
+ (5, 'Warehouse Five', 1, 1, 1, 1, 0, 0, 0);
INSERT INTO `vn`.`sector`(`id`, `description`, `warehouseFk`, `isPreviousPreparedByPacking`, `code`, `pickingPlacement`, `path`)
VALUES
diff --git a/print/methods/closure.js b/print/methods/closure.js
index c12dd07b0..4b25c5abc 100644
--- a/print/methods/closure.js
+++ b/print/methods/closure.js
@@ -16,8 +16,7 @@ module.exports = app => {
JOIN client c ON c.id = t.clientFk
JOIN warehouse w ON w.id = t.warehouseFk AND hasComission
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
- WHERE
- ts.alertLevel = 2
+ WHERE ts.code = 'PACKED'
AND DATE(t.shipped) BETWEEN DATE_ADD(CURDATE(), INTERVAL -2 DAY) AND CURDATE()
AND t.refFk IS NULL
GROUP BY e.ticketFk`);
@@ -37,22 +36,30 @@ module.exports = app => {
await email.send();
} catch (error) {
// Save tickets on a list of failed ids
- failedtickets.push(ticket.id);
+ failedtickets.push({
+ id: ticket.id,
+ stacktrace: error
+ });
}
}
// Send email with failed tickets
if (failedtickets.length > 0) {
- const ticketList = failedtickets.join(', ');
+ let body = 'This following tickets has failed:
';
+
+ for (ticket of failedtickets) {
+ body += `Ticket: ${ticket.id}
+
${ticket.stacktrace}
`;
+ }
+
smtp.send({
to: config.app.reportEmail,
- subject: 'Nightly ticket closure has failed',
- text: `This following tickets has failed: ${ticketList}`
+ subject: '[API] Nightly ticket closure has failed',
+ html: body
});
}
res.status(200).json({
- statusCode: 200,
message: 'Closure executed successfully'
});
});
diff --git a/print/templates/reports/delivery-note/locale/fr.yml b/print/templates/reports/delivery-note/locale/fr.yml
new file mode 100644
index 000000000..98b1264b1
--- /dev/null
+++ b/print/templates/reports/delivery-note/locale/fr.yml
@@ -0,0 +1,26 @@
+title: Bon de livraison
+ticketId: Bon de livraison
+clientId: Client
+deliveryAddress: Addresse de livraison
+fiscalData: Datos fiscales
+saleLines: Líneas de pedido
+date: Date
+reference: Ref.
+quantity: Cant.
+concept: Concepto
+price: PVP/u
+discount: Dto.
+vat: IVA
+amount: Importe
+type: Tipo
+taxBase: Base imp.
+tax: Tasa
+fee: Cuota
+total: Total
+subtotal: Subtotal
+taxBreakdown: Répartition de la taxe
+packagings: Seaux et emballages
+services: Servicios
+vatType: Tipo de IVA
+digitalSignature: Firma digital
+ticket: Albarán {0}
\ No newline at end of file