Exemplo n.º 1
0
function goCreateContacts()
{
    $trainees = db::runQuery("select * from process_trainee where processed = '0'  and inerror = '0'");
    if ($trainees) {
        foreach ($trainees as $trains) {
            $traineeBatchID = db::esc($trains['ID']);
            $processgroup = db::esc($trains['processgroupID']);
            //check to make sure this item has been procesed in another thread.
            $dupcheck = db::runQuery("select * from process_trainee where processed = '0' and ID = '{$traineeBatchID}'");
            if (!$dupcheck) {
                //do nothing for now, later date we will add some extra processing steps here when volumes increas heavily.
            } else {
                $contactVars = array('givenName' => $trains['firstname'], 'surname' => $trains['lastname'], 'title' => '', 'emailAddress' => $trains['email'], 'mobilephone' => $trains['mobile'], 'organisation' => $trains['workplace'], 'address1' => $trains['address'], 'city' => $trains['suburb'], 'postcode' => $trains['postcode'], 'USI' => $trains['usi'], 'customField_additionalinfo' => $trains['additionalinfo'], 'customField_processingGroupID' => $trains['processgroupID']);
                db::insertQuery("update process_trainee set processed = '2' where ID = '{$traineeBatchID}'");
                $enroll = axcelerate_save_contact($contactVars);
                ob_start();
                echo "Axcelerate Create Contact\n";
                var_dump($enroll);
                echo "\n\nvars:\n\n";
                var_dump($contactVars);
                $extrans_dump = ob_get_clean();
                dlog($extrans_dump, false, $processgroup);
                dlog("is Error: " . $enroll->ERROR, false, $processgroup);
                dlog("Error Message: : " . $enroll->DETAILS, false, $processgroup);
                if ($enroll->ERROR == 1 || $enroll->ERROR == "1" || $enroll->ERROR == true) {
                    $errorMessage = $enroll->DETAILS;
                    db::insertQuery("update process_trainee set processed = '0', inerror = '1' where ID = '{$traineeBatchID}'");
                    $errorMessage = db::esc($errorMessage);
                    db::insertQuery("update process_group set process_status = '99' and errorMessage = '{$errormessage}' where processgroupID = '{$processgroup}'");
                    markGroupError($processgroup, $errorMessage);
                } else {
                    $contactID = db::esc($enroll->CONTACTID);
                    db::insertQuery("update process_trainee set processed = '1', contactID = '{$contactID}' where ID = '{$traineeBatchID}'");
                    checkEnrolmentsComplete();
                }
            }
        }
    }
    return true;
}
Exemplo n.º 2
0
 //$_SESSION['enrol_ArrayHash'] =  md5(date('r',strtotime('now')));
 dlog("Field Pickups ");
 //Create contact in Excelerate for this entry
 if ($dontInvoiceUser) {
     $contactVars = array('givenName' => $enrolVar['fname'], 'surname' => $enrolVar['lname'], 'title' => '', 'emailAddress' => $addressToInvoice, 'mobilephone' => $enrolVar['mobile'], 'organisation' => $enrolVar['workplace'], 'address1' => $enrolVar['address'], 'city' => $enrolVar['suburb'], 'postcode' => $enrolVar['postcode'], 'USI' => $enrolVar['usi']);
     $dontsuppressInvoiceEmail = true;
     dlog("Set: Dont Invoice User ");
 } else {
     $contactVars = array('givenName' => $enrolVar['fname'], 'surname' => $enrolVar['lname'], 'title' => '', 'emailAddress' => $enrolVar['email'], 'mobilephone' => $enrolVar['mobile'], 'organisation' => $enrolVar['workplace'], 'address1' => $enrolVar['address'], 'city' => $enrolVar['suburb'], 'postcode' => $enrolVar['postcode'], 'USI' => $enrolVar['usi']);
     $dontsuppressInvoiceEmail = false;
     dlog("Set: Invoice User ");
 }
 $arrayHash = md5(serialize($contactVars));
 //couponAddressToInvoice
 if (!$_SESSION['enrol_Contact'] || !$arrayHash == $_SESSION['enrol_ArrayHash']) {
     $enroll = axcelerate_save_contact($contactVars);
     $_SESSION['enrol_Contact'] = $enroll;
     $_SESSION['enrol_ArrayHash'] = $arrayHash;
     $contactID = $enroll->CONTACTID;
     $courseInstanceID = $courseID;
     dlog("Enrol-Contact: Created Contact ID " . $contactID);
 } else {
     $enroll = $_SESSION['enrol_Contact'];
     $contactID = $enroll->CONTACTID;
     $courseInstanceID = $courseID;
     dlog("Enrol-Contact: Used Session Contact ID " . $contactID);
 }
 if ($campaignCode) {
     if (!$dontsuppressInvoiceEmail) {
         $supressInvoiceEmail = "1";
         $generateInvoice = "false";
function goCreateContacts()
{
    $trainees = db::runQuery("select * from process_trainee where processed = '0'");
    if ($trainees) {
        foreach ($trainees as $trains) {
            $traineeBatchID = db::esc($trains['ID']);
            //check to make sure this item has been procesed in another thread.
            $dupcheck = db::runQuery("select * from process_trainee where processed = '0' and ID = '{$traineeBatchID}'");
            if (!$dupcheck) {
                //do nothing for now, later date we will add some extra processing steps here when volumes increas heavily.
            } else {
                $contactVars = array('givenName' => $trains['firstname'], 'surname' => $trains['lastname'], 'title' => '', 'emailAddress' => $trains['email'], 'mobilephone' => $trains['mobile'], 'organisation' => $trains['workplace'], 'address1' => $trains['address'], 'city' => $trains['suburb'], 'postcode' => $trains['postcode'], 'USI' => $trains['usi'], 'customField_additionalinfo' => $trains['additionalinfo'], 'customField_processingGroupID' => $trains['processgroupID']);
                $enroll = axcelerate_save_contact($contactVars);
                $contactID = db::esc($enroll->CONTACTID);
                db::insertQuery("update process_trainee set processed = '1', contactID = '{$contactID}' where ID = '{$traineeBatchID}'");
                checkEnrolmentsComplete();
            }
        }
    }
    return true;
}