TNG 9 – Sheets Mod

I’ve worked with a LOT of genealogy software applications over the years and all of them have left me, for one reason or another, unsatisfied.

I started experimenting with The Next Generation of Genealogy Sitebuilding, also known as TNG, back in mid-2010, but really started digging deep into the application over the past few months. What makes TNG so unique is that it’s a web based app instead of a Windows or Mac fat-client application. I love this approach as it gives me total access to my data, and since the application is written in PHP and has a built-in Mod architecture and manager, it’s really, REALLY easy to extend the application to make it do things that it doesn’t do natively.

I’m currently editing a book for a particular line in my database and needed the Person and Group Sheets to include divorce information. Unfortunately the reports that ship with TNG 9, the latest version, do not support this. My first thought was to export a GEDCOM and import it into an application like Reunion, but without going into the details, I HATED the results. That led me to creating my own Mod to extend both the Person Sheet and Group Sheet PDFs to include divorce information.

To use the mod, save the code below or download this file to gt_sheet_v9.0.0.1.cfg in your tng/mods folder and then install like any other mod.

I’ve only tested the Mod with TNG V9, so I can’t speak to its compatibility with previous versions.

%name:GT Custom Sheet%
%version:V9.0.0.0%
%description:This mod will modify the person and group sheet pdf reports to add divorce information.%

%target:tngdblib.php%
%location:%
//Get most family data for a known spouse
function getSpouseFamilyDataPlusDates($tree, $spouse1, $spouse1ID, $spouseorder) {
    global $families_table;

        $query = "SELECT gedcom, husband, wife, familyID, marrdate, marrdatetr, marrplace, marrtype, living, private, branch,
                YEAR(marrdatetr) as marryear, MONTH(marrdatetr) as marrmonth, DAYOFMONTH(marrdatetr) as marrday, marrplace, sealdate, sealplace
                FROM $families_table
                WHERE $spouse1 = \"$spouse1ID\" AND gedcom = \"$tree\"
                ORDER BY $spouseorder";

    return dbExecuteQuery($query);
}

//Get most family data for a known spouse with unknown gender
function getSpouseFamilyDataUnionPlusDates($tree, $spouse1ID) {
    global $families_table;

        $query = "SELECT gedcom, husband, wife, familyID, marrdate, marrdatetr, marrplace, marrtype, living, private, branch,
                        YEAR(marrdatetr) as marryear, MONTH(marrdatetr) as marrmonth, DAYOFMONTH(marrdatetr) as marrday, marrplace, sealdate, sealplace
        FROM $families_table
        WHERE husband = \"$spouse1ID\" AND gedcom = \"$tree\"
        UNION
            SELECT gedcom, husband, wife, familyID, marrdate, marrdatetr, marrplace, marrtype, living, private, branch,
                                YEAR(marrdatetr) as marryear, MONTH(marrdatetr) as marrmonth, DAYOFMONTH(marrdatetr) as marrday, marrplace, sealdate, sealplace
            FROM $families_table
            WHERE wife = \"$spouse1ID\" AND gedcom = \"$tree\"";

    return dbExecuteQuery($query);
}
%end:%
%replace:%
//Get most family data for a known spouse
function getSpouseFamilyDataPlusDates($tree, $spouse1, $spouse1ID, $spouseorder) {
    global $families_table;

        $query = "SELECT gedcom, husband, wife, familyID, marrdate, marrdatetr, marrplace, marrtype, divdate, divplace, living, private, branch,
                YEAR(marrdatetr) as marryear, MONTH(marrdatetr) as marrmonth, DAYOFMONTH(marrdatetr) as marrday, marrplace, sealdate, sealplace
                FROM $families_table
                WHERE $spouse1 = \"$spouse1ID\" AND gedcom = \"$tree\"
                ORDER BY $spouseorder";

    return dbExecuteQuery($query);
}

//Get most family data for a known spouse with unknown gender
function getSpouseFamilyDataUnionPlusDates($tree, $spouse1ID) {
    global $families_table;

        $query = "SELECT gedcom, husband, wife, familyID, marrdate, marrdatetr, marrplace, marrtype, divdate, divplace, living, private, branch,
                        YEAR(marrdatetr) as marryear, MONTH(marrdatetr) as marrmonth, DAYOFMONTH(marrdatetr) as marrday, marrplace, sealdate, sealplace
        FROM $families_table
        WHERE husband = \"$spouse1ID\" AND gedcom = \"$tree\"
        UNION
            SELECT gedcom, husband, wife, familyID, marrdate, marrdatetr, marrplace, marrtype, divdate, divplace, living, private, branch,
                                YEAR(marrdatetr) as marryear, MONTH(marrdatetr) as marrmonth, DAYOFMONTH(marrdatetr) as marrday, marrplace, sealdate, sealplace
            FROM $families_table
            WHERE wife = \"$spouse1ID\" AND gedcom = \"$tree\"";

    return dbExecuteQuery($query);
}
%end:%

%target:rpt_ind.php%
%location:%
                if($rights['both']) {
                    $cite = reorderCitation($marriagerow['familyID']."_MARR", 0);
                    doubleLine($text['married'], displayDate($marriagerow['marrdate']), $text['place'], $marriagerow['marrplace'], $cite);
                }
%end:%
%replace:%
                if($rights['both']) {
                    $cite = reorderCitation($marriagerow['familyID']."_MARR", 0);
                    $citex = reorderCitation($marriagerow['familyID']."_DIV", 0);
                    doubleLine($text['married'], displayDate($marriagerow['marrdate']), $text['place'], $marriagerow['marrplace'], $cite);
                    doubleLine($text['divorced'], displayDate($marriagerow['divdate']), $text['place'], $marriagerow['divplace'], $citex);
                }
%end:%

%target:rpt_fam.php%
%location:%
        // married
        if ($frights['both']) {
            $cite = reorderCitation($familyID."_MARR", 0);
            dateLine($text['married'], displayDate($fam['marrdate']), $fam['marrplace'], $cite);
        }
%end:%
%replace:%
        // married
        if ($frights['both']) {
            $cite = reorderCitation($familyID."_MARR", 0);
            $citex = reorderCitation($familyID."_DIV", 0);
            dateLine($text['married'], displayDate($fam['marrdate']), $fam['marrplace'], $cite);
            dateLine($text['divorced'], displayDate($fam['divdate']), $fam['divplace'], $citex);
        }
%end:%

Until next time – GEEK OUT!

~GT~

Leave a Comment

Your email address will not be published. Required fields are marked *