refs #5525 sql correct
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Satorres 2023-09-13 11:02:47 +02:00
parent b5d882ae5d
commit d26a73bdd9
2 changed files with 9 additions and 4 deletions

View File

@ -1,3 +1,7 @@
ALTER TABLE `vn`.`supplierAccount` ADD COLUMN `countryFk` mediumint(8) unsigned NULL;
ALTER TABLE `vn`.`supplierAccount` ADD CONSTRAINT `supplierAccount_fk_country` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`);
ALTER TABLE `vn`.`company` MODIFY COLUMN `supplierAccountFk` mediumint(8) unsigned DEFAULT NULL NULL COMMENT 'Cuenta por defecto para ingresos desde este pais';
d

View File

@ -7,10 +7,11 @@ module.exports = {
name: 'letter-debtor-st',
async serverPrefetch() {
this.debtor = await db.findOne(`
SELECT sa.iban FROM client c
LEFT JOIN supplierAccount sa ON c.countryFk = sa.countryFk
WHERE c.id = ?
OR (c.id IS NULL AND c.countryFk = sa.countryFk)`,
SELECT sa.iban, be.name bankName
FROM supplierAccount sa
JOIN bankEntity be ON sa.bankEntityFk = be.id
JOIN client c ON c.countryFk = sa.countryFk
WHERE c.id = ? OR (c.id IS NULL AND c.countryFk = sa.countryFk);`,
[this.id]);
},
data() {