Example #1
0
                 $sSQLpersonFields .= $aPersonTableFields[$currentType] . ", ";
                 break;
         }
     }
 }
 // Second pass at the person_per SQL.. this time we know the Country
 for ($col = 0; $col < $numCol; $col++) {
     // Is it not a custom field?
     if (!$aColumnCustom[$col]) {
         $currentType = $aColumnID[$col];
         switch ($currentType) {
             // Phone numbers..
             case 14:
             case 15:
             case 16:
                 $sSQLpersonData .= "'" . addslashes(CollapsePhoneNumber($aData[$col], $sCountry)) . "',";
                 $sSQLpersonFields .= $aPersonTableFields[$currentType] . ", ";
                 break;
             default:
                 break;
         }
     }
 }
 // Finish up the person_per SQL..
 $sSQLpersonData .= $iClassID . ",'" . addslashes($sCountry) . "',";
 $sSQLpersonData .= "'" . date("YmdHis") . "'," . $_SESSION['iUserID'] . ")";
 $sSQLpersonFields .= "per_cls_ID, per_Country, per_DateEntered, per_EnteredBy)";
 $sSQLperson = $sSQLpersonFields . $sSQLpersonData;
 RunQuery($sSQLperson);
 //echo "<br>" . $sSQLperson . "<br>";
 if ($bHasCustom) {
Example #2
0
function sqlCustomField(&$sSQL, $type, $data, $col_Name, $special)
{
    switch ($type) {
        // boolean
        case 1:
            switch ($data) {
                case "false":
                    $data = "'false'";
                    break;
                case "true":
                    $data = "'true'";
                    break;
                default:
                    $data = "NULL";
                    break;
            }
            $sSQL .= $col_Name . " = " . $data . ", ";
            break;
            // date
        // date
        case 2:
            if (strlen($data) > 0) {
                $sSQL .= $col_Name . " = \"" . $data . "\", ";
            } else {
                $sSQL .= $col_Name . " = NULL, ";
            }
            break;
            // year
        // year
        case 6:
            if (strlen($data) > 0) {
                $sSQL .= $col_Name . " = '" . $data . "', ";
            } else {
                $sSQL .= $col_Name . " = NULL, ";
            }
            break;
            // season
        // season
        case 7:
            if ($data != 'none') {
                $sSQL .= $col_Name . " = '" . $data . "', ";
            } else {
                $sSQL .= $col_Name . " = NULL, ";
            }
            break;
            // integer, money
        // integer, money
        case 8:
        case 10:
            if (strlen($data) > 0) {
                $sSQL .= $col_Name . " = '" . $data . "', ";
            } else {
                $sSQL .= $col_Name . " = NULL, ";
            }
            break;
            // list selects
        // list selects
        case 9:
        case 12:
            if ($data != 0) {
                $sSQL .= $col_Name . " = '" . $data . "', ";
            } else {
                $sSQL .= $col_Name . " = NULL, ";
            }
            break;
            // strings
        // strings
        case 3:
        case 4:
        case 5:
            if (strlen($data) > 0) {
                $sSQL .= $col_Name . " = '" . $data . "', ";
            } else {
                $sSQL .= $col_Name . " = NULL, ";
            }
            break;
            // phone
        // phone
        case 11:
            if (strlen($data) > 0) {
                if (!isset($_POST[$col_Name . "noformat"])) {
                    $sSQL .= $col_Name . " = '" . CollapsePhoneNumber($data, $special) . "', ";
                } else {
                    $sSQL .= $col_Name . " = '" . $data . "', ";
                }
            } else {
                $sSQL .= $col_Name . " = NULL, ";
            }
            break;
        default:
            $sSQL .= $col_Name . " = '" . $data . "', ";
            break;
    }
}
Example #3
0
     $currentFieldData = FilterInput($_POST[$fam_custom_Field]);
     $bErrorFlag |= !validateCustomField($type_ID, $currentFieldData, $fam_custom_Field, $aCustomErrors);
     // assign processed value locally to $aPersonProps so we can use it to generate the form later
     $aCustomData[$fam_custom_Field] = $currentFieldData;
 }
 //If no errors, then let's update...
 if (!$bErrorFlag) {
     // Format the phone numbers before we store them
     if (!$bNoFormat_HomePhone) {
         $sHomePhone = CollapsePhoneNumber($sHomePhone, $sCountry);
     }
     if (!$bNoFormat_WorkPhone) {
         $sWorkPhone = CollapsePhoneNumber($sWorkPhone, $sCountry);
     }
     if (!$bNoFormat_CellPhone) {
         $sCellPhone = CollapsePhoneNumber($sCellPhone, $sCountry);
     }
     //Write the base SQL depending on the Action
     if ($bSendNewsLetter) {
         $bSendNewsLetterString = "'TRUE'";
     } else {
         $bSendNewsLetterString = "'FALSE'";
     }
     if ($bOkToCanvass) {
         $bOkToCanvassString = "'TRUE'";
     } else {
         $bOkToCanvassString = "'FALSE'";
     }
     if ($iFamilyID < 1) {
         $sSQL = "INSERT INTO family_fam (\n\t\t\t\t\t\tfam_Name, \n\t\t\t\t\t\tfam_Address1, \n\t\t\t\t\t\tfam_Address2, \n\t\t\t\t\t\tfam_City, \n\t\t\t\t\t\tfam_State, \n\t\t\t\t\t\tfam_Zip, \n\t\t\t\t\t\tfam_Country, \n\t\t\t\t\t\tfam_HomePhone, \n\t\t\t\t\t\tfam_WorkPhone, \n\t\t\t\t\t\tfam_CellPhone, \n\t\t\t\t\t\tfam_Email, \n\t\t\t\t\t\tfam_WeddingDate, \n\t\t\t\t\t\tfam_DateEntered, \n\t\t\t\t\t\tfam_EnteredBy, \n\t\t\t\t\t\tfam_SendNewsLetter,\n\t\t\t\t\t\tfam_OkToCanvass,\n\t\t\t\t\t\tfam_Canvasser,\n\t\t\t\t\t\tfam_Latitude,\n\t\t\t\t\t\tfam_Longitude,\n\t\t\t\t\t\tfam_Envelope)\n\t\t\t\t\tVALUES ('" . $sName . "','" . $sAddress1 . "','" . $sAddress2 . "','" . $sCity . "','" . $sState . "','" . $sZip . "','" . $sCountry . "','" . $sHomePhone . "','" . $sWorkPhone . "','" . $sCellPhone . "','" . $sEmail . "'," . $dWeddingDate . ",'" . date("YmdHis") . "'," . $_SESSION['iUserID'] . "," . $bSendNewsLetterString . "," . $bOkToCanvassString . ",'" . $iCanvasser . "'," . $nLatitude . "," . $nLongitude . "," . $nEnvelope . ")";
         $bGetKeyBack = true;