diff --git a/gramps/gui/editors/editeventref.py b/gramps/gui/editors/editeventref.py index 69ddc025c..d205fa68f 100644 --- a/gramps/gui/editors/editeventref.py +++ b/gramps/gui/editors/editeventref.py @@ -243,13 +243,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/gramps/gui/editors/editmediaref.py b/gramps/gui/editors/editmediaref.py index 1ac75df35..0b4500397 100644 --- a/gramps/gui/editors/editmediaref.py +++ b/gramps/gui/editors/editmediaref.py @@ -500,15 +500,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/gramps/gui/editors/editreporef.py b/gramps/gui/editors/editreporef.py index 85f5df19a..9f3a627a0 100644 --- a/gramps/gui/editors/editreporef.py +++ b/gramps/gui/editors/editreporef.py @@ -189,13 +189,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