From 7e37d7f3f1b943009e14206852f6482a0b357642 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 23 Mar 2023 09:25:56 +0100 Subject: [PATCH] refs #5342 actualido el itemType.isFragile para las 'plants' --- db/changes/231201/00-itemType_isFragile.sql | 11 ++++++++++- db/changes/231201/00-ticket_getWarnings.sql | 3 +-- db/dump/fixtures.sql | 14 +++++++------- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/db/changes/231201/00-itemType_isFragile.sql b/db/changes/231201/00-itemType_isFragile.sql index 00a74b8b6..5b25288f3 100644 --- a/db/changes/231201/00-itemType_isFragile.sql +++ b/db/changes/231201/00-itemType_isFragile.sql @@ -1,5 +1,14 @@ ALTER TABLE `vn`.`itemType` ADD isFragile tinyint(1) NULL; ALTER TABLE `vn`.`itemType` MODIFY COLUMN isFragile tinyint(1) DEFAULT 0 NOT NULL; + UPDATE `vn`.`itemType` SET isFragile = 1 - WHERE code IN ('ZKA', 'ZKE'); +WHERE code IN ('ZKA', 'ZKE'); + +UPDATE `vn`.`itemType` + SET isFragile = 1 +WHERE id IN (SELECT it.id + FROM itemCategory ic + JOIN itemType it ON it.categoryFk = ic.id + WHERE ic.code = 'plant'); + diff --git a/db/changes/231201/00-ticket_getWarnings.sql b/db/changes/231201/00-ticket_getWarnings.sql index 605fe6ad0..5253b58ab 100644 --- a/db/changes/231201/00-ticket_getWarnings.sql +++ b/db/changes/231201/00-ticket_getWarnings.sql @@ -26,11 +26,10 @@ BEGIN LEFT JOIN sale s ON s.ticketFk = tt.ticketFk LEFT JOIN item i ON i.id = s.itemFk LEFT JOIN itemType it ON it.id = i.typeFk - LEFT JOIN itemCategory ic ON ic.id = it.categoryFk LEFT JOIN agencyMode am ON am.id = tt.agencyModeFk LEFT JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk WHERE dm.code IN ('AGENCY') - AND (ic.code = 'plant' OR it.isFragile); + AND it.isFragile; DROP TEMPORARY TABLE IF EXISTS tmp.ticket_warnings; CREATE TEMPORARY TABLE tmp.ticket_warnings diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 2145f8429..f78313cc9 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -838,14 +838,14 @@ INSERT INTO `vn`.`temperature`(`code`, `name`, `description`) ('warm', 'Warm', 'Warm'), ('cool', 'Cool', 'Cool'); -INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`, `workerFk`, `isPackaging`, `temperatureFk`) +INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`, `workerFk`, `isPackaging`, `temperatureFk`, `isFragile`) VALUES - (1, 'CRI', 'Crisantemo', 2, 31, 35, 0, 'cool'), - (2, 'ITG', 'Anthurium', 1, 31, 35, 0, 'cool'), - (3, 'WPN', 'Paniculata', 2, 31, 35, 0, 'cool'), - (4, 'PRT', 'Delivery ports', 3, NULL, 35, 1, 'warm'), - (5, 'CON', 'Container', 3, NULL, 35, 1, 'warm'), - (6, 'ALS', 'Alstroemeria', 1, 31, 16, 0, 'warm'); + (1, 'CRI', 'Crisantemo', 2, 31, 35, 0, 'cool', 0), + (2, 'ITG', 'Anthurium', 1, 31, 35, 0, 'cool', 1), + (3, 'WPN', 'Paniculata', 2, 31, 35, 0, 'cool', 0), + (4, 'PRT', 'Delivery ports', 3, NULL, 35, 1, 'warm', 0), + (5, 'CON', 'Container', 3, NULL, 35, 1, 'warm', 0), + (6, 'ALS', 'Alstroemeria', 1, 31, 16, 0, 'warm', 1); INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`, `hex`) VALUES