Geography : bugs #06044 and #05975 : detection of multiple places with same title

svn: r20391
This commit is contained in:
Serge Noiraud 2012-09-15 07:54:07 +00:00
parent 4b9ced7609
commit 07623a6cf1

View File

@ -960,9 +960,29 @@ class GeoGraphyView(osmGpsMap, NavigationView):
loc = place.get_main_location() loc = place.get_main_location()
oldv = (loc.get_country(), loc.get_state(), loc.get_county()) if loc else None oldv = (loc.get_country(), loc.get_state(), loc.get_county()) if loc else None
places_handle = self.dbstate.db.iter_place_handles() places_handle = self.dbstate.db.iter_place_handles()
nb_places = 0
gids = ""
for place_hdl in places_handle: for place_hdl in places_handle:
plce = self.dbstate.db.get_place_from_handle(place_hdl) plce = self.dbstate.db.get_place_from_handle(place_hdl)
if plce.get_title() == place.get_title(): if plce.get_title() == place.get_title():
nb_places += 1
if gids == "":
gids = plce.gramps_id
else:
gids = gids + ", " + plce.gramps_id
if nb_places > 1:
from QuestionDialog import WarningDialog
WarningDialog(
_('You have at least two places with the same title.'),
_("The title of the places is :\n"
"<b>%(title)s</b>\n"
"The following places are similar : %(gid)s\n"
"Eiher you rename the places either you merge them."
"\n\n<b>I can't proceed your request</b>.\n") % {
'title': plce.get_title(),
'gid': gids}
)
else:
self.mark = [None,None,None,None,None,None,None, self.mark = [None,None,None,None,None,None,None,
None,None,plce.gramps_id,None,None] None,None,plce.gramps_id,None,None]
self.select_fct = PlaceSelection(self.uistate, self.dbstate, self.osm, self.select_fct = PlaceSelection(self.uistate, self.dbstate, self.osm,