Fix Reorder ID tool so subsequent db additions used next possible ID

Fixes #11346
This commit is contained in:
prculley 2019-09-20 09:16:42 -05:00 committed by Nick Hall
parent 26351c18c9
commit bb5b03dd78

View File

@ -66,6 +66,9 @@ WIKI_HELP_SEC = _('manual|Reorder_Gramps_ID')
PREFIXES = {'person': 'i', 'family': 'f', 'event': 'e', 'place': 'p', PREFIXES = {'person': 'i', 'family': 'f', 'event': 'e', 'place': 'p',
'source': 's', 'citation': 'c', 'repository': 'r', 'source': 's', 'citation': 'c', 'repository': 'r',
'media': 'o', 'note': 'n'} 'media': 'o', 'note': 'n'}
DB_INDXES = {'person': 'p', 'family': 'f', 'event': 'e', 'place': 'l',
'source': 's', 'citation': 'c', 'repository': 'r',
'media': 'o', 'note': 'n'}
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Actual tool # Actual tool
@ -548,6 +551,9 @@ class ReorderIds(tool.BatchTool, ManagedWindow, UpdateCallback):
self.progress.set_pass( self.progress.set_pass(
_('Reorder %s IDs ...') % _(prim_objs.title()), _('Reorder %s IDs ...') % _(prim_objs.title()),
self.obj_values[prim_obj].quant_id) self.obj_values[prim_obj].quant_id)
# reset the db next_id index to zero so we restart new IDs
# at lowest possible position
setattr(self.db, DB_INDXES[prim_obj] + 'map_index', 0)
# Process reordering # Process reordering
self._reorder(prim_obj) self._reorder(prim_obj)