231801_test_to_master #1519

Merged
alexm merged 490 commits from 231801_test_to_master into master 2023-05-12 06:29:59 +00:00
2 changed files with 20 additions and 7 deletions
Showing only changes of commit 43ab07d954 - Show all commits

View File

@ -0,0 +1,12 @@
-- vn.companyL10n source
CREATE OR REPLACE
ALGORITHM = UNDEFINED VIEW `vn`.`companyL10n` AS
select
`c`.`id` AS `id`,
ifnull(`ci`.`footnotes`, `c`.`footnotes`) AS `footnotes`
from
(`vn`.`company` `c`
left join `vn`.`companyI18n` `ci` on
(`ci`.`companyFk` = `c`.`id`
and `ci`.`lang` = `util`.`LANG`()));

View File

@ -4,13 +4,14 @@ const db = require('../../database');
module.exports = { module.exports = {
name: 'report-footer', name: 'report-footer',
async serverPrefetch() { async serverPrefetch() {
this.company = await db.findOne( this.company = await db.findOne(`
`SELECT SELECT IFNULL(ci.footnotes, cl.footnotes) as footnotes
ci.footnotes FROM company c
FROM companyI18n ci LEFT JOIN companyL10n cl ON c.id = cl.id
JOIN company c ON c.id = ci.companyFk LEFT JOIN companyI18n ci ON ci.companyFk = cl.id
WHERE c.code = ? AND ci.lang = (SELECT lang FROM account.user WHERE id = ?)`, AND ci.lang = (SELECT lang FROM account.user where id = ?)
[this.companyCode, this.recipientId]); WHERE c.code = ?`,
[this.recipientId, this.companyCode]);
}, },
props: ['leftText', 'companyCode', 'recipientId', 'centerText'] props: ['leftText', 'companyCode', 'recipientId', 'centerText']