From d05ddef5fae0d3826a2807c151b04b9f6ba88d4f Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 22 Mar 2023 14:54:59 +0100 Subject: [PATCH] refs #084200 primer commit companyI18n --- db/changes/231001/00-newCompanyI18n.sql | 9 +++++++++ .../components/report-footer/report-footer.html | 2 +- .../core/components/report-footer/report-footer.js | 14 +++++++------- 3 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 db/changes/231001/00-newCompanyI18n.sql diff --git a/db/changes/231001/00-newCompanyI18n.sql b/db/changes/231001/00-newCompanyI18n.sql new file mode 100644 index 000000000..0aad8527b --- /dev/null +++ b/db/changes/231001/00-newCompanyI18n.sql @@ -0,0 +1,9 @@ +-- vn.companyI18n definition + +CREATE TABLE `companyI18n` ( + `companyFk` smallint(5) unsigned NOT NULL, + `lang` char(2) CHARACTER SET utf8mb3 NOT NULL, + `footnotes` longtext COLLATE utf8mb3_unicode_ci DEFAULT NULL, + PRIMARY KEY (`companyFk`,`lang`), + CONSTRAINT `companyI18n_FK` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; \ No newline at end of file diff --git a/print/core/components/report-footer/report-footer.html b/print/core/components/report-footer/report-footer.html index 447091f9b..62d0d9ae6 100644 --- a/print/core/components/report-footer/report-footer.html +++ b/print/core/components/report-footer/report-footer.html @@ -8,7 +8,7 @@

+ v-html="$18n.locale(`${company.footnotes}`)">

diff --git a/print/core/components/report-footer/report-footer.js b/print/core/components/report-footer/report-footer.js index 4debfce12..5027bcf7a 100755 --- a/print/core/components/report-footer/report-footer.js +++ b/print/core/components/report-footer/report-footer.js @@ -8,13 +8,13 @@ module.exports = { methods: { getCompany(code) { return db.findOne(` - SELECT - c.footnotes, - c.code - FROM company c - JOIN companyGroup cg ON cg.id = c.companyGroupFk - JOIN supplier s ON s.id = c.id - WHERE c.code = ?`, [code]); + SELECT + (SELECT ci.footnotes FROM companyI18n ci WHERE ci.companyFk = c.id) AS footnotes, + c.code + FROM company c + JOIN companyGroup cg ON cg.id = c.companyGroupFk + JOIN supplier s ON s.id = c.id + WHERE c.code = ?`); } }, props: ['leftText', 'companyCode', 'centerText']