fix: refs#7748 solicitud de domiciliación bancaria #2752

Merged
carlosap merged 7 commits from 7748-Modificar-solicitud-de-domiciliación-bancaria into master 2024-07-19 09:43:16 +00:00
3 changed files with 6 additions and 15 deletions
Showing only changes of commit 9d17a9e827 - Show all commits

View File

@ -1,13 +1,12 @@
const vnReport = require('../../../core/mixins/vn-report.js');
const db = require('../../../core/database');
module.exports = {
name: 'sepa-core',
mixins: [vnReport],
async serverPrefetch() {
this.client = await this.findOneFromDef('client', [this.companyId, this.companyId, this.id]);
this.client = await this.findOneFromDef('client', [this.id]);
this.checkMainEntity(this.client);
const suppliers = await this.rawSqlFromDef('supplier', [this.companyId, this.companyId, this.id]);
const suppliers = await this.rawSqlFromDef('supplier', [this.companyId, this.id]);
this.supplier = {
...suppliers[0],
accountDetailValue: suppliers.map(val => val?.accountDetailValue)

View File

@ -1,5 +1,4 @@
SELECT c.id,
m.code mandateCode,
c.socialName,
c.street,
c.postcode,
@ -11,11 +10,5 @@ SELECT c.id,
ct.ibanLength ibanLength
FROM client c
JOIN country ct ON ct.id = c.countryFk
LEFT JOIN province p ON p.id = c.provinceFk
LEFT JOIN mandate m ON m.clientFk = c.id
AND m.companyFk = ?
AND m.finished IS NULL
WHERE (m.companyFk = ? OR m.companyFk IS NULL)
AND c.id = ?
ORDER BY m.created DESC
LIMIT 1
JOIN province p ON p.id = c.provinceFk
WHERE c.id = ?

View File

@ -20,6 +20,5 @@ SELECT m.code mandateCode,
AND c.id = ?
AND mt.name = 'CORE'
AND adt.description = 'Referencia Remesas'
GROUP BY m.id
GROUP BY m.id, ad.value
ORDER BY m.created DESC
LIMIT 1;