From 01512c7d36f2cdce1fa36010ecd79460316626d5 Mon Sep 17 00:00:00 2001 From: robert Date: Mon, 5 Feb 2024 13:52:28 +0100 Subject: [PATCH 01/33] feat: refs #6777 change dependecies vn2008 to vn --- .../bi/procedures/Greuge_Evolution_Add.sql | 10 ++-- .../bi/procedures/analisis_ventas_update.sql | 52 +++++++++---------- .../bi/procedures/claim_ratio_routine.sql | 24 ++++----- db/routines/bi/procedures/comparativa_add.sql | 10 ++-- .../bi/procedures/comparativa_add_manual.sql | 10 ++-- .../bs/procedures/comercialesCompleto.sql | 18 +++---- .../bs/procedures/manaCustomerUpdate.sql | 8 +-- .../bs/procedures/ventas_contables_add.sql | 20 +++---- .../ventas_contables_por_cliente.sql | 30 +++++------ .../vn/functions/getAlert3StateTest.sql | 14 ++--- .../vn/functions/isPalletHomogeneus.sql | 6 +-- .../vn/functions/ticketPositionInPath.sql | 6 +-- .../vn/procedures/invoiceFromAddress.sql | 11 ++-- .../vn2008/procedures/availableTraslate.sql | 2 +- db/routines/vn2008/procedures/clean.sql | 12 ++--- .../procedures/confection_control_source.sql | 26 +++++----- .../vn2008/procedures/historico_multiple.sql | 2 +- db/routines/vn2008/views/Tickets_state.sql | 7 --- db/routines/vn2008/views/Tickets_turno.sql | 6 --- 19 files changed, 132 insertions(+), 142 deletions(-) delete mode 100644 db/routines/vn2008/views/Tickets_state.sql delete mode 100644 db/routines/vn2008/views/Tickets_turno.sql diff --git a/db/routines/bi/procedures/Greuge_Evolution_Add.sql b/db/routines/bi/procedures/Greuge_Evolution_Add.sql index 83033cbf8..36491cbab 100644 --- a/db/routines/bi/procedures/Greuge_Evolution_Add.sql +++ b/db/routines/bi/procedures/Greuge_Evolution_Add.sql @@ -92,12 +92,12 @@ BEGIN UPDATE bi.Greuge_Evolution ge JOIN ( SELECT cs.Id_Cliente, sum(Valor * Cantidad) as Importe - FROM vn2008.Tickets t - JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.Id_Consigna - JOIN vn2008.Movimientos m on m.Id_Ticket = t.Id_Ticket + FROM vn.ticket t + JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.addressFk + JOIN vn2008.Movimientos m on m.Id_Ticket = t.id JOIN vn2008.Movimientos_componentes mc on mc.Id_Movimiento = m.Id_Movimiento - WHERE t.Fecha >= datFEC - AND t.Fecha < datFEC_TOMORROW + WHERE t.shipped >= datFEC + AND t.shipped < datFEC_TOMORROW AND mc.Id_Componente = 17 -- Recobro GROUP BY cs.Id_Cliente ) sub using(Id_Cliente) diff --git a/db/routines/bi/procedures/analisis_ventas_update.sql b/db/routines/bi/procedures/analisis_ventas_update.sql index 4f6a448ed..228660d07 100644 --- a/db/routines/bi/procedures/analisis_ventas_update.sql +++ b/db/routines/bi/procedures/analisis_ventas_update.sql @@ -10,18 +10,18 @@ BEGIN OR (Año = YEAR(vLastMonth) AND Mes >= MONTH(vLastMonth)); INSERT INTO analisis_ventas ( - Familia, - Reino, - Comercial, - Comprador, - Provincia, - almacen, - Año, - Mes, - Semana, - Vista, - Importe - ) + Familia, + Reino, + Comercial, + Comprador, + Provincia, + almacen, + Año, + Mes, + Semana, + Vista, + Importe + ) SELECT tp.Tipo AS Familia, r.reino AS Reino, @@ -35,19 +35,19 @@ BEGIN dm.description AS Vista, bt.importe AS Importe FROM bs.ventas bt - LEFT JOIN vn2008.Tipos tp ON tp.tipo_id = bt.tipo_id - LEFT JOIN vn2008.reinos r ON r.id = tp.reino_id - LEFT JOIN vn2008.Clientes c on c.Id_Cliente = bt.Id_Cliente - LEFT JOIN vn2008.Trabajadores tr ON tr.Id_Trabajador = c.Id_Trabajador - LEFT JOIN vn2008.Trabajadores tr2 ON tr2.Id_Trabajador = tp.Id_Trabajador - JOIN vn2008.time tm ON tm.date = bt.fecha - JOIN vn2008.Movimientos m ON m.Id_Movimiento = bt.Id_Movimiento - LEFT JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket - JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia - LEFT JOIN vn.deliveryMethod dm ON dm.id = a.Vista - LEFT JOIN vn2008.Consignatarios cs ON cs.Id_Consigna = t.Id_Consigna - LEFT JOIN vn2008.province p ON p.province_id = cs.province_id - LEFT JOIN vn.warehouse w ON w.id = t.warehouse_id - WHERE bt.fecha >= vLastMonth AND r.mercancia; + LEFT JOIN vn2008.Tipos tp ON tp.tipo_id = bt.tipo_id + LEFT JOIN vn2008.reinos r ON r.id = tp.reino_id + LEFT JOIN vn2008.Clientes c on c.Id_Cliente = bt.Id_Cliente + LEFT JOIN vn2008.Trabajadores tr ON tr.Id_Trabajador = c.Id_Trabajador + LEFT JOIN vn2008.Trabajadores tr2 ON tr2.Id_Trabajador = tp.Id_Trabajador + JOIN vn2008.time tm ON tm.date = bt.fecha + JOIN vn2008.Movimientos m ON m.Id_Movimiento = bt.Id_Movimiento + LEFT JOIN vn.ticket t ON t.id = m.Id_Ticket + JOIN vn2008.Agencias a ON a.Id_Agencia = t.agencyModeFk + LEFT JOIN vn.deliveryMethod dm ON dm.id = a.Vista + LEFT JOIN vn2008.Consignatarios cs ON cs.Id_Consigna = t.addressFk + LEFT JOIN vn2008.province p ON p.province_id = cs.province_id + LEFT JOIN vn.warehouse w ON w.id = t.warehouseFk + WHERE bt.fecha >= vLastMonth AND r.mercancia; END$$ DELIMITER ; diff --git a/db/routines/bi/procedures/claim_ratio_routine.sql b/db/routines/bi/procedures/claim_ratio_routine.sql index 4616bcb9e..dce098e2d 100644 --- a/db/routines/bi/procedures/claim_ratio_routine.sql +++ b/db/routines/bi/procedures/claim_ratio_routine.sql @@ -59,18 +59,18 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; CREATE TEMPORARY TABLE tmp.ticket_list (PRIMARY KEY (Id_Ticket)) - SELECT DISTINCT t.Id_Ticket + SELECT DISTINCT t.id FROM vn2008.Movimientos_componentes mc JOIN vn2008.Movimientos m ON mc.Id_Movimiento = m.Id_Movimiento - JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket - JOIN vn2008.Tickets_state ts ON ts.Id_Ticket = t.Id_Ticket - JOIN vn.ticketTracking tt ON tt.id = ts.inter_id - JOIN vn2008.state s ON s.id = tt.stateFk + JOIN vn.ticket t ON t.id = m.Id_Ticket + JOIN vn.ticketLastState ts ON ts.ticketFk = t.id + JOIN vn.ticketTracking tt ON tt.id = ts.ticketTrackingFk + JOIN vn.state s ON s.id = tt.stateFk WHERE mc.Id_Componente = 17 AND mc.greuge = 0 - AND t.Fecha >= '2016-10-01' - AND t.Fecha < util.VN_CURDATE() - AND s.alert_level >= 3; + AND t.shipped >= '2016-10-01' + AND t.shipped < util.VN_CURDATE() + AND s.alertLevel >= 3; DELETE g.* FROM vn2008.Greuges g @@ -82,15 +82,15 @@ BEGIN SELECT Id_Cliente ,concat('recobro ', m.Id_Ticket), - round(SUM(mc.Valor*Cantidad),2) AS dif - ,date(t.Fecha) + ,date(t.shipped) , 2 ,tt.Id_Ticket FROM vn2008.Movimientos m - JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket - JOIN tmp.ticket_list tt ON tt.Id_Ticket = t.Id_Ticket + JOIN vn.ticket t ON t.id = m.Id_Ticket + JOIN tmp.ticket_list tt ON tt.Id_Ticket = t.id JOIN vn2008.Movimientos_componentes mc ON mc.Id_Movimiento = m.Id_Movimiento AND mc.Id_Componente = 17 - GROUP BY t.Id_Ticket + GROUP BY t.id HAVING ABS(dif) > 1; UPDATE vn2008.Movimientos_componentes mc diff --git a/db/routines/bi/procedures/comparativa_add.sql b/db/routines/bi/procedures/comparativa_add.sql index 4297c8aff..ac06798db 100644 --- a/db/routines/bi/procedures/comparativa_add.sql +++ b/db/routines/bi/procedures/comparativa_add.sql @@ -15,17 +15,17 @@ BEGIN IF lastCOMP < vMaxPeriod - 3 AND vMaxWeek > 3 THEN REPLACE vn2008.Comparativa(Periodo, Id_Article, warehouse_id, Cantidad,price) - SELECT tm.period as Periodo, m.Id_Article, t.warehouse_id, sum(m.Cantidad), sum(v.importe) + SELECT tm.period as Periodo, m.Id_Article, t.warehouseFk, sum(m.Cantidad), sum(v.importe) FROM bs.ventas v JOIN vn2008.time tm ON tm.date = v.fecha JOIN vn2008.Movimientos m ON m.Id_Movimiento = v.Id_Movimiento JOIN vn2008.Tipos tp ON tp.tipo_id = v.tipo_id JOIN vn2008.reinos r ON r.id = tp.reino_id - JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket + JOIN vn.ticket t ON t.id = m.Id_Ticket WHERE tm.period BETWEEN lastCOMP AND vMaxPeriod - 3 - AND t.Id_Cliente NOT IN(400,200) - AND t.warehouse_id NOT IN (0,13) - GROUP BY m.Id_Article, Periodo, t.warehouse_id; + AND t.clientFk NOT IN(400,200) + AND t.warehouseFk NOT IN (0,13) + GROUP BY m.Id_Article, Periodo, t.warehouseFk; END IF; END$$ diff --git a/db/routines/bi/procedures/comparativa_add_manual.sql b/db/routines/bi/procedures/comparativa_add_manual.sql index 281e15b23..2b05b1277 100644 --- a/db/routines/bi/procedures/comparativa_add_manual.sql +++ b/db/routines/bi/procedures/comparativa_add_manual.sql @@ -25,16 +25,16 @@ BEGIN WHERE Periodo BETWEEN periodStart AND periodEnd; INSERT INTO vn2008.Comparativa(Periodo, Id_Article, warehouse_id, Cantidad,price) - SELECT tm.period as Periodo, m.Id_Article, t.warehouse_id, sum(m.Cantidad), sum(v.importe) + SELECT tm.period as Periodo, m.Id_Article, t.warehouseFk, sum(m.Cantidad), sum(v.importe) FROM bs.ventas v JOIN vn2008.time tm ON tm.date = v.fecha JOIN vn2008.Movimientos m ON m.Id_Movimiento = v.Id_Movimiento JOIN vn2008.Tipos tp ON tp.tipo_id = v.tipo_id JOIN vn2008.reinos r ON r.id = tp.reino_id - JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket + JOIN vn.ticket t ON t.id = m.Id_Ticket WHERE tm.period BETWEEN periodStart AND periodEnd - AND t.Id_Cliente NOT IN(400,200) - AND t.warehouse_id NOT IN (0,13) - GROUP BY m.Id_Article, Periodo, t.warehouse_id; + AND t.clientFk NOT IN(400,200) + AND t.warehouseFk NOT IN (0,13) + GROUP BY m.Id_Article, Periodo, t.warehouseFk; END$$ DELIMITER ; diff --git a/db/routines/bs/procedures/comercialesCompleto.sql b/db/routines/bs/procedures/comercialesCompleto.sql index 323d5cd00..8f519b6ca 100644 --- a/db/routines/bs/procedures/comercialesCompleto.sql +++ b/db/routines/bs/procedures/comercialesCompleto.sql @@ -70,23 +70,23 @@ BEGIN AND (v.fecha BETWEEN TIMESTAMPADD(DAY, - DAY(vDate) + 1, vDate) AND TIMESTAMPADD(DAY, - 1, vDate)) GROUP BY Id_Cliente) mes_actual ON mes_actual.Id_Cliente = c.Id_Cliente LEFT JOIN - (SELECT t.Id_Cliente, SUM(m.preu * m.Cantidad * (1 - m.Descuento / 100)) futur - FROM vn2008.Tickets t - JOIN vn2008.Clientes c ON c.Id_Cliente = t.Id_Cliente - JOIN vn2008.Movimientos m ON m.Id_Ticket = t.Id_Ticket + (SELECT t.clientFk, SUM(m.preu * m.Cantidad * (1 - m.Descuento / 100)) futur + FROM vn.ticket t + JOIN vn2008.Clientes c ON c.Id_Cliente = t.clientFk + JOIN vn2008.Movimientos m ON m.Id_Ticket = t.id LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador WHERE (c.Id_Trabajador = vWorker OR tr.boss = vWorker) - AND t.Fecha BETWEEN vDate AND util.dayEnd(LAST_DAY(vDate)) + AND t.shipped BETWEEN vDate AND util.dayEnd(LAST_DAY(vDate)) GROUP BY Id_Cliente) f ON c.Id_Cliente = f.Id_Cliente LEFT JOIN - (SELECT MAX(t.Fecha) LastTicket, c.Id_Cliente - FROM vn2008.Tickets t - JOIN vn2008.Clientes c ON c.Id_cliente = t.Id_Cliente + (SELECT MAX(t.shipped) LastTicket, c.Id_Cliente + FROM vn.ticket t + JOIN vn2008.Clientes c ON c.Id_cliente = t.clientFk LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador WHERE (c.Id_Trabajador = vWorker OR tr.boss = vWorker) - GROUP BY t.Id_Cliente) LastTicket ON LastTicket.Id_Cliente = c.Id_Cliente + GROUP BY t.clientFk) LastTicket ON LastTicket.Id_Cliente = c.Id_Cliente LEFT JOIN ( SELECT SUM(importe) peso, c.Id_Cliente diff --git a/db/routines/bs/procedures/manaCustomerUpdate.sql b/db/routines/bs/procedures/manaCustomerUpdate.sql index 1e9cb8429..7a4ee6dba 100644 --- a/db/routines/bs/procedures/manaCustomerUpdate.sql +++ b/db/routines/bs/procedures/manaCustomerUpdate.sql @@ -68,13 +68,13 @@ BEGIN FROM ( SELECT cs.Id_Cliente, Cantidad * Valor as mana - FROM vn2008.Tickets t + FROM vn.ticket t JOIN vn2008.Consignatarios cs using(Id_Consigna) - JOIN vn2008.Movimientos m on m.Id_Ticket = t.Id_Ticket + JOIN vn2008.Movimientos m on m.Id_Ticket = t.id JOIN vn2008.Movimientos_componentes mc on mc.Id_Movimiento = m.Id_Movimiento WHERE Id_Componente IN (vManaAutoId, vManaId, vClaimManaId) - AND t.Fecha > vFromDated - AND date(t.Fecha) <= vToDated + AND t.shipped > vFromDated + AND date(t.shipped) <= vToDated UNION ALL SELECT r.Id_Cliente, - Entregado FROM vn2008.Recibos r diff --git a/db/routines/bs/procedures/ventas_contables_add.sql b/db/routines/bs/procedures/ventas_contables_add.sql index d8e963e3e..554972e4c 100644 --- a/db/routines/bs/procedures/ventas_contables_add.sql +++ b/db/routines/bs/procedures/ventas_contables_add.sql @@ -19,11 +19,11 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; CREATE TEMPORARY TABLE tmp.ticket_list - (PRIMARY KEY (Id_Ticket)) + (PRIMARY KEY (id)) ENGINE = MEMORY - SELECT Id_Ticket - FROM vn2008.Tickets t - JOIN vn2008.Facturas f ON f.Id_Factura = t.Factura + SELECT id + FROM vn.ticket t + JOIN vn2008.Facturas f ON f.Id_Factura = t.refFk WHERE year(f.Fecha) = vYear AND month(f.Fecha) = vMonth; @@ -46,7 +46,7 @@ BEGIN ) as grupo , tp.reino_id , a.tipo_id - , t.empresa_id + , t.companyFk , 7000000000 + IF(e.empresa_grupo = e2.empresa_grupo ,1 @@ -54,12 +54,12 @@ BEGIN ) * 1000000 + tp.reino_id * 10000 as Gasto FROM vn2008.Movimientos m - JOIN vn2008.Tickets t on t.Id_Ticket = m.Id_Ticket - JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.Id_Consigna + JOIN vn.ticket t on t.id = m.Id_Ticket + JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.addressFk JOIN vn2008.Clientes c on c.Id_Cliente = cs.Id_Cliente - JOIN tmp.ticket_list tt on tt.Id_Ticket = t.Id_Ticket + JOIN tmp.ticket_list tt on tt.id = t.id JOIN vn2008.Articles a on m.Id_Article = a.Id_Article - JOIN vn2008.empresa e on e.id = t.empresa_id + JOIN vn2008.empresa e on e.id = t.companyFk LEFT JOIN vn2008.empresa e2 on e2.Id_Cliente = c.Id_Cliente JOIN vn2008.Tipos tp on tp.tipo_id = a.tipo_id WHERE Cantidad <> 0 @@ -92,7 +92,7 @@ BEGIN JOIN vn.ticket t ON ts.ticketFk = t.id JOIN vn.address a on a.id = t.addressFk JOIN vn.client cl on cl.id = a.clientFk - JOIN tmp.ticket_list tt on tt.Id_Ticket = t.id + JOIN tmp.ticket_list tt on tt.id = t.id JOIN vn.company c on c.id = t.companyFk LEFT JOIN vn.company c2 on c2.clientFk = cl.id GROUP BY grupo, t.companyFk ; diff --git a/db/routines/bs/procedures/ventas_contables_por_cliente.sql b/db/routines/bs/procedures/ventas_contables_por_cliente.sql index 9f1399025..26da1b870 100644 --- a/db/routines/bs/procedures/ventas_contables_por_cliente.sql +++ b/db/routines/bs/procedures/ventas_contables_por_cliente.sql @@ -10,38 +10,38 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; CREATE TEMPORARY TABLE tmp.ticket_list - (PRIMARY KEY (Id_Ticket)) - SELECT Id_Ticket - FROM vn2008.Tickets t - JOIN vn2008.Facturas f ON f.Id_Factura = t.Factura - WHERE year(f.Fecha) = vYear - AND month(f.Fecha) = vMonth; - + (PRIMARY KEY (id)) + SELECT id + FROM vn.ticket t + JOIN vn2008.Facturas f ON f.Id_Factura = t.refFk + WHERE year(f.shipped) = vYear + AND month(f.shipped) = vMonth; + SELECT vYear Año, vMonth Mes, - t.Id_Cliente, + t.clientFk, round(sum(Cantidad * Preu * (100 - m.Descuento)/100)) Venta, IF(e.empresa_grupo = e2.empresa_grupo, 1, IF(e2.empresa_grupo,2,0)) AS grupo, - t.empresa_id empresa + t.companyFk empresa FROM vn2008.Movimientos m - JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket - JOIN vn2008.Consignatarios cs ON cs.Id_Consigna = t.Id_Consigna + JOIN vn.ticket t ON t.id = m.Id_Ticket + JOIN vn2008.Consignatarios cs ON cs.Id_Consigna = t.addressFk JOIN vn2008.Clientes c ON c.Id_Cliente = cs.Id_Cliente - JOIN tmp.ticket_list tt ON tt.Id_Ticket = t.Id_Ticket + JOIN tmp.ticket_list tt ON tt.id = t.id JOIN vn2008.Articles a ON m.Id_Article = a.Id_Article - JOIN vn2008.empresa e ON e.id = t.empresa_id + JOIN vn2008.empresa e ON e.id = t.companyFk LEFT JOIN vn2008.empresa e2 ON e2.Id_Cliente = c.Id_Cliente JOIN vn2008.Tipos tp ON tp.tipo_id = a.tipo_id WHERE Cantidad <> 0 AND Preu <> 0 AND m.Descuento <> 100 AND a.tipo_id != 188 - GROUP BY t.Id_Cliente, grupo,t.empresa_id; + GROUP BY t.clientFk, grupo,t.companyFk; DROP TEMPORARY TABLE tmp.ticket_list; - + END$$ DELIMITER ; diff --git a/db/routines/vn/functions/getAlert3StateTest.sql b/db/routines/vn/functions/getAlert3StateTest.sql index 6a14d80d4..beba0948c 100644 --- a/db/routines/vn/functions/getAlert3StateTest.sql +++ b/db/routines/vn/functions/getAlert3StateTest.sql @@ -11,9 +11,9 @@ BEGIN SELECT a.Vista INTO vDeliveryType - FROM vn2008.Tickets t - JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia - WHERE Id_Ticket = vTicket; + FROM ticket t + JOIN vn2008.Agencias a ON a.Id_Agencia = t.agencyModeFk + WHERE id = vTicket; CASE vDeliveryType WHEN 1 THEN -- AGENCIAS @@ -23,11 +23,11 @@ BEGIN SET vCode = 'ON_DELIVERY'; ELSE -- MERCADO, OTROS - SELECT t.warehouse_id <> w.warehouse_id INTO isWaitingForPickUp - FROM vn2008.Tickets t + SELECT t.warehouseFk <> w.warehouse_id INTO isWaitingForPickUp + FROM ticket t LEFT JOIN vn2008.warehouse_pickup w - ON w.agency_id = t.Id_Agencia AND w.warehouse_id = t.warehouse_id - WHERE t.Id_Ticket = vTicket; + ON w.agency_id = t.agencyModeFk AND w.warehouse_id = t.warehouseFk + WHERE t.id = vTicket; IF isWaitingForPickUp THEN SET vCode = 'WAITING_FOR_PICKUP'; diff --git a/db/routines/vn/functions/isPalletHomogeneus.sql b/db/routines/vn/functions/isPalletHomogeneus.sql index 39c6461ae..05c20a71b 100644 --- a/db/routines/vn/functions/isPalletHomogeneus.sql +++ b/db/routines/vn/functions/isPalletHomogeneus.sql @@ -14,12 +14,12 @@ BEGIN SELECT COUNT(*) INTO vDistinctRoutesInThePallet FROM ( - SELECT DISTINCT t.Id_Ruta + SELECT DISTINCT t.routeFk FROM vn2008.scan_line sl JOIN vn2008.expeditions e ON e.expeditions_id = sl.code - JOIN vn2008.Tickets t ON t.Id_Ticket = e.ticket_id + JOIN ticket t ON t.id = e.ticket_id WHERE sl.scan_id = vScanId - AND t.Id_Ruta + AND t.routeFk ) t1; RETURN vDistinctRoutesInThePallet = 1; diff --git a/db/routines/vn/functions/ticketPositionInPath.sql b/db/routines/vn/functions/ticketPositionInPath.sql index 9bd2c110e..9a3bb4a0e 100644 --- a/db/routines/vn/functions/ticketPositionInPath.sql +++ b/db/routines/vn/functions/ticketPositionInPath.sql @@ -28,10 +28,10 @@ SELECT t.routeFk, t.warehouseFk, IFNULL(ts.productionOrder,0) SELECT (ag.`name` = 'VN_VALENCIA') INTO vIsValenciaPath - FROM vn2008.Rutas r - JOIN vn2008.Agencias a on a.Id_Agencia = r.Id_Agencia + FROM `route` r + JOIN vn2008.Agencias a on a.Id_Agencia = r.agencyModeFk JOIN vn2008.agency ag on ag.agency_id = a.agency_id - WHERE r.Id_Ruta = vMyPath; + WHERE r.id = vMyPath; IF vIsValenciaPath THEN -- Rutas Valencia diff --git a/db/routines/vn/procedures/invoiceFromAddress.sql b/db/routines/vn/procedures/invoiceFromAddress.sql index bde7afd8c..bea49e747 100644 --- a/db/routines/vn/procedures/invoiceFromAddress.sql +++ b/db/routines/vn/procedures/invoiceFromAddress.sql @@ -10,10 +10,13 @@ BEGIN CREATE TEMPORARY TABLE `tmp.``ticketToInvoice` (PRIMARY KEY (`id`)) - ENGINE = MEMORY - SELECT Id_Ticket id FROM vn2008.Tickets WHERE (Fecha BETWEEN vMinDateTicket - AND vMaxTicketDate) AND Id_Consigna = vAddress - AND Factura IS NULL AND empresa_id = vCompany; + ENGINE = MEMORY + SELECT id id + FROM ticket + WHERE (shipped BETWEEN vMinDateTicket AND vMaxTicketDate) + AND addressFk = vAddress + AND refFk IS NULL + AND companyFk = vCompany; END$$ DELIMITER ; diff --git a/db/routines/vn2008/procedures/availableTraslate.sql b/db/routines/vn2008/procedures/availableTraslate.sql index 6328560c8..399302d7b 100644 --- a/db/routines/vn2008/procedures/availableTraslate.sql +++ b/db/routines/vn2008/procedures/availableTraslate.sql @@ -18,7 +18,7 @@ proc: BEGIN -- Calcula algunos parámetros necesarios SET vDatedFrom = TIMESTAMP(vDated, '00:00:00'); SET vDatedTo = TIMESTAMP(TIMESTAMPADD(DAY, 4, vDated), '23:59:59'); - SELECT FechaInventario INTO vDatedInventory FROM tblContadores; + SELECT inventoried INTO vDatedInventory FROM vn.config; SELECT SUBTIME(util.VN_NOW(), reserveTime) INTO vDatedReserve FROM hedera.orderConfig; diff --git a/db/routines/vn2008/procedures/clean.sql b/db/routines/vn2008/procedures/clean.sql index bd8a324c6..dba4799d9 100644 --- a/db/routines/vn2008/procedures/clean.sql +++ b/db/routines/vn2008/procedures/clean.sql @@ -34,8 +34,8 @@ proc: BEGIN WHERE t.Fecha < vDate; DELETE tobs - FROM ticket_observation tobs - JOIN Tickets t ON tobs.Id_Ticket = t.Id_Ticket + FROM ticketObservation tobs + JOIN Tickets t ON tobs.ticketFk = t.Id_Ticket WHERE t.Fecha < vDate; DELETE tobs @@ -45,10 +45,10 @@ proc: BEGIN DELETE FROM Remesas WHERE `Fecha Remesa` < vDate18; - DELETE tt.* - FROM Tickets_turno tt - LEFT JOIN Movimientos m USING(Id_Ticket) - WHERE m.Id_Article IS NULL; + DELETE tw.* + FROM vn.ticketWeekly tw + LEFT JOIN vn.sale s USING(ticketFk) + WHERE s.Id_Article IS NULL; DELETE FROM cl_main WHERE Fecha < vDate18; DELETE FROM hedera.`order` WHERE date_send < vDate18; diff --git a/db/routines/vn2008/procedures/confection_control_source.sql b/db/routines/vn2008/procedures/confection_control_source.sql index 77b4df5f3..2951e9c38 100644 --- a/db/routines/vn2008/procedures/confection_control_source.sql +++ b/db/routines/vn2008/procedures/confection_control_source.sql @@ -11,33 +11,33 @@ BEGIN CREATE TEMPORARY TABLE tmp.production_buffer ENGINE = MEMORY SELECT - date(t.Fecha) as Fecha, - hour(t.Fecha) as Hora, - hour(t.Fecha) as Departure, - t.Id_Ticket, + date(t.shipped) as Fecha, + hour(t.shipped) as Hora, + hour(t.shipped) as Departure, + t.id, m.Id_Movimiento, m.Cantidad, m.Concepte, ABS(m.Reservado) Reservado, i.Categoria, tp.Tipo, - t.Alias as Cliente, + t.nickname as Cliente, wh.name as Almacen, - t.warehouse_id, + t.warehouseFk, cs.province_id, a.agency_id, ct.description as Taller, stock.visible, stock.available - FROM vn2008.Tickets t - JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia - JOIN vn.warehouse wh ON wh.id = t.warehouse_id - JOIN vn2008.Movimientos m ON m.Id_Ticket = t.Id_Ticket + FROM vn.ticket t + JOIN vn2008.Agencias a ON a.Id_Agencia = t.agencyModeFk + JOIN vn.warehouse wh ON wh.id = t.warehouseFk + JOIN vn2008.Movimientos m ON m.Id_Ticket = t.id JOIN vn2008.Articles i ON i.Id_Article = m.Id_Article JOIN vn2008.Tipos tp ON tp.tipo_id = i.tipo_id JOIN vn.confectionType ct ON ct.id = tp.confeccion - JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.Id_Consigna - LEFT JOIN vn.ticketState tls on tls.ticketFk = t.Id_Ticket + JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.addressFk + LEFT JOIN vn.ticketState tls on tls.ticketFk = t.id LEFT JOIN ( SELECT item_id, sum(visible) visible, sum(available) available @@ -61,7 +61,7 @@ BEGIN WHERE tp.confeccion AND tls.alertLevel < maxAlertLevel AND wh.hasConfectionTeam - AND t.Fecha BETWEEN vDated AND vEndingDate + AND t.shipped BETWEEN vDated AND vEndingDate AND m.Cantidad > 0; -- Entradas diff --git a/db/routines/vn2008/procedures/historico_multiple.sql b/db/routines/vn2008/procedures/historico_multiple.sql index ae4045a34..c68fbf2ad 100644 --- a/db/routines/vn2008/procedures/historico_multiple.sql +++ b/db/routines/vn2008/procedures/historico_multiple.sql @@ -4,7 +4,7 @@ BEGIN DECLARE vDateInventory DATETIME; - SELECT Fechainventario INTO vDateInventory FROM tblContadores; + SELECT inventoried INTO vDateInventory FROM vn.config; SET @a = 0; diff --git a/db/routines/vn2008/views/Tickets_state.sql b/db/routines/vn2008/views/Tickets_state.sql deleted file mode 100644 index be59a750f..000000000 --- a/db/routines/vn2008/views/Tickets_state.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`Tickets_state` -AS SELECT `t`.`ticketFk` AS `Id_Ticket`, - `t`.`ticketTrackingFk` AS `inter_id`, - `t`.`name` AS `state_name` -FROM `vn`.`ticketLastState` `t` diff --git a/db/routines/vn2008/views/Tickets_turno.sql b/db/routines/vn2008/views/Tickets_turno.sql deleted file mode 100644 index 28bc2d55f..000000000 --- a/db/routines/vn2008/views/Tickets_turno.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`Tickets_turno` -AS SELECT `tw`.`ticketFk` AS `Id_Ticket`, - `tw`.`weekDay` AS `weekDay` -FROM `vn`.`ticketWeekly` `tw` From 350088614991bee0909b1ba54af10b14ff72ff6d Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 6 Feb 2024 08:37:28 +0100 Subject: [PATCH 02/33] feat: refs #6777 tabulacion --- .../procedures/confection_control_source.sql | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/db/routines/vn2008/procedures/confection_control_source.sql b/db/routines/vn2008/procedures/confection_control_source.sql index 2951e9c38..6833cd29d 100644 --- a/db/routines/vn2008/procedures/confection_control_source.sql +++ b/db/routines/vn2008/procedures/confection_control_source.sql @@ -15,31 +15,31 @@ BEGIN hour(t.shipped) as Hora, hour(t.shipped) as Departure, t.id, - m.Id_Movimiento, + m.Id_Movimiento, m.Cantidad, m.Concepte, - ABS(m.Reservado) Reservado, + ABS(m.Reservado) Reservado, i.Categoria, - tp.Tipo, + tp.Tipo, t.nickname as Cliente, wh.name as Almacen, t.warehouseFk, cs.province_id, a.agency_id, - ct.description as Taller, - stock.visible, - stock.available + ct.description as Taller, + stock.visible, + stock.available FROM vn.ticket t JOIN vn2008.Agencias a ON a.Id_Agencia = t.agencyModeFk JOIN vn.warehouse wh ON wh.id = t.warehouseFk JOIN vn2008.Movimientos m ON m.Id_Ticket = t.id - JOIN vn2008.Articles i ON i.Id_Article = m.Id_Article + JOIN vn2008.Articles i ON i.Id_Article = m.Id_Article JOIN vn2008.Tipos tp ON tp.tipo_id = i.tipo_id - JOIN vn.confectionType ct ON ct.id = tp.confeccion + JOIN vn.confectionType ct ON ct.id = tp.confeccion JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.addressFk LEFT JOIN vn.ticketState tls on tls.ticketFk = t.id - LEFT JOIN - ( + LEFT JOIN + ( SELECT item_id, sum(visible) visible, sum(available) available FROM ( @@ -57,12 +57,12 @@ BEGIN where cc.cache_id IN (2,8) and cc.params IN ("1","44") ) sub GROUP BY item_id - ) stock ON stock.item_id = m.Id_Article + ) stock ON stock.item_id = m.Id_Article WHERE tp.confeccion AND tls.alertLevel < maxAlertLevel AND wh.hasConfectionTeam AND t.shipped BETWEEN vDated AND vEndingDate - AND m.Cantidad > 0; + AND m.Cantidad > 0; -- Entradas @@ -74,9 +74,9 @@ BEGIN Categoria, Cliente, Almacen, - Taller + Taller ) - SELECT + SELECT tr.shipment AS Fecha, e.Id_Entrada AS Id_Ticket, c.Cantidad, @@ -96,10 +96,7 @@ BEGIN WHERE who.hasConfectionTeam AND tp.confeccion AND tr.shipment BETWEEN vDated AND vEndingDate; - - - SELECT * FROM tmp.production_buffer; - + SELECT * FROM tmp.production_buffer; END$$ DELIMITER ; From c598e62d1ecc50e77ef0662840ca1afff3d5acdc Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 6 Feb 2024 14:03:33 +0100 Subject: [PATCH 03/33] feat: refs #6777 change dependencies vn2008 to vn part7 --- db/routines/bi/views/v_ventas_contables.sql | 10 +- db/routines/vn/views/ticketMRW.sql | 16 +-- .../procedures/ListaTicketsEncajados.sql | 36 ++--- db/routines/vn2008/procedures/clean.sql | 19 +-- .../procedures/customerDebtEvolution.sql | 32 ++--- .../emailYesterdayPurchasesByConsigna.sql | 16 +-- .../vn2008/procedures/embalajes_stocks.sql | 74 +++++----- .../procedures/embalajes_stocks_detalle.sql | 135 +++++++++--------- .../vn2008/procedures/historico_absoluto.sql | 20 +-- .../vn2008/procedures/historico_multiple.sql | 12 +- .../vn2008/procedures/preOrdenarRuta.sql | 24 ++-- .../vn2008/procedures/prepare_ticket_list.sql | 12 +- .../vn2008/procedures/risk_vs_client_list.sql | 10 +- db/routines/vn2008/views/item_out.sql | 8 +- 14 files changed, 213 insertions(+), 211 deletions(-) diff --git a/db/routines/bi/views/v_ventas_contables.sql b/db/routines/bi/views/v_ventas_contables.sql index 373fcdd3f..82bbeeaac 100644 --- a/db/routines/bi/views/v_ventas_contables.sql +++ b/db/routines/bi/views/v_ventas_contables.sql @@ -11,13 +11,13 @@ AS SELECT `time`.`year` AS `year`, FROM ( ( ( - `vn2008`.`Tickets` `t` - JOIN `bi`.`f_tvc` ON(`t`.`Id_Ticket` = `bi`.`f_tvc`.`Id_Ticket`) + `vn`.`ticket` `t` + JOIN `bi`.`f_tvc` ON(`t`.`id` = `bi`.`f_tvc`.`Id_Ticket`) ) - JOIN `vn2008`.`Movimientos` `m` ON(`t`.`Id_Ticket` = `m`.`Id_Ticket`) + JOIN `vn2008`.`Movimientos` `m` ON(`t`.`id` = `m`.`Id_Ticket`) ) - JOIN `vn2008`.`time` ON(`time`.`date` = cast(`t`.`Fecha` AS date)) + JOIN `vn2008`.`time` ON(`time`.`date` = cast(`t`.`shipped` AS date)) ) -WHERE `t`.`Fecha` >= '2014-01-01' +WHERE `t`.`shipped` >= '2014-01-01' GROUP BY `time`.`year`, `time`.`month` diff --git a/db/routines/vn/views/ticketMRW.sql b/db/routines/vn/views/ticketMRW.sql index d612c8742..2677b41e7 100644 --- a/db/routines/vn/views/ticketMRW.sql +++ b/db/routines/vn/views/ticketMRW.sql @@ -1,8 +1,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vn`.`ticketMRW` -AS SELECT `Tickets`.`Id_Agencia` AS `id_Agencia`, - `Tickets`.`empresa_id` AS `empresa_id`, +AS SELECT `ticket`.`agencyModeFk` AS `id_Agencia`, + `ticket`.`companyFk` AS `empresa_id`, `Consignatarios`.`consignatario` AS `Consignatario`, `Consignatarios`.`domicilio` AS `DOMICILIO`, `Consignatarios`.`poblacion` AS `POBLACION`, @@ -19,13 +19,13 @@ AS SELECT `Tickets`.`Id_Agencia` AS `id_Agencia`, 0 ) AS `movil`, `Clientes`.`if` AS `IF`, - `Tickets`.`Id_Ticket` AS `Id_Ticket`, - `Tickets`.`warehouse_id` AS `warehouse_id`, + `ticket`.`id` AS `Id_Ticket`, + `ticket`.`warehouseFk` AS `warehouse_id`, `Consignatarios`.`id_consigna` AS `Id_Consigna`, `Paises`.`Codigo` AS `CodigoPais`, - `Tickets`.`Fecha` AS `Fecha`, + `ticket`.`shipped` AS `Fecha`, `province`.`province_id` AS `province_id`, - `Tickets`.`landing` AS `landing` + `ticket`.`landed` AS `landing` FROM ( ( ( @@ -35,8 +35,8 @@ FROM ( `Clientes`.`id_cliente` = `Consignatarios`.`Id_cliente` ) ) - JOIN `vn2008`.`Tickets` ON( - `Consignatarios`.`id_consigna` = `Tickets`.`Id_Consigna` + JOIN `vn`.`ticket` ON( + `Consignatarios`.`id_consigna` = `ticket`.`addressFk` ) ) JOIN `vn2008`.`province` ON( diff --git a/db/routines/vn2008/procedures/ListaTicketsEncajados.sql b/db/routines/vn2008/procedures/ListaTicketsEncajados.sql index 3d3318c63..e220cd9ad 100644 --- a/db/routines/vn2008/procedures/ListaTicketsEncajados.sql +++ b/db/routines/vn2008/procedures/ListaTicketsEncajados.sql @@ -2,24 +2,24 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`ListaTicketsEncajados`(IN intId_Trabajador int) BEGIN -SELECT Agencia, - Consignatario, - ti.Id_Ticket, - ts.userFk Id_Trabajador, - IFNULL(ncajas,0) AS ncajas, - IFNULL(nbultos,0) AS nbultos, - IFNULL(notros,0) AS notros, - ts.code AS Estado - FROM Tickets ti - INNER JOIN Consignatarios ON ti.Id_Consigna = Consignatarios.Id_consigna - INNER JOIN Agencias ON ti.Id_Agencia = Agencias.Id_Agencia - LEFT JOIN (SELECT Ticket_Id,count(*) AS ncajas FROM expeditions WHERE Id_Article=94 GROUP BY ticket_id) sub1 ON ti.Id_Ticket=sub1.Ticket_Id - LEFT JOIN (SELECT Ticket_Id,count(*) AS nbultos FROM expeditions WHERE Id_Article IS NULL GROUP BY ticket_id) sub2 ON ti.Id_Ticket=sub2.Ticket_Id - LEFT JOIN (SELECT Ticket_Id,count(*) AS notros FROM expeditions WHERE Id_Article >0 GROUP BY ticket_id) sub3 ON ti.Id_Ticket=sub3.Ticket_Id - INNER JOIN vn.ticketState ts ON ti.Id_ticket = ts.ticketFk - WHERE ti.Fecha=util.VN_CURDATE() AND - ts.userFk=intId_Trabajador - GROUP BY ti.Id_Ticket; + SELECT Agencia, + Consignatario, + ti.id Id_Ticket, + ts.userFk Id_Trabajador, + IFNULL(ncajas,0) AS ncajas, + IFNULL(nbultos,0) AS nbultos, + IFNULL(notros,0) AS notros, + ts.code AS Estado + FROM Tickets ti + INNER JOIN Consignatarios ON ti.addressFk = Consignatarios.Id_consigna + INNER JOIN Agencias ON ti.agencyModeFk = Agencias.Id_Agencia + LEFT JOIN (SELECT Ticket_Id,count(*) AS ncajas FROM expeditions WHERE Id_Article=94 GROUP BY ticket_id) sub1 ON ti.id=sub1.Ticket_Id + LEFT JOIN (SELECT Ticket_Id,count(*) AS nbultos FROM expeditions WHERE Id_Article IS NULL GROUP BY ticket_id) sub2 ON ti.id=sub2.Ticket_Id + LEFT JOIN (SELECT Ticket_Id,count(*) AS notros FROM expeditions WHERE Id_Article >0 GROUP BY ticket_id) sub3 ON ti.id=sub3.Ticket_Id + INNER JOIN vn.ticketState ts ON ti.id = ts.ticketFk + WHERE ti.shipped=util.VN_CURDATE() AND + ts.userFk=intId_Trabajador + GROUP BY ti.id; END$$ DELIMITER ; diff --git a/db/routines/vn2008/procedures/clean.sql b/db/routines/vn2008/procedures/clean.sql index dba4799d9..00279c090 100644 --- a/db/routines/vn2008/procedures/clean.sql +++ b/db/routines/vn2008/procedures/clean.sql @@ -30,18 +30,19 @@ proc: BEGIN DELETE ts FROM Tickets_stack ts - JOIN Tickets t ON ts.Id_Ticket = t.Id_Ticket - WHERE t.Fecha < vDate; + JOIN vn.ticket t ON ts.Id_Ticket = t.id + WHERE t.shipped < vDate; DELETE tobs FROM ticketObservation tobs - JOIN Tickets t ON tobs.ticketFk = t.Id_Ticket - WHERE t.Fecha < vDate; + JOIN vn.ticket t ON tobs.ticketFk = t.id + WHERE t.shipped < vDate; DELETE tobs FROM movement_label tobs JOIN Movimientos m ON tobs.Id_Movimiento = m.Id_Movimiento - JOIN Tickets t ON m.Id_Ticket = t.Id_Ticket WHERE t.Fecha < vDate; + JOIN vn.ticket t ON m.Id_Ticket = t.id + WHERE t.shipped < vDate; DELETE FROM Remesas WHERE `Fecha Remesa` < vDate18; @@ -92,9 +93,9 @@ proc: BEGIN END IF; -- Tickets Nulos PAK 11/10/2016 - UPDATE Tickets - SET empresa_id = 965 - WHERE Id_Cliente = 31 - AND empresa_id != 965; + UPDATE vn.ticket + SET companyFk = 965 + WHERE clientFk = 31 + AND companyFk != 965; END$$ DELIMITER ; diff --git a/db/routines/vn2008/procedures/customerDebtEvolution.sql b/db/routines/vn2008/procedures/customerDebtEvolution.sql index e5d23f0ef..f6f81e2b0 100644 --- a/db/routines/vn2008/procedures/customerDebtEvolution.sql +++ b/db/routines/vn2008/procedures/customerDebtEvolution.sql @@ -13,28 +13,28 @@ SELECT * FROM LEFT JOIN (SELECT Euros, date(Fecha) as Fecha FROM ( - SELECT Fechacobro as Fecha, Entregado as Euros + SELECT Fechacobro as Fecha, Entregado as Euros FROM Recibos WHERE Id_Cliente = vCustomer - AND Fechacobro >= '2017-01-01' - UNION ALL - SELECT vn.getDueDate(f.Fecha,c.Vencimiento), - Importe + AND Fechacobro >= '2017-01-01' + UNION ALL + SELECT vn.getDueDate(f.Fecha,c.Vencimiento), - Importe FROM Facturas f - JOIN Clientes c ON f.Id_Cliente = c.Id_Cliente + JOIN Clientes c ON f.Id_Cliente = c.Id_Cliente WHERE f.Id_Cliente = vCustomer - AND Fecha >= '2017-01-01' - UNION ALL - SELECT '2016-12-31', Debt + AND Fecha >= '2017-01-01' + UNION ALL + SELECT '2016-12-31', Debt FROM bi.customerDebtInventory WHERE Id_Cliente = vCustomer - UNION ALL - SELECT Fecha, - SUM(Cantidad * Preu * (100 - Descuento ) * 1.10 / 100) - FROM Tickets t - JOIN Movimientos m on m.Id_Ticket = t.Id_Ticket - WHERE Id_Cliente = vCustomer - AND Factura IS NULL - AND Fecha >= '2017-01-01' - GROUP BY Fecha + UNION ALL + SELECT t.shipped, - SUM(m.Cantidad * m.Preu * (100 - m.Descuento ) * 1.10 / 100) + FROM vn.ticket t + JOIN Movimientos m on m.Id_Ticket = t.id + WHERE t.clientFk = vCustomer + AND t.refFk IS NULL + AND t.shipped >= '2017-01-01' + GROUP BY t.shipped ) sub2 ORDER BY Fecha )sub ON time.date = sub.Fecha diff --git a/db/routines/vn2008/procedures/emailYesterdayPurchasesByConsigna.sql b/db/routines/vn2008/procedures/emailYesterdayPurchasesByConsigna.sql index 439eba5ad..2a753157d 100644 --- a/db/routines/vn2008/procedures/emailYesterdayPurchasesByConsigna.sql +++ b/db/routines/vn2008/procedures/emailYesterdayPurchasesByConsigna.sql @@ -14,8 +14,8 @@ BEGIN DECLARE txt TEXT; DECLARE rs CURSOR FOR - SELECT t.Id_Ticket, Alias, cast(amount as decimal(10,2)) Importe, Domicilio, POBLACION - FROM Tickets t + SELECT t.id, Alias, cast(amount as decimal(10,2)) Importe, Domicilio, POBLACION + FROM vn.ticket t JOIN Consignatarios cs ON t.Id_Consigna = cs.Id_Consigna JOIN ( SELECT `Movimientos`.`Id_Ticket` AS `Id_Ticket`, @@ -24,15 +24,15 @@ BEGIN ) AS `amount` FROM ( `vn2008`.`Movimientos` - JOIN `vn2008`.`Tickets` ON( - `Movimientos`.`Id_Ticket` = `Tickets`.`Id_Ticket` + JOIN `vn`.`ticket` ON( + `Movimientos`.`Id_Ticket` = `ticket`.`id` ) ) - WHERE `Tickets`.`Fecha` >= `util`.`VN_CURDATE`() + INTERVAL -6 MONTH + WHERE `ticket`.`shipped` >= `util`.`VN_CURDATE`() + INTERVAL -6 MONTH GROUP BY `Movimientos`.`Id_Ticket` - ) v ON v.Id_Ticket = t.Id_Ticket - WHERE t.Fecha BETWEEN v_Date AND util.dayEnd(v_Date) - AND t.Id_Cliente = v_Client_Id; + ) v ON v.Id_Ticket = t.id + WHERE t.shipped BETWEEN v_Date AND util.dayEnd(v_Date) + AND t.clientFk = v_Client_Id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; diff --git a/db/routines/vn2008/procedures/embalajes_stocks.sql b/db/routines/vn2008/procedures/embalajes_stocks.sql index b20e44c79..f6b0d9b9a 100644 --- a/db/routines/vn2008/procedures/embalajes_stocks.sql +++ b/db/routines/vn2008/procedures/embalajes_stocks.sql @@ -2,50 +2,50 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`embalajes_stocks`(IN idPEOPLE INT, IN bolCLIENT BOOLEAN) BEGIN -if bolCLIENT then + IF bolCLIENT THEN - select m.Id_Article, Article, - cast(sum(m.Cantidad) as decimal) as Saldo - from Movimientos m - join Articles a on m.Id_Article = a.Id_Article - join Tipos tp on tp.tipo_id = a.tipo_id - join Tickets t using(Id_Ticket) - join Consignatarios cs using(Id_Consigna) - where cs.Id_Cliente = idPEOPLE - and Tipo = 'Contenedores' - and t.Fecha > '2010-01-01' - group by m.Id_Article; + SELECT m.Id_Article, Article, - cast(sum(m.Cantidad) as decimal) Saldo + FROM Movimientos m + JOIN Articles a ON m.Id_Article = a.Id_Article + JOIN Tipos tp ON tp.tipo_id = a.tipo_id + JOIN ticket t ON t.id = m.Id_Ticket + JOIN Consignatarios cs using(Id_Consigna) + WHERE cs.Id_Cliente = idPEOPLE + AND Tipo = 'Contenedores' + AND t.shipped > '2010-01-01' + GROUP BY m.Id_Article; -else + ELSE -select Id_Article, Article, sum(Cantidad) as Saldo -from -(select Id_Article, Cantidad -from Compres c -join Articles a using(Id_Article) -join Tipos tp using(tipo_id) -join Entradas e using(Id_Entrada) -join travel tr on tr.id = travel_id -where Id_Proveedor = idPEOPLE -and landing >= '2010-01-01' -and reino_id = 6 + SELECT Id_Article, Article, sum(Cantidad) Saldo + FROM + (SELECT Id_Article, Cantidad + FROM Compres c + JOIN Articles a using(Id_Article) + JOIN Tipos tp using(tipo_id) + JOIN Entradas e using(Id_Entrada) + JOIN travel tr ON tr.id = travel_id + WHERE Id_Proveedor = idPEOPLE + AND landing >= '2010-01-01' + AND reino_id = 6 -union all + union all -select Id_Article, - Cantidad -from Movimientos m -join Articles a using(Id_Article) -join Tipos tp using(tipo_id) -join Tickets t using(Id_Ticket) -join Consignatarios cs using(Id_Consigna) -join proveedores_clientes pc on pc.Id_Cliente = cs.Id_Cliente -where Id_Proveedor = idPEOPLE -and reino_id = 6 -and t.Fecha > '2010-01-01') mov + SELECT Id_Article, - Cantidad + FROM Movimientos m + JOIN Articles a using(Id_Article) + JOIN Tipos tp using(tipo_id) + JOIN ticket t ON t.id = m.Id_Ticket + JOIN Consignatarios cs using(Id_Consigna) + JOIN proveedores_clientes pc ON pc.Id_Cliente = cs.Id_Cliente + WHERE Id_Proveedor = idPEOPLE + AND reino_id = 6 + AND t.shipped > '2010-01-01') mov -join Articles a using(Id_Article) -group by Id_Article; + JOIN Articles a using(Id_Article) + GROUP BY Id_Article; -end if; + END IF; END$$ DELIMITER ; diff --git a/db/routines/vn2008/procedures/embalajes_stocks_detalle.sql b/db/routines/vn2008/procedures/embalajes_stocks_detalle.sql index c49d1b88a..0319e0f75 100644 --- a/db/routines/vn2008/procedures/embalajes_stocks_detalle.sql +++ b/db/routines/vn2008/procedures/embalajes_stocks_detalle.sql @@ -2,77 +2,78 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`embalajes_stocks_detalle`(IN idPEOPLE INT, IN idARTICLE INT, IN bolCLIENT BOOLEAN) BEGIN + IF bolCLIENT THEN -if bolCLIENT then + SELECT m.Id_Article + , Article + , IF(Cantidad < 0, - Cantidad, NULL) Entrada + , IF(Cantidad < 0, NULL, Cantidad) Salida + , 'T' Tabla + , t.id Registro + , t.shipped Fecha + , w.name Almacen + , cast(Preu as Decimal(5,2)) Precio + , c.Cliente Proveedor + , abbreviation Empresa + FROM Movimientos m + JOIN Articles a using(Id_Article) + JOIN ticket t ON t.id = m.Id_Ticket + JOIN empresa e ON e.id = t.companyFk + JOIN warehouse w ON w.id = t.warehouseFk + JOIN Consignatarios cs using(Id_Consigna) + JOIN Clientes c ON c.Id_Cliente = cs.Id_Cliente + WHERE cs.Id_Cliente = idPEOPLE + AND m.Id_Article = idARTICLE + AND t.shipped > '2010-01-01'; - select m.Id_Article - , Article - , IF(Cantidad < 0, - Cantidad, NULL) as Entrada - , IF(Cantidad < 0, NULL, Cantidad) as Salida - , 'T' as Tabla - , t.Id_Ticket as Registro - , t.Fecha - , w.name as Almacen - , cast(Preu as Decimal(5,2)) Precio - , c.Cliente as Proveedor - , abbreviation as Empresa - from Movimientos m - join Articles a using(Id_Article) - join Tickets t using(Id_Ticket) - join empresa e on e.id = t.empresa_id - join warehouse w on w.id = t.warehouse_id - join Consignatarios cs using(Id_Consigna) - join Clientes c on c.Id_Cliente = cs.Id_Cliente - where cs.Id_Cliente = idPEOPLE - and m.Id_Article = idARTICLE - and t.Fecha > '2010-01-01'; + ELSE -else + SELECT Id_Article, + Tabla, + Registro, + Fecha, + Article, + w.name Almacen, + Entrada, + Salida, + Proveedor, + cast(Precio as Decimal(5,2)) Precio + FROM + (SELECT Id_Article + , IF(Cantidad > 0, Cantidad, NULL) Entrada + , IF(Cantidad > 0, NULL,- Cantidad) Salida + , 'E' Tabla + , Id_Entrada Registro + , landing Fecha + , tr.warehouse_id + , Costefijo Precio + FROM Compres c + JOIN Entradas e using(Id_Entrada) + JOIN travel tr ON tr.id = travel_id + WHERE Id_Proveedor = idPEOPLE + AND Id_Article = idARTICLE + AND landing >= '2010-01-01' -select Id_Article, Tabla, Registro, Fecha, Article -, w.name as Almacen, Entrada, Salida, Proveedor, cast(Precio as Decimal(5,2)) Precio - -from - -(select Id_Article - , IF(Cantidad > 0, Cantidad, NULL) as Entrada - , IF(Cantidad > 0, NULL,- Cantidad) as Salida - , 'E' as Tabla - , Id_Entrada as Registro - , landing as Fecha - , tr.warehouse_id - , Costefijo as Precio -from Compres c -join Entradas e using(Id_Entrada) -join travel tr on tr.id = travel_id -where Id_Proveedor = idPEOPLE -and Id_Article = idARTICLE -and landing >= '2010-01-01' - -union all - -select Id_Article - , IF(Cantidad < 0, - Cantidad, NULL) as Entrada - , IF(Cantidad < 0, NULL, Cantidad) as Salida - , 'T' - , Id_Ticket - , Fecha - , t.warehouse_id - , Preu -from Movimientos m -join Tickets t using(Id_Ticket) -join Consignatarios cs using(Id_Consigna) -join proveedores_clientes pc on pc.Id_Cliente = cs.Id_Cliente -where Id_Proveedor = idPEOPLE -and Id_Article = idARTICLE -and t.Fecha > '2010-01-01') mov - -join Articles a using(Id_Article) -join Proveedores p on Id_Proveedor = idPEOPLE -join warehouse w on w.id = mov.warehouse_id -; - -end if; + union all + SELECT Id_Article + , IF(Cantidad < 0, - Cantidad, NULL) Entrada + , IF(Cantidad < 0, NULL, Cantidad) Salida + , 'T' + , Id_Ticket + , Fecha + , t.warehouseFk warehouse_id + , Preu + FROM Movimientos m + JOIN ticket t ON t.id = m.Id_Ticket + JOIN Consignatarios cs using(Id_Consigna) + JOIN proveedores_clientes pc ON pc.Id_Cliente = cs.Id_Cliente + WHERE Id_Proveedor = idPEOPLE + AND Id_Article = idARTICLE + AND t.shipped > '2010-01-01') mov + JOIN Articles a using(Id_Article) + JOIN Proveedores p ON Id_Proveedor = idPEOPLE + JOIN warehouse w ON w.id = mov.warehouse_id; + END IF; END$$ DELIMITER ; diff --git a/db/routines/vn2008/procedures/historico_absoluto.sql b/db/routines/vn2008/procedures/historico_absoluto.sql index 1a7e1dbfa..55f33ee89 100644 --- a/db/routines/vn2008/procedures/historico_absoluto.sql +++ b/db/routines/vn2008/procedures/historico_absoluto.sql @@ -50,20 +50,20 @@ BEGIN AND E.Inventario = 0 AND E.Redada = 0 UNION ALL - SELECT T.Fecha Fecha, + SELECT t.shipped Fecha, NULL Entrada, M.Cantidad Salida, - (M.OK <> 0 OR T.Etiquetasemitidas <> 0 OR T.Factura IS NOT NULL) OK, - T.Alias Alias, - T.Factura Referencia, - T.Id_Ticket, - T.PedidoImpreso + (M.OK <> 0 OR t.isLabeled <> 0 OR t.refFk IS NOT NULL) OK, + t.nickname Alias, + t.refFk Referencia, + t.id Id_Ticket, + t.isPrinted PedidoImpreso FROM Movimientos M - INNER JOIN Tickets T USING (Id_Ticket) - JOIN Clientes C ON C.Id_Cliente = T.Id_Cliente - WHERE T.Fecha >= '2001-01-01' + INNER JOIN ticket t USING (Id_Ticket) + JOIN Clientes C ON C.Id_Cliente = t.clientFk + WHERE t.shipped >= '2001-01-01' AND M.Id_Article = idART - AND wh IN (T.warehouse_id , 0) + AND wh IN (t.warehouseFk , 0) ) t1 ORDER BY Fecha, Entrada DESC, OK DESC; diff --git a/db/routines/vn2008/procedures/historico_multiple.sql b/db/routines/vn2008/procedures/historico_multiple.sql index c68fbf2ad..fbec7bb1d 100644 --- a/db/routines/vn2008/procedures/historico_multiple.sql +++ b/db/routines/vn2008/procedures/historico_multiple.sql @@ -66,17 +66,17 @@ BEGIN UNION ALL - SELECT T.Fecha as Fecha, + SELECT t.shipped as Fecha, NULL as Entrada, M.Cantidad as Salida, warehouse_id as wh, - (M.OK <> 0 OR T.Etiquetasemitidas <> 0 OR T.Factura IS NOT NULL) as OK, - T.Factura as Referencia, - T.Id_Ticket as id + (M.OK <> 0 OR t.isLabeled <> 0 OR t.refFk IS NOT NULL) as OK, + t.refFk as Referencia, + t.id as id FROM Movimientos M - INNER JOIN Tickets T USING (Id_Ticket) - WHERE T.Fecha >= vDateInventory + INNER JOIN ticket t ON t.id = M.Id_Ticket + WHERE t.shipped >= vDateInventory AND M.Id_Article = vItemFk ) AS Historia diff --git a/db/routines/vn2008/procedures/preOrdenarRuta.sql b/db/routines/vn2008/procedures/preOrdenarRuta.sql index b5fd2b24b..9bcf853bd 100644 --- a/db/routines/vn2008/procedures/preOrdenarRuta.sql +++ b/db/routines/vn2008/procedures/preOrdenarRuta.sql @@ -6,17 +6,17 @@ BEGIN * DEPRECATED use vn.routeGressPriority */ -UPDATE Tickets mt -JOIN ( - SELECT tt.Id_Consigna, round(ifnull(avg(t.Prioridad),0),0) as Prioridad - from Tickets t - JOIN Tickets tt on tt.Id_Consigna = t.Id_Consigna - where t.Fecha > TIMESTAMPADD(YEAR,-1,util.VN_CURDATE()) - AND tt.Id_Ruta = vRutaId - GROUP BY Id_Consigna - ) sub ON sub.Id_Consigna = mt.Id_Consigna - SET mt.Prioridad = sub.Prioridad - WHERE mt.Id_Ruta = vRutaId; - + UPDATE vn.ticket mt + JOIN ( + SELECT tt.addressFk Id_Consigna, round(ifnull(avg(t.priority),0),0) as Prioridad + FROM vn.ticket t + JOIN vn.ticket tt on tt.addressFk = t.addressFk + WHERE t.shipped > TIMESTAMPADD(YEAR,-1,util.VN_CURDATE()) + AND tt.routeFk = vRutaId + GROUP BY addressFk + ) sub ON sub.Id_Consigna = mt.Id_Consigna + SET mt.priority = sub.Prioridad + WHERE mt.routeFk = vRutaId; + END$$ DELIMITER ; diff --git a/db/routines/vn2008/procedures/prepare_ticket_list.sql b/db/routines/vn2008/procedures/prepare_ticket_list.sql index e407a91b7..07cff3ff5 100644 --- a/db/routines/vn2008/procedures/prepare_ticket_list.sql +++ b/db/routines/vn2008/procedures/prepare_ticket_list.sql @@ -5,17 +5,17 @@ BEGIN CREATE TEMPORARY TABLE tmp.ticket_list (PRIMARY KEY (Id_Ticket)) ENGINE = MEMORY - SELECT t.Id_Ticket, c.Id_Cliente - FROM Tickets t - LEFT JOIN vn.ticketState ts ON ts.ticketFk = t.Id_Ticket - JOIN Clientes c ON c.Id_Cliente = t.Id_Cliente + SELECT t.id Id_Ticket, c.Id_Cliente + FROM vn.ticket t + LEFT JOIN vn.ticketState ts ON ts.ticketFk = t.id + JOIN Clientes c ON c.Id_Cliente = t.clientFk WHERE c.typeFk IN ('normal','handMaking','internalUse') AND ( Fecha BETWEEN util.today() AND vEndingDate OR ( ts.alertLevel < 3 - AND t.Fecha >= vStartingDate - AND t.Fecha < util.today() + AND t.shipped >= vStartingDate + AND t.shipped < util.today() ) ); END$$ diff --git a/db/routines/vn2008/procedures/risk_vs_client_list.sql b/db/routines/vn2008/procedures/risk_vs_client_list.sql index 92f94eb9f..bb3c1028c 100644 --- a/db/routines/vn2008/procedures/risk_vs_client_list.sql +++ b/db/routines/vn2008/procedures/risk_vs_client_list.sql @@ -33,14 +33,14 @@ BEGIN CREATE TEMPORARY TABLE tmp.tickets_sin_facturar (PRIMARY KEY (Id_Cliente)) ENGINE = MEMORY - SELECT t.Id_Cliente, floor(IF(cl.isVies, 1, 1.1) * sum(Cantidad * Preu * (100 - Descuento) / 100)) as total + SELECT t.clientFk Id_Cliente, floor(IF(cl.isVies, 1, 1.1) * sum(Cantidad * Preu * (100 - Descuento) / 100)) as total FROM Movimientos m - JOIN Tickets t on m.Id_Ticket = t.Id_Ticket - JOIN tmp.client_list c on c.Id_Cliente = t.Id_Cliente - JOIN vn.client cl ON cl.id = t.Id_Cliente + JOIN vn.ticket t on m.Id_Ticket = t.id + JOIN tmp.client_list c on c.Id_Cliente = t.clientFk + JOIN vn.client cl ON cl.id = t.clientFk WHERE Factura IS NULL AND Fecha BETWEEN startingDate AND endingDate - GROUP BY t.Id_Cliente; + GROUP BY t.clientFk; DROP TEMPORARY TABLE IF EXISTS tmp.risk; CREATE TEMPORARY TABLE tmp.risk diff --git a/db/routines/vn2008/views/item_out.sql b/db/routines/vn2008/views/item_out.sql index 57353a6d6..a1e714cb6 100644 --- a/db/routines/vn2008/views/item_out.sql +++ b/db/routines/vn2008/views/item_out.sql @@ -1,17 +1,17 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vn2008`.`item_out` -AS SELECT `t`.`warehouse_id` AS `warehouse_id`, - `t`.`Fecha` AS `dat`, +AS SELECT `t`.`warehouseFk` AS `warehouse_id`, + `t`.`shipped` AS `dat`, `m`.`Id_Article` AS `item_id`, - `m`.`Cantidad` AS `amount`, `m`.`OK` AS `ok`, `m`.`Reservado` AS `Reservado`, - `t`.`Factura` AS `invoice`, + `t`.`refFk` AS `invoice`, `m`.`Id_Movimiento` AS `saleFk`, `m`.`Id_Ticket` AS `ticketFk` FROM ( `vn2008`.`Movimientos` `m` - JOIN `vn2008`.`Tickets` `t` ON(`m`.`Id_Ticket` = `t`.`Id_Ticket`) + JOIN `vn`.`ticket` `t` ON(`m`.`Id_Ticket` = `t`.`id`) ) WHERE `m`.`Cantidad` <> 0 From 714cd3c2c37f71bb4d83ccf07e83ac122f3f268c Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 6 Feb 2024 14:55:20 +0100 Subject: [PATCH 04/33] feat: refs #6777 --- db/routines/bi/procedures/claim_ratio_routine.sql | 2 +- db/routines/bs/procedures/comercialesCompleto.sql | 2 +- db/routines/bs/procedures/ventas_contables_por_cliente.sql | 6 +++--- db/routines/vn/procedures/invoiceFromAddress.sql | 2 +- db/routines/vn2008/procedures/confection_control_source.sql | 2 +- db/routines/vn2008/procedures/customerDebtEvolution.sql | 2 +- .../vn2008/procedures/emailYesterdayPurchasesByConsigna.sql | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/db/routines/bi/procedures/claim_ratio_routine.sql b/db/routines/bi/procedures/claim_ratio_routine.sql index dce098e2d..d7adbaba1 100644 --- a/db/routines/bi/procedures/claim_ratio_routine.sql +++ b/db/routines/bi/procedures/claim_ratio_routine.sql @@ -59,7 +59,7 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; CREATE TEMPORARY TABLE tmp.ticket_list (PRIMARY KEY (Id_Ticket)) - SELECT DISTINCT t.id + SELECT DISTINCT t.id Id_Ticket FROM vn2008.Movimientos_componentes mc JOIN vn2008.Movimientos m ON mc.Id_Movimiento = m.Id_Movimiento JOIN vn.ticket t ON t.id = m.Id_Ticket diff --git a/db/routines/bs/procedures/comercialesCompleto.sql b/db/routines/bs/procedures/comercialesCompleto.sql index 8f519b6ca..72b54656a 100644 --- a/db/routines/bs/procedures/comercialesCompleto.sql +++ b/db/routines/bs/procedures/comercialesCompleto.sql @@ -70,7 +70,7 @@ BEGIN AND (v.fecha BETWEEN TIMESTAMPADD(DAY, - DAY(vDate) + 1, vDate) AND TIMESTAMPADD(DAY, - 1, vDate)) GROUP BY Id_Cliente) mes_actual ON mes_actual.Id_Cliente = c.Id_Cliente LEFT JOIN - (SELECT t.clientFk, SUM(m.preu * m.Cantidad * (1 - m.Descuento / 100)) futur + (SELECT t.clientFk Id_Cliente, SUM(m.preu * m.Cantidad * (1 - m.Descuento / 100)) futur FROM vn.ticket t JOIN vn2008.Clientes c ON c.Id_Cliente = t.clientFk JOIN vn2008.Movimientos m ON m.Id_Ticket = t.id diff --git a/db/routines/bs/procedures/ventas_contables_por_cliente.sql b/db/routines/bs/procedures/ventas_contables_por_cliente.sql index 26da1b870..31e93adb7 100644 --- a/db/routines/bs/procedures/ventas_contables_por_cliente.sql +++ b/db/routines/bs/procedures/ventas_contables_por_cliente.sql @@ -14,12 +14,12 @@ BEGIN SELECT id FROM vn.ticket t JOIN vn2008.Facturas f ON f.Id_Factura = t.refFk - WHERE year(f.shipped) = vYear - AND month(f.shipped) = vMonth; + WHERE year(f.Fecha) = vYear + AND month(f.Fecha) = vMonth; SELECT vYear Año, vMonth Mes, - t.clientFk, + t.clientFk Id_Cliente, round(sum(Cantidad * Preu * (100 - m.Descuento)/100)) Venta, IF(e.empresa_grupo = e2.empresa_grupo, 1, diff --git a/db/routines/vn/procedures/invoiceFromAddress.sql b/db/routines/vn/procedures/invoiceFromAddress.sql index bea49e747..bf657a731 100644 --- a/db/routines/vn/procedures/invoiceFromAddress.sql +++ b/db/routines/vn/procedures/invoiceFromAddress.sql @@ -11,7 +11,7 @@ BEGIN CREATE TEMPORARY TABLE `tmp.``ticketToInvoice` (PRIMARY KEY (`id`)) ENGINE = MEMORY - SELECT id id + SELECT id FROM ticket WHERE (shipped BETWEEN vMinDateTicket AND vMaxTicketDate) AND addressFk = vAddress diff --git a/db/routines/vn2008/procedures/confection_control_source.sql b/db/routines/vn2008/procedures/confection_control_source.sql index 6833cd29d..4b60b041e 100644 --- a/db/routines/vn2008/procedures/confection_control_source.sql +++ b/db/routines/vn2008/procedures/confection_control_source.sql @@ -23,7 +23,7 @@ BEGIN tp.Tipo, t.nickname as Cliente, wh.name as Almacen, - t.warehouseFk, + t.warehouseFk warehouse_id, cs.province_id, a.agency_id, ct.description as Taller, diff --git a/db/routines/vn2008/procedures/customerDebtEvolution.sql b/db/routines/vn2008/procedures/customerDebtEvolution.sql index f6f81e2b0..fad1a8a59 100644 --- a/db/routines/vn2008/procedures/customerDebtEvolution.sql +++ b/db/routines/vn2008/procedures/customerDebtEvolution.sql @@ -28,7 +28,7 @@ SELECT * FROM FROM bi.customerDebtInventory WHERE Id_Cliente = vCustomer UNION ALL - SELECT t.shipped, - SUM(m.Cantidad * m.Preu * (100 - m.Descuento ) * 1.10 / 100) + SELECT t.shipped Fecha, - SUM(m.Cantidad * m.Preu * (100 - m.Descuento ) * 1.10 / 100) FROM vn.ticket t JOIN Movimientos m on m.Id_Ticket = t.id WHERE t.clientFk = vCustomer diff --git a/db/routines/vn2008/procedures/emailYesterdayPurchasesByConsigna.sql b/db/routines/vn2008/procedures/emailYesterdayPurchasesByConsigna.sql index 2a753157d..7da510afa 100644 --- a/db/routines/vn2008/procedures/emailYesterdayPurchasesByConsigna.sql +++ b/db/routines/vn2008/procedures/emailYesterdayPurchasesByConsigna.sql @@ -14,7 +14,7 @@ BEGIN DECLARE txt TEXT; DECLARE rs CURSOR FOR - SELECT t.id, Alias, cast(amount as decimal(10,2)) Importe, Domicilio, POBLACION + SELECT t.id Id_Ticket, Alias, cast(amount as decimal(10,2)) Importe, Domicilio, POBLACION FROM vn.ticket t JOIN Consignatarios cs ON t.Id_Consigna = cs.Id_Consigna JOIN ( From 747dabd1544a3f22492129591a63f4768682e2ed Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 7 Feb 2024 11:41:22 +0100 Subject: [PATCH 05/33] feat: refs #6777 --- .../bi/procedures/claim_ratio_routine.sql | 2 +- .../bs/procedures/ventas_contables_add.sql | 2 +- .../vn/procedures/invoiceFromAddress.sql | 2 +- .../procedures/ListaTicketsEncajados.sql | 2 +- db/routines/vn2008/procedures/clean.sql | 18 ++---------------- .../procedures/confection_control_source.sql | 2 +- .../emailYesterdayPurchasesByConsigna.sql | 4 ++-- .../vn2008/procedures/embalajes_stocks.sql | 8 ++++---- .../procedures/embalajes_stocks_detalle.sql | 10 +++++----- .../vn2008/procedures/historico_absoluto.sql | 2 +- .../vn2008/procedures/historico_multiple.sql | 6 +++--- .../vn2008/procedures/preOrdenarRuta.sql | 4 ++-- .../vn2008/procedures/prepare_ticket_list.sql | 2 +- .../vn2008/procedures/risk_vs_client_list.sql | 4 ++-- 14 files changed, 27 insertions(+), 41 deletions(-) diff --git a/db/routines/bi/procedures/claim_ratio_routine.sql b/db/routines/bi/procedures/claim_ratio_routine.sql index d7adbaba1..833a1153a 100644 --- a/db/routines/bi/procedures/claim_ratio_routine.sql +++ b/db/routines/bi/procedures/claim_ratio_routine.sql @@ -79,7 +79,7 @@ BEGIN INSERT INTO vn2008.Greuges (Id_Cliente,Comentario,Importe,Fecha, Greuges_type_id, Id_Ticket) - SELECT Id_Cliente + SELECT t.clientFk ,concat('recobro ', m.Id_Ticket), - round(SUM(mc.Valor*Cantidad),2) AS dif ,date(t.shipped) diff --git a/db/routines/bs/procedures/ventas_contables_add.sql b/db/routines/bs/procedures/ventas_contables_add.sql index 554972e4c..955356d4e 100644 --- a/db/routines/bs/procedures/ventas_contables_add.sql +++ b/db/routines/bs/procedures/ventas_contables_add.sql @@ -86,7 +86,7 @@ BEGIN ) as grupo , NULL , NULL - , t.companyFk + , t.companyFk empresa_id , 7050000000 FROM vn.ticketService ts JOIN vn.ticket t ON ts.ticketFk = t.id diff --git a/db/routines/vn/procedures/invoiceFromAddress.sql b/db/routines/vn/procedures/invoiceFromAddress.sql index bf657a731..2879460ce 100644 --- a/db/routines/vn/procedures/invoiceFromAddress.sql +++ b/db/routines/vn/procedures/invoiceFromAddress.sql @@ -8,7 +8,7 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS `tmp`.`ticketToInvoice`; - CREATE TEMPORARY TABLE `tmp.``ticketToInvoice` + CREATE TEMPORARY TABLE `tmp`.`ticketToInvoice` (PRIMARY KEY (`id`)) ENGINE = MEMORY SELECT id diff --git a/db/routines/vn2008/procedures/ListaTicketsEncajados.sql b/db/routines/vn2008/procedures/ListaTicketsEncajados.sql index e220cd9ad..6a9838da3 100644 --- a/db/routines/vn2008/procedures/ListaTicketsEncajados.sql +++ b/db/routines/vn2008/procedures/ListaTicketsEncajados.sql @@ -10,7 +10,7 @@ BEGIN IFNULL(nbultos,0) AS nbultos, IFNULL(notros,0) AS notros, ts.code AS Estado - FROM Tickets ti + FROM vn.ticket ti INNER JOIN Consignatarios ON ti.addressFk = Consignatarios.Id_consigna INNER JOIN Agencias ON ti.agencyModeFk = Agencias.Id_Agencia LEFT JOIN (SELECT Ticket_Id,count(*) AS ncajas FROM expeditions WHERE Id_Article=94 GROUP BY ticket_id) sub1 ON ti.id=sub1.Ticket_Id diff --git a/db/routines/vn2008/procedures/clean.sql b/db/routines/vn2008/procedures/clean.sql index 00279c090..0ae70d648 100644 --- a/db/routines/vn2008/procedures/clean.sql +++ b/db/routines/vn2008/procedures/clean.sql @@ -22,19 +22,12 @@ proc: BEGIN DELETE FROM cdr WHERE calldate < vDate18; DELETE FROM Monitoring WHERE ODBC_TIME < vDate; - DELETE FROM Conteo WHERE Fecha < vDate; DELETE FROM mail WHERE DATE_ODBC < vDate; - DELETE FROM expeditions_deleted WHERE odbc_date < vDate26; DELETE FROM Movimientos_mark WHERE odbc_date < vDate; DELETE FROM Splits WHERE Fecha < vDate18; - DELETE ts - FROM Tickets_stack ts - JOIN vn.ticket t ON ts.Id_Ticket = t.id - WHERE t.shipped < vDate; - DELETE tobs - FROM ticketObservation tobs + FROM vn.ticketObservation tobs JOIN vn.ticket t ON tobs.ticketFk = t.id WHERE t.shipped < vDate; @@ -49,7 +42,7 @@ proc: BEGIN DELETE tw.* FROM vn.ticketWeekly tw LEFT JOIN vn.sale s USING(ticketFk) - WHERE s.Id_Article IS NULL; + WHERE s.id IS NULL; DELETE FROM cl_main WHERE Fecha < vDate18; DELETE FROM hedera.`order` WHERE date_send < vDate18; @@ -65,13 +58,6 @@ proc: BEGIN JOIN travel t ON t.id = e.travel_id WHERE t.landing <= vDate; - DELETE co - FROM Compres_ok co JOIN Compres c ON c.Id_Compra = co.Id_Compra - JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada - JOIN travel t ON t.id = e.travel_id - WHERE t.landing <= vDate; - DELETE FROM scan WHERE odbc_date < vDate6 AND id <> 1; - IF v_full THEN CREATE OR REPLACE TEMPORARY TABLE tTicketDelete SELECT DISTINCT tl.originFk ticketFk diff --git a/db/routines/vn2008/procedures/confection_control_source.sql b/db/routines/vn2008/procedures/confection_control_source.sql index 4b60b041e..84126bc8c 100644 --- a/db/routines/vn2008/procedures/confection_control_source.sql +++ b/db/routines/vn2008/procedures/confection_control_source.sql @@ -14,7 +14,7 @@ BEGIN date(t.shipped) as Fecha, hour(t.shipped) as Hora, hour(t.shipped) as Departure, - t.id, + t.id Id_Ticket, m.Id_Movimiento, m.Cantidad, m.Concepte, diff --git a/db/routines/vn2008/procedures/emailYesterdayPurchasesByConsigna.sql b/db/routines/vn2008/procedures/emailYesterdayPurchasesByConsigna.sql index 7da510afa..be2f01d1f 100644 --- a/db/routines/vn2008/procedures/emailYesterdayPurchasesByConsigna.sql +++ b/db/routines/vn2008/procedures/emailYesterdayPurchasesByConsigna.sql @@ -14,9 +14,9 @@ BEGIN DECLARE txt TEXT; DECLARE rs CURSOR FOR - SELECT t.id Id_Ticket, Alias, cast(amount as decimal(10,2)) Importe, Domicilio, POBLACION + SELECT t.id Id_Ticket, nickname Alias, cast(amount as decimal(10,2)) Importe, Domicilio, POBLACION FROM vn.ticket t - JOIN Consignatarios cs ON t.Id_Consigna = cs.Id_Consigna + JOIN Consignatarios cs ON t.addressFk = cs.Id_Consigna JOIN ( SELECT `Movimientos`.`Id_Ticket` AS `Id_Ticket`, sum( diff --git a/db/routines/vn2008/procedures/embalajes_stocks.sql b/db/routines/vn2008/procedures/embalajes_stocks.sql index f6b0d9b9a..6479b19f8 100644 --- a/db/routines/vn2008/procedures/embalajes_stocks.sql +++ b/db/routines/vn2008/procedures/embalajes_stocks.sql @@ -8,8 +8,8 @@ BEGIN FROM Movimientos m JOIN Articles a ON m.Id_Article = a.Id_Article JOIN Tipos tp ON tp.tipo_id = a.tipo_id - JOIN ticket t ON t.id = m.Id_Ticket - JOIN Consignatarios cs using(Id_Consigna) + JOIN vn.ticket t ON t.id = m.Id_Ticket + JOIN Consignatarios cs ON cs.Id_Consigna = t.addressFk WHERE cs.Id_Cliente = idPEOPLE AND Tipo = 'Contenedores' AND t.shipped > '2010-01-01' @@ -35,8 +35,8 @@ BEGIN FROM Movimientos m JOIN Articles a using(Id_Article) JOIN Tipos tp using(tipo_id) - JOIN ticket t ON t.id = m.Id_Ticket - JOIN Consignatarios cs using(Id_Consigna) + JOIN vn.ticket t ON t.id = m.Id_Ticket + JOIN Consignatarios cs ON cs.Id_Consigna = t.addressFk JOIN proveedores_clientes pc ON pc.Id_Cliente = cs.Id_Cliente WHERE Id_Proveedor = idPEOPLE AND reino_id = 6 diff --git a/db/routines/vn2008/procedures/embalajes_stocks_detalle.sql b/db/routines/vn2008/procedures/embalajes_stocks_detalle.sql index 0319e0f75..2992e6029 100644 --- a/db/routines/vn2008/procedures/embalajes_stocks_detalle.sql +++ b/db/routines/vn2008/procedures/embalajes_stocks_detalle.sql @@ -17,10 +17,10 @@ BEGIN , abbreviation Empresa FROM Movimientos m JOIN Articles a using(Id_Article) - JOIN ticket t ON t.id = m.Id_Ticket + JOIN vn.ticket t ON t.id = m.Id_Ticket JOIN empresa e ON e.id = t.companyFk - JOIN warehouse w ON w.id = t.warehouseFk - JOIN Consignatarios cs using(Id_Consigna) + JOIN vn.warehouse w ON w.id = t.warehouseFk + JOIN Consignatarios cs ON cs.Id_Consigna = t.addressFk JOIN Clientes c ON c.Id_Cliente = cs.Id_Cliente WHERE cs.Id_Cliente = idPEOPLE AND m.Id_Article = idARTICLE @@ -65,8 +65,8 @@ BEGIN , t.warehouseFk warehouse_id , Preu FROM Movimientos m - JOIN ticket t ON t.id = m.Id_Ticket - JOIN Consignatarios cs using(Id_Consigna) + JOIN vn.ticket t ON t.id = m.Id_Ticket + JOIN Consignatarios cs ON cs.Id_Consigna = t.addressFk JOIN proveedores_clientes pc ON pc.Id_Cliente = cs.Id_Cliente WHERE Id_Proveedor = idPEOPLE AND Id_Article = idARTICLE diff --git a/db/routines/vn2008/procedures/historico_absoluto.sql b/db/routines/vn2008/procedures/historico_absoluto.sql index 55f33ee89..e11fb64d5 100644 --- a/db/routines/vn2008/procedures/historico_absoluto.sql +++ b/db/routines/vn2008/procedures/historico_absoluto.sql @@ -59,7 +59,7 @@ BEGIN t.id Id_Ticket, t.isPrinted PedidoImpreso FROM Movimientos M - INNER JOIN ticket t USING (Id_Ticket) + INNER JOIN vn.ticket t ON t.id = M.Id_Ticket JOIN Clientes C ON C.Id_Cliente = t.clientFk WHERE t.shipped >= '2001-01-01' AND M.Id_Article = idART diff --git a/db/routines/vn2008/procedures/historico_multiple.sql b/db/routines/vn2008/procedures/historico_multiple.sql index fbec7bb1d..b3ddc208a 100644 --- a/db/routines/vn2008/procedures/historico_multiple.sql +++ b/db/routines/vn2008/procedures/historico_multiple.sql @@ -69,19 +69,19 @@ BEGIN SELECT t.shipped as Fecha, NULL as Entrada, M.Cantidad as Salida, - warehouse_id as wh, + t.warehouseFk as wh, (M.OK <> 0 OR t.isLabeled <> 0 OR t.refFk IS NOT NULL) as OK, t.refFk as Referencia, t.id as id FROM Movimientos M - INNER JOIN ticket t ON t.id = M.Id_Ticket + INNER JOIN vn.ticket t ON t.id = M.Id_Ticket WHERE t.shipped >= vDateInventory AND M.Id_Article = vItemFk ) AS Historia - INNER JOIN warehouse ON warehouse.id = Historia.wh + INNER JOIN vn.warehouse ON warehouse.id = Historia.wh ORDER BY Fecha, Entrada DESC, OK DESC; diff --git a/db/routines/vn2008/procedures/preOrdenarRuta.sql b/db/routines/vn2008/procedures/preOrdenarRuta.sql index 9bcf853bd..d3e1862f6 100644 --- a/db/routines/vn2008/procedures/preOrdenarRuta.sql +++ b/db/routines/vn2008/procedures/preOrdenarRuta.sql @@ -13,8 +13,8 @@ BEGIN JOIN vn.ticket tt on tt.addressFk = t.addressFk WHERE t.shipped > TIMESTAMPADD(YEAR,-1,util.VN_CURDATE()) AND tt.routeFk = vRutaId - GROUP BY addressFk - ) sub ON sub.Id_Consigna = mt.Id_Consigna + GROUP BY t.addressFk + ) sub ON sub.Id_Consigna = mt.addressFk SET mt.priority = sub.Prioridad WHERE mt.routeFk = vRutaId; diff --git a/db/routines/vn2008/procedures/prepare_ticket_list.sql b/db/routines/vn2008/procedures/prepare_ticket_list.sql index 07cff3ff5..ea1dc8e7d 100644 --- a/db/routines/vn2008/procedures/prepare_ticket_list.sql +++ b/db/routines/vn2008/procedures/prepare_ticket_list.sql @@ -11,7 +11,7 @@ BEGIN JOIN Clientes c ON c.Id_Cliente = t.clientFk WHERE c.typeFk IN ('normal','handMaking','internalUse') AND ( - Fecha BETWEEN util.today() AND vEndingDate + t.shipped BETWEEN util.today() AND vEndingDate OR ( ts.alertLevel < 3 AND t.shipped >= vStartingDate diff --git a/db/routines/vn2008/procedures/risk_vs_client_list.sql b/db/routines/vn2008/procedures/risk_vs_client_list.sql index bb3c1028c..148379a64 100644 --- a/db/routines/vn2008/procedures/risk_vs_client_list.sql +++ b/db/routines/vn2008/procedures/risk_vs_client_list.sql @@ -38,8 +38,8 @@ BEGIN JOIN vn.ticket t on m.Id_Ticket = t.id JOIN tmp.client_list c on c.Id_Cliente = t.clientFk JOIN vn.client cl ON cl.id = t.clientFk - WHERE Factura IS NULL - AND Fecha BETWEEN startingDate AND endingDate + WHERE t.refFk IS NULL + AND t.shipped BETWEEN startingDate AND endingDate GROUP BY t.clientFk; DROP TEMPORARY TABLE IF EXISTS tmp.risk; From be4403819da7c94d8514b48e859422483b3175d2 Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 7 Feb 2024 11:45:14 +0100 Subject: [PATCH 06/33] feat: refs #6777 --- db/routines/bs/procedures/ventas_contables_add.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/bs/procedures/ventas_contables_add.sql b/db/routines/bs/procedures/ventas_contables_add.sql index 955356d4e..7c8063e56 100644 --- a/db/routines/bs/procedures/ventas_contables_add.sql +++ b/db/routines/bs/procedures/ventas_contables_add.sql @@ -66,7 +66,7 @@ BEGIN AND Preu <> 0 AND m.Descuento <> 100 AND a.tipo_id != TIPO_PATRIMONIAL - GROUP BY grupo, reino_id, tipo_id, empresa_id, Gasto; + GROUP BY grupo, reino_id, tipo_id, t.companyFk, Gasto; INSERT INTO bs.ventas_contables(year , month From 311401daba314635241aa7eed2513db509e767f5 Mon Sep 17 00:00:00 2001 From: robert Date: Thu, 29 Feb 2024 08:59:25 +0100 Subject: [PATCH 07/33] fix: refs #6777 ticketMRW --- db/routines/vn/views/ticketMRW.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/views/ticketMRW.sql b/db/routines/vn/views/ticketMRW.sql index 2677b41e7..26b928ac4 100644 --- a/db/routines/vn/views/ticketMRW.sql +++ b/db/routines/vn/views/ticketMRW.sql @@ -44,4 +44,4 @@ FROM ( ) ) JOIN `vn2008`.`Paises` ON(`province`.`Paises_Id` = `Paises`.`Id`) - ) + ); From 624c214178c1c7671df2515388187b545f7c66da Mon Sep 17 00:00:00 2001 From: robert Date: Thu, 29 Feb 2024 10:46:08 +0100 Subject: [PATCH 08/33] fix: refs #6777 Fixed version --- .../10921-bronzeAralia/00-firstScript.sql | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 db/versions/10921-bronzeAralia/00-firstScript.sql diff --git a/db/versions/10921-bronzeAralia/00-firstScript.sql b/db/versions/10921-bronzeAralia/00-firstScript.sql new file mode 100644 index 000000000..55aa03dca --- /dev/null +++ b/db/versions/10921-bronzeAralia/00-firstScript.sql @@ -0,0 +1,49 @@ +-- Para evitar el error al hacer myt run +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`Clientes` +AS SELECT `c`.`id` AS `id_cliente`, + `c`.`name` AS `cliente`, + `c`.`fi` AS `if`, + `c`.`socialName` AS `razonSocial`, + `c`.`contact` AS `contacto`, + `c`.`street` AS `domicilio`, + `c`.`city` AS `poblacion`, + `c`.`postcode` AS `codPostal`, + `c`.`phone` AS `telefono`, + `c`.`mobile` AS `movil`, + `c`.`isRelevant` AS `real`, + `c`.`email` AS `e-mail`, + `c`.`iban` AS `iban`, + `c`.`dueDay` AS `vencimiento`, + `c`.`accountingAccount` AS `Cuenta`, + `c`.`isEqualizated` AS `RE`, + `c`.`provinceFk` AS `province_id`, + `c`.`hasToInvoice` AS `invoice`, + `c`.`credit` AS `credito`, + `c`.`countryFk` AS `Id_Pais`, + `c`.`isActive` AS `activo`, + `c`.`gestdocFk` AS `gestdoc_id`, + `c`.`quality` AS `calidad`, + `c`.`payMethodFk` AS `pay_met_id`, + `c`.`created` AS `created`, + `c`.`isToBeMailed` AS `mail`, + `c`.`contactChannelFk` AS `chanel_id`, + `c`.`hasSepaVnl` AS `sepaVnl`, + `c`.`hasCoreVnl` AS `coreVnl`, + `c`.`hasCoreVnh` AS `coreVnh`, + `c`.`hasLcr` AS `hasLcr`, + `c`.`defaultAddressFk` AS `default_address`, + `c`.`riskCalculated` AS `risk_calculated`, + `c`.`hasToInvoiceByAddress` AS `invoiceByAddress`, + `c`.`isTaxDataChecked` AS `contabilizado`, + `c`.`isFreezed` AS `congelado`, + `c`.`creditInsurance` AS `creditInsurance`, + `c`.`isCreatedAsServed` AS `isCreatedAsServed`, + `c`.`hasInvoiceSimplified` AS `hasInvoiceSimplified`, + `c`.`salesPersonFk` AS `Id_Trabajador`, + `c`.`isVies` AS `vies`, + `c`.`eypbc` AS `EYPBC`, + `c`.`bankEntityFk` AS `bankEntityFk`, + `c`.`typeFk` AS `typeFk` +FROM `vn`.`client` `c`; \ No newline at end of file From 052acdcc0874f36b2e5e1913eca080c243a75126 Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 13 Mar 2024 13:20:14 +0100 Subject: [PATCH 09/33] feat: refs #7029 packaging --- db/versions/10950-greenArborvitae/00-firstScript.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 db/versions/10950-greenArborvitae/00-firstScript.sql diff --git a/db/versions/10950-greenArborvitae/00-firstScript.sql b/db/versions/10950-greenArborvitae/00-firstScript.sql new file mode 100644 index 000000000..e8d4e31f2 --- /dev/null +++ b/db/versions/10950-greenArborvitae/00-firstScript.sql @@ -0,0 +1,3 @@ +-- Place your SQL code here +ALTER TABLE vn.packaging +MODIFY COLUMN volume decimal(10,2) CHECK (volume >= COALESCE(width, 1) * COALESCE(depth, 1) * COALESCE(height, 1)); From c2a2a86f355aa30ffb225cdf9d311bacfcdc289b Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 10 Apr 2024 09:42:55 +0200 Subject: [PATCH 10/33] feat: refs #6777 ultima comprobacion --- .../bs/procedures/ventas_contables_add.sql | 16 +++--- .../ventas_contables_por_cliente.sql | 14 +++--- db/routines/vn2008/views/Rutas.sql | 19 ------- db/routines/vn2008/views/state.sql | 13 ----- db/routines/vn2008/views/tag.sql | 10 ---- .../vn2008/views/tarifa_componentes.sql | 10 ---- .../views/tarifa_componentes_series.sql | 7 --- db/routines/vn2008/views/tblContadores.sql | 39 --------------- db/routines/vn2008/views/thermograph.sql | 6 --- .../vn2008/views/ticket_observation.sql | 8 --- db/routines/vn2008/views/tickets_gestdoc.sql | 6 --- .../10921-bronzeAralia/00-firstScript.sql | 49 ------------------- 12 files changed, 15 insertions(+), 182 deletions(-) delete mode 100644 db/routines/vn2008/views/Rutas.sql delete mode 100644 db/routines/vn2008/views/state.sql delete mode 100644 db/routines/vn2008/views/tag.sql delete mode 100644 db/routines/vn2008/views/tarifa_componentes.sql delete mode 100644 db/routines/vn2008/views/tarifa_componentes_series.sql delete mode 100644 db/routines/vn2008/views/tblContadores.sql delete mode 100644 db/routines/vn2008/views/thermograph.sql delete mode 100644 db/routines/vn2008/views/ticket_observation.sql delete mode 100644 db/routines/vn2008/views/tickets_gestdoc.sql delete mode 100644 db/versions/10921-bronzeAralia/00-firstScript.sql diff --git a/db/routines/bs/procedures/ventas_contables_add.sql b/db/routines/bs/procedures/ventas_contables_add.sql index abb4be25d..ad4e80a06 100644 --- a/db/routines/bs/procedures/ventas_contables_add.sql +++ b/db/routines/bs/procedures/ventas_contables_add.sql @@ -21,9 +21,9 @@ BEGIN CREATE TEMPORARY TABLE tmp.ticket_list (PRIMARY KEY (id)) ENGINE = MEMORY - SELECT Id_Ticket - FROM vn2008.Tickets t - JOIN vn.invoiceOut io ON io.`ref` = t.Factura + SELECT t.id + FROM vn.ticket t + JOIN vn.invoiceOut io ON io.`ref` = t.refFk WHERE year(io.issued) = vYear AND month(io.issued) = vMonth; @@ -46,7 +46,7 @@ BEGIN ) as grupo , tp.reino_id , a.tipo_id - , t.empresa_id + , t.companyFk , a.expenseFk + IF(e.empresa_grupo = e2.empresa_grupo ,1 @@ -54,8 +54,8 @@ BEGIN ) * 100000 + tp.reino_id * 1000 as Gasto FROM vn2008.Movimientos m - JOIN vn2008.Tickets t on t.Id_Ticket = m.Id_Ticket - JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.Id_Consigna + JOIN vn.ticket t ON t.id = m.Id_Ticket + JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.addressFk JOIN vn2008.Clientes c on c.Id_Cliente = cs.Id_Cliente JOIN tmp.ticket_list tt on tt.id = t.id JOIN vn2008.Articles a on m.Id_Article = a.Id_Article @@ -66,7 +66,7 @@ BEGIN AND Preu <> 0 AND m.Descuento <> 100 AND a.tipo_id != TIPO_PATRIMONIAL - GROUP BY grupo, reino_id, tipo_id, empresa_id, Gasto; + GROUP BY grupo, reino_id, tipo_id, companyFk, Gasto; INSERT INTO bs.ventas_contables(year , month @@ -92,7 +92,7 @@ BEGIN JOIN vn.ticket t ON ts.ticketFk = t.id JOIN vn.address a on a.id = t.addressFk JOIN vn.client cl on cl.id = a.clientFk - JOIN tmp.ticket_list tt on tt.Id_Ticket = t.id + JOIN tmp.ticket_list tt on tt.id = t.id JOIN vn.company c on c.id = t.companyFk LEFT JOIN vn.company c2 on c2.clientFk = cl.id GROUP BY grupo, t.companyFk ; diff --git a/db/routines/bs/procedures/ventas_contables_por_cliente.sql b/db/routines/bs/procedures/ventas_contables_por_cliente.sql index 26ba670b1..ed3773cf7 100644 --- a/db/routines/bs/procedures/ventas_contables_por_cliente.sql +++ b/db/routines/bs/procedures/ventas_contables_por_cliente.sql @@ -10,13 +10,13 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; CREATE TEMPORARY TABLE tmp.ticket_list - (PRIMARY KEY (Id_Ticket)) - SELECT Id_Ticket - FROM vn2008.Tickets t - JOIN vn.invoiceOut io ON io.id = t.Factura + (PRIMARY KEY (id)) + SELECT t.id + FROM vn.ticket t + JOIN vn.invoiceOut io ON io.id = t.refFk WHERE year(io.issued) = vYear - AND month(io.issued) = vMonth; - + AND month(io.issued) = vMonth; + SELECT vYear Año, vMonth Mes, t.clientFk Id_Cliente, @@ -40,7 +40,7 @@ BEGIN AND m.Descuento <> 100 AND a.tipo_id != 188 GROUP BY t.clientFk, grupo,t.companyFk; - + DROP TEMPORARY TABLE tmp.ticket_list; END$$ diff --git a/db/routines/vn2008/views/Rutas.sql b/db/routines/vn2008/views/Rutas.sql deleted file mode 100644 index 78b3bb471..000000000 --- a/db/routines/vn2008/views/Rutas.sql +++ /dev/null @@ -1,19 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`Rutas` -AS SELECT `r`.`id` AS `Id_Ruta`, - `r`.`workerFk` AS `Id_Trabajador`, - `r`.`created` AS `Fecha`, - `r`.`vehicleFk` AS `Id_Vehiculo`, - `r`.`agencyModeFk` AS `Id_Agencia`, - `r`.`time` AS `Hora`, - `r`.`isOk` AS `ok`, - `r`.`kmStart` AS `km_start`, - `r`.`kmEnd` AS `km_end`, - `r`.`started` AS `date_start`, - `r`.`finished` AS `date_end`, - `r`.`gestdocFk` AS `gestdoc_id`, - `r`.`cost` AS `cost`, - `r`.`m3` AS `m3`, - `r`.`description` AS `description` -FROM `vn`.`route` `r` diff --git a/db/routines/vn2008/views/state.sql b/db/routines/vn2008/views/state.sql deleted file mode 100644 index 63f6589af..000000000 --- a/db/routines/vn2008/views/state.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`state` -AS SELECT `s`.`id` AS `id`, - `s`.`name` AS `name`, - `s`.`order` AS `order`, - `s`.`alertLevel` AS `alert_level`, - `s`.`code` AS `code`, - `s`.`sectorProdPriority` AS `sectorProdPriority`, - `s`.`nextStateFk` AS `nextStateFk`, - `s`.`isPreviousPreparable` AS `isPreviousPreparable`, - `s`.`isPicked` AS `isPicked` -FROM `vn`.`state` `s` diff --git a/db/routines/vn2008/views/tag.sql b/db/routines/vn2008/views/tag.sql deleted file mode 100644 index 25b3ab82e..000000000 --- a/db/routines/vn2008/views/tag.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`tag` -AS SELECT `t`.`id` AS `id`, - `t`.`name` AS `name`, - `t`.`isFree` AS `isFree`, - `t`.`isQuantitatif` AS `isQuantitatif`, - `t`.`sourceTable` AS `sourceTable`, - `t`.`unit` AS `unit` -FROM `vn`.`tag` `t` diff --git a/db/routines/vn2008/views/tarifa_componentes.sql b/db/routines/vn2008/views/tarifa_componentes.sql deleted file mode 100644 index bec53abd9..000000000 --- a/db/routines/vn2008/views/tarifa_componentes.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`tarifa_componentes` -AS SELECT `tarifa_componentes`.`Id_Componente` AS `Id_Componente`, - `tarifa_componentes`.`Componente` AS `Componente`, - `tarifa_componentes`.`tarifa_componentes_series_id` AS `tarifa_componentes_series_id`, - `tarifa_componentes`.`tarifa_class` AS `tarifa_class`, - `tarifa_componentes`.`tax` AS `tax`, - `tarifa_componentes`.`is_renewable` AS `is_renewable` -FROM `bi`.`tarifa_componentes` diff --git a/db/routines/vn2008/views/tarifa_componentes_series.sql b/db/routines/vn2008/views/tarifa_componentes_series.sql deleted file mode 100644 index a1d188709..000000000 --- a/db/routines/vn2008/views/tarifa_componentes_series.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`tarifa_componentes_series` -AS SELECT `tarifa_componentes_series`.`tarifa_componentes_series_id` AS `tarifa_componentes_series_id`, - `tarifa_componentes_series`.`Serie` AS `Serie`, - `tarifa_componentes_series`.`base` AS `base` -FROM `bi`.`tarifa_componentes_series` diff --git a/db/routines/vn2008/views/tblContadores.sql b/db/routines/vn2008/views/tblContadores.sql deleted file mode 100644 index 129d3ce8b..000000000 --- a/db/routines/vn2008/views/tblContadores.sql +++ /dev/null @@ -1,39 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`tblContadores` -AS SELECT `c`.`id` AS `id`, - `c`.`ochoa` AS `ochoa`, - `c`.`invoiceOutFk` AS `nfactura`, - `c`.`inventoried` AS `FechaInventario`, - `c`.`itemLog` AS `HistoricoArticulo`, - `c`.`weekGoal` AS `week_goal`, - `c`.`photosPath` AS `Rutafotos`, - `c`.`cashBoxNumber` AS `numCaja`, - `c`.`redCode` AS `CodigoRojo`, - `c`.`TabletTime` AS `Tablet_Hora`, - `c`.`t0` AS `t0`, - `c`.`t1` AS `t1`, - `c`.`t2` AS `t2`, - `c`.`t3` AS `t3`, - `c`.`cc` AS `cc`, - `c`.`palet` AS `palet`, - `c`.`campaign` AS `campaign`, - `c`.`campaignLife` AS `campaign_life`, - `c`.`truckDays` AS `truck_days`, - `c`.`transportCharges` AS `tasa_transporte`, - `c`.`escanerPath` AS `escaner_path`, - `c`.`printedTurn` AS `turnoimpreso`, - `c`.`truckLength` AS `truck_length`, - `c`.`fuelConsumption` AS `fuel_consumption`, - `c`.`petrol` AS `petrol`, - `c`.`maintenance` AS `maintenance`, - `c`.`hourPrice` AS `hour_price`, - `c`.`meterPrice` AS `meter_price`, - `c`.`kmPrice` AS `km_price`, - `c`.`routeOption` AS `route_option`, - `c`.`dbproduccion` AS `dbproduccion`, - `c`.`mdbServer` AS `mdbServer`, - `c`.`fakeEmail` AS `fakeEmail`, - `c`.`defaultersMaxAmount` AS `defaultersMaxAmount`, - `c`.`ASIEN` AS `ASIEN` -FROM `vn`.`config` `c` diff --git a/db/routines/vn2008/views/thermograph.sql b/db/routines/vn2008/views/thermograph.sql deleted file mode 100644 index f51b83d24..000000000 --- a/db/routines/vn2008/views/thermograph.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`thermograph` -AS SELECT `t`.`id` AS `thermograph_id`, - `t`.`model` AS `model` -FROM `vn`.`thermograph` `t` diff --git a/db/routines/vn2008/views/ticket_observation.sql b/db/routines/vn2008/views/ticket_observation.sql deleted file mode 100644 index deb85e4b6..000000000 --- a/db/routines/vn2008/views/ticket_observation.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`ticket_observation` -AS SELECT `to`.`id` AS `ticket_observation_id`, - `to`.`ticketFk` AS `Id_Ticket`, - `to`.`observationTypeFk` AS `observation_type_id`, - `to`.`description` AS `text` -FROM `vn`.`ticketObservation` `to` diff --git a/db/routines/vn2008/views/tickets_gestdoc.sql b/db/routines/vn2008/views/tickets_gestdoc.sql deleted file mode 100644 index a8682db57..000000000 --- a/db/routines/vn2008/views/tickets_gestdoc.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`tickets_gestdoc` -AS SELECT `td`.`ticketFk` AS `Id_Ticket`, - `td`.`dmsFk` AS `gestdoc_id` -FROM `vn`.`ticketDms` `td` diff --git a/db/versions/10921-bronzeAralia/00-firstScript.sql b/db/versions/10921-bronzeAralia/00-firstScript.sql deleted file mode 100644 index 55aa03dca..000000000 --- a/db/versions/10921-bronzeAralia/00-firstScript.sql +++ /dev/null @@ -1,49 +0,0 @@ --- Para evitar el error al hacer myt run -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`Clientes` -AS SELECT `c`.`id` AS `id_cliente`, - `c`.`name` AS `cliente`, - `c`.`fi` AS `if`, - `c`.`socialName` AS `razonSocial`, - `c`.`contact` AS `contacto`, - `c`.`street` AS `domicilio`, - `c`.`city` AS `poblacion`, - `c`.`postcode` AS `codPostal`, - `c`.`phone` AS `telefono`, - `c`.`mobile` AS `movil`, - `c`.`isRelevant` AS `real`, - `c`.`email` AS `e-mail`, - `c`.`iban` AS `iban`, - `c`.`dueDay` AS `vencimiento`, - `c`.`accountingAccount` AS `Cuenta`, - `c`.`isEqualizated` AS `RE`, - `c`.`provinceFk` AS `province_id`, - `c`.`hasToInvoice` AS `invoice`, - `c`.`credit` AS `credito`, - `c`.`countryFk` AS `Id_Pais`, - `c`.`isActive` AS `activo`, - `c`.`gestdocFk` AS `gestdoc_id`, - `c`.`quality` AS `calidad`, - `c`.`payMethodFk` AS `pay_met_id`, - `c`.`created` AS `created`, - `c`.`isToBeMailed` AS `mail`, - `c`.`contactChannelFk` AS `chanel_id`, - `c`.`hasSepaVnl` AS `sepaVnl`, - `c`.`hasCoreVnl` AS `coreVnl`, - `c`.`hasCoreVnh` AS `coreVnh`, - `c`.`hasLcr` AS `hasLcr`, - `c`.`defaultAddressFk` AS `default_address`, - `c`.`riskCalculated` AS `risk_calculated`, - `c`.`hasToInvoiceByAddress` AS `invoiceByAddress`, - `c`.`isTaxDataChecked` AS `contabilizado`, - `c`.`isFreezed` AS `congelado`, - `c`.`creditInsurance` AS `creditInsurance`, - `c`.`isCreatedAsServed` AS `isCreatedAsServed`, - `c`.`hasInvoiceSimplified` AS `hasInvoiceSimplified`, - `c`.`salesPersonFk` AS `Id_Trabajador`, - `c`.`isVies` AS `vies`, - `c`.`eypbc` AS `EYPBC`, - `c`.`bankEntityFk` AS `bankEntityFk`, - `c`.`typeFk` AS `typeFk` -FROM `vn`.`client` `c`; \ No newline at end of file From 67172676139a69aa27d52566856590d4d9734b3f Mon Sep 17 00:00:00 2001 From: Sergio De la torre Date: Wed, 10 Apr 2024 11:23:33 +0200 Subject: [PATCH 11/33] refs ~6921 feat:addNoteFromDelivery --- .../vn/procedures/addNoteFromDelivery.sql | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/db/routines/vn/procedures/addNoteFromDelivery.sql b/db/routines/vn/procedures/addNoteFromDelivery.sql index 61295b7db..37bb198ad 100644 --- a/db/routines/vn/procedures/addNoteFromDelivery.sql +++ b/db/routines/vn/procedures/addNoteFromDelivery.sql @@ -1,13 +1,20 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`addNoteFromDelivery`(idTicket INT,nota TEXT) +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`addNoteFromDelivery`(vTicketFk INT, vDescription TEXT, vCode VARCHAR(45)) BEGIN - - DECLARE observationTypeFk INT DEFAULT 3; /*3 = REPARTIDOR*/ - INSERT INTO ticketObservation(ticketFk,observationTypeFk,description) - VALUES (idTicket,observationTypeFk,nota) - ON DUPLICATE KEY UPDATE description = CONCAT(ticketObservation.description,VALUES(description),' '); + /** + * Inserta observaciones para los tickets + * + * @param vTicketFk Identificador del ticket + * @param vDescription Texto de la nota a insertar + * param vCode Identificador del tipo de nota + */ + INSERT INTO ticketObservation(ticketFk, observationTypeFk, description) + SELECT vTicketFk, id, vDescription + FROM vn.observationType + WHERE code = vCode + ON DUPLICATE KEY UPDATE description = CONCAT(ticketObservation.description, VALUES(description),' '); END$$ DELIMITER ; From 0956dbc7b1c2f280ac745d50bc5ac841e8cb9061 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Wed, 10 Apr 2024 11:32:45 +0200 Subject: [PATCH 12/33] refs #6921 feat: addFromDelivery --- db/versions/10987-tealMonstera/00-firstScript.sql | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 db/versions/10987-tealMonstera/00-firstScript.sql diff --git a/db/versions/10987-tealMonstera/00-firstScript.sql b/db/versions/10987-tealMonstera/00-firstScript.sql new file mode 100644 index 000000000..e78d54fd4 --- /dev/null +++ b/db/versions/10987-tealMonstera/00-firstScript.sql @@ -0,0 +1,4 @@ +-- Place your SQL code here + +USE vn; +INSERT INTO vn.observationType (description,code) VALUES ('Entrega','dropOff') \ No newline at end of file From b46102653b24bba10c087bcd4819f9b6284e4c8c Mon Sep 17 00:00:00 2001 From: sergiodt Date: Wed, 10 Apr 2024 11:35:28 +0200 Subject: [PATCH 13/33] refs #6921 feat: addFromDelivery --- db/routines/vn/procedures/addNoteFromDelivery.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/addNoteFromDelivery.sql b/db/routines/vn/procedures/addNoteFromDelivery.sql index 37bb198ad..7431d4f49 100644 --- a/db/routines/vn/procedures/addNoteFromDelivery.sql +++ b/db/routines/vn/procedures/addNoteFromDelivery.sql @@ -7,7 +7,7 @@ BEGIN * * @param vTicketFk Identificador del ticket * @param vDescription Texto de la nota a insertar - * param vCode Identificador del tipo de nota + * @param vCode Identificador del tipo de nota */ INSERT INTO ticketObservation(ticketFk, observationTypeFk, description) From 9c373d9ef3d9fa83ee5cd2fb306665c5f9575a21 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Wed, 10 Apr 2024 12:02:25 +0200 Subject: [PATCH 14/33] refs #6921 feat: getTicketsObservations --- modules/route/back/methods/route/getTickets.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/route/back/methods/route/getTickets.js b/modules/route/back/methods/route/getTickets.js index 59ba389ed..6f7162178 100644 --- a/modules/route/back/methods/route/getTickets.js +++ b/modules/route/back/methods/route/getTickets.js @@ -44,13 +44,13 @@ module.exports = Self => { st.name ticketStateName, wh.name warehouseName, tob.description ticketObservation, + tob2.description ticketObservationDropOff, a.street, a.postalCode, a.city, am.name agencyModeName, u.nickname userNickname, vn.ticketTotalVolume(t.id) volume, - tob.description, GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt, c.phone clientPhone, c.mobile clientMobile, @@ -72,6 +72,9 @@ module.exports = Self => { LEFT JOIN observationType ot ON ot.code = 'delivery' LEFT JOIN ticketObservation tob ON tob.ticketFk = t.id AND tob.observationTypeFk = ot.id + LEFT JOIN observationType ot2 ON ot2.code = 'dropOff' + LEFT JOIN ticketObservation tob2 ON tob2.ticketFk = t.id + AND tob2.observationTypeFk = ot2.id LEFT JOIN address a ON a.id = t.addressFk LEFT JOIN agencyMode am ON am.id = t.agencyModeFk LEFT JOIN account.user u ON u.id = r.workerFk From d24de61213e68fea6df21da0d8e7ae7c970a62c3 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Tue, 16 Apr 2024 08:29:39 +0200 Subject: [PATCH 15/33] refs #6921 feat: addFromDelivery --- modules/route/back/methods/route/getTickets.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/route/back/methods/route/getTickets.js b/modules/route/back/methods/route/getTickets.js index 6f7162178..2393018cf 100644 --- a/modules/route/back/methods/route/getTickets.js +++ b/modules/route/back/methods/route/getTickets.js @@ -43,8 +43,9 @@ module.exports = Self => { st.code ticketStateCode, st.name ticketStateName, wh.name warehouseName, - tob.description ticketObservation, - tob2.description ticketObservationDropOff, + tob.description observationDelivery, + tob2.description observationDropOff, + tob2.id, a.street, a.postalCode, a.city, From 32e2827287161a494541f6ff97a8f267c1fe6ba8 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Wed, 17 Apr 2024 13:55:07 +0200 Subject: [PATCH 16/33] refs #6921 feat: addFromDelivery --- db/dump/fixtures.before.sql | 3 +- ...-firstScript.sql => 00-firstScript.vn.sql} | 2 +- .../methods/ticket-observation/addDropOff.js | 54 +++++++++++++++++++ .../specs/addDropOff.spec.js | 37 +++++++++++++ .../ticket/back/models/ticket-observation.js | 1 + 5 files changed, 95 insertions(+), 2 deletions(-) rename db/versions/10987-tealMonstera/{00-firstScript.sql => 00-firstScript.vn.sql} (87%) create mode 100644 modules/ticket/back/methods/ticket-observation/addDropOff.js create mode 100644 modules/ticket/back/methods/ticket-observation/specs/addDropOff.spec.js diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 8660d61c9..30564d8a2 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -527,7 +527,8 @@ INSERT INTO `vn`.`observationType`(`id`,`description`, `code`) (4, 'SalesPerson', 'salesPerson'), (5, 'Administrative', 'administrative'), (6, 'Weight', 'weight'), - (7, 'InvoiceOut', 'invoiceOut'); + (7, 'InvoiceOut', 'invoiceOut'), + (8, 'DropOff', 'dropOff'); INSERT INTO `vn`.`addressObservation`(`id`,`addressFk`,`observationTypeFk`,`description`) VALUES diff --git a/db/versions/10987-tealMonstera/00-firstScript.sql b/db/versions/10987-tealMonstera/00-firstScript.vn.sql similarity index 87% rename from db/versions/10987-tealMonstera/00-firstScript.sql rename to db/versions/10987-tealMonstera/00-firstScript.vn.sql index e78d54fd4..d24ddd5de 100644 --- a/db/versions/10987-tealMonstera/00-firstScript.sql +++ b/db/versions/10987-tealMonstera/00-firstScript.vn.sql @@ -1,4 +1,4 @@ -- Place your SQL code here USE vn; -INSERT INTO vn.observationType (description,code) VALUES ('Entrega','dropOff') \ No newline at end of file +INSERT INTO vn.observationType (description,code) VALUES ('Entrega','dropOff'); \ No newline at end of file diff --git a/modules/ticket/back/methods/ticket-observation/addDropOff.js b/modules/ticket/back/methods/ticket-observation/addDropOff.js new file mode 100644 index 000000000..52a12a58e --- /dev/null +++ b/modules/ticket/back/methods/ticket-observation/addDropOff.js @@ -0,0 +1,54 @@ + +module.exports = Self => { + Self.remoteMethod('addDropOff', { + description: 'Add a dropOff note in a ticket', + accessType: 'WRITE', + accepts: [{ + arg: 'ticketFk', + type: 'number', + required: true, + description: 'ticket ID' + }, { + arg: 'note', + type: 'string', + required: true, + description: 'note text' + }], + + http: { + path: `/addDropOff`, + verb: 'post' + } + }); + + Self.addDropOff = async(ticketFk, note, options) => { + const models = Self.app.models; + const myOptions = {}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + try { + const observationTypeDropOff = await models.ObservationType.findOne({ + where: {code: 'dropOff'} + }, myOptions); + + await models.TicketObservation.create({ + ticketFk: ticketFk, + observationTypeFk: observationTypeDropOff.id, + description: note + + }, myOptions); + + if (tx) await tx.commit(); + } catch (error) { + if (tx) await tx.rollback(); + throw error; + } + }; +}; diff --git a/modules/ticket/back/methods/ticket-observation/specs/addDropOff.spec.js b/modules/ticket/back/methods/ticket-observation/specs/addDropOff.spec.js new file mode 100644 index 000000000..1034dbe67 --- /dev/null +++ b/modules/ticket/back/methods/ticket-observation/specs/addDropOff.spec.js @@ -0,0 +1,37 @@ +const {models} = require('vn-loopback/server/server'); + +describe('ticketObservation addDropOff()', () => { + const ticketFk = 5; + const note = 'DropOff note'; + const code = 'dropOff'; + + it('should return a dropOff note', async() => { + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await models.TicketObservation.beginTransaction({}); + myOptions.transaction = tx; + } + try { + await models.TicketObservation.addDropOff( + ticketFk, note, myOptions); + + const observationTypeDropOff = await models.TicketObservation.find({ + where: { + ticketFk, + code + } + }, myOptions); + + expect(observationTypeDropOff.length).toEqual(1); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/ticket/back/models/ticket-observation.js b/modules/ticket/back/models/ticket-observation.js index 77d15d85c..3076484bf 100644 --- a/modules/ticket/back/models/ticket-observation.js +++ b/modules/ticket/back/models/ticket-observation.js @@ -1,6 +1,7 @@ const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { + require('../methods/ticket-observation/addDropOff')(Self); Self.rewriteDbError(function(err) { if (err.code === 'ER_DUP_ENTRY') return new UserError(`The observation type can't be repeated`); From 3f291da02ce8a52654f2707b9f5a08db29265148 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Wed, 17 Apr 2024 13:57:56 +0200 Subject: [PATCH 17/33] refs #6921 feat: addFromDelivery --- .../vn/procedures/addNoteFromDelivery.sql | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/db/routines/vn/procedures/addNoteFromDelivery.sql b/db/routines/vn/procedures/addNoteFromDelivery.sql index 7431d4f49..61295b7db 100644 --- a/db/routines/vn/procedures/addNoteFromDelivery.sql +++ b/db/routines/vn/procedures/addNoteFromDelivery.sql @@ -1,20 +1,13 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`addNoteFromDelivery`(vTicketFk INT, vDescription TEXT, vCode VARCHAR(45)) +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`addNoteFromDelivery`(idTicket INT,nota TEXT) BEGIN + + DECLARE observationTypeFk INT DEFAULT 3; /*3 = REPARTIDOR*/ - /** - * Inserta observaciones para los tickets - * - * @param vTicketFk Identificador del ticket - * @param vDescription Texto de la nota a insertar - * @param vCode Identificador del tipo de nota - */ + INSERT INTO ticketObservation(ticketFk,observationTypeFk,description) + VALUES (idTicket,observationTypeFk,nota) + ON DUPLICATE KEY UPDATE description = CONCAT(ticketObservation.description,VALUES(description),' '); - INSERT INTO ticketObservation(ticketFk, observationTypeFk, description) - SELECT vTicketFk, id, vDescription - FROM vn.observationType - WHERE code = vCode - ON DUPLICATE KEY UPDATE description = CONCAT(ticketObservation.description, VALUES(description),' '); END$$ DELIMITER ; From e909d647579befa0b0361311f4f5e8c0d4e6b8ad Mon Sep 17 00:00:00 2001 From: sergiodt Date: Thu, 18 Apr 2024 10:01:22 +0200 Subject: [PATCH 18/33] refs #6921 feat: addFromDelivery --- .../methods/ticket-observation/addDropOff.js | 28 ++++++------------- .../specs/addDropOff.spec.js | 14 +++------- 2 files changed, 12 insertions(+), 30 deletions(-) diff --git a/modules/ticket/back/methods/ticket-observation/addDropOff.js b/modules/ticket/back/methods/ticket-observation/addDropOff.js index 52a12a58e..5f773f593 100644 --- a/modules/ticket/back/methods/ticket-observation/addDropOff.js +++ b/modules/ticket/back/methods/ticket-observation/addDropOff.js @@ -24,31 +24,19 @@ module.exports = Self => { Self.addDropOff = async(ticketFk, note, options) => { const models = Self.app.models; const myOptions = {}; - let tx; if (typeof options == 'object') Object.assign(myOptions, options); - if (!myOptions.transaction) { - tx = await Self.beginTransaction({}); - myOptions.transaction = tx; - } - try { - const observationTypeDropOff = await models.ObservationType.findOne({ - where: {code: 'dropOff'} - }, myOptions); + const observationTypeDropOff = await models.ObservationType.findOne({ + where: {code: 'dropOff'} + }, myOptions); - await models.TicketObservation.create({ - ticketFk: ticketFk, - observationTypeFk: observationTypeDropOff.id, - description: note + await models.TicketObservation.create({ + ticketFk: ticketFk, + observationTypeFk: observationTypeDropOff.id, + description: note - }, myOptions); - - if (tx) await tx.commit(); - } catch (error) { - if (tx) await tx.rollback(); - throw error; - } + }, myOptions); }; }; diff --git a/modules/ticket/back/methods/ticket-observation/specs/addDropOff.spec.js b/modules/ticket/back/methods/ticket-observation/specs/addDropOff.spec.js index 1034dbe67..82c692946 100644 --- a/modules/ticket/back/methods/ticket-observation/specs/addDropOff.spec.js +++ b/modules/ticket/back/methods/ticket-observation/specs/addDropOff.spec.js @@ -6,25 +6,19 @@ describe('ticketObservation addDropOff()', () => { const code = 'dropOff'; it('should return a dropOff note', async() => { - const myOptions = {}; + const tx = await models.TicketObservation.beginTransaction({}); - if (typeof options == 'object') - Object.assign(myOptions, options); - - if (!myOptions.transaction) { - tx = await models.TicketObservation.beginTransaction({}); - myOptions.transaction = tx; - } try { + const options = {transaction: tx}; await models.TicketObservation.addDropOff( - ticketFk, note, myOptions); + ticketFk, note, options); const observationTypeDropOff = await models.TicketObservation.find({ where: { ticketFk, code } - }, myOptions); + }, options); expect(observationTypeDropOff.length).toEqual(1); From 9295bddaa84bc15c66319d50f3d35b1fee212e61 Mon Sep 17 00:00:00 2001 From: robert Date: Thu, 18 Apr 2024 13:06:45 +0200 Subject: [PATCH 19/33] feat: refs #174903 item_getSimilar --- db/routines/vn/procedures/item_getSimilar.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/item_getSimilar.sql b/db/routines/vn/procedures/item_getSimilar.sql index f79bed375..f7126c1a5 100644 --- a/db/routines/vn/procedures/item_getSimilar.sql +++ b/db/routines/vn/procedures/item_getSimilar.sql @@ -65,7 +65,9 @@ BEGIN WHEN b.groupingMode = 2 THEN b.packing ELSE 1 END AS minQuantity, - iss.visible located + iss.visible located, + b.price2, + b.price3 FROM vn.item i JOIN cache.available a ON a.item_id = i.id AND a.calc_id = vCalcFk From 067e71e3ce0ff545cc1a38e8b97148e9438dcf31 Mon Sep 17 00:00:00 2001 From: robert Date: Fri, 19 Apr 2024 07:48:45 +0200 Subject: [PATCH 20/33] feat: refs #6777 puppeteer --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index d700ce1f9..bfe31fc60 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -71,6 +71,7 @@ pipeline { stage('Back') { steps { sh 'pnpm install --prefer-offline' + sh 'node node_modules/puppeteer/install.mjs' } } stage('Print') { From 322d91d81404f5d2d5ec001749ca9f7a639ea180 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 19 Apr 2024 10:49:57 +0200 Subject: [PATCH 21/33] feat(salix): refs #6930 Add DEFAULT scope --- back/methods/dms/downloadFile.js | 2 +- back/methods/docuware/download.js | 2 +- back/methods/image/download.js | 2 +- modules/claim/back/methods/claim/claimPickupPdf.js | 2 +- modules/claim/back/methods/claim/downloadFile.js | 2 +- modules/client/back/methods/client/campaignMetricsPdf.js | 2 +- modules/entry/back/methods/entry/entryOrderPdf.js | 2 +- modules/invoiceOut/back/methods/invoiceOut/download.js | 2 +- modules/invoiceOut/back/methods/invoiceOut/downloadZip.js | 2 +- modules/invoiceOut/back/methods/invoiceOut/exportationPdf.js | 2 +- modules/invoiceOut/back/methods/invoiceOut/invoiceCsv.js | 2 +- modules/invoiceOut/back/methods/invoiceOut/negativeBasesCsv.js | 2 +- modules/item/back/methods/item-image-queue/download.js | 2 +- modules/route/back/methods/route/cmr.js | 2 +- modules/route/back/methods/route/downloadCmrsZip.js | 2 +- modules/route/back/methods/route/downloadZip.js | 2 +- modules/route/back/methods/route/driverRoutePdf.js | 2 +- modules/supplier/back/methods/supplier/campaignMetricsPdf.js | 2 +- modules/ticket/back/methods/ticket/deliveryNoteCsv.js | 2 +- modules/ticket/back/methods/ticket/deliveryNotePdf.js | 2 +- modules/travel/back/methods/travel/extraCommunityPdf.js | 2 +- modules/worker/back/methods/worker-dms/downloadFile.js | 2 +- 22 files changed, 22 insertions(+), 22 deletions(-) diff --git a/back/methods/dms/downloadFile.js b/back/methods/dms/downloadFile.js index d64b15b70..9290188a1 100644 --- a/back/methods/dms/downloadFile.js +++ b/back/methods/dms/downloadFile.js @@ -30,7 +30,7 @@ module.exports = Self => { path: `/:id/downloadFile`, verb: 'GET' }, - accessScopes: ['read:multimedia'] + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.downloadFile = async function(ctx, id) { diff --git a/back/methods/docuware/download.js b/back/methods/docuware/download.js index a1776cde5..eb575236d 100644 --- a/back/methods/docuware/download.js +++ b/back/methods/docuware/download.js @@ -43,7 +43,7 @@ module.exports = Self => { path: `/:id/download`, verb: 'GET' }, - accessScopes: ['read:multimedia'] + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.download = async function(id, fileCabinet, filter) { diff --git a/back/methods/image/download.js b/back/methods/image/download.js index 201e16164..e0fcb0951 100644 --- a/back/methods/image/download.js +++ b/back/methods/image/download.js @@ -48,7 +48,7 @@ module.exports = Self => { path: `/:collection/:size/:id/download`, verb: 'GET' }, - accessScopes: ['read:multimedia'] + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.download = async function(ctx, collection, size, id) { diff --git a/modules/claim/back/methods/claim/claimPickupPdf.js b/modules/claim/back/methods/claim/claimPickupPdf.js index 4b66bd418..232c134f6 100644 --- a/modules/claim/back/methods/claim/claimPickupPdf.js +++ b/modules/claim/back/methods/claim/claimPickupPdf.js @@ -35,7 +35,7 @@ module.exports = Self => { path: '/:id/claim-pickup-pdf', verb: 'GET' }, - accessScopes: ['read:multimedia'] + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.claimPickupPdf = (ctx, id) => Self.printReport(ctx, id, 'claim-pickup-order'); diff --git a/modules/claim/back/methods/claim/downloadFile.js b/modules/claim/back/methods/claim/downloadFile.js index 61784f39e..ffcf51367 100644 --- a/modules/claim/back/methods/claim/downloadFile.js +++ b/modules/claim/back/methods/claim/downloadFile.js @@ -33,7 +33,7 @@ module.exports = Self => { path: `/:id/downloadFile`, verb: 'GET' }, - accessScopes: ['read:multimedia'] + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.downloadFile = async function(ctx, id) { diff --git a/modules/client/back/methods/client/campaignMetricsPdf.js b/modules/client/back/methods/client/campaignMetricsPdf.js index 20c35494e..dc89a6802 100644 --- a/modules/client/back/methods/client/campaignMetricsPdf.js +++ b/modules/client/back/methods/client/campaignMetricsPdf.js @@ -46,7 +46,7 @@ module.exports = Self => { path: '/:id/campaign-metrics-pdf', verb: 'GET' }, - accessScopes: ['read:multimedia'] + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.campaignMetricsPdf = (ctx, id) => Self.printReport(ctx, id, 'campaign-metrics'); diff --git a/modules/entry/back/methods/entry/entryOrderPdf.js b/modules/entry/back/methods/entry/entryOrderPdf.js index 93c1b6bd9..7a432123e 100644 --- a/modules/entry/back/methods/entry/entryOrderPdf.js +++ b/modules/entry/back/methods/entry/entryOrderPdf.js @@ -34,7 +34,7 @@ module.exports = Self => { path: '/:id/entry-order-pdf', verb: 'GET' }, - accessScopes: ['read:multimedia'] + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.entryOrderPdf = (ctx, id) => Self.printReport(ctx, id, 'entry-order'); diff --git a/modules/invoiceOut/back/methods/invoiceOut/download.js b/modules/invoiceOut/back/methods/invoiceOut/download.js index cb71121d5..748e2df17 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/download.js +++ b/modules/invoiceOut/back/methods/invoiceOut/download.js @@ -32,7 +32,7 @@ module.exports = Self => { path: '/:id/download', verb: 'GET' }, - accessScopes: ['read:multimedia'] + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.download = async function(ctx, id, options) { diff --git a/modules/invoiceOut/back/methods/invoiceOut/downloadZip.js b/modules/invoiceOut/back/methods/invoiceOut/downloadZip.js index 4f2a8aab3..8d6e7c6d9 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/downloadZip.js +++ b/modules/invoiceOut/back/methods/invoiceOut/downloadZip.js @@ -32,7 +32,7 @@ module.exports = Self => { path: '/downloadZip', verb: 'GET' }, - accessScopes: ['read:multimedia'] + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.downloadZip = async function(ctx, ids, options) { diff --git a/modules/invoiceOut/back/methods/invoiceOut/exportationPdf.js b/modules/invoiceOut/back/methods/invoiceOut/exportationPdf.js index 0b08aec6d..6c4845c11 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/exportationPdf.js +++ b/modules/invoiceOut/back/methods/invoiceOut/exportationPdf.js @@ -35,7 +35,7 @@ module.exports = Self => { path: '/:reference/exportation-pdf', verb: 'GET' }, - accessScopes: ['read:multimedia'] + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.exportationPdf = (ctx, reference) => Self.printReport(ctx, reference, 'exportation'); diff --git a/modules/invoiceOut/back/methods/invoiceOut/invoiceCsv.js b/modules/invoiceOut/back/methods/invoiceOut/invoiceCsv.js index 6822e5a23..fd754d51b 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/invoiceCsv.js +++ b/modules/invoiceOut/back/methods/invoiceOut/invoiceCsv.js @@ -38,7 +38,7 @@ module.exports = Self => { path: '/:reference/invoice-csv', verb: 'GET' }, - accessScopes: ['read:multimedia'] + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.invoiceCsv = async reference => { diff --git a/modules/invoiceOut/back/methods/invoiceOut/negativeBasesCsv.js b/modules/invoiceOut/back/methods/invoiceOut/negativeBasesCsv.js index 6ac56b68c..3e466d1f4 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/negativeBasesCsv.js +++ b/modules/invoiceOut/back/methods/invoiceOut/negativeBasesCsv.js @@ -40,7 +40,7 @@ module.exports = Self => { path: '/negativeBasesCsv', verb: 'GET' }, - accessScopes: ['read:multimedia'] + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.negativeBasesCsv = async(ctx, options) => { diff --git a/modules/item/back/methods/item-image-queue/download.js b/modules/item/back/methods/item-image-queue/download.js index e1bc248ae..001a2b950 100644 --- a/modules/item/back/methods/item-image-queue/download.js +++ b/modules/item/back/methods/item-image-queue/download.js @@ -11,7 +11,7 @@ module.exports = Self => { path: `/download`, verb: 'POST', }, - accessScopes: ['read:multimedia'] + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.download = async() => { diff --git a/modules/route/back/methods/route/cmr.js b/modules/route/back/methods/route/cmr.js index 08a8182e0..5033dee2f 100644 --- a/modules/route/back/methods/route/cmr.js +++ b/modules/route/back/methods/route/cmr.js @@ -30,7 +30,7 @@ module.exports = Self => { path: '/:id/cmr', verb: 'GET' }, - accessScopes: ['read:multimedia'] + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.cmr = (ctx, id) => Self.printReport(ctx, id, 'cmr'); diff --git a/modules/route/back/methods/route/downloadCmrsZip.js b/modules/route/back/methods/route/downloadCmrsZip.js index 43f6e9648..c6934edca 100644 --- a/modules/route/back/methods/route/downloadCmrsZip.js +++ b/modules/route/back/methods/route/downloadCmrsZip.js @@ -30,7 +30,7 @@ module.exports = Self => { path: '/downloadCmrsZip', verb: 'GET' }, - accessScopes: ['read:multimedia'] + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.downloadCmrsZip = async function(ctx, ids, options) { diff --git a/modules/route/back/methods/route/downloadZip.js b/modules/route/back/methods/route/downloadZip.js index d7fc30aa3..8eecf62e4 100644 --- a/modules/route/back/methods/route/downloadZip.js +++ b/modules/route/back/methods/route/downloadZip.js @@ -30,7 +30,7 @@ module.exports = Self => { path: '/downloadZip', verb: 'GET' }, - accessScopes: ['read:multimedia'] + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.downloadZip = async function(ctx, id, options) { diff --git a/modules/route/back/methods/route/driverRoutePdf.js b/modules/route/back/methods/route/driverRoutePdf.js index e7b4dee17..69b26d846 100644 --- a/modules/route/back/methods/route/driverRoutePdf.js +++ b/modules/route/back/methods/route/driverRoutePdf.js @@ -35,7 +35,7 @@ module.exports = Self => { path: '/:id/driver-route-pdf', verb: 'GET' }, - accessScopes: ['read:multimedia'] + accessScopes: ['DEFAULT', 'read:multimedia'] }); diff --git a/modules/supplier/back/methods/supplier/campaignMetricsPdf.js b/modules/supplier/back/methods/supplier/campaignMetricsPdf.js index 51c626e69..58282747d 100644 --- a/modules/supplier/back/methods/supplier/campaignMetricsPdf.js +++ b/modules/supplier/back/methods/supplier/campaignMetricsPdf.js @@ -45,7 +45,7 @@ module.exports = Self => { path: '/:id/campaign-metrics-pdf', verb: 'GET' }, - accessScopes: ['read:multimedia'] + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.campaignMetricsPdf = (ctx, id) => Self.printReport(ctx, id, 'supplier-campaign-metrics'); diff --git a/modules/ticket/back/methods/ticket/deliveryNoteCsv.js b/modules/ticket/back/methods/ticket/deliveryNoteCsv.js index 9fa3c183e..f02debba8 100644 --- a/modules/ticket/back/methods/ticket/deliveryNoteCsv.js +++ b/modules/ticket/back/methods/ticket/deliveryNoteCsv.js @@ -38,7 +38,7 @@ module.exports = Self => { path: '/:id/delivery-note-csv', verb: 'GET' }, - accessScopes: ['read:multimedia'] + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.deliveryNoteCsv = async id => { diff --git a/modules/ticket/back/methods/ticket/deliveryNotePdf.js b/modules/ticket/back/methods/ticket/deliveryNotePdf.js index adc9e4435..205f4ba7b 100644 --- a/modules/ticket/back/methods/ticket/deliveryNotePdf.js +++ b/modules/ticket/back/methods/ticket/deliveryNotePdf.js @@ -42,7 +42,7 @@ module.exports = Self => { path: '/:id/delivery-note-pdf', verb: 'GET' }, - accessScopes: ['read:multimedia'] + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.deliveryNotePdf = (ctx, id) => Self.printReport(ctx, id, 'delivery-note'); diff --git a/modules/travel/back/methods/travel/extraCommunityPdf.js b/modules/travel/back/methods/travel/extraCommunityPdf.js index 73748ac50..459e74d69 100644 --- a/modules/travel/back/methods/travel/extraCommunityPdf.js +++ b/modules/travel/back/methods/travel/extraCommunityPdf.js @@ -79,7 +79,7 @@ module.exports = Self => { path: '/extra-community-pdf', verb: 'GET' }, - accessScopes: ['read:multimedia'] + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.extraCommunityPdf = ctx => Self.printReport(ctx, null, 'extra-community'); diff --git a/modules/worker/back/methods/worker-dms/downloadFile.js b/modules/worker/back/methods/worker-dms/downloadFile.js index 08fbcf924..93d685429 100644 --- a/modules/worker/back/methods/worker-dms/downloadFile.js +++ b/modules/worker/back/methods/worker-dms/downloadFile.js @@ -30,7 +30,7 @@ module.exports = Self => { path: `/:id/downloadFile`, verb: 'GET' }, - accessScopes: ['read:multimedia'] + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.downloadFile = async function(ctx, id) { From 30d0db163e875f158c049bb08a383c45a7e52d71 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 19 Apr 2024 10:50:14 +0200 Subject: [PATCH 22/33] feat(salix): refs #6930 minor updates --- .../methods/vn-user/specs/renew-token.spec.js | 5 +- loopback/locale/en.json | 433 +++++++++--------- modules/worker/back/models/worker.json | 4 +- 3 files changed, 223 insertions(+), 219 deletions(-) diff --git a/back/methods/vn-user/specs/renew-token.spec.js b/back/methods/vn-user/specs/renew-token.spec.js index 741388bf9..70e7473d1 100644 --- a/back/methods/vn-user/specs/renew-token.spec.js +++ b/back/methods/vn-user/specs/renew-token.spec.js @@ -28,6 +28,9 @@ describe('Renew Token', () => { }); it('should renew token', async() => { + const {courtesyTime} = await models.AccessTokenConfig.findOne({ + fields: ['courtesyTime'] + }); const mockDate = new Date(startingTime + 26600000); jasmine.clock().mockDate(mockDate); const {id} = await models.VnUser.renewToken(ctx); @@ -35,7 +38,7 @@ describe('Renew Token', () => { expect(id).not.toEqual(ctx.req.accessToken.id); await models.VnUser.logout(ctx.req.accessToken.id); - jasmine.clock().tick(70 * 1000); + jasmine.clock().tick((courtesyTime + 10) * 1000); let tokenNotExists; try { tokenNotExists = await models.AccessToken.findById(ctx.req.accessToken.id); diff --git a/loopback/locale/en.json b/loopback/locale/en.json index a0e60550f..9a3a1f52a 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -1,217 +1,217 @@ { - "State cannot be blank": "State cannot be blank", - "Cannot be blank": "Cannot be blank", - "The credit must be an integer greater than or equal to zero": "The credit must be an integer greater than or equal to zero", - "The grade must be an integer greater than or equal to zero": "The grade must be an integer greater than or equal to zero", - "Invalid email": "Invalid email", - "Name cannot be blank": "Name cannot be blank", - "Phone cannot be blank": "Phone cannot be blank", - "Description should have maximum of 45 characters": "Description should have maximum of 45 characters", - "Period cannot be blank": "Period cannot be blank", - "Sample type cannot be blank": "Sample type cannot be blank", - "That payment method requires an IBAN": "That payment method requires an IBAN", - "That payment method requires a BIC": "That payment method requires a BIC", - "The default consignee can not be unchecked": "The default consignee can not be unchecked", - "Enter an integer different to zero": "Enter an integer different to zero", - "Package cannot be blank": "Package cannot be blank", - "The price of the item changed": "The price of the item changed", - "The sales of this ticket can't be modified": "The sales of this ticket can't be modified", - "Cannot check Equalization Tax in this NIF/CIF": "Cannot check Equalization Tax in this NIF/CIF", - "You can't create an order for a frozen client": "You can't create an order for a frozen client", - "This address doesn't exist": "This address doesn't exist", - "Warehouse cannot be blank": "Warehouse cannot be blank", - "Agency cannot be blank": "Agency cannot be blank", - "The IBAN does not have the correct format": "The IBAN does not have the correct format", - "You can't make changes on the basic data of an confirmed order or with rows": "You can't make changes on the basic data of an confirmed order or with rows", - "You can't create a ticket for an inactive client": "You can't create a ticket for an inactive client", - "Worker cannot be blank": "Worker cannot be blank", - "You must delete the claim id %d first": "You must delete the claim id %d first", - "You don't have enough privileges": "You don't have enough privileges", - "Tag value cannot be blank": "Tag value cannot be blank", - "A client with that Web User name already exists": "A client with that Web User name already exists", - "The warehouse can't be repeated": "The warehouse can't be repeated", - "Barcode must be unique": "Barcode must be unique", - "You don't have enough privileges to do that": "You don't have enough privileges to do that", - "You can't create a ticket for a frozen client": "You can't create a ticket for a frozen client", - "can't be blank": "can't be blank", - "Street cannot be empty": "Street cannot be empty", - "City cannot be empty": "City cannot be empty", - "EXTENSION_INVALID_FORMAT": "Invalid extension", - "The secret can't be blank": "The secret can't be blank", - "Invalid TIN": "Invalid Tax number", - "This ticket can't be invoiced": "This ticket can't be invoiced", - "The value should be a number": "The value should be a number", - "The current ticket can't be modified": "The current ticket can't be modified", - "Extension format is invalid": "Extension format is invalid", - "NO_ZONE_FOR_THIS_PARAMETERS": "NO_ZONE_FOR_THIS_PARAMETERS", - "This client can't be invoiced": "This client can't be invoiced", - "You must provide the correction information to generate a corrective invoice": "You must provide the correction information to generate a corrective invoice", - "The introduced hour already exists": "The introduced hour already exists", - "Invalid parameters to create a new ticket": "Invalid parameters to create a new ticket", - "Concept cannot be blank": "Concept cannot be blank", - "Ticket id cannot be blank": "Ticket id cannot be blank", - "Weekday cannot be blank": "Weekday cannot be blank", - "This ticket can not be modified": "This ticket can not be modified", - "You can't delete a confirmed order": "You can't delete a confirmed order", - "Value has an invalid format": "Value has an invalid format", - "The postcode doesn't exist. Please enter a correct one": "The postcode doesn't exist. Please enter a correct one", - "Swift / BIC can't be empty": "Swift / BIC can't be empty", - "Deleted sales from ticket": "I have deleted the following lines from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}", - "Added sale to ticket": "I have added the following line to the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}", - "Changed sale discount": "I have changed the following lines discounts from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", - "Created claim": "I have created the claim [{{claimId}}]({{{claimUrl}}}) for the following lines from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", - "Changed sale price": "I have changed the price of [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) from {{oldPrice}}€ ➔ *{{newPrice}}€* of the ticket [{{ticketId}}]({{{ticketUrl}}})", - "Changed sale quantity": "I have changed the quantity of [{{itemId}} {{concept}}]({{{itemUrl}}}) from {{oldQuantity}} ➔ *{{newQuantity}}* of the ticket [{{ticketId}}]({{{ticketUrl}}})", - "Changed sale reserved state": "I have changed the following lines reserved state from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", - "Bought units from buy request": "Bought {{quantity}} units of [{{itemId}} {{concept}}]({{{urlItem}}}) for the ticket id [{{ticketId}}]({{{url}}})", - "MESSAGE_INSURANCE_CHANGE": "I have changed the insurence credit of client [{{clientName}} ({{clientId}})]({{{url}}}) to *{{credit}} €*", - "Changed client paymethod": "I have changed the pay method for client [{{clientName}} ({{clientId}})]({{{url}}})", - "Sent units from ticket": "I sent *{{quantity}}* units of [{{concept}} ({{itemId}})]({{{itemUrl}}}) to *\"{{nickname}}\"* coming from ticket id [{{ticketId}}]({{{ticketUrl}}})", - "Change quantity": "{{concept}} change of {{oldQuantity}} to {{newQuantity}}", - "Claim will be picked": "The product from the claim [({{claimId}})]({{{claimUrl}}}) from the client *{{clientName}}* will be picked, with the pickup type *{{claimPickup}}*", - "Claim state has changed to": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *{{newState}}*", - "Customs agent is required for a non UEE member": "Customs agent is required for a non UEE member", - "Incoterms is required for a non UEE member": "Incoterms is required for a non UEE member", - "Client checked as validated despite of duplication": "Client checked as validated despite of duplication from client id {{clientId}}", - "Landing cannot be lesser than shipment": "Landing cannot be lesser than shipment", - "NOT_ZONE_WITH_THIS_PARAMETERS": "There's no zone available for this day", - "Created absence": "The worker {{author}} has added an absence of type '{{absenceType}}' to {{employee}} for day {{dated}}.", - "Deleted absence": "The worker {{author}} has deleted an absence of type '{{absenceType}}' to {{employee}} for day {{dated}}.", - "I have deleted the ticket id": "I have deleted the ticket id [{{id}}]({{{url}}})", - "I have restored the ticket id": "I have restored the ticket id [{{id}}]({{{url}}})", - "Changed this data from the ticket": "I have changed the data from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", - "The grade must be similar to the last one": "The grade must be similar to the last one", - "agencyModeFk": "Agency", - "clientFk": "Client", - "zoneFk": "Zone", - "warehouseFk": "Warehouse", - "shipped": "Shipped", - "landed": "Landed", - "addressFk": "Address", - "companyFk": "Company", - "agency": "Agency", - "delivery": "Delivery", - "You need to fill sage information before you check verified data": "You need to fill sage information before you check verified data", - "The social name cannot be empty": "The social name cannot be empty", - "The nif cannot be empty": "The nif cannot be empty", - "Amount cannot be zero": "Amount cannot be zero", - "Company has to be official": "Company has to be official", - "Unable to clone this travel": "Unable to clone this travel", - "The observation type can't be repeated": "The observation type can't be repeated", - "New ticket request has been created with price": "New ticket request has been created *'{{description}}'* for day *{{shipped}}*, with a quantity of *{{quantity}}* and a price of *{{price}} €*", - "New ticket request has been created": "New ticket request has been created *'{{description}}'* for day *{{shipped}}*, with a quantity of *{{quantity}}*", - "There's a new urgent ticket": "There's a new urgent ticket: [{{title}}](https://cau.verdnatura.es/WorkOrder.do?woMode=viewWO&woID={{issueId}})", - "Swift / BIC cannot be empty": "Swift / BIC cannot be empty", - "Role name must be written in camelCase": "Role name must be written in camelCase", - "Client assignment has changed": "I did change the salesperson ~*\"<{{previousWorkerName}}>\"*~ by *\"<{{currentWorkerName}}>\"* from the client [{{clientName}} ({{clientId}})]({{{url}}})", - "None": "None", - "error densidad = 0": "error densidad = 0", - "This document already exists on this ticket": "This document already exists on this ticket", - "serial non editable": "This serial doesn't allow to set a reference", - "nickname": "nickname", - "State": "State", - "regular": "regular", - "reserved": "reserved", - "Global invoicing failed": "[Global invoicing] Wasn't able to invoice some of the clients", - "A ticket with a negative base can't be invoiced": "A ticket with a negative base can't be invoiced", - "This client is not invoiceable": "This client is not invoiceable", - "INACTIVE_PROVIDER": "Inactive provider", - "reference duplicated": "reference duplicated", - "The PDF document does not exist": "The PDF document does not exists. Try regenerating it from 'Regenerate invoice PDF' option", - "This item is not available": "This item is not available", - "Deny buy request": "Purchase request for ticket id [{{ticketId}}]({{{url}}}) has been rejected. Reason: {{observation}}", - "The type of business must be filled in basic data": "The type of business must be filled in basic data", - "The worker has hours recorded that day": "The worker has hours recorded that day", - "isWithoutNegatives": "isWithoutNegatives", - "routeFk": "routeFk", - "Not enough privileges to edit a client with verified data": "Not enough privileges to edit a client with verified data", - "Can't change the password of another worker": "Can't change the password of another worker", - "No hay un contrato en vigor": "There is no existing contract", - "No está permitido trabajar": "Not allowed to work", - "Dirección incorrecta": "Wrong direction", - "No se permite fichar a futuro": "It is not allowed to sign in the future", - "Descanso diario 12h.": "Daily rest 12h.", - "Fichadas impares": "Odd signs", - "Descanso diario 9h.": "Daily rest 9h.", - "Descanso semanal 36h. / 72h.": "Weekly rest 36h. / 72h.", - "Verify email": "Verify email", - "Click on the following link to verify this email. If you haven't requested this email, just ignore it": "Click on the following link to verify this email. If you haven't requested this email, just ignore it", - "Password does not meet requirements": "Password does not meet requirements", - "You don't have privileges to change the zone": "You don't have privileges to change the zone or for these parameters there are more than one shipping options, talk to agencies", - "Not enough privileges to edit a client": "Not enough privileges to edit a client", - "Claim pickup order sent": "Claim pickup order sent [{{claimId}}]({{{claimUrl}}}) to client *{{clientName}}*", - "You don't have grant privilege": "You don't have grant privilege", - "You don't own the role and you can't assign it to another user": "You don't own the role and you can't assign it to another user", - "Email verify": "Email verify", - "Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) merged with [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})", - "App locked": "App locked by user {{userId}}", - "The sales of the receiver ticket can't be modified": "The sales of the receiver ticket can't be modified", - "Receipt's bank was not found": "Receipt's bank was not found", - "This receipt was not compensated": "This receipt was not compensated", - "Client's email was not found": "Client's email was not found", - "Tickets with associated refunds": "Tickets with associated refunds can't be deleted. This ticket is associated with refund Nº %d", - "It is not possible to modify tracked sales": "It is not possible to modify tracked sales", - "It is not possible to modify sales that their articles are from Floramondo": "It is not possible to modify sales that their articles are from Floramondo", - "It is not possible to modify cloned sales": "It is not possible to modify cloned sales", - "Warehouse inventory not set": "Almacén inventario no está establecido", - "Component cost not set": "Componente coste no está estabecido", - "Description cannot be blank": "Description cannot be blank", - "company": "Company", - "country": "Country", - "clientId": "Id client", - "clientSocialName": "Client", - "amount": "Amount", - "taxableBase": "Taxable base", - "ticketFk": "Id ticket", - "isActive": "Active", - "hasToInvoice": "Invoice", - "isTaxDataChecked": "Data checked", - "comercialId": "Id Comercial", - "comercialName": "Comercial", - "Added observation": "Added observation", - "Comment added to client": "Comment added to client", - "This ticket is already a refund": "This ticket is already a refund", - "A claim with that sale already exists": "A claim with that sale already exists", - "Pass expired": "The password has expired, change it from Salix", - "Can't transfer claimed sales": "Can't transfer claimed sales", - "Invalid quantity": "Invalid quantity", - "Failed to upload delivery note": "Error to upload delivery note {{id}}", - "Mail not sent": "There has been an error sending the invoice to the client [{{clientId}}]({{{clientUrl}}}), please check the email address", - "The renew period has not been exceeded": "The renew period has not been exceeded", - "You can not use the same password": "You can not use the same password", - "Valid priorities": "Valid priorities: %d", - "hasAnyNegativeBase": "Negative basis of tickets: {{ticketsIds}}", - "hasAnyPositiveBase": "Positive basis of tickets: {{ticketsIds}}", - "This ticket cannot be left empty.": "This ticket cannot be left empty. %s", - "Social name should be uppercase": "Social name should be uppercase", - "Street should be uppercase": "Street should be uppercase", - "You don't have enough privileges.": "You don't have enough privileges.", - "This ticket is locked": "This ticket is locked", - "This ticket is not editable.": "This ticket is not editable.", - "The ticket doesn't exist.": "The ticket doesn't exist.", - "The sales do not exists": "The sales do not exists", - "Ticket without Route": "Ticket without route", - "Select a different client": "Select a different client", - "Fill all the fields": "Fill all the fields", - "Error while generating PDF": "Error while generating PDF", - "Can't invoice to future": "Can't invoice to future", - "This ticket is already invoiced": "This ticket is already invoiced", - "Negative basis of tickets: 23": "Negative basis of tickets: 23", - "Booking completed": "Booking complete", - "The ticket is in preparation": "The ticket [{{ticketId}}]({{{ticketUrl}}}) of the sales person {{salesPersonId}} is in preparation", - "You can only add negative amounts in refund tickets": "You can only add negative amounts in refund tickets", - "Bank entity must be specified": "Bank entity must be specified", - "Try again": "Try again", - "keepPrice": "keepPrice", - "Cannot past travels with entries": "Cannot past travels with entries", - "It was not able to remove the next expeditions:": "It was not able to remove the next expeditions: {{expeditions}}", - "Incorrect pin": "Incorrect pin.", - "The notification subscription of this worker cant be modified": "The notification subscription of this worker cant be modified", - "Name should be uppercase": "Name should be uppercase", - "You cannot update these fields": "You cannot update these fields", - "CountryFK cannot be empty": "Country cannot be empty", - "You are not allowed to modify the alias": "You are not allowed to modify the alias", - "You already have the mailAlias": "You already have the mailAlias", + "State cannot be blank": "State cannot be blank", + "Cannot be blank": "Cannot be blank", + "The credit must be an integer greater than or equal to zero": "The credit must be an integer greater than or equal to zero", + "The grade must be an integer greater than or equal to zero": "The grade must be an integer greater than or equal to zero", + "Invalid email": "Invalid email", + "Name cannot be blank": "Name cannot be blank", + "Phone cannot be blank": "Phone cannot be blank", + "Description should have maximum of 45 characters": "Description should have maximum of 45 characters", + "Period cannot be blank": "Period cannot be blank", + "Sample type cannot be blank": "Sample type cannot be blank", + "That payment method requires an IBAN": "That payment method requires an IBAN", + "That payment method requires a BIC": "That payment method requires a BIC", + "The default consignee can not be unchecked": "The default consignee can not be unchecked", + "Enter an integer different to zero": "Enter an integer different to zero", + "Package cannot be blank": "Package cannot be blank", + "The price of the item changed": "The price of the item changed", + "The sales of this ticket can't be modified": "The sales of this ticket can't be modified", + "Cannot check Equalization Tax in this NIF/CIF": "Cannot check Equalization Tax in this NIF/CIF", + "You can't create an order for a frozen client": "You can't create an order for a frozen client", + "This address doesn't exist": "This address doesn't exist", + "Warehouse cannot be blank": "Warehouse cannot be blank", + "Agency cannot be blank": "Agency cannot be blank", + "The IBAN does not have the correct format": "The IBAN does not have the correct format", + "You can't make changes on the basic data of an confirmed order or with rows": "You can't make changes on the basic data of an confirmed order or with rows", + "You can't create a ticket for an inactive client": "You can't create a ticket for an inactive client", + "Worker cannot be blank": "Worker cannot be blank", + "You must delete the claim id %d first": "You must delete the claim id %d first", + "You don't have enough privileges": "You don't have enough privileges", + "Tag value cannot be blank": "Tag value cannot be blank", + "A client with that Web User name already exists": "A client with that Web User name already exists", + "The warehouse can't be repeated": "The warehouse can't be repeated", + "Barcode must be unique": "Barcode must be unique", + "You don't have enough privileges to do that": "You don't have enough privileges to do that", + "You can't create a ticket for a frozen client": "You can't create a ticket for a frozen client", + "can't be blank": "can't be blank", + "Street cannot be empty": "Street cannot be empty", + "City cannot be empty": "City cannot be empty", + "EXTENSION_INVALID_FORMAT": "Invalid extension", + "The secret can't be blank": "The secret can't be blank", + "Invalid TIN": "Invalid Tax number", + "This ticket can't be invoiced": "This ticket can't be invoiced", + "The value should be a number": "The value should be a number", + "The current ticket can't be modified": "The current ticket can't be modified", + "Extension format is invalid": "Extension format is invalid", + "NO_ZONE_FOR_THIS_PARAMETERS": "NO_ZONE_FOR_THIS_PARAMETERS", + "This client can't be invoiced": "This client can't be invoiced", + "You must provide the correction information to generate a corrective invoice": "You must provide the correction information to generate a corrective invoice", + "The introduced hour already exists": "The introduced hour already exists", + "Invalid parameters to create a new ticket": "Invalid parameters to create a new ticket", + "Concept cannot be blank": "Concept cannot be blank", + "Ticket id cannot be blank": "Ticket id cannot be blank", + "Weekday cannot be blank": "Weekday cannot be blank", + "This ticket can not be modified": "This ticket can not be modified", + "You can't delete a confirmed order": "You can't delete a confirmed order", + "Value has an invalid format": "Value has an invalid format", + "The postcode doesn't exist. Please enter a correct one": "The postcode doesn't exist. Please enter a correct one", + "Swift / BIC can't be empty": "Swift / BIC can't be empty", + "Deleted sales from ticket": "I have deleted the following lines from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}", + "Added sale to ticket": "I have added the following line to the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}", + "Changed sale discount": "I have changed the following lines discounts from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", + "Created claim": "I have created the claim [{{claimId}}]({{{claimUrl}}}) for the following lines from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", + "Changed sale price": "I have changed the price of [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) from {{oldPrice}}€ ➔ *{{newPrice}}€* of the ticket [{{ticketId}}]({{{ticketUrl}}})", + "Changed sale quantity": "I have changed the quantity of [{{itemId}} {{concept}}]({{{itemUrl}}}) from {{oldQuantity}} ➔ *{{newQuantity}}* of the ticket [{{ticketId}}]({{{ticketUrl}}})", + "Changed sale reserved state": "I have changed the following lines reserved state from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", + "Bought units from buy request": "Bought {{quantity}} units of [{{itemId}} {{concept}}]({{{urlItem}}}) for the ticket id [{{ticketId}}]({{{url}}})", + "MESSAGE_INSURANCE_CHANGE": "I have changed the insurence credit of client [{{clientName}} ({{clientId}})]({{{url}}}) to *{{credit}} €*", + "Changed client paymethod": "I have changed the pay method for client [{{clientName}} ({{clientId}})]({{{url}}})", + "Sent units from ticket": "I sent *{{quantity}}* units of [{{concept}} ({{itemId}})]({{{itemUrl}}}) to *\"{{nickname}}\"* coming from ticket id [{{ticketId}}]({{{ticketUrl}}})", + "Change quantity": "{{concept}} change of {{oldQuantity}} to {{newQuantity}}", + "Claim will be picked": "The product from the claim [({{claimId}})]({{{claimUrl}}}) from the client *{{clientName}}* will be picked, with the pickup type *{{claimPickup}}*", + "Claim state has changed to": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *{{newState}}*", + "Customs agent is required for a non UEE member": "Customs agent is required for a non UEE member", + "Incoterms is required for a non UEE member": "Incoterms is required for a non UEE member", + "Client checked as validated despite of duplication": "Client checked as validated despite of duplication from client id {{clientId}}", + "Landing cannot be lesser than shipment": "Landing cannot be lesser than shipment", + "NOT_ZONE_WITH_THIS_PARAMETERS": "There's no zone available for this day", + "Created absence": "The worker {{author}} has added an absence of type '{{absenceType}}' to {{employee}} for day {{dated}}.", + "Deleted absence": "The worker {{author}} has deleted an absence of type '{{absenceType}}' to {{employee}} for day {{dated}}.", + "I have deleted the ticket id": "I have deleted the ticket id [{{id}}]({{{url}}})", + "I have restored the ticket id": "I have restored the ticket id [{{id}}]({{{url}}})", + "Changed this data from the ticket": "I have changed the data from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", + "The grade must be similar to the last one": "The grade must be similar to the last one", + "agencyModeFk": "Agency", + "clientFk": "Client", + "zoneFk": "Zone", + "warehouseFk": "Warehouse", + "shipped": "Shipped", + "landed": "Landed", + "addressFk": "Address", + "companyFk": "Company", + "agency": "Agency", + "delivery": "Delivery", + "You need to fill sage information before you check verified data": "You need to fill sage information before you check verified data", + "The social name cannot be empty": "The social name cannot be empty", + "The nif cannot be empty": "The nif cannot be empty", + "Amount cannot be zero": "Amount cannot be zero", + "Company has to be official": "Company has to be official", + "Unable to clone this travel": "Unable to clone this travel", + "The observation type can't be repeated": "The observation type can't be repeated", + "New ticket request has been created with price": "New ticket request has been created *'{{description}}'* for day *{{shipped}}*, with a quantity of *{{quantity}}* and a price of *{{price}} €*", + "New ticket request has been created": "New ticket request has been created *'{{description}}'* for day *{{shipped}}*, with a quantity of *{{quantity}}*", + "There's a new urgent ticket": "There's a new urgent ticket: [{{title}}](https://cau.verdnatura.es/WorkOrder.do?woMode=viewWO&woID={{issueId}})", + "Swift / BIC cannot be empty": "Swift / BIC cannot be empty", + "Role name must be written in camelCase": "Role name must be written in camelCase", + "Client assignment has changed": "I did change the salesperson ~*\"<{{previousWorkerName}}>\"*~ by *\"<{{currentWorkerName}}>\"* from the client [{{clientName}} ({{clientId}})]({{{url}}})", + "None": "None", + "error densidad = 0": "error densidad = 0", + "This document already exists on this ticket": "This document already exists on this ticket", + "serial non editable": "This serial doesn't allow to set a reference", + "nickname": "nickname", + "State": "State", + "regular": "regular", + "reserved": "reserved", + "Global invoicing failed": "[Global invoicing] Wasn't able to invoice some of the clients", + "A ticket with a negative base can't be invoiced": "A ticket with a negative base can't be invoiced", + "This client is not invoiceable": "This client is not invoiceable", + "INACTIVE_PROVIDER": "Inactive provider", + "reference duplicated": "reference duplicated", + "The PDF document does not exist": "The PDF document does not exists. Try regenerating it from 'Regenerate invoice PDF' option", + "This item is not available": "This item is not available", + "Deny buy request": "Purchase request for ticket id [{{ticketId}}]({{{url}}}) has been rejected. Reason: {{observation}}", + "The type of business must be filled in basic data": "The type of business must be filled in basic data", + "The worker has hours recorded that day": "The worker has hours recorded that day", + "isWithoutNegatives": "isWithoutNegatives", + "routeFk": "routeFk", + "Not enough privileges to edit a client with verified data": "Not enough privileges to edit a client with verified data", + "Can't change the password of another worker": "Can't change the password of another worker", + "No hay un contrato en vigor": "There is no existing contract", + "No está permitido trabajar": "Not allowed to work", + "Dirección incorrecta": "Wrong direction", + "No se permite fichar a futuro": "It is not allowed to sign in the future", + "Descanso diario 12h.": "Daily rest 12h.", + "Fichadas impares": "Odd signs", + "Descanso diario 9h.": "Daily rest 9h.", + "Descanso semanal 36h. / 72h.": "Weekly rest 36h. / 72h.", + "Verify email": "Verify email", + "Click on the following link to verify this email. If you haven't requested this email, just ignore it": "Click on the following link to verify this email. If you haven't requested this email, just ignore it", + "Password does not meet requirements": "Password does not meet requirements", + "You don't have privileges to change the zone": "You don't have privileges to change the zone or for these parameters there are more than one shipping options, talk to agencies", + "Not enough privileges to edit a client": "Not enough privileges to edit a client", + "Claim pickup order sent": "Claim pickup order sent [{{claimId}}]({{{claimUrl}}}) to client *{{clientName}}*", + "You don't have grant privilege": "You don't have grant privilege", + "You don't own the role and you can't assign it to another user": "You don't own the role and you can't assign it to another user", + "Email verify": "Email verify", + "Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) merged with [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})", + "App locked": "App locked by user {{userId}}", + "The sales of the receiver ticket can't be modified": "The sales of the receiver ticket can't be modified", + "Receipt's bank was not found": "Receipt's bank was not found", + "This receipt was not compensated": "This receipt was not compensated", + "Client's email was not found": "Client's email was not found", + "Tickets with associated refunds": "Tickets with associated refunds can't be deleted. This ticket is associated with refund Nº %d", + "It is not possible to modify tracked sales": "It is not possible to modify tracked sales", + "It is not possible to modify sales that their articles are from Floramondo": "It is not possible to modify sales that their articles are from Floramondo", + "It is not possible to modify cloned sales": "It is not possible to modify cloned sales", + "Warehouse inventory not set": "Almacén inventario no está establecido", + "Component cost not set": "Componente coste no está estabecido", + "Description cannot be blank": "Description cannot be blank", + "company": "Company", + "country": "Country", + "clientId": "Id client", + "clientSocialName": "Client", + "amount": "Amount", + "taxableBase": "Taxable base", + "ticketFk": "Id ticket", + "isActive": "Active", + "hasToInvoice": "Invoice", + "isTaxDataChecked": "Data checked", + "comercialId": "Id Comercial", + "comercialName": "Comercial", + "Added observation": "Added observation", + "Comment added to client": "Comment added to client", + "This ticket is already a refund": "This ticket is already a refund", + "A claim with that sale already exists": "A claim with that sale already exists", + "Pass expired": "The password has expired, change it from Salix", + "Can't transfer claimed sales": "Can't transfer claimed sales", + "Invalid quantity": "Invalid quantity", + "Failed to upload delivery note": "Error to upload delivery note {{id}}", + "Mail not sent": "There has been an error sending the invoice to the client [{{clientId}}]({{{clientUrl}}}), please check the email address", + "The renew period has not been exceeded": "The renew period has not been exceeded", + "You can not use the same password": "You can not use the same password", + "Valid priorities": "Valid priorities: %d", + "hasAnyNegativeBase": "Negative basis of tickets: {{ticketsIds}}", + "hasAnyPositiveBase": "Positive basis of tickets: {{ticketsIds}}", + "This ticket cannot be left empty.": "This ticket cannot be left empty. %s", + "Social name should be uppercase": "Social name should be uppercase", + "Street should be uppercase": "Street should be uppercase", + "You don't have enough privileges.": "You don't have enough privileges.", + "This ticket is locked": "This ticket is locked", + "This ticket is not editable.": "This ticket is not editable.", + "The ticket doesn't exist.": "The ticket doesn't exist.", + "The sales do not exists": "The sales do not exists", + "Ticket without Route": "Ticket without route", + "Select a different client": "Select a different client", + "Fill all the fields": "Fill all the fields", + "Error while generating PDF": "Error while generating PDF", + "Can't invoice to future": "Can't invoice to future", + "This ticket is already invoiced": "This ticket is already invoiced", + "Negative basis of tickets: 23": "Negative basis of tickets: 23", + "Booking completed": "Booking complete", + "The ticket is in preparation": "The ticket [{{ticketId}}]({{{ticketUrl}}}) of the sales person {{salesPersonId}} is in preparation", + "You can only add negative amounts in refund tickets": "You can only add negative amounts in refund tickets", + "Bank entity must be specified": "Bank entity must be specified", + "Try again": "Try again", + "keepPrice": "keepPrice", + "Cannot past travels with entries": "Cannot past travels with entries", + "It was not able to remove the next expeditions:": "It was not able to remove the next expeditions: {{expeditions}}", + "Incorrect pin": "Incorrect pin.", + "The notification subscription of this worker cant be modified": "The notification subscription of this worker cant be modified", + "Name should be uppercase": "Name should be uppercase", + "You cannot update these fields": "You cannot update these fields", + "CountryFK cannot be empty": "Country cannot be empty", + "You are not allowed to modify the alias": "You are not allowed to modify the alias", + "You already have the mailAlias": "You already have the mailAlias", "This machine is already in use.": "This machine is already in use.", "the plate does not exist": "The plate {{plate}} does not exist", "We do not have availability for the selected item": "We do not have availability for the selected item", @@ -223,6 +223,7 @@ "printerNotExists": "The printer does not exist", "There are not picking tickets": "There are not picking tickets", "ticketCommercial": "The ticket {{ ticket }} for the salesperson {{ salesMan }} is in preparation. (automatically generated message)", - "This password can only be changed by the user themselves": "This password can only be changed by the user themselves", - "They're not your subordinate": "They're not your subordinate" -} + "This password can only be changed by the user themselves": "This password can only be changed by the user themselves", + "They're not your subordinate": "They're not your subordinate", + "InvoiceIn is already booked": "InvoiceIn is already booked" +} \ No newline at end of file diff --git a/modules/worker/back/models/worker.json b/modules/worker/back/models/worker.json index 57dc80ec9..f959d3138 100644 --- a/modules/worker/back/models/worker.json +++ b/modules/worker/back/models/worker.json @@ -99,7 +99,7 @@ { "relation": "user", "scope": { - "fields": ["email", "name", "nickname", "roleFk"], + "fields": ["email", "name", "nickname", "roleFk", "name", "emailVerified","recoveryPhone"], "include": [ { "relation": "role", @@ -127,7 +127,7 @@ }, { "relation": "client", "scope": { - "fields": [ + "fields": [ "id", "name", "fi", From fb17a54ebd3ac6cf431acd648b37b396dcedc1c0 Mon Sep 17 00:00:00 2001 From: robert Date: Fri, 19 Apr 2024 10:53:03 +0200 Subject: [PATCH 23/33] feat: refs #6777 resotre view --- db/routines/vn2008/views/tblContadores.sql | 39 +++++++++++++++++++ db/routines/vn2008/views/thermograph.sql | 6 +++ .../vn2008/views/ticket_observation.sql | 8 ++++ db/routines/vn2008/views/tickets_gestdoc.sql | 6 +++ 4 files changed, 59 insertions(+) create mode 100644 db/routines/vn2008/views/tblContadores.sql create mode 100644 db/routines/vn2008/views/thermograph.sql create mode 100644 db/routines/vn2008/views/ticket_observation.sql create mode 100644 db/routines/vn2008/views/tickets_gestdoc.sql diff --git a/db/routines/vn2008/views/tblContadores.sql b/db/routines/vn2008/views/tblContadores.sql new file mode 100644 index 000000000..129d3ce8b --- /dev/null +++ b/db/routines/vn2008/views/tblContadores.sql @@ -0,0 +1,39 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`tblContadores` +AS SELECT `c`.`id` AS `id`, + `c`.`ochoa` AS `ochoa`, + `c`.`invoiceOutFk` AS `nfactura`, + `c`.`inventoried` AS `FechaInventario`, + `c`.`itemLog` AS `HistoricoArticulo`, + `c`.`weekGoal` AS `week_goal`, + `c`.`photosPath` AS `Rutafotos`, + `c`.`cashBoxNumber` AS `numCaja`, + `c`.`redCode` AS `CodigoRojo`, + `c`.`TabletTime` AS `Tablet_Hora`, + `c`.`t0` AS `t0`, + `c`.`t1` AS `t1`, + `c`.`t2` AS `t2`, + `c`.`t3` AS `t3`, + `c`.`cc` AS `cc`, + `c`.`palet` AS `palet`, + `c`.`campaign` AS `campaign`, + `c`.`campaignLife` AS `campaign_life`, + `c`.`truckDays` AS `truck_days`, + `c`.`transportCharges` AS `tasa_transporte`, + `c`.`escanerPath` AS `escaner_path`, + `c`.`printedTurn` AS `turnoimpreso`, + `c`.`truckLength` AS `truck_length`, + `c`.`fuelConsumption` AS `fuel_consumption`, + `c`.`petrol` AS `petrol`, + `c`.`maintenance` AS `maintenance`, + `c`.`hourPrice` AS `hour_price`, + `c`.`meterPrice` AS `meter_price`, + `c`.`kmPrice` AS `km_price`, + `c`.`routeOption` AS `route_option`, + `c`.`dbproduccion` AS `dbproduccion`, + `c`.`mdbServer` AS `mdbServer`, + `c`.`fakeEmail` AS `fakeEmail`, + `c`.`defaultersMaxAmount` AS `defaultersMaxAmount`, + `c`.`ASIEN` AS `ASIEN` +FROM `vn`.`config` `c` diff --git a/db/routines/vn2008/views/thermograph.sql b/db/routines/vn2008/views/thermograph.sql new file mode 100644 index 000000000..f51b83d24 --- /dev/null +++ b/db/routines/vn2008/views/thermograph.sql @@ -0,0 +1,6 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`thermograph` +AS SELECT `t`.`id` AS `thermograph_id`, + `t`.`model` AS `model` +FROM `vn`.`thermograph` `t` diff --git a/db/routines/vn2008/views/ticket_observation.sql b/db/routines/vn2008/views/ticket_observation.sql new file mode 100644 index 000000000..deb85e4b6 --- /dev/null +++ b/db/routines/vn2008/views/ticket_observation.sql @@ -0,0 +1,8 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`ticket_observation` +AS SELECT `to`.`id` AS `ticket_observation_id`, + `to`.`ticketFk` AS `Id_Ticket`, + `to`.`observationTypeFk` AS `observation_type_id`, + `to`.`description` AS `text` +FROM `vn`.`ticketObservation` `to` diff --git a/db/routines/vn2008/views/tickets_gestdoc.sql b/db/routines/vn2008/views/tickets_gestdoc.sql new file mode 100644 index 000000000..a8682db57 --- /dev/null +++ b/db/routines/vn2008/views/tickets_gestdoc.sql @@ -0,0 +1,6 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`tickets_gestdoc` +AS SELECT `td`.`ticketFk` AS `Id_Ticket`, + `td`.`dmsFk` AS `gestdoc_id` +FROM `vn`.`ticketDms` `td` From 28c08d8b18a1b1aad8c7613e931d6f8938a469c2 Mon Sep 17 00:00:00 2001 From: robert Date: Fri, 19 Apr 2024 10:58:19 +0200 Subject: [PATCH 24/33] feat: refs #7237 company_getSuppliersDebt --- db/routines/vn/procedures/company_getSuppliersDebt.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/company_getSuppliersDebt.sql b/db/routines/vn/procedures/company_getSuppliersDebt.sql index 50c64669c..6335ccbe3 100644 --- a/db/routines/vn/procedures/company_getSuppliersDebt.sql +++ b/db/routines/vn/procedures/company_getSuppliersDebt.sql @@ -188,7 +188,7 @@ BEGIN FROM tPendingDuedates vp LEFT JOIN supplier s ON s.id = vp.supplierFk LEFT JOIN client c ON c.fi = s.nif - JOIN clientRisk cr ON cr.clientFk = c.id + LEFT JOIN clientRisk cr ON cr.clientFk = c.id AND cr.companyFk = vp.companyFk LEFT JOIN supplierAccount sa ON sa.supplierFk = s.id LEFT JOIN bankEntity be ON be.id = sa.bankEntityFk From e601310d3e347281535d2031ce0b9e9ecdd372e2 Mon Sep 17 00:00:00 2001 From: robert Date: Fri, 19 Apr 2024 11:27:54 +0200 Subject: [PATCH 25/33] feat: refs #6777 restore view --- db/routines/vn2008/views/Rutas.sql | 19 +++++++++++++++++++ db/routines/vn2008/views/Tickets_turno.sql | 6 ++++++ db/routines/vn2008/views/state.sql | 13 +++++++++++++ db/routines/vn2008/views/tag.sql | 10 ++++++++++ .../vn2008/views/tarifa_componentes.sql | 10 ++++++++++ .../views/tarifa_componentes_series.sql | 7 +++++++ 6 files changed, 65 insertions(+) create mode 100644 db/routines/vn2008/views/Rutas.sql create mode 100644 db/routines/vn2008/views/Tickets_turno.sql create mode 100644 db/routines/vn2008/views/state.sql create mode 100644 db/routines/vn2008/views/tag.sql create mode 100644 db/routines/vn2008/views/tarifa_componentes.sql create mode 100644 db/routines/vn2008/views/tarifa_componentes_series.sql diff --git a/db/routines/vn2008/views/Rutas.sql b/db/routines/vn2008/views/Rutas.sql new file mode 100644 index 000000000..78b3bb471 --- /dev/null +++ b/db/routines/vn2008/views/Rutas.sql @@ -0,0 +1,19 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`Rutas` +AS SELECT `r`.`id` AS `Id_Ruta`, + `r`.`workerFk` AS `Id_Trabajador`, + `r`.`created` AS `Fecha`, + `r`.`vehicleFk` AS `Id_Vehiculo`, + `r`.`agencyModeFk` AS `Id_Agencia`, + `r`.`time` AS `Hora`, + `r`.`isOk` AS `ok`, + `r`.`kmStart` AS `km_start`, + `r`.`kmEnd` AS `km_end`, + `r`.`started` AS `date_start`, + `r`.`finished` AS `date_end`, + `r`.`gestdocFk` AS `gestdoc_id`, + `r`.`cost` AS `cost`, + `r`.`m3` AS `m3`, + `r`.`description` AS `description` +FROM `vn`.`route` `r` diff --git a/db/routines/vn2008/views/Tickets_turno.sql b/db/routines/vn2008/views/Tickets_turno.sql new file mode 100644 index 000000000..28bc2d55f --- /dev/null +++ b/db/routines/vn2008/views/Tickets_turno.sql @@ -0,0 +1,6 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`Tickets_turno` +AS SELECT `tw`.`ticketFk` AS `Id_Ticket`, + `tw`.`weekDay` AS `weekDay` +FROM `vn`.`ticketWeekly` `tw` diff --git a/db/routines/vn2008/views/state.sql b/db/routines/vn2008/views/state.sql new file mode 100644 index 000000000..63f6589af --- /dev/null +++ b/db/routines/vn2008/views/state.sql @@ -0,0 +1,13 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`state` +AS SELECT `s`.`id` AS `id`, + `s`.`name` AS `name`, + `s`.`order` AS `order`, + `s`.`alertLevel` AS `alert_level`, + `s`.`code` AS `code`, + `s`.`sectorProdPriority` AS `sectorProdPriority`, + `s`.`nextStateFk` AS `nextStateFk`, + `s`.`isPreviousPreparable` AS `isPreviousPreparable`, + `s`.`isPicked` AS `isPicked` +FROM `vn`.`state` `s` diff --git a/db/routines/vn2008/views/tag.sql b/db/routines/vn2008/views/tag.sql new file mode 100644 index 000000000..25b3ab82e --- /dev/null +++ b/db/routines/vn2008/views/tag.sql @@ -0,0 +1,10 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`tag` +AS SELECT `t`.`id` AS `id`, + `t`.`name` AS `name`, + `t`.`isFree` AS `isFree`, + `t`.`isQuantitatif` AS `isQuantitatif`, + `t`.`sourceTable` AS `sourceTable`, + `t`.`unit` AS `unit` +FROM `vn`.`tag` `t` diff --git a/db/routines/vn2008/views/tarifa_componentes.sql b/db/routines/vn2008/views/tarifa_componentes.sql new file mode 100644 index 000000000..bec53abd9 --- /dev/null +++ b/db/routines/vn2008/views/tarifa_componentes.sql @@ -0,0 +1,10 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`tarifa_componentes` +AS SELECT `tarifa_componentes`.`Id_Componente` AS `Id_Componente`, + `tarifa_componentes`.`Componente` AS `Componente`, + `tarifa_componentes`.`tarifa_componentes_series_id` AS `tarifa_componentes_series_id`, + `tarifa_componentes`.`tarifa_class` AS `tarifa_class`, + `tarifa_componentes`.`tax` AS `tax`, + `tarifa_componentes`.`is_renewable` AS `is_renewable` +FROM `bi`.`tarifa_componentes` diff --git a/db/routines/vn2008/views/tarifa_componentes_series.sql b/db/routines/vn2008/views/tarifa_componentes_series.sql new file mode 100644 index 000000000..a1d188709 --- /dev/null +++ b/db/routines/vn2008/views/tarifa_componentes_series.sql @@ -0,0 +1,7 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`tarifa_componentes_series` +AS SELECT `tarifa_componentes_series`.`tarifa_componentes_series_id` AS `tarifa_componentes_series_id`, + `tarifa_componentes_series`.`Serie` AS `Serie`, + `tarifa_componentes_series`.`base` AS `base` +FROM `bi`.`tarifa_componentes_series` From 5b027a88fa20d99329cf42cc4a7b654bb982884a Mon Sep 17 00:00:00 2001 From: robert Date: Fri, 19 Apr 2024 11:33:33 +0200 Subject: [PATCH 26/33] feat: refs #6777 restore view --- db/routines/vn2008/views/Tickets_state.sql | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 db/routines/vn2008/views/Tickets_state.sql diff --git a/db/routines/vn2008/views/Tickets_state.sql b/db/routines/vn2008/views/Tickets_state.sql new file mode 100644 index 000000000..be59a750f --- /dev/null +++ b/db/routines/vn2008/views/Tickets_state.sql @@ -0,0 +1,7 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`Tickets_state` +AS SELECT `t`.`ticketFk` AS `Id_Ticket`, + `t`.`ticketTrackingFk` AS `inter_id`, + `t`.`name` AS `state_name` +FROM `vn`.`ticketLastState` `t` From e6258dc9e548fa6ffab681dbee6f62ce44e2210d Mon Sep 17 00:00:00 2001 From: sergiodt Date: Fri, 19 Apr 2024 13:03:57 +0200 Subject: [PATCH 27/33] refs #6413 hotFix fix:ubicadorChecking --- db/routines/vn/procedures/itemShelving_addList.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/itemShelving_addList.sql b/db/routines/vn/procedures/itemShelving_addList.sql index c07dd985c..130007de5 100644 --- a/db/routines/vn/procedures/itemShelving_addList.sql +++ b/db/routines/vn/procedures/itemShelving_addList.sql @@ -39,7 +39,7 @@ BEGIN UPDATE vn.itemShelving SET isChecked = vIsChecked WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk - AND itemFk = vItemFk; + AND itemFk = vItemFk AND isChecked IS NULL; SET vCounter = vCounter + 1; END WHILE; From e0cd08b28033a9d1c4aa0d4164594298f9154ebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Fri, 19 Apr 2024 14:10:11 +0200 Subject: [PATCH 28/33] fix: hotfix importar A3 Ticket 175840 --- db/routines/vn2008/views/payrollWorker.sql | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/db/routines/vn2008/views/payrollWorker.sql b/db/routines/vn2008/views/payrollWorker.sql index d4ada9aa0..6199e98b8 100644 --- a/db/routines/vn2008/views/payrollWorker.sql +++ b/db/routines/vn2008/views/payrollWorker.sql @@ -1,6 +1,9 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY DEFINER - VIEW `vn2008`.`payroll_employee` -AS SELECT `pw`.`workerFkA3` AS `CodTrabajador`, - `pw`.`companyFkA3` AS `codempresa` -FROM `vn`.`payrollWorker` `pw` + VIEW `vn2008`.`payroll_employee` AS +SELECT + `pw`.`workerFkA3` AS `CodTrabajador`, + `pw`.`companyFkA3` AS `codempresa`, + `pw`.`workerFk` AS `workerFk` +FROM + `vn`.`payrollWorker` `pw`; \ No newline at end of file From 65892625d5462e48feb0d182104317ad61fcf052 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 19 Apr 2024 14:17:49 +0200 Subject: [PATCH 29/33] feat: #7231 Collection_assing more time and throw --- db/routines/vn/procedures/collection_assign.sql | 7 +++---- db/routines/vn/procedures/collection_new.sql | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/db/routines/vn/procedures/collection_assign.sql b/db/routines/vn/procedures/collection_assign.sql index bfc7b0f93..f6000e87d 100644 --- a/db/routines/vn/procedures/collection_assign.sql +++ b/db/routines/vn/procedures/collection_assign.sql @@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_assign`( vUserFk INT, OUT vCollectionFk INT ) -proc:BEGIN +BEGIN /** * Comprueba si existen colecciones libres que se ajustan * al perfil del usuario y le asigna la más antigua. @@ -16,7 +16,7 @@ proc:BEGIN DECLARE vItemPackingTypeFk VARCHAR(1); DECLARE vWarehouseFk INT; DECLARE vLockName VARCHAR(215); - DECLARE vLockTime INT DEFAULT 15; + DECLARE vLockTime INT DEFAULT 30; DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN @@ -39,7 +39,6 @@ proc:BEGIN IF vHasTooMuchCollections THEN CALL util.throw('Hay colecciones pendientes'); - LEAVE proc; END IF; SELECT warehouseFk, itemPackingTypeFk @@ -54,7 +53,7 @@ proc:BEGIN ); IF NOT GET_LOCK(vLockName, vLockTime) THEN - LEAVE proc; + CALL util.throw(CONCAT('Cannot get lock: ', vLockName)); END IF; -- Se eliminan las colecciones sin asignar que estan obsoletas diff --git a/db/routines/vn/procedures/collection_new.sql b/db/routines/vn/procedures/collection_new.sql index 1292707af..f3767ddf3 100644 --- a/db/routines/vn/procedures/collection_new.sql +++ b/db/routines/vn/procedures/collection_new.sql @@ -1,6 +1,6 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_new`(vUserFk INT, OUT vCollectionFk INT) -proc:BEGIN +BEGIN /** * Genera colecciones de tickets sin asignar trabajador. * @@ -26,7 +26,7 @@ proc:BEGIN DECLARE vHasUniqueCollectionTime BOOL; DECLARE vDone INT DEFAULT FALSE; DECLARE vLockName VARCHAR(215); - DECLARE vLockTime INT DEFAULT 15; + DECLARE vLockTime INT DEFAULT 30; DECLARE vFreeWagonFk INT; DECLARE c1 CURSOR FOR @@ -86,7 +86,7 @@ proc:BEGIN ); IF NOT GET_LOCK(vLockName, vLockTime) THEN - LEAVE proc; + CALL util.throw(CONCAT('Cannot get lock: ', vLockName)); END IF; -- Se prepara el tren, con tantos vagones como sea necesario. From 283d27e1c5b5a7402fe312127f115bf848abf180 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 22 Apr 2024 06:22:36 +0000 Subject: [PATCH 30/33] Actualizar modules/worker/back/models/worker.json --- modules/worker/back/models/worker.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/worker/back/models/worker.json b/modules/worker/back/models/worker.json index f959d3138..c9db0aeee 100644 --- a/modules/worker/back/models/worker.json +++ b/modules/worker/back/models/worker.json @@ -99,7 +99,7 @@ { "relation": "user", "scope": { - "fields": ["email", "name", "nickname", "roleFk", "name", "emailVerified","recoveryPhone"], + "fields": ["email", "name", "nickname", "roleFk", "name", "emailVerified"], "include": [ { "relation": "role", From f6199f8f8ede30cf3097d8a4de14780bb41cd107 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 22 Apr 2024 06:56:05 +0000 Subject: [PATCH 31/33] Actualizar modules/worker/back/models/worker.json --- modules/worker/back/models/worker.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/worker/back/models/worker.json b/modules/worker/back/models/worker.json index c9db0aeee..c203f6e09 100644 --- a/modules/worker/back/models/worker.json +++ b/modules/worker/back/models/worker.json @@ -99,7 +99,7 @@ { "relation": "user", "scope": { - "fields": ["email", "name", "nickname", "roleFk", "name", "emailVerified"], + "fields": ["email", "name", "nickname", "roleFk", "emailVerified"], "include": [ { "relation": "role", From a1a3470df4754db3cd6ece40849827b00e8d810d Mon Sep 17 00:00:00 2001 From: robert Date: Mon, 22 Apr 2024 09:43:13 +0200 Subject: [PATCH 32/33] feat: refs #174903 --- db/routines/vn/procedures/item_getSimilar.sql | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/db/routines/vn/procedures/item_getSimilar.sql b/db/routines/vn/procedures/item_getSimilar.sql index f7126c1a5..e576a6c16 100644 --- a/db/routines/vn/procedures/item_getSimilar.sql +++ b/db/routines/vn/procedures/item_getSimilar.sql @@ -66,8 +66,7 @@ BEGIN ELSE 1 END AS minQuantity, iss.visible located, - b.price2, - b.price3 + b.price2 FROM vn.item i JOIN cache.available a ON a.item_id = i.id AND a.calc_id = vCalcFk From b88dff0d997e66e1ad6295a23d7a3eb01b426141 Mon Sep 17 00:00:00 2001 From: robert Date: Mon, 22 Apr 2024 10:48:37 +0200 Subject: [PATCH 33/33] feat: refs #6777 --- db/routines/vn/functions/getAlert3StateTest.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/functions/getAlert3StateTest.sql b/db/routines/vn/functions/getAlert3StateTest.sql index beba0948c..f1a8ac4cc 100644 --- a/db/routines/vn/functions/getAlert3StateTest.sql +++ b/db/routines/vn/functions/getAlert3StateTest.sql @@ -13,7 +13,7 @@ BEGIN INTO vDeliveryType FROM ticket t JOIN vn2008.Agencias a ON a.Id_Agencia = t.agencyModeFk - WHERE id = vTicket; + WHERE t.id = vTicket; CASE vDeliveryType WHEN 1 THEN -- AGENCIAS