Created
February 23, 2026 07:36
-
-
Save notz/03494676f166b85eaa391d0190e9eae4 to your computer and use it in GitHub Desktop.
mautic lead zero value patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Index: app/bundles/LeadBundle/Controller/Api/CustomFieldsApiControllerTrait.php | |
| IDEA additional info: | |
| Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
| <+>UTF-8 | |
| =================================================================== | |
| diff --git a/app/bundles/LeadBundle/Controller/Api/CustomFieldsApiControllerTrait.php b/app/bundles/LeadBundle/Controller/Api/CustomFieldsApiControllerTrait.php | |
| --- a/app/bundles/LeadBundle/Controller/Api/CustomFieldsApiControllerTrait.php (revision 2d61136d55c47db0970c5563df6c9a883ff24339) | |
| +++ b/app/bundles/LeadBundle/Controller/Api/CustomFieldsApiControllerTrait.php (date 1761638296460) | |
| @@ -184,19 +184,6 @@ | |
| if (isset($parameters['points']) && empty($parameters['points'])) { | |
| unset($parameters['points']); | |
| } | |
| - | |
| - // When merging a contact because of a unique identifier match in POST /api/contacts//new or PATCH /api/contacts//edit all 0 values must be unset because | |
| - // we have to assume 0 was not meant to overwrite an existing value. Other empty values will be caught by LeadModel::setFieldValues | |
| - $parameters = array_filter( | |
| - $parameters, | |
| - function ($value): bool { | |
| - if (is_numeric($value)) { | |
| - return 0 !== (int) $value; | |
| - } | |
| - | |
| - return true; | |
| - } | |
| - ); | |
| } | |
| $overwriteWithBlank = !$isPostOrPatch; | |
| Index: app/bundles/LeadBundle/Model/LeadModel.php | |
| IDEA additional info: | |
| Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
| <+>UTF-8 | |
| =================================================================== | |
| diff --git a/app/bundles/LeadBundle/Model/LeadModel.php b/app/bundles/LeadBundle/Model/LeadModel.php | |
| --- a/app/bundles/LeadBundle/Model/LeadModel.php (revision 2d61136d55c47db0970c5563df6c9a883ff24339) | |
| +++ b/app/bundles/LeadBundle/Model/LeadModel.php (date 1761641809892) | |
| @@ -687,7 +687,7 @@ | |
| $newValue = implode('|', $newValue); | |
| } | |
| - $isEmpty = (null == $newValue || '' == $newValue); | |
| + $isEmpty = (null === $newValue || '' == $newValue); | |
| if ($curValue !== $newValue && (!$isEmpty || ($isEmpty && $overwriteWithBlank))) { | |
| $field['value'] = $newValue; | |
| $lead->addUpdatedField($alias, $newValue, $curValue); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment