fix accountcode filter
parent
d74598c877
commit
75cdf7e036
|
|
@ -7,19 +7,19 @@ if (configFunctions.getProperty('settings.dynamicsGP.integrationIsEnabled')) {
|
||||||
}
|
}
|
||||||
function filterCashReceipt(cashReceipt) {
|
function filterCashReceipt(cashReceipt) {
|
||||||
const accountCodes = configFunctions.getProperty('settings.dynamicsGP.accountCodes');
|
const accountCodes = configFunctions.getProperty('settings.dynamicsGP.accountCodes');
|
||||||
for (const accountCode of accountCodes) {
|
if (accountCodes.length > 0) {
|
||||||
let found = cashReceipt.details.some((detailRecord) => {
|
for (const detail of cashReceipt.details) {
|
||||||
return detailRecord.accountCode === accountCode;
|
if (accountCodes.includes(detail.accountCode)) {
|
||||||
});
|
return cashReceipt;
|
||||||
if (!found) {
|
}
|
||||||
found = cashReceipt.distributions.some((distributionRecord) => {
|
}
|
||||||
return distributionRecord.accountCode === accountCode;
|
for (const distribution of cashReceipt.distributions) {
|
||||||
});
|
if (accountCodes.includes(distribution.accountCode)) {
|
||||||
|
return cashReceipt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!found) {
|
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return cashReceipt;
|
return cashReceipt;
|
||||||
}
|
}
|
||||||
function filterInvoice(invoice) {
|
function filterInvoice(invoice) {
|
||||||
|
|
|
||||||
|
|
@ -31,21 +31,21 @@ function filterCashReceipt(
|
||||||
'settings.dynamicsGP.accountCodes'
|
'settings.dynamicsGP.accountCodes'
|
||||||
)
|
)
|
||||||
|
|
||||||
for (const accountCode of accountCodes) {
|
if (accountCodes.length > 0) {
|
||||||
let found = cashReceipt.details.some((detailRecord) => {
|
for (const detail of cashReceipt.details) {
|
||||||
return detailRecord.accountCode === accountCode
|
if (accountCodes.includes(detail.accountCode)) {
|
||||||
})
|
return cashReceipt
|
||||||
|
}
|
||||||
if (!found) {
|
}
|
||||||
found = cashReceipt.distributions.some((distributionRecord) => {
|
|
||||||
return distributionRecord.accountCode === accountCode
|
for (const distribution of cashReceipt.distributions) {
|
||||||
})
|
if (accountCodes.includes(distribution.accountCode)) {
|
||||||
|
return cashReceipt
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return cashReceipt
|
return cashReceipt
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue