hotfix-sepaCore #2678

Merged
carlossa merged 7 commits from hotfix-sepaCore into master 2024-07-05 05:52:16 +00:00
4 changed files with 30 additions and 10 deletions

View File

@ -3884,3 +3884,18 @@ INSERT INTO `vn`.`calendarHolidays` (calendarHolidaysTypeFk, dated, calendarHoli
(1, '2001-05-17', 1, 5), (1, '2001-05-17', 1, 5),
(1, '2001-05-18', 1, 5); (1, '2001-05-18', 1, 5);
INSERT INTO vn.accountDetail
(id, value, accountDetailTypeFk, supplierAccountFk)
VALUES
(21, 'ES12345B12345678', 3, 241),
(35, 'ES12346B12345679', 3, 241);
INSERT INTO vn.accountDetailType
(id, description)
VALUES
(1, 'IBAN'),
(2, 'SWIFT'),
(3, 'Referencia Remesas'),
(4, 'Referencia Transferencias'),
(5, 'Referencia Nominas'),
(6, 'ABA');

View File

@ -27,8 +27,7 @@
<tr> <tr>
<td>{{$t('supplier.identifier')}}</td> <td>{{$t('supplier.identifier')}}</td>
<th> <th>
<div>{{supplier.iban}}</div> <div>{{supplier.accountDetailValue.join(', ')}}</div>
<div>{{supplier.nif}}</div>
</th> </th>
</tr> </tr>
<tr> <tr>

View File

@ -7,7 +7,11 @@ module.exports = {
async serverPrefetch() { async serverPrefetch() {
this.client = await this.findOneFromDef('client', [this.companyId, this.companyId, this.id]); this.client = await this.findOneFromDef('client', [this.companyId, this.companyId, this.id]);
this.checkMainEntity(this.client); this.checkMainEntity(this.client);
this.supplier = await this.findOneFromDef('supplier', [this.companyId, this.companyId, this.id]); const suppliers = await this.rawSqlFromDef('supplier', [this.companyId, this.companyId, this.id]);
this.supplier = {
...suppliers[0],
accountDetailValue: suppliers.map(val => val?.accountDetailValue)
};
}, },
props: { props: {
id: { id: {
@ -23,11 +27,11 @@ module.exports = {
methods: { methods: {
getSupplierCif() { getSupplierCif() {
return db.findOne(` return db.findOne(`
SELECT sa.iban, s.nif SELECT DISTINCT ad.value
FROM supplierAccount sa FROM supplierAccount sa
JOIN company co ON co.supplierAccountFk = sa.id JOIN accountDetail ad ON ad.supplierAccountFk = sa.id
JOIN supplier s ON sa.supplierFk = s.id JOIN accountDetailType adt ON adt.id = ad.accountDetailTypeFk AND adt.id = 3
WHERE co.id = ?`) [this.companyId]; WHERE sa.supplierFk = ?`) [this.companyId];
} }
} }

View File

@ -9,7 +9,8 @@ SELECT
s.nif, s.nif,
sa.iban, sa.iban,
sa.supplierFk, sa.supplierFk,
be.name bankName be.name bankName,
ad.value accountDetailValue
FROM FROM
client c client c
LEFT JOIN mandate m ON m.clientFk = c.id AND m.companyFk = ? AND m.finished IS NULL LEFT JOIN mandate m ON m.clientFk = c.id AND m.companyFk = ? AND m.finished IS NULL
@ -19,9 +20,10 @@ FROM
LEFT JOIN province p ON p.id = c.provinceFk LEFT JOIN province p ON p.id = c.provinceFk
LEFT JOIN supplierAccount sa ON sa.supplierFk = s.id LEFT JOIN supplierAccount sa ON sa.supplierFk = s.id
LEFT JOIN bankEntity be ON sa.bankEntityFk = be.id LEFT JOIN bankEntity be ON sa.bankEntityFk = be.id
LEFT JOIN accountDetail ad ON ad.supplierAccountFk = sa.id
LEFT JOIN accountDetailType adt ON adt.id = ad.accountDetailTypeFk AND adt.id = 3
WHERE WHERE
(m.companyFk = ? OR m.companyFk IS NULL) (m.companyFk = ? OR m.companyFk IS NULL)
AND (c.id = ? OR (c.id IS NULL AND c.countryFk = sa.countryFk)) AND (c.id = ? OR (c.id IS NULL AND c.countryFk = sa.countryFk))
ORDER BY ORDER BY
m.created DESC m.created DESC;
LIMIT 1;