From 3e928b02874df68ce4a7a2fc48bde6f4c78c2e2c Mon Sep 17 00:00:00 2001 From: Nigel Horne Date: Wed, 6 Nov 2024 14:11:08 -0500 Subject: [PATCH] Refactor person_in_residence_record() --- gedcom | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/gedcom b/gedcom index f624e1f..5dab266 100755 --- a/gedcom +++ b/gedcom @@ -13360,14 +13360,18 @@ sub person_in_residence_record { my $params = get_params(undef, @_); - my $person = $params->{'person'}; - my $date = $params->{'date'}; + # my $person = $params->{'person'}; + # my $date = $params->{'date'}; + my ($person, $date) = $params->{qw(person date)}; foreach my $event(get_all_residences($person)) { my $edate = $event->date(); - if($edate && ($edate !~ /^bet\s/i) && ($edate !~ /[,\-]/) && (datecmp($edate, $date) == 0)) { - return 1; - } + + # Skip if $edate is undefined, contains "bet", or contains a comma or dash + next unless $edate && $edate !~ /^bet\s/i && $edate !~ /[,\-]/; + + # Return 1 if dates match + return 1 if datecmp($edate, $date) == 0; } return 0; @@ -14126,6 +14130,7 @@ brother::brother brother-in-law::brother-in-law brothers::brothers check out %s::check out %s +c.::c. child::child children::children cousin::cousin @@ -14221,6 +14226,7 @@ birthplace::ville natale both with %s::tous les deux avec %s brother::frère brother-in-law::beau-frère +c.::environ check out %s::visitez %s child::enfant children::enfants @@ -14316,6 +14322,7 @@ both with %s::beide mit %s brother::Bruder brothers::Brüder check out %s::Schau mal bei %s +c.::circa child::Kind children::Kinder cousin:M:Cousin