Exemple #1
0
 $errorCount = 0;
 $resultArray = array();
 $payloadChunks = array_chunk($payload, $logIndex);
 $chunkCount = 0;
 $recordCount = 0;
 foreach ($payloadChunks as $chunk) {
     $chunkCount++;
     # Create the XML for the operation/object.
     $xml = ZuoraAPIHelper::printXMLWithNS($operation, $object, $fieldList, $chunk, $debug, 0, $defaultApiNamespace, $defaultObjectNamespace, false);
     if ($showRequest) {
         $soapRequest = createRequest($header->data["session"], $xml);
         fwrite($lf, "Request:\n");
         fwrite($lf, xml_pretty_printer($soapRequest, true) . "\n");
         continue;
     }
     $result = ZuoraAPIHelper::bulkOperation($client, $header, $operation, $xml, count($chunk), $debug, TRUE, $objectCount);
     $successCount += $result["successCount"];
     $errorCount += $result["errorCount"];
     $resultArray[] = $result;
     $recordCount += count($chunk);
     // Print a Summary of results
     fwrite($lf, "Chunk " . $chunkCount . ", " . $recordCount . " records processed: successfully " . $operation . "d " . $result["successCount"] . " out of " . count($chunk) . " ZObjects. Number of errors: " . $result["errorCount"] . ". Total errors: " . $errorCount . "/" . $recordCount . ".\n");
     if ($result["errorCount"] > 0) {
         fwrite($lf, "The following ZObjects failed:\n");
         $errorList = $result["errorList"];
         for ($i = 0; $i < count($errorList); $i++) {
             $error = $errorList[$i];
             // Please note the offset by 1 for the header.
             $recordIndex = $recordCount - count($chunk) + $error["index"] + 1;
             fwrite($lf, $recordIndex . "," . $error["code"] . "," . $error["message"] . "\n");
             fwrite($of, date($DATE_FORMAT, time()) . $SEPARATOR . $error["message"] . $SEPARATOR . $recordIndex . $SEPARATOR . $error["code"] . $SEPARATOR . $chunkCount . "\n");
Exemple #2
0
function bulkOperation($client, $header, $method, $payload, $itemCount, $debug, $htmlOutput = FALSE)
{
    return ZuoraAPIHelper::bulkOperation($client, $header, $method, $payload, $itemCount, $debug, $htmlOutput);
}