Ejemplo n.º 1
0
        $fields['termsAndConditionsChecked'] = '';
        $fields['promotionalCode'] = '';
        $fields['giftCardNumber'] = '';
        $fields['jacketTypeChoices'] = '';
        $fields['whereDoYouWhereYourJacketChoices'] = '';
        $fields['underwearStyleChoices'] = '';
        $fields['styleDislikeDescription'] = '';
        //fill all fields with something not null
        foreach ($fields as &$value) {
            if (empty($value)) {
                $value = '';
            }
        }
        //send it
        $ws_res = $ws->sendForm($fields);
        // if it does not say sagepay or its empty its wrong
        $patt = '/\\<title\\>Sage\\sPay/';
        preg_match($patt, $ws_res, $match);
        if (empty($match[0]) || empty($ws_res)) {
            $this->log_it("Something went wrong on the webservices.");
        } else {
            $this->log_it("Just sent {$profile->email}");
        }
        //mark it as sent in db
        //querying instead of using bespoke update method because that will update the modified field
        $this->wpdb->query("UPDATE {$this->table} SET salesforce = 1, ws_sent_date = now() WHERE profile_id = {$profile->profile_id}");
    }
}
$cron = new Cronjobs();
$cron->createSalesforceAccounts();