From 5519b50900b2c3341afe01d833c6677de29b0f92 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Fri, 20 Jan 2023 22:09:51 -0500 Subject: [PATCH] Apply changes to user-contact table first in Contact::update - The truncateFieldsForTable call in the same method was potentially restricting the fields that could be updated in the user-contact table --- src/Model/Contact.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Model/Contact.php b/src/Model/Contact.php index e847ce034..0f953a0b3 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -243,15 +243,13 @@ class Contact * @throws \Exception * @todo Let's get rid of boolean type of $old_fields */ - public static function update(array $fields, array $condition, $old_fields = []) + public static function update(array $fields, array $condition, $old_fields = []): bool { - $fields = DI::dbaDefinition()->truncateFieldsForTable('contact', $fields); - $ret = DBA::update('contact', $fields, $condition, $old_fields); - // Apply changes to the "user-contact" table on dedicated fields Contact\User::updateByContactUpdate($fields, $condition); - return $ret; + $fields = DI::dbaDefinition()->truncateFieldsForTable('contact', $fields); + return DBA::update('contact', $fields, $condition, $old_fields); } /**