Fix php warnings, don't save empty coordinates see BT#15176

pull/3063/head
Julio 7 years ago
parent af27c5639e
commit 20c906ae52
  1. 20
      main/inc/lib/extra_field_value.lib.php
  2. 20
      main/social/map.php
  3. 44
      main/template/default/social/map.tpl

@ -156,16 +156,18 @@ class ExtraFieldValue extends Model
switch ($extraFieldInfo['field_type']) {
case ExtraField::FIELD_TYPE_GEOLOCALIZATION:
if (isset($params['extra_'.$extraFieldInfo['variable'].'_coordinates'])) {
$value = $value.'::'.$params['extra_'.$extraFieldInfo['variable'].'_coordinates'];
if (!empty($value)) {
if (isset($params['extra_'.$extraFieldInfo['variable'].'_coordinates'])) {
$value = $value.'::'.$params['extra_'.$extraFieldInfo['variable'].'_coordinates'];
}
$newParams = [
'item_id' => $params['item_id'],
'field_id' => $extraFieldInfo['id'],
'value' => $value,
'comment' => $comment,
];
self::save($newParams, $showQuery);
}
$newParams = [
'item_id' => $params['item_id'],
'field_id' => $extraFieldInfo['id'],
'value' => $value,
'comment' => $comment,
];
self::save($newParams, $showQuery);
break;
case ExtraField::FIELD_TYPE_TAG:
if ($type == EntityExtraField::USER_FIELD_TYPE) {

@ -38,17 +38,21 @@ if (!empty($users)) {
foreach ($data as &$result) {
$result['complete_name'] = addslashes(api_get_person_name($result['firstname'], $result['lastname']));
$parts = explode('::', $result['ville']);
$parts2 = explode(',', $parts[1]);
$result['ville_lat'] = $parts2[0];
$result['ville_long'] = $parts2[1];
if (isset($parts[1])) {
$parts2 = explode(',', $parts[1]);
$result['ville_lat'] = $parts2[0];
$result['ville_long'] = $parts2[1];
unset($result['ville']);
unset($result['ville']);
}
$parts = explode('::', $result['stage']);
$parts2 = explode(',', $parts[1]);
$result['stage_lat'] = $parts2[0];
$result['stage_long'] = $parts2[1];
unset($result['stage']);
if (isset($parts[1])) {
$parts2 = explode(',', $parts[1]);
$result['stage_lat'] = $parts2[0];
$result['stage_long'] = $parts2[1];
unset($result['stage']);
}
}
}

@ -29,28 +29,30 @@ function start()
if (cities.length) {
for (var i = 0; i < cities.length; i++) {
// Add ville
//cities[i]['type'] = 'ville';
var markerOptions = {
position: new google.maps.LatLng(cities[i]['ville_lat'], cities[i]['ville_long']),
title: cities[i]['complete_name'],
city: cities[i],
icon: imageCity,
};
var marker = new google.maps.Marker(markerOptions);
markers.push(marker);
oms.addMarker(marker);
if ('ville_lat' in cities[i]) {
var markerOptions = {
position: new google.maps.LatLng(cities[i]['ville_lat'], cities[i]['ville_long']),
title: cities[i]['complete_name'],
city: cities[i],
icon: imageCity,
};
var marker = new google.maps.Marker(markerOptions);
markers.push(marker);
oms.addMarker(marker);
}
// Add stage
//cities[i]['type'] = 'stage';
var markerOptions = {
position: new google.maps.LatLng(cities[i]['stage_lat'], cities[i]['stage_long']),
title: cities[i]['complete_name'],
city: cities[i],
icon: stageCity,
};
var marker = new google.maps.Marker(markerOptions);
markers.push(marker);
oms.addMarker(marker);
if ('stage_lat' in cities[i]) {
var markerOptions = {
position: new google.maps.LatLng(cities[i]['stage_lat'], cities[i]['stage_long']),
title: cities[i]['complete_name'],
city: cities[i],
icon: stageCity,
};
var marker = new google.maps.Marker(markerOptions);
markers.push(marker);
oms.addMarker(marker);
}
}
// Enable cluster
@ -84,4 +86,4 @@ function start()
</script>
<script async defer type="text/javascript" src="https://maps.google.com/maps/api/js?key={{ api_key }}&callback=start"></script>
{% endblock %}
{% endblock %}

Loading…
Cancel
Save