Web based family history software

Question Vytux Cousins - Children of half sibblings will not be recognized as cousins

  • Modellbauhütte
  • Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 10 months ago #1 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

Please Log in or Create an account to join the conversation.

More
2 years 10 months ago #2 by ardhtu
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:
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
  • New Member
More
2 years 10 months ago #3 by Modellbauhütte
Thanks,
this bugfix works perfectly!

Greetings,
Moritz

Please Log in or Create an account to join the conversation.

  • Franz Frese
  • Away
  • Elite Member
  • Elite Member
More
2 years 10 months ago #4 by Franz Frese
many thx, it works well (as far as I tested).

p.s.: no missing info on small devices (chrome).

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum
}