- Posts: 12
Question Vytux Cousins - Children of half sibblings will not be recognized as cousins
- Modellbauhütte
- Topic Author
- Offline
- New Member
Less
More
2 years 10 months ago #1
by Modellbauhütte
Vytux Cousins - Children of half sibblings will not be recognized as cousins was created by Modellbauhütte
Hello,
I'm using the Vytux Cousins Plugin for webtrees. I found an error in case, the mothers of the persons are half sisters. The children of the half sisters will not be recognized as cousins.
Is Vytux still supporting this development or is there an alternative plugin?
Greetings,
Moritz
I'm using the Vytux Cousins Plugin for webtrees. I found an error in case, the mothers of the persons are half sisters. The children of the half sisters will not be recognized as cousins.
Is Vytux still supporting this development or is there an alternative plugin?
Greetings,
Moritz
Please Log in or Create an account to join the conversation.
- ardhtu
- Offline
- New Member
2 years 10 months ago #2
by ardhtu
Hannu
MySqlI 5.0.12
PHP 8.1 Server API: CGI/FastCGI,
webtrees 2.1.4
Replied by ardhtu on topic Vytux Cousins - Children of half sibblings will not be recognized as cousins
Hi, I found the same thing and fixed it by myself.
Replace the function getCousins in the module.php here: ./modules_v4/vytux_cousins/module.php with this:
Replace the function getCousins in the module.php here: ./modules_v4/vytux_cousins/module.php with this:
Code:
private function getCousins(Individual $individual): object
{
$cousinsObj = (object)[];
$cousinsObj->self = $individual;
$cousinsObj->fathersCousinCount = 0;
$cousinsObj->mothersCousinCount = 0;
$cousinsObj->allCousinCount = 0;
$cousinsObj->fatherCousins = [];
$cousinsObj->motherCousins = [];
if ($individual->childFamilies()->first()) {
$cousinsObj->father = $individual->childFamilies()->first()->husband();
$cousinsObj->mother = $individual->childFamilies()->first()->wife();
if ($cousinsObj->father) {
foreach ($cousinsObj->father->childFamilies() as $family) {
foreach ($family->spouses() as $parent) {
foreach ($parent->spouseFamilies() as $family2) {
foreach ($family2->children() as $sibling) {
if ($sibling !== $cousinsObj->father) {
foreach ($sibling->spouseFamilies() as $fam) {
foreach ($fam->children() as $child) {
$cousinsObj->fatherCousins[] = $child;
$cousinsObj->fathersCousinCount++;
}
}
}
}
}
}
}
}
$cousinsObj->fatherCousins = array_unique( $cousinsObj->fatherCousins );
$cousinsObj->fathersCousinCount = sizeof( $cousinsObj->fatherCousins );
if ($cousinsObj->mother) {
foreach ($cousinsObj->mother->childFamilies() as $family) {
foreach ($family->spouses() as $parent) {
foreach ($parent->spouseFamilies() as $family2) {
foreach ($family2->children() as $sibling) {
if ($sibling !== $cousinsObj->mother) {
foreach ($sibling->spouseFamilies() as $fam) {
foreach ($fam->children() as $child) {
if ( in_array( $child, $cousinsObj->fatherCousins )){} else {
$cousinsObj->motherCousins[] = $child;
$cousinsObj->mothersCousinCount++;
}
}
}
}
}
}
}
}
}
$cousinsObj->motherCousins = array_unique( $cousinsObj->motherCousins );
$cousinsObj->mothersCousinCount = sizeof( $cousinsObj->motherCousins );
$cousinsObj->allCousinCount = sizeof(array_unique(array_merge($cousinsObj->fatherCousins,$cousinsObj->motherCousins)));
}
return $cousinsObj;
}
Hannu
MySqlI 5.0.12
PHP 8.1 Server API: CGI/FastCGI,
webtrees 2.1.4
Please Log in or Create an account to join the conversation.
- Modellbauhütte
- Topic Author
- Offline
- New Member
Less
More
- Posts: 12
2 years 10 months ago #3
by Modellbauhütte
Replied by Modellbauhütte on topic Vytux Cousins - Children of half sibblings will not be recognized as cousins
Thanks,
this bugfix works perfectly!
Greetings,
Moritz
this bugfix works perfectly!
Greetings,
Moritz
Please Log in or Create an account to join the conversation.
- Franz Frese
- Away
- Elite Member
2 years 10 months ago #4
by Franz Frese
Replied by Franz Frese on topic Vytux Cousins - Children of half sibblings will not be recognized as cousins
many thx, it works well (as far as I tested).
p.s.: no missing info on small devices (chrome).
p.s.: no missing info on small devices (chrome).
Please Log in or Create an account to join the conversation.