diff --git a/gramps/gui/editors/editeventref.py b/gramps/gui/editors/editeventref.py index 2c6a0f20f..57fb187de 100644 --- a/gramps/gui/editors/editeventref.py +++ b/gramps/gui/editors/editeventref.py @@ -245,13 +245,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 a980f1ea1..1d09057a6 100644 --- a/gramps/gui/editors/editmediaref.py +++ b/gramps/gui/editors/editmediaref.py @@ -633,15 +633,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 cb35003bb..fa980ce55 100644 --- a/gramps/gui/editors/editreporef.py +++ b/gramps/gui/editors/editreporef.py @@ -191,13 +191,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