Jump to content
TNG Community
Smiths

Census Plus International- Can't Add Links

Recommended Posts

Smiths

Just put up Census International version 11.0.0.4a a couple of days ago on TNG 11.0.1. Getting an error when attempting to link. For some reason the cpeventID is not being populated. What does it represent? 

 

screenshotcpeventid.PNG

I also notice in the query string that goes to the cplinkid.php page that foundPID is unpopulated.

tngPID=I2159&foundPID=&mycpdataID=20&cpbaseID=11&assignevent=106&assigntree=tree1&debug=

The link Add Type is "Add" even though I deleted all the records from data and base. It doesn't appear to me that there has been, in that section of code at 529, anything that has inserted the record into the TNG events table for it to get the cpeventid. Yes? 

Share this post


Link to post
Share on other sites
Ken Roy

What error are you getting?  What I see above is your attempt to diagnose the problem.  Please provide the error.

If it is the INSERT query, then run the query in phpMyAdmin and provide the error message from there.

Share this post


Link to post
Share on other sites
Smiths

The error shows that the value for field cpeventID is not being stuffed and then it fails. If I manually put in an eventID, it works, so someplace, and I suspect it's in the code that adds values to the events table, that's not working.

Share this post


Link to post
Share on other sites
Ken Roy

From what I can tell, you are a first time user of this mod, so I am trying to determine if something was left out of the setup.

Please run the failing query in phpMyAdmin and provide the error message returned by phpMyAdmin.

Share this post


Link to post
Share on other sites
Ken Roy

What are you selecting for Item#3 on the Import from Ancestry screen?

Quote

Select the Event to be used:           If the Census Event list is empty, you need to create a Custom Event where the tag is CENS or where the display contains census.

Notice that if the Census Event list is empty you need to take action to create a Custom Event for the Census where the tag is either CENS or the display contains the word census.

Share this post


Link to post
Share on other sites
Ken Roy
5 hours ago, Smiths said:

The error shows that the value for field cpeventID is not being stuffed and then it fails. If I manually put in an eventID, it works, so someplace, and I suspect it's in the code that adds values to the events table, that's not working.

My guess is that there are no Census Events in the pull down list on the Import from Ancestry screen and that you did not create such an event when the list showed as empty event list..

You need to go to Admin > Custom Events and add a custom event for Census with a tag of CENS or with the word census in the event display

Share this post


Link to post
Share on other sites
Smiths

No, that wasn't it. I had a custom event defined, but it wasn't stuffing the variable. I fixed it this morning. I went to the section for $cplinktype="Add" and put in a check for the $eventid. if nothing there, then it inserts into the event table with gedcom, persfamid, etc, then selects from the events table to get the eventid. I don't have time to figure out why it never got the eventid, but this fixes it. From cplinkID.php

$cplinktype = 'Add';
        //try adding for the cpeventID here
        if ($eventID ==""){
        //echo "no eventid";
                        $eventdatetr=$year."-00-00";
                //    additional event fields cannot be null 
                $eventage = '';
                $eventagency = '';
                $eventcause = '';
                $eventaddressID = '';
                $eventparenttag = '';
                $eventinfo = '';
                $insertquery = "INSERT INTO `$events_table` (gedcom, persfamID, eventtypeID, eventdate, eventdatetr, eventplace, age, agency, cause, addressID, parenttag, info) VALUES (\"$tree\",\"$foundPID\",\"$eventtypeID\",\"$year\",\"$eventdatetr\",\"$location\", \"$eventage\", \"$eventagency\", \"$eventcause\", \"$eventaddressID\", \"$eventparenttag\", \"$eventinfo\") ";
                //echo $insertquery;
                //exit;
                $insertresult = tng_query($insertquery) or die(tng_error());
                $eventID = tng_insert_id();
                $cplinktype = $cpeventadd;
                $query1="SELECT $events_table.* FROM `$events_table` WHERE `gedcom` = '$assigntree' AND `persfamID` = '$pID' AND `eventtypeID` ='$eventtypeID' AND `eventdate` LIKE '%$year%' ";   //  Look only for YYYY in eventdate
            $result1=tng_query($query1);
            if(tng_num_rows( $result1 )) {
                while ($row1 = tng_fetch_assoc( $result1 )) {
                    $eventID =  $row1['eventID'];
                }// end while row1          
            } // end of if result1

        //exit;
         } 
        tng_query("INSERT INTO `$cp_link` (cpdataID, cpbaseID, gedcom, cpersonID, eventtypeID, cpeventID, cplinktype, censusYear ) VALUES (\"$cpdataID\", \"$cpbaseID\", \"$tree\", \"$foundPID\", \"$eventtypeID\", \"$eventID\", \"$cplinktype\", \"$censusYear\" ) ") or die(tng_error());
        $cplinkID = tng_insert_id();
 

Share this post


Link to post
Share on other sites
Ken Roy

Thanks for providing a fix.  Looking at the code it looks like it is a bug from the original version of the mod in TNG V9.

I am surprised that no one reported this as a problem before now, unless mod mod users import their data and already have a census event that can be linked to.

If you want to test the fix before I publish a new mod version, contact me to provide an email address where I can send the updated module.  I am thinking that additional code is needed similar to the code in lines 174-25

Share this post


Link to post
Share on other sites
Stonefire

Is this bug fixed ? I've got an empty pull down list, despite I've got 2 events "Cens"...Using TNG v 10.1.2

Share this post


Link to post
Share on other sites
Ken Roy

Steen,

This sounds like a different problem.  What version of the Census Plus International mod are you using?

Can you add a screen capture of the problem?  or message me credentials to access your site.

Share this post


Link to post
Share on other sites
Ken Roy

Hi Steen.

It looks like the code that builds the Census Event list is searching only for displays that contain the word census.

I will have to check whether I can change that to also search for CENS in the tag. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×