2013-03-01 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_gis.php: fixed the delete layers.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7764 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-03-01 10:14:53 +00:00
parent 85e11a4e99
commit d533a1076f
2 changed files with 20 additions and 4 deletions

View File

@ -1,3 +1,7 @@
2013-03-01 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_gis.php: fixed the delete layers.
2013-03-01 Sergio Martin <sergio.martin@artica.es> 2013-03-01 Sergio Martin <sergio.martin@artica.es>
* include/javascript/jquery.pandora.js * include/javascript/jquery.pandora.js

View File

@ -780,19 +780,25 @@ function gis_update_map($idMap, $map_name, $map_initial_longitude, $map_initial_
); );
} }
$listOldIdLayers = db_get_all_rows_sql('SELECT id_tmap_layer FROM tgis_map_layer WHERE tgis_map_id_tgis_map = ' . $idMap); $listOldIdLayers = db_get_all_rows_sql('SELECT id_tmap_layer
FROM tgis_map_layer WHERE tgis_map_id_tgis_map = ' . $idMap);
if ($listOldIdLayers == false) if ($listOldIdLayers == false)
$listOldIdLayers = array(); $listOldIdLayers = array();
$list_onlyIDsLayers = array();
foreach ($listOldIdLayers as $idLayer) { foreach ($listOldIdLayers as $idLayer) {
db_process_sql_delete('tgis_map_layer_has_tagente', array('tgis_map_layer_id_tmap_layer' => $idLayer['id_tmap_layer'])); db_process_sql_delete('tgis_map_layer_has_tagente',
array('tgis_map_layer_id_tmap_layer' => $idLayer['id_tmap_layer']));
$list_onlyIDsLayers[$idLayer['id_tmap_layer']] = 0;
} }
foreach ($arrayLayers as $index => $layer) { foreach ($arrayLayers as $index => $layer) {
if ($layer['id'] != 0) { if ($layer['id'] != 0) {
$idLayer = $layer['id']; $idLayer = $layer['id'];
unset($list_onlyIDsLayers[$idLayer]);
db_process_sql_update('tgis_map_layer', db_process_sql_update('tgis_map_layer',
array( array(
@ -832,6 +838,12 @@ function gis_update_map($idMap, $map_name, $map_initial_longitude, $map_initial_
} }
} }
//Delete layers that not carry the $arrayLayers
foreach ($list_onlyIDsLayers as $idLayer => $trash) {
db_process_sql_delete('tgis_map_layer',
array('id_tmap_layer' => $idLayer));
}
} }
/** /**