Пример #1
0
 public function testPrefixNone()
 {
     // test to ensure that the object from an fsockopen is valid
     $C = new Codes();
     $format = "******";
     $prefix = $C->getPrefix($format);
     $this->assertTrue(strlen($C->prefix) == 0);
 }
Пример #2
0
$mySforceConnection->login(USERNAME, PASSWORD . SECURITY_TOKEN);
/************************** SELECT CDA_id **************************/
/* */
echo "<pre>";
$query = "SELECT Id FROM ContractDealAttribute__c LIMIT 1";
$response = $mySforceConnection->query($query);
//echo "Results of query '$query'<br/><br/>\n";
foreach ($response->records as $record) {
    //    echo $record->Id ." - "  ."<br/>\n";
    $cda = $record->Id;
}
/************************** GENERATE SOME CODES **************************/
require_once './codes.php';
$C = new Codes();
$C->format = $_GET['format'];
$C->prefix = $C->getPrefix($C->format);
$C->__construct();
$C->num_random_chars = strlen($C->format) - strlen($C->prefix);
$C->fieldlength = 100;
// sets fieldlength artifically low just for test usually 32768
$codes = $C->generateMany($number_of_codes);
$prep = $C->prepareCodesForInsert($codes);
print_r($codes);
/************************** INSERT DATA INTO SF **************************/
$records = array();
$i = 0;
foreach ($prep as $code) {
    $records[$i] = new stdclass();
    $records[$i]->Contract_Deal_Attribute__c = $cda;
    $records[$i]->Voucher_Code__c = $code;
    $i++;