Skip to content

Commit b0f56cf

Browse files
committed
Fix places update
1 parent b15a005 commit b0f56cf

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

admin/admin_place.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
$query = '
6060
SELECT name
6161
FROM '.osm_place_table.'
62+
WHERE id NOT IN ('.$_POST['edit_list'].')
6263
;';
6364
$existing_names = array_from_query($query, 'name');
6465

@@ -82,22 +83,19 @@
8283
$place_lat = stripslashes($_POST['place_lat-'.$place_id]);
8384
$place_lon = stripslashes($_POST['place_lon-'.$place_id]);
8485

85-
if ($place_name != $current_name_of[$place_id])
86+
if (in_array($place_name, $existing_names))
8687
{
87-
if (in_array($place_name, $existing_names))
88-
{
8988
$page['errors'][] = l10n('Place "%s" already exists', $place_name);
90-
}
91-
else if (!empty($place_name))
92-
{
89+
}
90+
else if (!empty($place_name))
91+
{
9392
$updates[] = array(
9493
'id' => $place_id,
9594
'name' => addslashes($place_name),
9695
'latitude' => $place_lat,
9796
'longitude' => $place_lon,
9897
);
99-
}
100-
}
98+
}
10199
}
102100
mass_updates(
103101
osm_place_table,

admin/admin_place.tpl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ $("#searchInput").on("keydown", function(e) {
147147
<p>
148148
<input type="hidden" name="pwg_token" value="{$PWG_TOKEN}">
149149
<input type="submit" name="edit" value="{'Edit selected places'|@translate}">
150-
<input type="submit" name="duplicate" value="{'Duplicate selected places'|@translate}">
151150
<input type="submit" name="delete" value="{'Delete selected places'|@translate}" onclick="return confirm('{'Are you sure?'|@translate}');">
152151
</p>
153152
</fieldset>

0 commit comments

Comments
 (0)