summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Http/RequestHandlers/ChangeFamilyMembersPage.php14
-rw-r--r--resources/views/edit/change-family-members.phtml35
-rw-r--r--tests/app/Module/AhnentafelReportModuleTest.php2
-rw-r--r--tests/app/Module/BirthDeathMarriageReportModuleTest.php2
-rw-r--r--tests/app/Module/BirthReportModuleTest.php2
-rw-r--r--tests/app/Module/CemeteryReportModuleTest.php2
-rw-r--r--tests/app/Module/ChangeReportModuleTest.php2
-rw-r--r--tests/app/Module/DeathReportModuleTest.php2
-rw-r--r--tests/app/Module/DescendancyReportModuleTest.php2
-rw-r--r--tests/app/Module/FactSourcesReportModuleTest.php2
-rw-r--r--tests/app/Module/FamilyGroupReportModuleTest.php2
-rw-r--r--tests/app/Module/IndividualFamiliesReportModuleTest.php2
-rw-r--r--tests/app/Module/IndividualReportModuleTest.php2
-rw-r--r--tests/app/Module/MarriageReportModuleTest.php2
-rw-r--r--tests/app/Module/MissingFactsReportModuleTest.php2
-rw-r--r--tests/app/Module/OccupationReportModuleTest.php2
-rw-r--r--tests/app/Module/PedigreeReportModuleTest.php2
-rw-r--r--tests/app/Module/RelatedIndividualsReportModuleTest.php2
-rw-r--r--tests/app/Services/ModuleServiceTest.php2
19 files changed, 35 insertions, 48 deletions
diff --git a/app/Http/RequestHandlers/ChangeFamilyMembersPage.php b/app/Http/RequestHandlers/ChangeFamilyMembersPage.php
index ff32ad80c9..1c23132cee 100644
--- a/app/Http/RequestHandlers/ChangeFamilyMembersPage.php
+++ b/app/Http/RequestHandlers/ChangeFamilyMembersPage.php
@@ -35,11 +35,6 @@ class ChangeFamilyMembersPage implements RequestHandlerInterface
{
use ViewResponseTrait;
- /**
- * @param ServerRequestInterface $request
- *
- * @return ResponseInterface
- */
public function handle(ServerRequestInterface $request): ResponseInterface
{
$tree = Validator::attributes($request)->tree();
@@ -49,12 +44,9 @@ class ChangeFamilyMembersPage implements RequestHandlerInterface
$title = I18N::translate('Change family members') . ' – ' . $family->fullName();
return $this->viewResponse('edit/change-family-members', [
- 'tree' => $tree,
- 'title' => $title,
- 'family' => $family,
- 'father' => $family->husband(),
- 'mother' => $family->wife(),
- 'children' => $family->children(),
+ 'tree' => $tree,
+ 'title' => $title,
+ 'family' => $family,
]);
}
}
diff --git a/resources/views/edit/change-family-members.phtml b/resources/views/edit/change-family-members.phtml
index 38836f768b..dcae3f9b7d 100644
--- a/resources/views/edit/change-family-members.phtml
+++ b/resources/views/edit/change-family-members.phtml
@@ -5,17 +5,12 @@ declare(strict_types=1);
use Fisharebest\Webtrees\Family;
use Fisharebest\Webtrees\Http\RequestHandlers\ChangeFamilyMembersAction;
use Fisharebest\Webtrees\I18N;
-use Fisharebest\Webtrees\Individual;
use Fisharebest\Webtrees\Tree;
-use Illuminate\Support\Collection;
/**
- * @var Collection<int,Individual> $children
- * @var Family $family
- * @var Individual|null $father
- * @var Individual|null $mother
- * @var string $title
- * @var Tree $tree
+ * @var Family $family
+ * @var string $title
+ * @var Tree $tree
*/
?>
@@ -28,40 +23,40 @@ use Illuminate\Support\Collection;
<div class="row">
<label class="col-sm-3 col-form-label wt-page-options-label" for="HUSB">
- <?php if ($father instanceof Individual && $father->sex() === 'M') : ?>
+ <?php if ($family->husband()?->sex() === 'M') : ?>
<?= I18N::translate('Husband') ?>
- <?php elseif ($father !== null && $father->sex() === 'F') : ?>
+ <?php elseif ($family->husband()?->sex() === 'F') : ?>
<?= I18N::translate('Wife') ?>
<?php else : ?>
<?= I18N::translate('Spouse') ?>
<?php endif ?>
</label>
<div class="col-sm-9 wt-page-options-value">
- <?= view('components/select-individual', ['name' => 'HUSB', 'individual' => $father, 'tree' => $tree]) ?>
+ <?= view('components/select-individual', ['name' => 'HUSB', 'individual' => $family->husband(), 'tree' => $tree]) ?>
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label wt-page-options-label" for="WIFE">
- <?php if ($mother instanceof Individual && $mother->sex() === 'M') : ?>
+ <?php if ($family->wife()?->sex() === 'M') : ?>
<?= I18N::translate('Husband') ?>
- <?php elseif ($mother !== null && $mother->sex() === 'F') : ?>
+ <?php elseif ($family->wife()?->sex() === 'F') : ?>
<?= I18N::translate('Wife') ?>
<?php else : ?>
<?= I18N::translate('Spouse') ?>
<?php endif ?>
</label>
<div class="col-sm-9 wt-page-options-value">
- <?= view('components/select-individual', ['name' => 'WIFE', 'individual' => $mother, 'tree' => $tree]) ?>
+ <?= view('components/select-individual', ['name' => 'WIFE', 'individual' => $family->wife(), 'tree' => $tree]) ?>
</div>
</div>
- <?php foreach ($children as $n => $child) : ?>
+ <?php foreach ($family->children() as $n => $child) : ?>
<div class="row">
- <label class="col-sm-3 col-form-label wt-page-options-label" for="CHIL<?= e($n) ?>">
- <?php if ($child !== null && $child->sex() === 'M') : ?>
+ <label class="col-sm-3 col-form-label wt-page-options-label" for="CHIL<?= $n ?>">
+ <?php if ($child->sex() === 'M') : ?>
<?= I18N::translate('Son') ?>
- <?php elseif ($child !== null && $child->sex() === 'F') : ?>
+ <?php elseif ($child->sex() === 'F') : ?>
<?= I18N::translate('Daughter') ?>
<?php else : ?>
<?= I18N::translate('Child') ?>
@@ -74,11 +69,11 @@ use Illuminate\Support\Collection;
<?php endforeach ?>
<div class="row">
- <label class="col-sm-3 col-form-label wt-page-options-label" for="CHIL<?= e(count($children) + 1) ?>">
+ <label class="col-sm-3 col-form-label wt-page-options-label" for="CHIL<?= count($family->children()) + 1 ?>">
<?= I18N::translate('Child') ?>
</label>
<div class="col-sm-9 wt-page-options-value">
- <?= view('components/select-individual', ['name' => 'CHIL[]', 'id' => 'CHIL' . (count($children) + 1), 'tree' => $tree]) ?>
+ <?= view('components/select-individual', ['name' => 'CHIL[]', 'id' => 'CHIL' . (count($family->children()) + 1), 'tree' => $tree]) ?>
</div>
</div>
diff --git a/tests/app/Module/AhnentafelReportModuleTest.php b/tests/app/Module/AhnentafelReportModuleTest.php
index ea746f9a8d..f4760bda1b 100644
--- a/tests/app/Module/AhnentafelReportModuleTest.php
+++ b/tests/app/Module/AhnentafelReportModuleTest.php
@@ -92,7 +92,7 @@ class AhnentafelReportModuleTest extends TestCase
];
$report = new ReportParserSetup($xml);
- self::assertIsArray($report->reportProperties());
+ self::assertNotEmpty($report->reportProperties());
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
diff --git a/tests/app/Module/BirthDeathMarriageReportModuleTest.php b/tests/app/Module/BirthDeathMarriageReportModuleTest.php
index f82b42241e..94141ced97 100644
--- a/tests/app/Module/BirthDeathMarriageReportModuleTest.php
+++ b/tests/app/Module/BirthDeathMarriageReportModuleTest.php
@@ -82,7 +82,7 @@ class BirthDeathMarriageReportModuleTest extends TestCase
];
$report = new ReportParserSetup($xml);
- self::assertIsArray($report->reportProperties());
+ self::assertNotEmpty($report->reportProperties());
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
diff --git a/tests/app/Module/BirthReportModuleTest.php b/tests/app/Module/BirthReportModuleTest.php
index 6e3392d519..e7f99ff46d 100644
--- a/tests/app/Module/BirthReportModuleTest.php
+++ b/tests/app/Module/BirthReportModuleTest.php
@@ -89,7 +89,7 @@ class BirthReportModuleTest extends TestCase
];
$report = new ReportParserSetup($xml);
- self::assertIsArray($report->reportProperties());
+ self::assertNotEmpty($report->reportProperties());
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
diff --git a/tests/app/Module/CemeteryReportModuleTest.php b/tests/app/Module/CemeteryReportModuleTest.php
index 6a269f0e27..72b6185fa8 100644
--- a/tests/app/Module/CemeteryReportModuleTest.php
+++ b/tests/app/Module/CemeteryReportModuleTest.php
@@ -87,7 +87,7 @@ class CemeteryReportModuleTest extends TestCase
];
$report = new ReportParserSetup($xml);
- self::assertIsArray($report->reportProperties());
+ self::assertNotEmpty($report->reportProperties());
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
diff --git a/tests/app/Module/ChangeReportModuleTest.php b/tests/app/Module/ChangeReportModuleTest.php
index 17b89c103c..14a7abb936 100644
--- a/tests/app/Module/ChangeReportModuleTest.php
+++ b/tests/app/Module/ChangeReportModuleTest.php
@@ -90,7 +90,7 @@ class ChangeReportModuleTest extends TestCase
];
$report = new ReportParserSetup($xml);
- self::assertIsArray($report->reportProperties());
+ self::assertNotEmpty($report->reportProperties());
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
diff --git a/tests/app/Module/DeathReportModuleTest.php b/tests/app/Module/DeathReportModuleTest.php
index 1e1c391fac..aa3f1d53f1 100644
--- a/tests/app/Module/DeathReportModuleTest.php
+++ b/tests/app/Module/DeathReportModuleTest.php
@@ -90,7 +90,7 @@ class DeathReportModuleTest extends TestCase
];
$report = new ReportParserSetup($xml);
- self::assertIsArray($report->reportProperties());
+ self::assertNotEmpty($report->reportProperties());
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
diff --git a/tests/app/Module/DescendancyReportModuleTest.php b/tests/app/Module/DescendancyReportModuleTest.php
index d331c8a65e..fb70853fb4 100644
--- a/tests/app/Module/DescendancyReportModuleTest.php
+++ b/tests/app/Module/DescendancyReportModuleTest.php
@@ -88,7 +88,7 @@ class DescendancyReportModuleTest extends TestCase
];
$report = new ReportParserSetup($xml);
- self::assertIsArray($report->reportProperties());
+ self::assertNotEmpty($report->reportProperties());
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
diff --git a/tests/app/Module/FactSourcesReportModuleTest.php b/tests/app/Module/FactSourcesReportModuleTest.php
index c2dd866202..d3bf1eb909 100644
--- a/tests/app/Module/FactSourcesReportModuleTest.php
+++ b/tests/app/Module/FactSourcesReportModuleTest.php
@@ -87,7 +87,7 @@ class FactSourcesReportModuleTest extends TestCase
];
$report = new ReportParserSetup($xml);
- self::assertIsArray($report->reportProperties());
+ self::assertNotEmpty($report->reportProperties());
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
diff --git a/tests/app/Module/FamilyGroupReportModuleTest.php b/tests/app/Module/FamilyGroupReportModuleTest.php
index 309ea815d4..b747bf3be0 100644
--- a/tests/app/Module/FamilyGroupReportModuleTest.php
+++ b/tests/app/Module/FamilyGroupReportModuleTest.php
@@ -90,7 +90,7 @@ class FamilyGroupReportModuleTest extends TestCase
];
$report = new ReportParserSetup($xml);
- self::assertIsArray($report->reportProperties());
+ self::assertNotEmpty($report->reportProperties());
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
diff --git a/tests/app/Module/IndividualFamiliesReportModuleTest.php b/tests/app/Module/IndividualFamiliesReportModuleTest.php
index 1e094d4ac0..f82837662d 100644
--- a/tests/app/Module/IndividualFamiliesReportModuleTest.php
+++ b/tests/app/Module/IndividualFamiliesReportModuleTest.php
@@ -93,7 +93,7 @@ class IndividualFamiliesReportModuleTest extends TestCase
];
$report = new ReportParserSetup($xml);
- self::assertIsArray($report->reportProperties());
+ self::assertNotEmpty($report->reportProperties());
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
diff --git a/tests/app/Module/IndividualReportModuleTest.php b/tests/app/Module/IndividualReportModuleTest.php
index 101f579b27..6618591d04 100644
--- a/tests/app/Module/IndividualReportModuleTest.php
+++ b/tests/app/Module/IndividualReportModuleTest.php
@@ -87,7 +87,7 @@ class IndividualReportModuleTest extends TestCase
];
$report = new ReportParserSetup($xml);
- self::assertIsArray($report->reportProperties());
+ self::assertNotEmpty($report->reportProperties());
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
diff --git a/tests/app/Module/MarriageReportModuleTest.php b/tests/app/Module/MarriageReportModuleTest.php
index 0aec51bd11..06498319c8 100644
--- a/tests/app/Module/MarriageReportModuleTest.php
+++ b/tests/app/Module/MarriageReportModuleTest.php
@@ -87,7 +87,7 @@ class MarriageReportModuleTest extends TestCase
];
$report = new ReportParserSetup($xml);
- self::assertIsArray($report->reportProperties());
+ self::assertNotEmpty($report->reportProperties());
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
diff --git a/tests/app/Module/MissingFactsReportModuleTest.php b/tests/app/Module/MissingFactsReportModuleTest.php
index ca5ce82e51..8392121bec 100644
--- a/tests/app/Module/MissingFactsReportModuleTest.php
+++ b/tests/app/Module/MissingFactsReportModuleTest.php
@@ -99,7 +99,7 @@ class MissingFactsReportModuleTest extends TestCase
];
$report = new ReportParserSetup($xml);
- self::assertIsArray($report->reportProperties());
+ self::assertNotEmpty($report->reportProperties());
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
diff --git a/tests/app/Module/OccupationReportModuleTest.php b/tests/app/Module/OccupationReportModuleTest.php
index b1a8c93085..44acaa622a 100644
--- a/tests/app/Module/OccupationReportModuleTest.php
+++ b/tests/app/Module/OccupationReportModuleTest.php
@@ -84,7 +84,7 @@ class OccupationReportModuleTest extends TestCase
];
$report = new ReportParserSetup($xml);
- self::assertIsArray($report->reportProperties());
+ self::assertNotEmpty($report->reportProperties());
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
diff --git a/tests/app/Module/PedigreeReportModuleTest.php b/tests/app/Module/PedigreeReportModuleTest.php
index 159dc57d0b..fa743aafc8 100644
--- a/tests/app/Module/PedigreeReportModuleTest.php
+++ b/tests/app/Module/PedigreeReportModuleTest.php
@@ -86,7 +86,7 @@ class PedigreeReportModuleTest extends TestCase
];
$report = new ReportParserSetup($xml);
- self::assertIsArray($report->reportProperties());
+ self::assertNotEmpty($report->reportProperties());
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
diff --git a/tests/app/Module/RelatedIndividualsReportModuleTest.php b/tests/app/Module/RelatedIndividualsReportModuleTest.php
index 3579e67ee1..7c9a5d78d8 100644
--- a/tests/app/Module/RelatedIndividualsReportModuleTest.php
+++ b/tests/app/Module/RelatedIndividualsReportModuleTest.php
@@ -90,7 +90,7 @@ class RelatedIndividualsReportModuleTest extends TestCase
];
$report = new ReportParserSetup($xml);
- self::assertIsArray($report->reportProperties());
+ self::assertNotEmpty($report->reportProperties());
ob_start();
new ReportParserGenerate($xml, new HtmlRenderer(), $vars, $tree);
diff --git a/tests/app/Services/ModuleServiceTest.php b/tests/app/Services/ModuleServiceTest.php
index fd76d7cea9..9a4d6882d8 100644
--- a/tests/app/Services/ModuleServiceTest.php
+++ b/tests/app/Services/ModuleServiceTest.php
@@ -53,7 +53,7 @@ class ModuleServiceTest extends TestCase
{
$module_service = new ModuleService();
- self::assertNotEmpty($module_service->all());
+ self::assertNotEmpty($module_service->all()->all());
}
/**