fixed sepa-core get mandate by supplier id
gitea/salix/test This commit looks good
Details
gitea/salix/test This commit looks good
Details
This commit is contained in:
parent
91f8f337f5
commit
3b5b5112e0
|
@ -11,7 +11,7 @@ module.exports = {
|
|||
if (!params.companyFk)
|
||||
throw new UserException('No company id specified');
|
||||
|
||||
return this.methods.fetchClient(params.clientFk)
|
||||
return this.methods.fetchClient(params.clientFk, params.companyFk)
|
||||
.then(([[client]]) => {
|
||||
if (!client)
|
||||
throw new UserException('No client data found');
|
||||
|
@ -24,7 +24,7 @@ module.exports = {
|
|||
this.$i18n.locale = this.locale;
|
||||
},
|
||||
methods: {
|
||||
fetchClient(clientFk) {
|
||||
fetchClient(clientFk, companyFk) {
|
||||
return database.pool.query(
|
||||
`SELECT
|
||||
c.id clientId,
|
||||
|
@ -46,12 +46,12 @@ module.exports = {
|
|||
FROM client c
|
||||
JOIN account.user u ON u.id = c.id
|
||||
JOIN country ct ON ct.id = c.countryFk
|
||||
JOIN mandate m ON m.clientFk = c.id AND m.finished IS NULL
|
||||
JOIN supplier s ON s.id = m.companyFk
|
||||
JOIN country sc ON sc.id = s.countryFk
|
||||
JOIN province sp ON sp.id = s.provinceFk
|
||||
LEFT JOIN province p ON p.id = c.provinceFk
|
||||
LEFT JOIN mandate m ON m.clientFk = c.id AND m.finished IS NULL
|
||||
LEFT JOIN supplier s ON s.id = m.companyFk
|
||||
LEFT JOIN country sc ON sc.id = s.countryFk
|
||||
LEFT JOIN province sp ON sp.id = s.provinceFk
|
||||
WHERE c.id = ?`, [clientFk]);
|
||||
WHERE m.companyFk = ? AND c.id = ?`, [companyFk, clientFk]);
|
||||
},
|
||||
dated: () => {
|
||||
return strftime('%d-%m-%Y', new Date());
|
||||
|
|
Loading…
Reference in New Issue