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
This commit is contained in:
Hypolite Petovan 2023-01-20 22:09:51 -05:00
parent dcfb8bb73e
commit 5519b50900

View File

@ -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);
}
/**