diff --git a/db/changes/10250-curfew/00-ACL.sql b/db/changes/10250-curfew/00-ACL.sql index 90f673c67..9c7fe1712 100644 --- a/db/changes/10250-curfew/00-ACL.sql +++ b/db/changes/10250-curfew/00-ACL.sql @@ -1,3 +1,11 @@ +UPDATE `salix`.`ACL` SET `principalId` = 'deliveryBoss' WHERE (`id` = '194'); +UPDATE `salix`.`ACL` SET `principalId` = 'claimManager' WHERE (`id` = '97'); +UPDATE `salix`.`ACL` SET `principalId` = 'claimManager' WHERE (`id` = '100'); +UPDATE `salix`.`ACL` SET `principalId` = 'claimManager' WHERE (`id` = '103'); +UPDATE `salix`.`ACL` SET `principalId` = 'claimManager' WHERE (`id` = '202'); + +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Town', '*', 'WRITE', 'ALLOW', 'ROLE', 'deliveryBoss'); +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Province', '*', 'WRITE', 'ALLOW', 'ROLE', 'deliveryBoss'); INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Supplier', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Supplier', '*', 'WRITE', 'ALLOW', 'ROLE', 'administrative'); INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('SupplierLog', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/changes/10250-toqueDeQueda/00-claimState.sql b/db/changes/10250-curfew/00-claimState.sql similarity index 100% rename from db/changes/10250-toqueDeQueda/00-claimState.sql rename to db/changes/10250-curfew/00-claimState.sql diff --git a/db/changes/10250-toqueDeQueda/00-observationType.sql b/db/changes/10250-curfew/00-observationType.sql similarity index 100% rename from db/changes/10250-toqueDeQueda/00-observationType.sql rename to db/changes/10250-curfew/00-observationType.sql diff --git a/db/changes/10250-toqueDeQueda/00-supplierLog.sql b/db/changes/10250-curfew/00-supplierLog.sql similarity index 100% rename from db/changes/10250-toqueDeQueda/00-supplierLog.sql rename to db/changes/10250-curfew/00-supplierLog.sql diff --git a/db/changes/10250-toqueDeQueda/00-ticket_beforeUpdate.sql b/db/changes/10250-curfew/00-ticket_beforeUpdate.sql similarity index 100% rename from db/changes/10250-toqueDeQueda/00-ticket_beforeUpdate.sql rename to db/changes/10250-curfew/00-ticket_beforeUpdate.sql diff --git a/db/changes/10250-toqueDeQueda/00-ticket_componentPreview.sql b/db/changes/10250-curfew/00-ticket_componentPreview.sql similarity index 100% rename from db/changes/10250-toqueDeQueda/00-ticket_componentPreview.sql rename to db/changes/10250-curfew/00-ticket_componentPreview.sql diff --git a/db/changes/10250-curfew/01-supplierFreighter.sql b/db/changes/10250-curfew/01-supplierFreighter.sql new file mode 100644 index 000000000..56c5f7680 --- /dev/null +++ b/db/changes/10250-curfew/01-supplierFreighter.sql @@ -0,0 +1,20 @@ +CREATE TABLE `vn`.supplierFreighter +( + supplierFk INT NOT NULL, + CONSTRAINT supplierFreighter_pk + PRIMARY KEY (supplierFk), + CONSTRAINT supplier_id_fk + FOREIGN KEY (supplierFk) REFERENCES supplier (id) + ON UPDATE CASCADE ON DELETE CASCADE +); + +INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (286); +INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (454); +INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (582); +INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (470); +INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (775); +INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (812); +INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (1112); +INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (1242); +INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (1281); +INSERT IGNORE INTO `vn`.supplierFreighter (supplierFk) VALUES (1765); \ No newline at end of file diff --git a/db/changes/10250-curfew/02-travel.sql b/db/changes/10250-curfew/02-travel.sql new file mode 100644 index 000000000..3bd84d61f --- /dev/null +++ b/db/changes/10250-curfew/02-travel.sql @@ -0,0 +1,7 @@ +ALTER TABLE `vn`.travel + DROP FOREIGN KEY travel_ibfk_4; + +ALTER TABLE `vn`.travel + ADD CONSTRAINT supplierFreighter_fk_4 + FOREIGN KEY (cargoSupplierFk) REFERENCES supplierFreighter (supplierFk) + ON UPDATE CASCADE ON DELETE SET NULL; diff --git a/db/changes/10250-toqueDeQueda/00-ACL.sql b/db/changes/10250-toqueDeQueda/00-ACL.sql deleted file mode 100644 index 4cdadfd04..000000000 --- a/db/changes/10250-toqueDeQueda/00-ACL.sql +++ /dev/null @@ -1,10 +0,0 @@ -UPDATE `salix`.`ACL` SET `principalId` = 'deliveryBoss' WHERE (`id` = '194'); -UPDATE `salix`.`ACL` SET `principalId` = 'claimManager' WHERE (`id` = '97'); -UPDATE `salix`.`ACL` SET `principalId` = 'claimManager' WHERE (`id` = '100'); -UPDATE `salix`.`ACL` SET `principalId` = 'claimManager' WHERE (`id` = '103'); -UPDATE `salix`.`ACL` SET `principalId` = 'claimManager' WHERE (`id` = '202'); - -INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Town', '*', 'WRITE', 'ALLOW', 'ROLE', 'deliveryBoss'); -INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Province', '*', 'WRITE', 'ALLOW', 'ROLE', 'deliveryBoss'); -INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('supplier', '*', 'WRITE', 'ALLOW', 'ROLE', 'administrative'); -INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('SupplierContact', '*', 'WRITE', 'ALLOW', 'ROLE', 'administrative'); diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 8cd6c2b5c..2e00878d2 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -439,7 +439,7 @@ INSERT INTO `vn`.`bankEntity`(`id`, `countryFk`, `name`, `bic`) (2100, 1, 'Caixa Bank', 'CAIXESBB'); INSERT INTO `vn`.`supplierAccount`(`id`, `supplierFk`, `iban`, `bankEntityFk`) - VALUES + VALUES (241, 442, 'ES111122333344111122221111', 128); INSERT INTO `vn`.`company`(`id`, `code`, `supplierAccountFk`, `workerManagerFk`, `companyCode`, `sage200Company`, `expired`) @@ -1226,6 +1226,11 @@ INSERT INTO `vn`.`supplierContact`(`id`, `supplierFk`, `phone`, `mobile`, `email (3, 2, 321654987, NULL, 'supplier2@email.es', NULL, NULL), (4, 442, 321654987, NULL, NULL, 'observation442', NULL); +INSERT INTO `vn`.`supplierFreighter` (`supplierFk`) + VALUES + (1), + (2); + INSERT INTO `cache`.`cache_calc`(`id`, `cache_id`, `cacheName`, `params`, `last_refresh`, `expires`, `created`, `connection_id`) VALUES (1, 2, 'available', CONCAT_WS('/',1,CURDATE()), CURRENT_TIMESTAMP(), DATE_ADD(CURRENT_TIMESTAMP(),INTERVAL 15 MINUTE), CURDATE(), NULL), @@ -1240,16 +1245,16 @@ INSERT INTO `vn`.`ticketWeekly`(`ticketFk`, `weekDay`) (4, 4), (5, 6); -INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseOutFk`, `agencyFk`, `m3`, `kg`,`ref`, `totalEntries`) +INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseOutFk`, `agencyFk`, `m3`, `kg`,`ref`, `totalEntries`, `cargoSupplierFk`) VALUES - (1, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 1, 2, 1, 100.00, 1000, 'first travel', 1), - (2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 150, 2000, 'second travel', 2), - (3, CURDATE(), CURDATE(), 1, 2, 1, 0.00, 0.00, 'third travel', 1), - (4, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 50.00, 500, 'fourth travel', 0), - (5, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 3, 2, 1, 50.00, 500, 'fifth travel', 1), - (6, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 4, 2, 1, 50.00, 500, 'sixth travel', 1), - (7, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 2, 1, 50.00, 500, 'seventh travel', 2), - (8, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 2, 1, 50.00, 500, 'eight travel', 1); + (1, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 1, 2, 1, 100.00, 1000, 'first travel', 1, 1), + (2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 150, 2000, 'second travel', 2, 2), + (3, CURDATE(), CURDATE(), 1, 2, 1, 0.00, 0.00, 'third travel', 1, 1), + (4, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 50.00, 500, 'fourth travel', 0, 2), + (5, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 3, 2, 1, 50.00, 500, 'fifth travel', 1, 1), + (6, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 4, 2, 1, 50.00, 500, 'sixth travel', 1, 2), + (7, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 2, 1, 50.00, 500, 'seventh travel', 2, 1), + (8, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 2, 1, 50.00, 500, 'eight travel', 1, 2); INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `ref`,`isInventory`, `isRaid`, `notes`, `evaNotes`) VALUES