diff options
Diffstat (limited to 'app/Functions')
| -rw-r--r-- | app/Functions/FunctionsCharts.php | 24 | ||||
| -rw-r--r-- | app/Functions/FunctionsEdit.php | 2 | ||||
| -rw-r--r-- | app/Functions/FunctionsExport.php | 4 | ||||
| -rw-r--r-- | app/Functions/FunctionsPrint.php | 2 | ||||
| -rw-r--r-- | app/Functions/FunctionsPrintFacts.php | 4 |
5 files changed, 17 insertions, 19 deletions
diff --git a/app/Functions/FunctionsCharts.php b/app/Functions/FunctionsCharts.php index cf969a65da..c5a6ba8521 100644 --- a/app/Functions/FunctionsCharts.php +++ b/app/Functions/FunctionsCharts.php @@ -309,12 +309,10 @@ class FunctionsCharts string $label = '', bool $show_cousins = false ) { - $bheight = app()->make(ModuleThemeInterface::class)->parameter('chart-box-y'); - + $bheight = app()->make(ModuleThemeInterface::class)->parameter('chart-box-y'); $pbheight = $bheight + 14; - $children = $family->children(); - $numchil = count($children); + $numchil = $children->count(); echo '<table border="0" cellpadding="0" cellspacing="0"><tr>'; if ($sosa > 0) { @@ -354,7 +352,8 @@ class FunctionsCharts echo '</tr>'; $nchi = 1; - if ($children) { + + if ($children->isNotEmpty()) { foreach ($children as $child) { echo '<tr>'; if ($sosa != 0) { @@ -385,8 +384,7 @@ class FunctionsCharts echo '</tr><tr><td></td>'; echo '<td style="text-align:end; vertical-align: top;">'; //find out how many cousins there are to establish vertical line on second families - $fchildren = $famids[$f]->children(); - $kids = count($fchildren); + $kids = $famids[$f]->children()->count(); if ($show_cousins) { if ($kids > 0) { @@ -407,8 +405,8 @@ class FunctionsCharts echo '<td class="details1" style="text-align:center;">'; $spouse = $famids[$f]->spouse($child); - $marr = $famids[$f]->firstFact('MARR'); - $div = $famids[$f]->firstFact('DIV'); + $marr = $famids[$f]->facts(['MARR'])->first(); + $div = $famids[$f]->facts(['DIV'])->first(); if ($marr) { // marriage date echo $marr->date()->minimumDate()->format('%Y'); @@ -510,15 +508,15 @@ class FunctionsCharts { $bheight = app()->make(ModuleThemeInterface::class)->parameter('chart-box-y'); $fchildren = $family->children(); - $kids = count($fchildren); + $kids = $fchildren->count(); echo '<td>'; - if ($kids) { + if ($fchildren->isNotEmpty()) { echo '<table cellspacing="0" cellpadding="0" border="0" ><tr>'; - if ($kids > 1) { + if ($fchildren->count() > 1) { echo '<td rowspan="', $kids, '"><img width="3px" height="', (($bheight) * ($kids - 1)), 'px" src="', e(asset('css/images/vline.png')), '"></td>'; } - $ctkids = count($fchildren); + $ctkids = $fchildren->count(); $i = 1; foreach ($fchildren as $fchil) { if ($i == 1) { diff --git a/app/Functions/FunctionsEdit.php b/app/Functions/FunctionsEdit.php index d5132fed6f..a06ba2efbd 100644 --- a/app/Functions/FunctionsEdit.php +++ b/app/Functions/FunctionsEdit.php @@ -564,7 +564,7 @@ class FunctionsEdit if ($fact === 'HUSB' || $fact === 'WIFE') { $family = Family::getInstance($xref, $tree); if ($family) { - $spouse_link = $family->firstFact($fact); + $spouse_link = $family->facts([$fact])->first(); if ($spouse_link) { $spouse = $spouse_link->target(); if ($spouse instanceof Individual) { diff --git a/app/Functions/FunctionsExport.php b/app/Functions/FunctionsExport.php index f16a85ca1c..c49ba96742 100644 --- a/app/Functions/FunctionsExport.php +++ b/app/Functions/FunctionsExport.php @@ -101,11 +101,11 @@ class FunctionsExport // Preserve some values from the original header $record = GedcomRecord::getInstance('HEAD', $tree); - $fact = $record->firstFact('COPR'); + $fact = $record->facts(['COPR'])->first(); if ($fact instanceof Fact) { $COPR = "\n1 COPR " .$fact->value(); } - $fact = $record->firstFact('LANG'); + $fact = $record->facts(['LANG'])->first(); if ($fact instanceof Fact) { $LANG = "\n1 LANG " .$fact->value(); } diff --git a/app/Functions/FunctionsPrint.php b/app/Functions/FunctionsPrint.php index 5ff06a1e13..ecf14bf930 100644 --- a/app/Functions/FunctionsPrint.php +++ b/app/Functions/FunctionsPrint.php @@ -274,7 +274,7 @@ class FunctionsPrint // Can't use getDeathDate(), as this also gives BURI/CREM events, which // wouldn't give the correct "days after death" result for people with // no DEAT. - $death_event = $record->firstFact('DEAT'); + $death_event = $record->facts(['DEAT'])->first(); if ($death_event) { $death_date = $death_event->date(); } else { diff --git a/app/Functions/FunctionsPrintFacts.php b/app/Functions/FunctionsPrintFacts.php index 540f522618..2d7ce2e7f1 100644 --- a/app/Functions/FunctionsPrintFacts.php +++ b/app/Functions/FunctionsPrintFacts.php @@ -606,7 +606,7 @@ class FunctionsPrintFacts } $data .= ' class="source_citations">'; // PUBL - $publ = $source->firstFact('PUBL'); + $publ = $source->facts(['PUBL'])->first(); if ($publ) { $data .= GedcomTag::getLabelValue('PUBL', $publ->value()); } @@ -790,7 +790,7 @@ class FunctionsPrintFacts if ($source) { echo '<a href="', e($source->url()), '">', $source->fullName(), '</a>'; // PUBL - $publ = $source->firstFact('PUBL'); + $publ = $source->facts(['PUBL'])->first(); if ($publ) { echo GedcomTag::getLabelValue('PUBL', $publ->value()); } |
