-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Default values imported, boolean values can be true/false/yes/no #2616
Conversation
@@ -1516,6 +1515,31 @@ public function importLead($fields, $data, $owner = null, $list = null, $tags = | |||
); | |||
} | |||
|
|||
$booleanTrue = ['1', 'true', 'yes']; |
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 could be simplified with $value = (int) filter_var($fieldData[$leadField['alias'], FILTER_VALIDATE_BOOLEAN);
http://php.net/manual/en/filter.filters.validate.php
Returns TRUE for "1", "true", "on" and "yes". Returns FALSE otherwise.
If FILTER_NULL_ON_FAILURE is set, FALSE is returned only for "0", "false", "off", "no", and "", and NULL is returned for all non-boolean values.
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.
Great suggestion. Implemented.
0 contacts were created for me before and after merging this PR (#2)(My boolean field) This value is not valid. |
That's odd. I retested and all 8 contacts were imported. Could you double-check the PR was applied before test? |
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.
Worked for me with the given csv file. Boolean fields were imported correctly.
Works as described. Thanks for providing thorough test instructions. +1 |
Description:
This PR does 2 things:
Steps to test this PR:
Notice:
Steps to reproduce the bug:
Notice: