5690: Can create multiple events with same Gramps-ID

This commit is contained in:
Paul Franklin 2014-05-13 14:17:15 -07:00
parent 69ff7d3e26
commit 5aa3a419ea
3 changed files with 6 additions and 9 deletions

View File

@ -245,13 +245,12 @@ class EditEventRef(EditReference):
def ok_clicked(self, obj): def ok_clicked(self, obj):
if self.check_for_duplicate_id('Event'):
return
if self.source.handle: if self.source.handle:
with DbTxn(_("Modify Event"), self.db) as trans: with DbTxn(_("Modify Event"), self.db) as trans:
self.commit_event(self.source,trans) self.commit_event(self.source,trans)
else: else:
if self.check_for_duplicate_id('Event'):
return
with DbTxn(_("Add Event"), self.db) as trans: with DbTxn(_("Add Event"), self.db) as trans:
self.add_event(self.source,trans) self.add_event(self.source,trans)
self.source_ref.ref = self.source.handle self.source_ref.ref = self.source.handle

View File

@ -633,15 +633,14 @@ class EditMediaRef(EditReference):
def save(self,*obj): def save(self,*obj):
if self.check_for_duplicate_id('Media'):
return
#first save primary object #first save primary object
if self.source.handle: if self.source.handle:
with DbTxn(_("Edit Media Object (%s)") % with DbTxn(_("Edit Media Object (%s)") %
self.source.get_description(), self.db) as trans: self.source.get_description(), self.db) as trans:
self.db.commit_media_object(self.source, trans) self.db.commit_media_object(self.source, trans)
else: else:
if self.check_for_duplicate_id('Media'):
return
with DbTxn(_("Add Media Object (%s)") % with DbTxn(_("Add Media Object (%s)") %
self.source.get_description(), self.db) as trans: self.source.get_description(), self.db) as trans:
self.db.add_object(self.source, trans) self.db.add_object(self.source, trans)

View File

@ -191,13 +191,12 @@ class EditRepoRef(EditReference):
def ok_clicked(self, obj): def ok_clicked(self, obj):
if self.check_for_duplicate_id('Repository'):
return
if self.source.handle: if self.source.handle:
with DbTxn(_("Modify Repository"), self.db) as trans: with DbTxn(_("Modify Repository"), self.db) as trans:
self.db.commit_repository(self.source,trans) self.db.commit_repository(self.source,trans)
else: else:
if self.check_for_duplicate_id('Repository'):
return
with DbTxn(_("Add Repository"), self.db) as trans: with DbTxn(_("Add Repository"), self.db) as trans:
self.db.add_repository(self.source,trans) self.db.add_repository(self.source,trans)
self.source_ref.ref = self.source.handle self.source_ref.ref = self.source.handle