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 vnReport = require('../../../core/mixins/vn-report.js');
const db = require('../../../core/database');
module.exports = { module.exports = {
name: 'sepa-core', name: 'sepa-core',
mixins: [vnReport], mixins: [vnReport],
async serverPrefetch() { 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); 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 = { this.supplier = {
...suppliers[0], ...suppliers[0],
accountDetailValue: suppliers.map(val => val?.accountDetailValue) accountDetailValue: suppliers.map(val => val?.accountDetailValue)

View File

@ -1,5 +1,4 @@
SELECT c.id, SELECT c.id,
m.code mandateCode,
c.socialName, c.socialName,
c.street, c.street,
c.postcode, c.postcode,
@ -11,11 +10,5 @@ SELECT c.id,
ct.ibanLength ibanLength ct.ibanLength ibanLength
FROM client c FROM client c
JOIN country ct ON ct.id = c.countryFk JOIN country ct ON ct.id = c.countryFk
LEFT JOIN province p ON p.id = c.provinceFk JOIN province p ON p.id = c.provinceFk
LEFT JOIN mandate m ON m.clientFk = c.id WHERE 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

View File

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