-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Restore "No change" option for boolean fields in Campaign Update Contact/Company action #14888
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
Conversation
@escopecz It's my first time doing some design stuff in Mautic, so I'd be grateful to get some suggestions for improving the code to have a more Mautic-like solution. Also, I was not sure which parts of the solution to test and how. Any suggestions? |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 5.2 #14888 +/- ##
============================================
- Coverage 63.69% 63.68% -0.01%
- Complexity 34663 34676 +13
============================================
Files 2273 2274 +1
Lines 103710 103729 +19
============================================
+ Hits 66054 66058 +4
- Misses 37656 37671 +15
🚀 New features to boost your workflow:
|
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.
Consider adding a functional test to verify that the boolean lead field is correctly updated in the campaign. Here is an example: https://github.com/mautic/mautic/blob/5.2/app/bundles/LeadBundle/Tests/EventListener/CampaignSubscriberFunctionalTest.php#L82
It is important to test all options: no change
, false
, true
.
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.
I noticed a few changes that would improve the code. Please take a look.
app/bundles/LeadBundle/Form/Type/CustomYesNoButtonGroupType.php
Outdated
Show resolved
Hide resolved
app/bundles/LeadBundle/Form/Type/CustomYesNoButtonGroupType.php
Outdated
Show resolved
Hide resolved
app/bundles/LeadBundle/Form/Type/CustomYesNoButtonGroupType.php
Outdated
Show resolved
Hide resolved
app/bundles/LeadBundle/Form/Type/EntityFieldsBuildFormTrait.php
Outdated
Show resolved
Hide resolved
In terms of design, I think changing the field type is the path for situations like these Buttons are adequate, thank you for the fix |
@andersonjeccel I was wondering if something like |
@patrykgruszka sounds great! |
@escopecz I have two issues with the code that I'm not able to solve: First of all, I didn't manage to get the overall button responsive. So when the window gets to small it overlaps with other stuff Number two is regarding my functions tests. After adding bool custom fields, I don't mange to set them to the desired value. Do you have an explanation for that?
|
@JonasLudwig1998 I'm not sure about the responsiveness. @andersonjeccel may give a better advise here. I'd look into the columns and make them into a single column before the button group overflow. And the "x" was there for this reason too, I'd think. For the test, you have to use the FieldModel to create a new field as it's doing also DB schema migrations. Check other tests how it's being done. For example the Another thing is that if an ALTER TABLE query is executed then the test cannot roll back. So make sure you turn that off with protected $useCleanupRollback = false; One more thing I'd recommend is to create a new contact with And please order the methods from public to protected to private so the public methods are at the top and private at the bottom of the classes. |
This field type is stored in the database as
|
@JonasLudwig1998 the columns rendering each field, use classes "col-md-6 col-xs-12" (both together, will generate 2 columns on desktop and one above the other on mobile) |
@andersonjeccel I changed _updatelead_action_widget.html.twig and _updatecompany_action_widget.html.twig to make the campaign action forms responsive (by adding col-md-6 col-xs-12"). |
@escopecz Your suggestions are implemented now
|
app/bundles/LeadBundle/Form/Type/EntityFieldsBuildFormTrait.php
Outdated
Show resolved
Hide resolved
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.
This fixes the issue by introducing the 'no change' option - I agree with @matbcvo that we need this to be a translatable string, @JonasLudwig1998 could you action that?
@andersonjeccel I was a little concerned that perhaps these should have some colour indications but perhaps thinking about it we don't want to assume which is positive or negative?
These were the ones I was thinking perhaps should have colour indicators:
Note: This can be followed up in a separate PR if necessary and shouldn't block the merging of this PR providing the translation string is fixed.
Note: I realised I had not tested the company boolean field updates in campaigns which I've just done - and this works too. |
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.
I’ve tested the PR and found no issues. Thank you!
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.
I see no issues in the code changes 👍
Description
This PR solves #14855
It makes sure that in the update contact/company campaign action bool values can be changed to not only true but also false.
📋 Steps to test this PR: