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

Fix checkbox bool overwrite #6282

Merged
merged 1 commit into from Sep 4, 2018

Conversation

Projects
None yet
4 participants
@kuzmany
Copy link
Contributor

kuzmany commented Jul 3, 2018

Please be sure you are submitting this against the staging branch.

Q A
Bug fix? Yes
New feature?
Automated tests included?
Related user documentation PR URL
Related developer documentation PR URL
Issues addressed (#s or URLs) #6087
BC breaks?
Deprecations?

Description:

This PR fixed form bool lead mapping witch checkbox based on this issue #6087
The form request handle empty result and then filter it https://github.com/mautic/mautic/compare/staging...kuzmany:fix-form-bool-type-null-result?expand=1#diff-21d987361e23066733f8c6d958fa2016R45
But filter_var return false.If value is empty. Every form field contain empty result (https://github.com/kuzmany/mautic/blob/5c0aa9bf7cd2ad2d79c9f557f5578418d11fb06e/app/bundles/FormBundle/Model/SubmissionModel.php#L233)

This PR added

Steps to reproduce the bug:

  1. Create form witch checkbox and lead matching bool custom field
  2. Create contact with true to custom bool field
  3. Send form with unchecked checkbox
  4. See contact. Even checkbox is not checked, contact custom bool field was set to false

Steps to test this PR:

  1. Repeat all steps and see If custom contact bool field is still true
  2. Then update form and default value of checkbox to 0 and enable in contact profile the custom field bool to true
  3. Send form with unchecked checkbox and see If custom contact bool field are set to false

@kuzmany kuzmany added this to the 2.14.1 milestone Jul 19, 2018

@escopecz

This comment has been minimized.

Copy link
Member

escopecz commented Aug 12, 2018

I'm not sure I'm following the use case. I'm guessing there is one checkbox the contact can either check or leave be. Because it would make more sense to map the boolean to a radio field with yes/no options.

Please answer this: How can the contact unsubscribe then? There is no option to unsubscribe and ignoring the checkbox doesn't do it either.

@escopecz

This comment has been minimized.

Copy link
Member

escopecz commented Aug 12, 2018

Other then the moral of the use case the code works as described. I leave up to the release leader whether an ignored checkbox mapped to a boolean field should be taken as false value or the default value.

@npracht
Copy link
Member

npracht left a comment

We've been testing it in prod environment for few weeks and it works.

@kuzmany

This comment has been minimized.

Copy link
Contributor Author

kuzmany commented Aug 13, 2018

@escopecz It's the same situation like with prefs center. Each channel has checkbox and If you uncheck, you're unsubscribe
Checkbox in form send 1 (true) with checked option, but nothing with unchecked option. I think we need send something with uncheck, that should fail If we are start using profiling forms.

@heathdutton heathdutton self-requested a review Sep 4, 2018

@heathdutton heathdutton merged commit 4fedaa8 into mautic:staging Sep 4, 2018

2 checks passed

Scrutinizer Analysis: No new issues – Tests: passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.