From 21be73b7346d30c6ab5d21c95122b8fdb33e8468 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Wed, 26 Feb 2020 14:30:30 +0100 Subject: [PATCH] 2127 - Disable preview on sepa core sample --- db/changes/10161-postValentineDay/00-sample.sql | 6 ++++++ modules/client/back/models/sample.json | 5 ++++- modules/client/front/sample/create/index.html | 9 ++++++--- modules/client/front/sample/create/index.js | 12 ++++++------ 4 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 db/changes/10161-postValentineDay/00-sample.sql diff --git a/db/changes/10161-postValentineDay/00-sample.sql b/db/changes/10161-postValentineDay/00-sample.sql new file mode 100644 index 000000000..d34835888 --- /dev/null +++ b/db/changes/10161-postValentineDay/00-sample.sql @@ -0,0 +1,6 @@ +ALTER TABLE `vn`.`sample` +ADD COLUMN `hasPreview` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1' AFTER `hasCompany`, +CHANGE COLUMN `isVisible` `isVisible` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1' , +CHANGE COLUMN `hasCompany` `hasCompany` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' ; + +UPDATE `vn`.`sample` SET `hasPreview` = '0' WHERE (`id` = '14'); diff --git a/modules/client/back/models/sample.json b/modules/client/back/models/sample.json index 8993250f3..725bfb9c7 100644 --- a/modules/client/back/models/sample.json +++ b/modules/client/back/models/sample.json @@ -22,7 +22,10 @@ "type": "Boolean" }, "hasCompany": { - "type": "Number" + "type": "Boolean" + }, + "hasPreview": { + "type": "Boolean" } }, "scopes": { diff --git a/modules/client/front/sample/create/index.html b/modules/client/front/sample/create/index.html index cd3412868..22f95eb20 100644 --- a/modules/client/front/sample/create/index.html +++ b/modules/client/front/sample/create/index.html @@ -23,7 +23,7 @@ - + + diff --git a/modules/client/front/sample/create/index.js b/modules/client/front/sample/create/index.js index e3504785d..f478243c7 100644 --- a/modules/client/front/sample/create/index.js +++ b/modules/client/front/sample/create/index.js @@ -26,13 +26,13 @@ class Controller extends Component { } get companyId() { - if (!this.clientSample.companyId) - this.clientSample.companyId = this.vnConfig.companyFk; - return this.clientSample.companyId; + if (!this.clientSample.companyFk) + this.clientSample.companyFk = this.vnConfig.companyFk; + return this.clientSample.companyFk; } set companyId(value) { - this.clientSample.companyId = value; + this.clientSample.companyFk = value; } onSubmit() { @@ -74,11 +74,11 @@ class Controller extends Component { if (!sampleType) return this.vnApp.showError(this.$translate.instant('Choose a sample')); - if (sampleType.hasCompany && !this.clientSample.companyId) + if (sampleType.hasCompany && !this.clientSample.companyFk) return this.vnApp.showError(this.$translate.instant('Choose a company')); if (sampleType.hasCompany) - params.companyId = this.clientSample.companyId; + params.companyId = this.clientSample.companyFk; if (isPreview) params.isPreview = true;