From db106e70f6e43264e7f62302a2cb3ba5fd1c37bc Mon Sep 17 00:00:00 2001 From: Paul Franklin Date: Fri, 18 Nov 2011 19:35:47 +0000 Subject: [PATCH] 5347: Verify.py should test for old age but no death svn: r18462 --- src/plugins/tool/Verify.py | 29 +++++++++++++++++++++++++++-- src/plugins/tool/verify.glade | 2 +- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/plugins/tool/Verify.py b/src/plugins/tool/Verify.py index c6b32224b..18b51a2f2 100644 --- a/src/plugins/tool/Verify.py +++ b/src/plugins/tool/Verify.py @@ -4,7 +4,7 @@ # Copyright (C) 2000-2007 Donald N. Allingham # Copyright (C) 2008 Brian G. Matherly # Copyright (C) 2010 Jakim Friant -# Copyright (C) 2011 PaulFranklin +# Copyright (C) 2011 Paul Franklin # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -81,6 +81,7 @@ WIKI_HELP_SEC = _('manual|Verify_the_Data...') _person_cache = {} _family_cache = {} _event_cache = {} +_today = gen.lib.date.Today().get_sort_value() def find_event(db, handle): if handle in _event_cache: @@ -359,6 +360,7 @@ class Verify(tool.Tool, ManagedWindow, UpdateCallback): BirthAfterDeath(self.db,person), BaptAfterBury(self.db,person), OldAge(self.db,person, oldage,estimate_age), + OldAgeButNoDeath(self.db,person, oldage,estimate_age), UnknownGender(self.db,person), MultipleParents(self.db,person), MarriedOften(self.db,person,wedder), @@ -736,7 +738,7 @@ class VerifyOptions(tool.ToolOptions): "Number of years"), 'oldunm' : ("=num","Maximum age for an unmarried person" "Number of years"), - 'estimate_age' : ("=0/1","Whether to estimate missing dates", + 'estimate_age' : ("=0/1","Whether to estimate missing or inexact dates", ["Do not estimate","Estimate dates"], True), 'invdate' : ("=0/1","Whether to check for invalid dates" @@ -1539,3 +1541,26 @@ class MarriedRelation(FamilyRule): def get_message(self): return _("Marriage date but not married") + +class OldAgeButNoDeath(PersonRule): + ID = 32 + SEVERITY = Rule.WARNING + def __init__(self,db,person, old_age,est): + PersonRule.__init__(self,db,person) + self.old_age = old_age + self.est = est + + def _get_params(self): + return (self.old_age,self.est) + + def broken(self): + birth_date = get_birth_date(self.db,self.obj,self.est) + dead = get_death_date(self.db,self.obj,True) # if no death use burial + if dead or not birth_date: + return 0 + age = ( _today - birth_date ) / 365 + return ( age > self.old_age ) + + def get_message(self): + return _("Old age but no death") + diff --git a/src/plugins/tool/verify.glade b/src/plugins/tool/verify.glade index d8901e780..a37ae901c 100644 --- a/src/plugins/tool/verify.glade +++ b/src/plugins/tool/verify.glade @@ -221,7 +221,7 @@ - _Estimate missing dates + _Estimate missing or inexact dates True True False