diff --git a/src/gen/lib/citation.py b/src/gen/lib/citation.py index 214315f45..ac9d24a6e 100644 --- a/src/gen/lib/citation.py +++ b/src/gen/lib/citation.py @@ -75,13 +75,13 @@ class Citation(MediaBase, NoteBase, PrimaryObject, DateBase): self.confidence = Citation.CONF_NORMAL # 4 self.datamap = {} # 8 - def serialize(self): + def serialize(self, no_text_date = False): """ Convert the object to a serialized tuple of data. """ return (self.handle, # 0 self.gramps_id, # 1 - DateBase.serialize(self), # 2 + DateBase.serialize(self, no_text_date),# 2 unicode(self.page), # 3 self.confidence, # 4 self.source_handle, # 5 diff --git a/src/gui/editors/editcitation.py b/src/gui/editors/editcitation.py index 636731fd9..15f6947b0 100644 --- a/src/gui/editors/editcitation.py +++ b/src/gui/editors/editcitation.py @@ -432,6 +432,29 @@ class EditCitation(EditPrimary): self.callback(self.obj.get_handle()) self.close() + def data_has_changed(self): + """ + A date comparison can fail incorrectly because we have made the + decision to store entered text in the date. However, there is no + entered date when importing from a XML file, so we can get an + incorrect fail. + """ + + if self.db.readonly: + return False + elif self.obj.handle: + orig = self.get_from_handle(self.obj.handle) + if orig: + cmp_obj = orig + else: + cmp_obj = self.empty_object() + return cmp(cmp_obj.serialize(True)[1:], + self.obj.serialize(True)[1:]) != 0 + else: + cmp_obj = self.empty_object() + return cmp(cmp_obj.serialize(True)[1:], + self.obj.serialize()[1:]) != 0 + class DeleteCitationQuery(object): def __init__(self, dbstate, uistate, citation, the_lists): self.citation = citation