Skip to content

Commit

Permalink
Refactor person_in_residence_record()
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Nov 6, 2024
1 parent 2a9a3d1 commit 3e928b0
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions gedcom
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3e928b0

Please sign in to comment.