Merge pull request 'hotfix-sepaCore' (!2678) from hotfix-sepaCore into master
gitea/salix/pipeline/head This commit looks good Details
gitea/salix/pipeline/pr-test There was a failure building this commit Details

Reviewed-on: #2678
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
Carlos Satorres 2024-07-05 05:52:15 +00:00
commit 69b30b1d42
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-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>
<td>{{$t('supplier.identifier')}}</td>
<th>
<div>{{supplier.iban}}</div>
<div>{{supplier.nif}}</div>
<div>{{supplier.accountDetailValue.join(', ')}}</div>
</th>
</tr>
<tr>

View File

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

View File

@ -9,7 +9,8 @@ SELECT
s.nif,
sa.iban,
sa.supplierFk,
be.name bankName
be.name bankName,
ad.value accountDetailValue
FROM
client c
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 supplierAccount sa ON sa.supplierFk = s.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
(m.companyFk = ? OR m.companyFk IS NULL)
AND (c.id = ? OR (c.id IS NULL AND c.countryFk = sa.countryFk))
ORDER BY
m.created DESC
LIMIT 1;
m.created DESC;