Skip to content

Commit

Permalink
Eoxia#173 [Address] fix: fatal
Browse files Browse the repository at this point in the history
  • Loading branch information
evarisk-micka committed Aug 22, 2024
1 parent 746b5cd commit 57affbe
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion class/geolocation.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class Geolocation extends SaturneObject
/**
* @var string Element type
*/
public string $element_type;
public string $element_type = 'contact';

/**
* @var int Fk_element
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf
$geolocation->status = Geolocation::STATUS_GEOLOCATED;
$geolocation->create($user);

} else {
$geolocation->status = Geolocation::STATUS_NOTFOUND;
$geolocation->create($user);
}
$contact->array_options['options_address_status'] = $geolocation->status;
$contact->updateExtraField('address_status');
Expand Down
8 changes: 5 additions & 3 deletions view/address_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,11 @@
$geolocation->status = Geolocation::STATUS_NOTFOUND;
setEventMessages($langs->trans('ErrorUpdateAddress'), [], 'errors');
}
$geolocation->update($user);
$contact->array_options['options_address_status'] = $geolocation->status;
$contact->updateExtraField('address_status');
if ($geolocation->id > 0) {
$geolocation->update($user);
$contact->array_options['options_address_status'] = $geolocation->status;
$contact->updateExtraField('address_status');
}
}
header('Location: ' . $_SERVER['PHP_SELF'] . '?from_id=' . $fromId . '&from_type=' . $objectType);
exit;
Expand Down

0 comments on commit 57affbe

Please sign in to comment.