diff --git a/Jenkinsfile b/Jenkinsfile index 8f1ada293..3123de092 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,6 +20,9 @@ pipeline { stage('Checkout') { steps { script { + // Uncomment to enable debugging + //env.DEBUG = 'strong-remoting:http-context,strong-remoting:shared-method' + switch (env.BRANCH_NAME) { case 'dev': env.NODE_ENV = 'dev' diff --git a/db/routines/vn2008/views/observation_type.sql b/db/routines/vn2008/views/observation_type.sql deleted file mode 100644 index 2fea17c5f..000000000 --- a/db/routines/vn2008/views/observation_type.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`observation_type` -AS SELECT `co`.`id` AS `observation_type_id`, - `co`.`description` AS `description` -FROM `vn`.`observationType` `co` diff --git a/db/routines/vn2008/views/order.sql b/db/routines/vn2008/views/order.sql deleted file mode 100644 index e0c8c5f85..000000000 --- a/db/routines/vn2008/views/order.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`order` -AS SELECT `hedera`.`order`.`id` AS `id`, - `hedera`.`order`.`date_make` AS `date_make`, - `hedera`.`order`.`date_send` AS `date_send`, - `hedera`.`order`.`customer_id` AS `customer_id`, - `hedera`.`order`.`delivery_method_id` AS `delivery_method_id`, - `hedera`.`order`.`agency_id` AS `agency_id`, - `hedera`.`order`.`address_id` AS `address_id`, - `hedera`.`order`.`note` AS `note`, - `hedera`.`order`.`confirmed` AS `confirmed`, - `hedera`.`order`.`is_bionic` AS `is_bionic`, - `hedera`.`order`.`source_app` AS `source_app` -FROM `hedera`.`order` diff --git a/db/routines/vn2008/views/order_Tickets.sql b/db/routines/vn2008/views/order_Tickets.sql deleted file mode 100644 index 46fdf8e55..000000000 --- a/db/routines/vn2008/views/order_Tickets.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`order_Tickets` -AS SELECT `ot`.`orderFk` AS `order_id`, - `ot`.`ticketFk` AS `Id_Ticket` -FROM `vn`.`orderTicket` `ot` diff --git a/db/routines/vn2008/views/order_component.sql b/db/routines/vn2008/views/order_component.sql deleted file mode 100644 index c4468f084..000000000 --- a/db/routines/vn2008/views/order_component.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`order_component` -AS SELECT `c`.`order_row_id` AS `order_row_id`, - `c`.`component_id` AS `component_id`, - `c`.`price` AS `price` -FROM `hedera`.`order_component` `c` diff --git a/db/routines/vn2008/views/order_row.sql b/db/routines/vn2008/views/order_row.sql deleted file mode 100644 index 7f151e32b..000000000 --- a/db/routines/vn2008/views/order_row.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`order_row` -AS SELECT `order_row`.`id` AS `id`, - `order_row`.`order_id` AS `order_id`, - `order_row`.`item_id` AS `item_id`, - `order_row`.`warehouse_id` AS `warehouse_id`, - `order_row`.`shipment` AS `shipment`, - `order_row`.`amount` AS `amount`, - `order_row`.`price` AS `price`, - `order_row`.`rate` AS `rate`, - `order_row`.`created` AS `created`, - `order_row`.`Id_Movimiento` AS `Id_Movimiento` -FROM `hedera`.`order_row` diff --git a/docker-compose.yml b/docker-compose.yml index 222e753d7..dda4187f2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,6 +22,7 @@ services: - 3000 environment: - NODE_ENV + - DEBUG configs: - source: datasources target: /etc/salix/datasources.json diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index e062e6f84..fd40c1c22 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -72,24 +72,25 @@ module.exports = Self => { async function createGestDoc(id) { const ticket = await models.Ticket.findById(id, - {include: [ - { - relation: 'warehouse', - scope: { - fields: ['id'] + { + include: [ + { + relation: 'warehouse', + scope: { + fields: ['id'] + } + }, { + relation: 'client', + scope: { + fields: ['name'] + } + }, { + relation: 'route', + scope: { + fields: ['id'] + } } - }, { - relation: 'client', - scope: { - fields: ['name'] - } - }, { - relation: 'route', - scope: { - fields: ['id'] - } - } - ] + ] }, myOptions); const dmsType = await models.DmsType.findOne({where: {code: 'Ticket'}, fields: ['id']}, myOptions); const ctxUploadFile = Object.assign({}, ctx); @@ -125,17 +126,17 @@ module.exports = Self => { if (await gestDocExists(ticketId)) throw new UserError('Ticket is already signed'); - if (location) setLocation(ticketId); + if (location) await setLocation(ticketId); if (!gestDocCreated) await createGestDoc(ticketId); await models.TicketDms.create({ticketFk: ticketId, dmsFk: dms[0].id}, myOptions); const ticket = await models.Ticket.findById(ticketId, null, myOptions); await ticket.updateAttribute('isSigned', true, myOptions); - const deliveryState = await models.State.find({ + const deliveryState = await models.State.findOne({ where: { code: 'DELIVERED' } - }, options); + }, myOptions); await models.Ticket.state(ctx, { ticketFk: ticketId, diff --git a/print/templates/reports/collection-label/collection-label.js b/print/templates/reports/collection-label/collection-label.js index cd6ff719a..db2adeb34 100644 --- a/print/templates/reports/collection-label/collection-label.js +++ b/print/templates/reports/collection-label/collection-label.js @@ -18,7 +18,6 @@ module.exports = { } }, async serverPrefetch() { - await this.rawSql('SET @hasPrevia := 0'); let ticketIds; const res = await this.rawSqlFromDef('tickets', [this.id]); if (res.length) { diff --git a/print/templates/reports/collection-label/sql/labelsData.sql b/print/templates/reports/collection-label/sql/labelsData.sql index 7a12a56d3..61990812d 100644 --- a/print/templates/reports/collection-label/sql/labelsData.sql +++ b/print/templates/reports/collection-label/sql/labelsData.sql @@ -16,7 +16,7 @@ SELECT c.itemPackingTypeFk code, DATE_FORMAT(t.shipped, '%d/%m/%y') shipped, tt.labelCount, t.nickName, - SUM(IF(sgd.id, IF(@hasPrevia, 0, @hasPrevia := 1), 1)) lineCount, + SUM(IF(sgd.id IS NULL, 1, 0)) + IF(sgd.id , 1, 0) lineCount, rm.routeFk FROM vn.ticket t JOIN vn.ticketCollection tc ON tc.ticketFk = t.id