diff options
| author | fisharebest <fisharebest@gmail.com> | 2011-01-03 09:50:45 +0000 |
|---|---|---|
| committer | fisharebest <fisharebest@gmail.com> | 2011-01-03 09:50:45 +0000 |
| commit | a253e5305b52b30c8aa3988e4cf421cd3becb833 (patch) | |
| tree | 62909feb0e35f7caa4e009ce3a2feb89fd178c66 /includes | |
| parent | 3d664b24f7a3b330d36eeb08de4931e0d4a22f46 (diff) | |
| download | webtrees-a253e5305b52b30c8aa3988e4cf421cd3becb833.tar.gz webtrees-a253e5305b52b30c8aa3988e4cf421cd3becb833.tar.bz2 webtrees-a253e5305b52b30c8aa3988e4cf421cd3becb833.zip | |
Minor tidy up. Use Objects instead of XREFs
Diffstat (limited to 'includes')
| -rw-r--r-- | includes/functions/functions_edit.php | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/includes/functions/functions_edit.php b/includes/functions/functions_edit.php index fa2dc45eb7..9f94399cdc 100644 --- a/includes/functions/functions_edit.php +++ b/includes/functions/functions_edit.php @@ -597,10 +597,17 @@ function print_indi_form($nextaction, $famid, $linenum='', $namerec='', $famtag= // Inherit surname from parents, spouse or child if (empty($namerec)) { // We'll need the parent's name to set the child's surname - $famrec=find_gedcom_record($famid, WT_GED_ID, true); - $parents=find_parents_in_record($famrec); - $father_name=get_gedcom_value('NAME', 0, find_person_record($parents['HUSB'], WT_GED_ID)); - $mother_name=get_gedcom_value('NAME', 0, find_person_record($parents['WIFE'], WT_GED_ID)); + $family=WT_Family::getInstance($famid); + if ($family && $family->getHusband()) { + $father_name=get_gedcom_value('NAME', 0, $family->getHusband()->getGedcomRecord()); + } else { + $father_name=''; + } + if ($family && $family->getWife()) { + $mother_name=get_gedcom_value('NAME', 0, $family->getWife()->getGedcomRecord()); + } else { + $mother_name=''; + } // We'll need the spouse/child's name to set the spouse/parent's surname $prec=find_gedcom_record($pid, WT_GED_ID, true); $indi_name=get_gedcom_value('NAME', 0, $prec); |
