7152-devToTest_2414 #2228
|
@ -1,11 +1,9 @@
|
|||
-- Auto-generated SQL script #202311241021
|
||||
INSERT INTO util.notification (name,description)
|
||||
VALUES ('zone-included','An email to notify zoneCollisions');
|
||||
|
||||
-- Auto-generated SQL script #202311241051
|
||||
INSERT INTO util.notificationSubscription (notificationFk,userFk)
|
||||
SELECT id, account.myUser_getId() FROM util.notification WHERE name= "zone-included"
|
||||
SELECT id, account.myUser_getId() FROM util.notification WHERE name= "zone-included";
|
||||
|
||||
|
||||
INSERT INTO util.notificationAcl (notificationFk,roleFk)
|
||||
SELECT id, account.role FROM util.notification WHERE name= "zone-included"
|
||||
SELECT id, (SELECT id from `account`.`role` where name = "system") FROM util.notification WHERE name= "zone-included";
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
DROP TRIGGER IF EXISTS `vn`.`zoneIncluded_afterInsert`;
|
||||
USE `vn`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneIncluded_afterInsert`
|
||||
AFTER INSERT ON `zoneIncluded`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO zoneLog
|
||||
SET `action` = 'insert',
|
||||
`changedModel` = 'zoneIncluded',
|
||||
`changedModelId` = NEW.zoneFk,
|
||||
`userFk` = account.myUser_getId();
|
||||
INSERT INTO zoneIncludedCheck
|
||||
SET
|
||||
`action`= 'insert',
|
||||
`zoneFk` = NEW.zoneFk,
|
||||
`geoFk` = NEW.geoFk,
|
||||
`userFk` = account.myUser_getId();
|
||||
-- CALL `vn`.`zoneIncluded_checkCollisions`(NEW.zoneFk, NEW.geoFk);
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
||||
DROP TRIGGER IF EXISTS `vn`.`zoneIncluded_afterUpdate`;
|
||||
USE `vn`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneIncluded_afterUpdate`
|
||||
AFTER UPDATE ON `zoneIncluded`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO zoneLog
|
||||
SET `action` = 'update',
|
||||
`changedModel` = 'zoneIncluded',
|
||||
`changedModelId` = OLD.zoneFk,
|
||||
`userFk` = account.myUser_getId();
|
||||
INSERT INTO zoneIncludedCheck
|
||||
SET
|
||||
`action`= 'update',
|
||||
`zoneFk` = NEW.zoneFk,
|
||||
`geoFk` = NEW.geoFk,
|
||||
`userFk` = account.myUser_getId();
|
||||
|
||||
-- CALL `vn`.`zoneIncluded_checkCollisions`();
|
||||
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
||||
DROP TRIGGER IF EXISTS `vn`.`zoneIncluded_afterDelete`;
|
||||
USE `vn`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneIncluded_afterDelete`
|
||||
AFTER DELETE ON `zoneIncluded`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO zoneLog
|
||||
SET `action` = 'delete',
|
||||
`changedModel` = 'zoneIncluded',
|
||||
`changedModelId` = OLD.zoneFk,
|
||||
`userFk` = account.myUser_getId();
|
||||
INSERT INTO zoneIncludedCheck
|
||||
SET
|
||||
`action`= 'delete',
|
||||
`zoneFk` = OLD.zoneFk,
|
||||
`geoFk` = OLD.geoFk,
|
||||
`userFk` = account.myUser_getId();
|
||||
|
||||
-- CALL `vn`.`zoneIncluded_checkCollisions`();
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,14 @@
|
|||
CREATE TABLE `vn`.`zoneIncludedCheck` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`zoneFK` int(11) NOT NULL,
|
||||
`geoFK` int(11) NOT NULL,
|
||||
`userFK` int(10) unsigned NOT NULL,
|
||||
`action`set('insert','update','delete') NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `user_FK` FOREIGN KEY (`userFK`) REFERENCES `account`.`user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||
CONSTRAINT `zone_FK` FOREIGN KEY (`zoneFK`) REFERENCES `vn`.`zone` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||
CONSTRAINT `geo_FK` FOREIGN KEY (`geoFK`) REFERENCES `vn`.`zoneGeo` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||
UNIQUE INDEX (`zoneFK`, `geoFK`, `userFK`, `action`)
|
||||
)
|
||||
|
||||
comment 'Table to save temporarily zone changes';
|
|
@ -0,0 +1,5 @@
|
|||
USE vn;
|
||||
CREATE EVENT zoneCollisionsCheck
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP
|
||||
DISABLE ON SLAVE
|
||||
DO SELECT vn.zoneIncluded_checkCollisions;
|
|
@ -0,0 +1,33 @@
|
|||
DROP PROCEDURE IF EXISTS `vn`.`zoneIncluded_checkCollisions`;
|
||||
DELIMITER $$
|
||||
|
||||
CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zoneIncluded_checkCollisions`()
|
||||
BEGIN
|
||||
DECLARE done INT DEFAULT 0;
|
||||
DECLARE zic_id, zic_zone, zic_geo, zic_action, zic_userFk INT;
|
||||
DECLARE z_name VARCHAR(255);
|
||||
DECLARE g_name VARCHAR(255);
|
||||
|
||||
DECLARE my_cur CURSOR FOR
|
||||
SELECT zic.id, z.name , zg.name , zic.geoFk ,zic.`action` , zic.userFK FROM vn.zoneIncludedCheck zic, vn.`zone` z, vn.zoneGeo zg WHERE zic.zoneFK =z.id AND zic.geoFK = zg.id ;
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
|
||||
|
||||
OPEN my_cur;
|
||||
my_cur_loop:
|
||||
LOOP FETCH my_cur INTO zic_id, z_name,g_name, zic_geo, zic_action, zic_userFk ;
|
||||
IF done = 1 THEN
|
||||
select concat('NO REDCORDS' ) AS '** DEBUG:';
|
||||
LEAVE my_cur_loop;
|
||||
END IF;
|
||||
SELECT concat('** ', zic_id, '** ',z_name, '** ',g_name,'**',zic_geo,'** ', zic_action,'** ', zic_userFk ) AS '** DEBUG:';
|
||||
DELETE FROM vn.zoneIncludedCheck WHERE id =zic_id;
|
||||
SELECT util.notification_send('zone-included',
|
||||
JSON_OBJECT('zoneSelected', z_name, 'geoSelected', g_name),
|
||||
account.myUser_getId()
|
||||
);
|
||||
END LOOP my_cur_loop;
|
||||
CLOSE my_cur;
|
||||
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,2 @@
|
|||
DELETE FROM bs.nightTask
|
||||
WHERE `procedure` ='zone_getCollisions';
|
|
@ -0,0 +1 @@
|
|||
DROP PROCEDURE vn.zone_getCollisions;
|
|
@ -0,0 +1,11 @@
|
|||
-- Auto-generated SQL script #202311241021
|
||||
INSERT INTO util.notification (name,description)
|
||||
VALUES ('zone-included','An email to notify zoneCollisions');
|
||||
|
||||
-- Auto-generated SQL script #202311241051
|
||||
INSERT INTO util.notificationSubscription (notificationFk,userFk)
|
||||
SELECT id, account.myUser_getId() FROM util.notification WHERE name= "zone-included"
|
||||
|
||||
|
||||
INSERT INTO util.notificationAcl (notificationFk,roleFk)
|
||||
SELECT id, account.role FROM util.notification WHERE name= "zone-included"
|
|
@ -1,8 +1,33 @@
|
|||
<email-body v-bind="$props">
|
||||
<div class="grid-row">
|
||||
<div class="grid-block vn-pa-ml">
|
||||
<h1>{{ $t('subject') }}</h1>
|
||||
<p>{{ $t('title', [zoneSelected,geoSelected]) }}</p>
|
||||
<table cellspacing="10">
|
||||
<tr>
|
||||
<th>C.Postal</th>
|
||||
<th>Número de zona</th>
|
||||
<th>Precio</th>
|
||||
<th>Zona</th>
|
||||
<th>Almacén</th>
|
||||
<th>Salix</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ zn.name }}</td>
|
||||
<td>{{ zoneFk }}</td>
|
||||
<td>{{ z.price }}</td>
|
||||
<td>{{ z.name }}</td>
|
||||
<td>{{ w.name }}</td>
|
||||
<td><a href="https://salix.verdnatura.es/#!/zone/',
|
||||
zoneFk,
|
||||
'/location?q=%7B%22search%22:%22',
|
||||
zn.name,
|
||||
'%22%7D">'
|
||||
'https://salix.verdnatura.es/#!/zone/',
|
||||
zoneFk,
|
||||
'/location?q=%7B%22search%22:%22',
|
||||
zn.name,
|
||||
'%22%7D</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</email-body>
|
||||
|
|
|
@ -5,6 +5,12 @@ module.exports = {
|
|||
name: 'zone-included',
|
||||
components: {
|
||||
'email-body': emailBody.build(),
|
||||
},
|
||||
computed: {
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
},
|
||||
props: {
|
||||
zoneSelected: {
|
||||
|
|
Loading…
Reference in New Issue