-
-
Notifications
You must be signed in to change notification settings - Fork 717
Feature console template parameter overwrite #5339
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
base: main
Are you sure you want to change the base?
Feature console template parameter overwrite #5339
Conversation
|
Sorry for the mess... I created a new PR with only my changes. One observation from my test: It is however valid HTML. |
|
I made a dedicated test, for which I added a second invoice template in the fixture. The customer's default template is HTML, via console I define the second template and get a PDF file. The php tests revealed then another problem in the tests/Controller/InvoiceControllerTest, where I corrected the number of invoice templates. As mentioned the CI failure is related to a Twig security issue solved in branch 2.29. That's my proposal, happy to get feedback. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5339 +/- ##
============================================
- Coverage 87.21% 87.20% -0.02%
- Complexity 9222 9228 +6
============================================
Files 824 824
Lines 30528 30542 +14
============================================
+ Hits 26625 26634 +9
- Misses 3903 3908 +5
|
…plate-parameter-overwrite' into feature-console-template-parameter-overwrite
|
This is unrelated to the feature enhancement in this PR, but since I started to complete the test cases for this, I got the impression, that there is a design decision to get an invoice document with success message, even if there wasn't any billable timesheet. When creating the invoice in the browser the page wouldn't offer the choice to create the invoice if no timesheet was found. This makes sense to me, because we would create also an invoice number for an invoice that doesn't contain billable entries. Maybe one could provide a check after the InvoiceModel was created, if there are any entries? I could add that here or in a separate PR. |
kevinpapst
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 👍 I had a look and have a few comments
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5339 +/- ##
============================================
- Coverage 87.41% 87.40% -0.01%
- Complexity 9477 9483 +6
============================================
Files 844 844
Lines 31260 31274 +14
============================================
+ Hits 27325 27336 +11
- Misses 3935 3938 +3
🚀 New features to boost your workflow:
|
|
Hello @kevinpapst, I'm not sure, if the answer to the review was sufficient. Can you tell me if you expect more to change in this PR from my side? |
|
Nope, there is nothing you should do. I will review and integrate it at some point. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for overwriting a customer’s default invoice template via the --template CLI option.
- Introduces
--templateprocessing in the invoice create command (by name or ID) - Adds new fixtures and tests to cover overwriting behavior
- Refactors template lookup logic in
InvoiceCreateCommand
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/DataFixtures/InvoiceTemplateFixtures.php | Adds a second sample invoice template for overwrite tests |
| tests/Controller/InvoiceControllerTest.php | Updates expected template count after deletion |
| tests/Command/InvoiceCreateCommandTest.php | Adapts invalid-case tests and adds new overwrite scenarios |
| src/Command/InvoiceCreateCommand.php | Implements --template option handling and refactors lookup logic |
Comments suppressed due to low confidence (3)
src/Command/InvoiceCreateCommand.php:211
- [nitpick] This message could be clearer; for example: "The --template option must be a template name or numeric ID."
$io->error('Option --template must be string or int');
src/Command/InvoiceCreateCommand.php:461
- [nitpick] Method name is very long and ties it to the command-line context. Consider renaming to
findTemplateByArgument()or similar for clarity.
getCommandLineArgumentTemplateForCustomer
src/Command/InvoiceCreateCommand.php:188
- [nitpick] Mixing Yoda conditions (
null !==) with non-Yoda elsewhere can hurt readability. Consider using a consistent style (e.g.$input->getOption('preview') !== null).
if (null !== $input->getOption('preview')) {
Description
When creating an invoice from command line the parameter
--templateis only considered, if the customer doesn't have defined a default invoice template.Closes #5337
Test have been adapted.
Types of changes
Checklist
composer code-check)