From d2fec7beee6fb3120eb806be6ba21aa041cafe95 Mon Sep 17 00:00:00 2001 From: davidd Date: Mon, 5 Feb 2024 07:30:04 +0100 Subject: [PATCH] refs #6642 --- db/routines/vn/views/ticketStateToday.sql | 13 ++++++------- db/routines/vn/views/zoneEstimatedDelivery.sql | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/db/routines/vn/views/ticketStateToday.sql b/db/routines/vn/views/ticketStateToday.sql index cf1f24539..2ee65b7c2 100644 --- a/db/routines/vn/views/ticketStateToday.sql +++ b/db/routines/vn/views/ticketStateToday.sql @@ -1,16 +1,15 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vn`.`ticketStateToday` -AS SELECT `ts`.`ticketFk` AS `ticket`, +AS SELECT + `ts`.`ticketFk` AS `ticketFk`, `ts`.`state` AS `state`, `ts`.`productionOrder` AS `productionOrder`, `ts`.`alertLevel` AS `alertLevel`, - `ts`.`userFk` AS `worker`, + `ts`.`userFk` AS `userFk`, `ts`.`code` AS `code`, `ts`.`updated` AS `updated`, `ts`.`isPicked` AS `isPicked` -FROM ( - `vn`.`ticketState` `ts` - JOIN `vn`.`ticket` `t` ON(`t`.`id` = `ts`.`ticketFk`) - ) -WHERE `t`.`shipped` BETWEEN `util`.`VN_CURDATE`() AND `MIDNIGHT`(`util`.`VN_CURDATE`()) +FROM `ticketState` `ts` + JOIN `ticket` `t` ON `t`.`id` = `ts`.`ticketFk` +WHERE `t`.`shipped` BETWEEN `util`.`VN_CURDATE`() AND `MIDNIGHT`(`util`.`VN_CURDATE`()); diff --git a/db/routines/vn/views/zoneEstimatedDelivery.sql b/db/routines/vn/views/zoneEstimatedDelivery.sql index e52d5487e..621d1a8f0 100644 --- a/db/routines/vn/views/zoneEstimatedDelivery.sql +++ b/db/routines/vn/views/zoneEstimatedDelivery.sql @@ -9,7 +9,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` lhp.m3, dl.minSpeed FROM ticket t - JOIN ticketStateToday tst ON tst.ticket = t.id + JOIN ticketStateToday tst ON tst.ticketFk = t.id JOIN state s ON s.id = tst.state JOIN saleVolume sv ON sv.ticketFk = t.id LEFT JOIN lastHourProduction lhp ON lhp.warehouseFk = t.warehouseFk -- 2.40.1