1781-zoneHoliday #994

Merged
joan merged 49 commits from 1781-zoneHoliday into dev 2022-08-03 06:41:31 +00:00
3 changed files with 14 additions and 11 deletions
Showing only changes of commit f7be419bbe - Show all commits

View File

@ -1,12 +1,13 @@
CREATE TABLE `vn`.`zoneExclusionGeo` ( CREATE TABLE `vn`.`zoneExclusionGeo` (
vicent marked this conversation as resolved Outdated

remove this

remove this
`id` int(11) NOT NULL AUTO_INCREMENT,
`zoneExclusionFk` int(11) NOT NULL, `zoneExclusionFk` int(11) NOT NULL,
`geoFk` int(11) NOT NULL, `geoFk` int(11) NOT NULL,
PRIMARY KEY (`zoneExclusionFk`,`geoFk`), PRIMARY KEY (`id`),
UNIQUE KEY `zoneExclusionGeo_UN` (`zoneExclusionFk`,`geoFk`),
KEY `zoneExclusionGeo2_FK_1` (`geoFk`), KEY `zoneExclusionGeo2_FK_1` (`geoFk`),
CONSTRAINT `zoneExclusionGeo2_FK_1` FOREIGN KEY (`geoFk`) REFERENCES `zoneGeo` (`id`) ON UPDATE CASCADE, CONSTRAINT `zoneExclusionGeo_FK` FOREIGN KEY (`geoFk`) REFERENCES `zoneGeo` (`id`) ON UPDATE CASCADE,
CONSTRAINT `zoneExclusionGeo_FK` FOREIGN KEY (`zoneExclusionFk`) REFERENCES `zoneExclusion` (`id`) ON DELETE CASCADE ON UPDATE CASCADE CONSTRAINT `zoneExclusionGeo_FK_1` FOREIGN KEY (`zoneExclusionFk`) REFERENCES `zoneExclusion` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
DROP PROCEDURE IF EXISTS `vn`.`zone_excludeFromGeo`; DROP PROCEDURE IF EXISTS `vn`.`zone_excludeFromGeo`;
DELIMITER $$ DELIMITER $$

View File

@ -2029,6 +2029,8 @@ INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `dated`)
(1, 'day', DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=4, 4, 11) - DAYOFWEEK(CURDATE())) DAY)), (1, 'day', DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=4, 4, 11) - DAYOFWEEK(CURDATE())) DAY)),
(1, 'day', DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=5, 5, 12) - DAYOFWEEK(CURDATE())) DAY)), (1, 'day', DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=5, 5, 12) - DAYOFWEEK(CURDATE())) DAY)),
(1, 'day', DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=6, 6, 13) - DAYOFWEEK(CURDATE())) DAY)), (1, 'day', DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=6, 6, 13) - DAYOFWEEK(CURDATE())) DAY)),
(1, 'day', DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=7, 7, 14) - DAYOFWEEK(CURDATE())) DAY)),
(1, 'day', DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=8, 8, 15) - DAYOFWEEK(CURDATE())) DAY)),
(2, 'day', DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=2, 2, 9) - DAYOFWEEK(CURDATE())) DAY)), (2, 'day', DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=2, 2, 9) - DAYOFWEEK(CURDATE())) DAY)),
(2, 'day', DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=3, 3, 10) - DAYOFWEEK(CURDATE())) DAY)), (2, 'day', DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=3, 3, 10) - DAYOFWEEK(CURDATE())) DAY)),
(2, 'day', DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=4, 4, 11) - DAYOFWEEK(CURDATE())) DAY)), (2, 'day', DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=4, 4, 11) - DAYOFWEEK(CURDATE())) DAY)),
@ -2578,9 +2580,9 @@ INSERT INTO `vn`.`machineWorker` (`workerFk`, `machineFk`, `inTimed`, `outTimed`
(1106, 2, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), DATE_ADD(CURDATE(), INTERVAL +1 DAY)); (1106, 2, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), DATE_ADD(CURDATE(), INTERVAL +1 DAY));
INSERT INTO `vn`.`zoneExclusion` (`id`, `zoneFk`, `dated`, `created`, `userFk`) INSERT INTO `vn`.`zoneExclusion` (`id`, `zoneFk`, `dated`, `created`, `userFk`)
VALUES VALUES
(1, 1, DATE_ADD(CURDATE(), INTERVAL + 10 DAY), CURDATE(), 100), (1, 1, DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=7, 7, 14) - DAYOFWEEK(CURDATE())) DAY), CURDATE(), 100),
(2, 1, DATE_ADD(CURDATE(), INTERVAL + 12 DAY), CURDATE(), 100); (2, 1, DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=8, 8, 15) - DAYOFWEEK(CURDATE())) DAY), CURDATE(), 100);
INSERT INTO `vn`.`zoneExclusionGeo` (`zoneExclusionFk`, `geoFk`) INSERT INTO `vn`.`zoneExclusionGeo` (`zoneExclusionFk`, `geoFk`)
VALUES VALUES

View File

@ -240,7 +240,7 @@ class Controller extends Section {
const params = { const params = {
zoneFk: parseInt(this.$params.id), zoneFk: parseInt(this.$params.id),
date: excludeSelected.dated, date: excludeSelected.dated,
geoFk: geoIds geoIds: geoIds
}; };
if (this.isNew) if (this.isNew)
@ -252,9 +252,9 @@ class Controller extends Section {
if (geoIds[actualPosition]) geoId = geoIds[actualPosition].id; if (geoIds[actualPosition]) geoId = geoIds[actualPosition].id;
else geoId = null; else geoId = null;
if (geoId) { if (geoId && geoId == exclusionGeo.geoFk) {
const params = { const params = {
zoneExclusionFk: excludeSelected.zoneExclusionFk, zoneExclusionFk: exclusionGeo.zoneExclusionFk,
geoFk: geoId geoFk: geoId
}; };
req = this.$http.put(`ZoneExclusionGeos/${exclusionGeo.id}`, params); req = this.$http.put(`ZoneExclusionGeos/${exclusionGeo.id}`, params);