<commit_before><?php
/*******************************************************************************
*
*  filename    : CartView.php
*  website     : http://www.churchdb.org
*
*  Copyright 2001-2003 <NAME>, <NAME>, <NAME>
*
*  Additional Contributors:
*  2006 <NAME>
*
*
*  Copyright 2006 Contributors
*
*  ChurchInfo is free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
*
*  This file best viewed in a text editor with tabs stops set to 4 characters
*
******************************************************************************/

function ExportCartToCSV()
{


    $sSQL  =    " SELECT lst_OptionName, fam_Name, per_LastName, per_FirstName, ".
                " fam_HomePhone, per_HomePhone, fam_Address1, fam_Address2, fam_City, ".
                " fam_State, fam_Zip, per_DateEntered".
                " FROM person_per ".
                " LEFT JOIN family_fam ON fam_ID = per_fam_ID ".
                " LEFT JOIN list_lst ON lst_OptionID = per_cls_ID ".
                " WHERE per_ID IN (" . ConvertCartToString($_SESSION['aPeopleCart']) . ") ".
                " AND lst_ID='1' ".
                " ORDER BY fam_Name, fam_ID, per_LastName, per_FirstName ";
	
	//Run the SQL
	$rsQueryResults = RunQuery($sSQL);

    $sCSVstring = "";

	if (mysql_error() != "")
	{
		$sCSVstring = gettext("An error occured: ") . mysql_errno() . "--" . mysql_error();
	}
	else
	{

		//Loop through the fields and write the header row
		for ($iCount = 0; $iCount < mysql_num_fields($rsQueryResults); $iCount++)
		{
            $sCSVstring .= mysql_field_name($rsQueryResults,$iCount) . ",";
		}

        $sCSVstring .= "\n";

		//Loop through the recordsert
		while($aRow =mysql_fetch_array($rsQueryResults))<commit_msg>Added canvassers to CSV export.  Modified Files:  	churchinfo/CartView.php<commit_after><?php
/*******************************************************************************
*
*  filename    : CartView.php
*  website     : http://www.churchdb.org
*
*  Copyright 2001-2003 <NAME>, <NAME>, <NAME>
*
*  Additional Contributors:
*  2006 <NAME>
*
*
*  Copyright 2006 Contributors
*
*  ChurchInfo is free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
*
*  This file best viewed in a text editor with tabs stops set to 4 characters
*
******************************************************************************/

function ExportCartToCSV()
{
    $sSQL  =    " DROP TEMPORARY TABLE IF EXISTS tmp_canvassers ";
    RunQuery($sSQL);

    // Make temporary copy of person_per table and call it tmp_canvassers
    $sSQL  =    " CREATE TEMPORARY TABLE tmp_canvassers ".
                " SELECT * FROM person_per ";
    RunQuery($sSQL);

    $sSQL  =    " SELECT lst_OptionName AS Classification, fam_Name AS Family, ".
                " person_per.per_LastName AS Last_Name, ".
                " person_per.per_FirstName AS First_Name, ".
                " fam_HomePhone, person_per.per_HomePhone AS per_HomePhone, ".
                " fam_Address1, fam_Address2, fam_City, ".
                " fam_State, fam_Zip, person_per.per_DateEntered AS DateEntered, ".
                " tmp_canvassers.per_LastName AS Cnvsr_Last_Name, ".
                " tmp_canvassers.per_FirstName AS Cnvsr_First_Name ".
                " FROM person_per ".
                " LEFT JOIN family_fam ON fam_ID = person_per.per_fam_ID ".
                " LEFT JOIN list_lst ON lst_OptionID = person_per.per_cls_ID ".
                " LEFT JOIN tmp_canvassers ON tmp_canvassers.per_ID = fam_Canvasser ".
                " WHERE person_per.per_ID ".
                "     IN (" . ConvertCartToString($_SESSION['aPeopleCart']) . ") ".
                " AND lst_ID='1' ".
                " ORDER BY fam_Name, fam_ID, Last_Name, First_Name ";
	
	//Run the SQL
	$rsQueryResults = RunQuery($sSQL);

    $sCSVstring = "";

	if (mysql_error() != "")
	{
		$sCSVstring = gettext("An error occured: ") . mysql_errno() . "--" . mysql_error();
	}
	else
	{

		//Loop through the fields and write the header row
		for ($iCount = 0; $iCount < mysql_num_fields($rsQueryResults); $iCount++)
		{
            $sCSVstring .= mysql_field_name($rsQueryResults,$iCount) . ",";
		}

        $sCSVstring .= "\n";

		//Loop through the recordsert
		while($aRow =mysql_fetch_array($rsQueryResults))
{'fraction_non_alphanumeric': 0.17118093174431204, 'fraction_numerical': 0.009534127843986998, 'mean_word_length': 2.8307053941908715, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2606960', 'n_tokens_mistral': 1498, 'n_tokens_neox': 1365, 'n_words': 365}