From 89d6a819d78da44ed1b58fdb6d8caceffc6d0d17 Mon Sep 17 00:00:00 2001 From: Paul Franklin Date: Tue, 13 May 2014 14:16:26 -0700 Subject: [PATCH] 5690: Can create multiple events with same Gramps-ID --- src/gui/editors/editeventref.py | 5 ++--- src/gui/editors/editmediaref.py | 5 ++--- src/gui/editors/editreporef.py | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/gui/editors/editeventref.py b/src/gui/editors/editeventref.py index 7504f08c5..29146b7c8 100644 --- a/src/gui/editors/editeventref.py +++ b/src/gui/editors/editeventref.py @@ -244,13 +244,12 @@ class EditEventRef(EditReference): def ok_clicked(self, obj): - if self.check_for_duplicate_id('Event'): - return - if self.source.handle: with DbTxn(_("Modify Event"), self.db) as trans: self.commit_event(self.source,trans) else: + if self.check_for_duplicate_id('Event'): + return with DbTxn(_("Add Event"), self.db) as trans: self.add_event(self.source,trans) self.source_ref.ref = self.source.handle diff --git a/src/gui/editors/editmediaref.py b/src/gui/editors/editmediaref.py index 1c45676b6..408fc61e1 100644 --- a/src/gui/editors/editmediaref.py +++ b/src/gui/editors/editmediaref.py @@ -656,15 +656,14 @@ class EditMediaRef(EditReference): def save(self,*obj): - if self.check_for_duplicate_id('Media'): - return - #first save primary object if self.source.handle: with DbTxn(_("Edit Media Object (%s)") % self.source.get_description(), self.db) as trans: self.db.commit_media_object(self.source, trans) else: + if self.check_for_duplicate_id('Media'): + return with DbTxn(_("Add Media Object (%s)") % self.source.get_description(), self.db) as trans: self.db.add_object(self.source, trans) diff --git a/src/gui/editors/editreporef.py b/src/gui/editors/editreporef.py index 135841f81..d0320dcc6 100644 --- a/src/gui/editors/editreporef.py +++ b/src/gui/editors/editreporef.py @@ -190,13 +190,12 @@ class EditRepoRef(EditReference): def ok_clicked(self, obj): - if self.check_for_duplicate_id('Repository'): - return - if self.source.handle: with DbTxn(_("Modify Repository"), self.db) as trans: self.db.commit_repository(self.source,trans) else: + if self.check_for_duplicate_id('Repository'): + return with DbTxn(_("Add Repository"), self.db) as trans: self.db.add_repository(self.source,trans) self.source_ref.ref = self.source.handle