From c47cac7d559133277ff453bbf89becbb803077a0 Mon Sep 17 00:00:00 2001 From: alexandre Date: Tue, 17 Jan 2023 08:54:26 +0100 Subject: [PATCH] refs #5020 isActive column added, filter in front --- db/changes/230201/00-borradoLogicoIPT.sql | 3 +++ db/dump/structure.sql | 2 -- modules/item/back/models/item-packing-type.json | 5 ++++- modules/ticket/front/advance-search-panel/index.js | 5 ++++- modules/ticket/front/advance/index.js | 2 ++ modules/ticket/front/future-search-panel/index.js | 5 ++++- modules/ticket/front/future/index.html | 4 ++-- modules/ticket/front/future/index.js | 2 ++ 8 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 db/changes/230201/00-borradoLogicoIPT.sql diff --git a/db/changes/230201/00-borradoLogicoIPT.sql b/db/changes/230201/00-borradoLogicoIPT.sql new file mode 100644 index 000000000..350c0d873 --- /dev/null +++ b/db/changes/230201/00-borradoLogicoIPT.sql @@ -0,0 +1,3 @@ +ALTER TABLE `vn`.`itemPackingType` ADD isActive BOOLEAN; +UPDATE `vn`.`itemPackingType` SET isActive = 0 WHERE code IN ('P', 'F'); +UPDATE `vn`.`itemPackingType` SET isActive = 1 WHERE code IN ('V', 'H'); diff --git a/db/dump/structure.sql b/db/dump/structure.sql index 4626279e4..7d381205c 100644 --- a/db/dump/structure.sql +++ b/db/dump/structure.sql @@ -80201,5 +80201,3 @@ USE `vncontrol`; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2022-11-21 7:57:28 - - diff --git a/modules/item/back/models/item-packing-type.json b/modules/item/back/models/item-packing-type.json index d77c37dd8..da435db24 100644 --- a/modules/item/back/models/item-packing-type.json +++ b/modules/item/back/models/item-packing-type.json @@ -13,6 +13,9 @@ }, "description": { "type": "string" + }, + "isActive":{ + "type": "boolean" } }, "acls": [ @@ -23,4 +26,4 @@ "permission": "ALLOW" } ] -} \ No newline at end of file +} diff --git a/modules/ticket/front/advance-search-panel/index.js b/modules/ticket/front/advance-search-panel/index.js index 259a40931..0ee16bc3c 100644 --- a/modules/ticket/front/advance-search-panel/index.js +++ b/modules/ticket/front/advance-search-panel/index.js @@ -25,7 +25,10 @@ class Controller extends SearchPanel { getItemPackingTypes() { let itemPackingTypes = []; - this.$http.get('ItemPackingTypes').then(res => { + const filter = { + where: {isActive: true} + }; + this.$http.get('ItemPackingTypes', {filter}).then(res => { for (let ipt of res.data) { itemPackingTypes.push({ code: ipt.code, diff --git a/modules/ticket/front/advance/index.js b/modules/ticket/front/advance/index.js index 1404f9472..b770440f1 100644 --- a/modules/ticket/front/advance/index.js +++ b/modules/ticket/front/advance/index.js @@ -39,6 +39,7 @@ export default class Controller extends Section { field: 'ipt', autocomplete: { url: 'ItemPackingTypes', + where: `{isActive: true}`, showField: 'description', valueField: 'code' } @@ -47,6 +48,7 @@ export default class Controller extends Section { field: 'futureIpt', autocomplete: { url: 'ItemPackingTypes', + where: `{isActive: true}`, showField: 'description', valueField: 'code' } diff --git a/modules/ticket/front/future-search-panel/index.js b/modules/ticket/front/future-search-panel/index.js index d7e7b3a5e..8a75420df 100644 --- a/modules/ticket/front/future-search-panel/index.js +++ b/modules/ticket/front/future-search-panel/index.js @@ -25,7 +25,10 @@ class Controller extends SearchPanel { getItemPackingTypes() { let itemPackingTypes = []; - this.$http.get('ItemPackingTypes').then(res => { + const filter = { + where: {isActive: true} + }; + this.$http.get('ItemPackingTypes', {filter}).then(res => { for (let ipt of res.data) { itemPackingTypes.push({ description: this.$t(ipt.description), diff --git a/modules/ticket/front/future/index.html b/modules/ticket/front/future/index.html index 68b0aa4fd..c0e1decc2 100644 --- a/modules/ticket/front/future/index.html +++ b/modules/ticket/front/future/index.html @@ -134,7 +134,7 @@ {{::ticket.shipped | date: 'dd/MM/yyyy HH:mm'}} - {{::ticket.ipt}} + {{::ticket.ipt | dashIfEmpty}} @@ -155,7 +155,7 @@ {{::ticket.futureShipped | date: 'dd/MM/yyyy HH:mm'}} - {{::ticket.futureIpt}} + {{::ticket.futureIpt | dashIfEmpty}} diff --git a/modules/ticket/front/future/index.js b/modules/ticket/front/future/index.js index 56ba1608e..5fb2c8f82 100644 --- a/modules/ticket/front/future/index.js +++ b/modules/ticket/front/future/index.js @@ -34,6 +34,7 @@ export default class Controller extends Section { field: 'ipt', autocomplete: { url: 'ItemPackingTypes', + where: `{isActive: true}`, showField: 'description', valueField: 'code' } @@ -42,6 +43,7 @@ export default class Controller extends Section { field: 'futureIpt', autocomplete: { url: 'ItemPackingTypes', + where: `{isActive: true}`, showField: 'description', valueField: 'code' }