Merge pull request 'refactor: refs #7934 Delete vn.MIDNIGHT function' (!2984) from 7934-DeleteVn.MIDNIGHT into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #2984 Reviewed-by: Guillermo Bonet <guillermo@verdnatura.es>
This commit is contained in:
commit
09dfacd753
|
@ -1,8 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`MIDNIGHT`(vDate DATE)
|
||||
RETURNS datetime
|
||||
DETERMINISTIC
|
||||
BEGIN
|
||||
RETURN TIMESTAMP(vDate,'23:59:59');
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,30 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`routeProposal_`(vTicketFk INT)
|
||||
RETURNS int(11)
|
||||
NOT DETERMINISTIC
|
||||
READS SQL DATA
|
||||
BEGIN
|
||||
|
||||
DECLARE vRouteFk INT;
|
||||
DECLARE vAddressFk INT;
|
||||
DECLARE vShipped DATETIME;
|
||||
|
||||
SELECT addressFk, date(shipped) INTO vAddressFk, vShipped
|
||||
FROM vn.ticket
|
||||
WHERE id = vTicketFk;
|
||||
|
||||
SELECT routeFk INTO vRouteFk
|
||||
FROM
|
||||
(SELECT t.routeFk, sum(af.friendship) friendshipSum
|
||||
FROM vn.ticket t
|
||||
JOIN cache.addressFriendship af ON af.addressFk2 = t.addressFk AND af.addressFk1 = vAddressFk
|
||||
WHERE t.shipped BETWEEN vShipped and MIDNIGHT(vShipped)
|
||||
AND t.routeFk
|
||||
GROUP BY routeFk
|
||||
ORDER BY friendshipSum DESC
|
||||
) sub
|
||||
LIMIT 1;
|
||||
|
||||
RETURN vRouteFk;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -38,7 +38,7 @@ BEGIN
|
|||
AND IFNULL(sub3.transit,0) < s.quantity
|
||||
AND s.isPicked = FALSE
|
||||
AND s.reserved = FALSE
|
||||
AND t.shipped BETWEEN util.VN_CURDATE() AND MIDNIGHT(util.VN_CURDATE())
|
||||
AND t.shipped BETWEEN util.VN_CURDATE() AND util.midnight()
|
||||
AND tst.isPreviousPreparable = TRUE
|
||||
AND t.warehouseFk = vWarehouseFk
|
||||
AND iss.sectorFk = vSectorFk
|
||||
|
|
|
@ -13,4 +13,4 @@ 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`())
|
||||
WHERE `t`.`shipped` BETWEEN `util`.`VN_CURDATE`() AND `util`.`midnight`()
|
||||
|
|
Loading…
Reference in New Issue