Skip to content

Commit

Permalink
UINV-566 add external number extention to the csv export (#829)
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaSedyx authored and usavkov-epam committed Nov 27, 2024
1 parent a4bc02d commit 3648a8c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## 6.2.0 (IN PROGRESS)

## 6.1.1 (IN PROGRESS)

* Add external number extention to the csv export. Refs UINV-566.

## [6.1.0](https://github.com/folio-org/ui-invoice/tree/v6.1.0) (2024-10-31)
[Full Changelog](https://github.com/folio-org/ui-invoice/compare/v6.0.4...v6.1.0)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,18 @@ const getExportAdjustmentData = (adjustments) => (
)).join(' | ').replace(/\n\s+/g, '')
);

const getInvoiceLineExternalAccountNumbers = (line, fundsMap, invalidReferenceLabel) => {
const getInvoiceLineExternalAccountNumbers = (line, fundsMap, expenseClassMap, invalidReferenceLabel) => {
return line.fundDistributions?.map(fund => {
const externalAccountNumber = fundsMap[fund.fundId]?.externalAccountNo;
const externalAccountNumberExt = expenseClassMap[fund.expenseClassId]?.externalAccountNumberExt;

return externalAccountNumber ? `"${externalAccountNumber}"` : invalidReferenceLabel;
if (externalAccountNumber && externalAccountNumberExt) {
return `"${externalAccountNumber}-${externalAccountNumberExt}"`;
} else if (externalAccountNumber) {
return `"${externalAccountNumber}"`;
} else {
return invalidReferenceLabel;
}
}).join(' | ');
};

Expand Down Expand Up @@ -155,7 +162,12 @@ function getInvoiceLineExportData({
invalidReferenceLabel,
invoice.currency,
),
externalAccountNumber: getInvoiceLineExternalAccountNumbers(line, fundsMap, invalidReferenceLabel),
externalAccountNumber: getInvoiceLineExternalAccountNumbers(
line,
fundsMap,
expenseClassMap,
invalidReferenceLabel,
),
referenceNumbers: getExportReferenceNumbers(line),
lineTags: line.tags?.tagList?.join(' | '),
invoiceLineCreatedBy: userMap[line.metadata?.createdByUserId]?.username,
Expand Down

0 comments on commit 3648a8c

Please sign in to comment.