Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OBAM-357 Allow multiple invoice templates on single shipment workflow #3197

Merged
merged 3 commits into from
May 16, 2022

Conversation

awalkowiak
Copy link
Collaborator

and OBAM-358 Add variables for custom document template

@awalkowiak awalkowiak requested a review from jmiranda May 12, 2022 23:07
@@ -45,8 +46,12 @@ class DocumentTemplateService {
Context context = new Context()
context.putVar("invoiceItems", shipmentInstance?.shipmentItems)
context.putVar("datePrinted", Constants.EUROPEAN_DATE_FORMATTER.format(new Date()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we hard-coding the date formatter here? I feel like this should be locale specific.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good question, I do not remember

context.putVar("destination", shipmentInstance?.destination)
context.putVar("originRequisitionCount", requisitionService.getRequisitionCountInCurrentFiscalYear(shipmentInstance?.origin))
context.putVar("destinationRequisitionCount", requisitionService.getRequisitionCountInCurrentFiscalYear(shipmentInstance?.destination))
JxlsHelper.getInstance().processTemplateAtCell(inputStream, outputStream, context, "Template!A1")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Template!A1 should probably be configurable. Just add something like the following to Config.groovy.

openboxes.documentTemplate.invoiceTemplate.targetCell = "Template!A1"

The "Template" part scares me. Is there no way to use the default tab's name?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean the Sheet1?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, will do it

documentList << [
name : documentTemplate?.name,
documentType: documentTemplate?.documentType?.name,
contentType : documentTemplate?.contentType,
stepNumber : null,
stepNumber : isInvoiceTemplate ? 5 : null,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to rethink this stepNumber thing at some point. I'll take the blame for that.

@awalkowiak awalkowiak merged commit 9cc1f16 into develop May 16, 2022
@awalkowiak awalkowiak deleted the OBAM-357 branch May 16, 2022 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants