";
locateOrderDataRequestLogFile($currentTime);
locateOrderDataRequestLogFile($locateOrderDataReq);
if ($selectedLanguage == "" || !is_numeric($selectedLanguage)) : $selectedLanguage = "1"; endif; // Default in English
$languageSelected = $selectedLanguage;
getLanguage(__FILE__);
getCurrentScript(__FILE__);
$err = array();
$locateOrderDataResponse = "";
$xmlLocateOrderData = "";
// ---------------------------------------------------------------------------
// GLOBAL MODE OF USAGE
$globalParUseRelatedCustomer = getParameterValue("0", "GLOBAL_USE_RELATED_CUSTOMER", "0");
// *** Parse request ***
$dataArray = xml2array($locateOrderDataReq);
if ($debug) :
echo "Order data:
\n\n";
print_r($dataArray); echo "
";
endif;
// *** Convert result array to usable parameters ***
// Authentication data
$sessionId = convertSpecial($dataArray["xml"]["locate_order_data"]["auth"]["session_id"]);
$passPhrase = convertSpecial($dataArray["xml"]["locate_order_data"]["auth"]["passphrase"]);
if (checkRequestAuthenticationData2($sessionId, $passPhrase)) :
$debugOut .= "Authentication okay!
\n";
// Get costcenter data
$operation = convertSpecial($dataArray["xml"]["locate_order_data"]["operation"]);
$debugOn = convertSpecial($dataArray["xml"]["locate_order_data"]["debug_on"]);
$debugOut .= "operation: " . $operation . "
\n";
$debugOut .= "address_type: " . $address_type . "
\n";
if (!$debug && $debugOn == "ON" || $debugOn == "YES") :
$debug = true;
echo "csId: " . $csId . "
";
echo "csEid: " . $csEid . "
";
endif;
// *********************************************************
/*
function getJobsByLocatingDummy ($gpsLong, $gpsLat, $radius) {
$retArr = array();
$retArr[] = array(10000, 53.077746, 10.003352, "Pension Haus Monika", "Nöllestraße", "38A", "29646", "Bispingen");
$retArr[] = array(10001, 53.115125, 9.791724, "Kulturverein Schneverdingen e. V.", "Oststraße", "31", "29640", "Schneverdingen");
$retArr[] = array(10002, 52.983248, 9.832366, "Bahnhof", "Am Bahnhof", "", "29614", "Soltau");
// ........
return $retArr;
}
*/
// *********************************************************
if ($operation == "SET") :
// TO BE DONE!
else :
$gpsLat = convertSpecial($dataArray["xml"]["locate_order_data"]["gps_lat"]);
$gpsLong = convertSpecial($dataArray["xml"]["locate_order_data"]["gps_long"]);
$radius = convertSpecial($dataArray["xml"]["locate_order_data"]["radius"]);
if ($debug) :
echo "gpsLat: " . $gpsLat . "
";
echo "gpsLong: " . $gpsLong . "
";
echo "radius: " . $radius . "
";
endif;
// Check radius to get jobs for
if ($radius == "" || !is_numeric($radius)) :
$radius = "50";
endif;
if ($gpsLong != "" && $gpsLat != "") :
$orderNumberArray = getJobsByLocating($gpsLong, $gpsLat, $radius);
$orderNumberArrayLen = count($orderNumberArray);
// Iterate array
$xmlLocateOrderData .= "";
if ($orderNumberArrayLen > 0) :
$xmlLocateOrderData .= "";
for ($i = 0; $i < $orderNumberArrayLen; $i++) :
$xmlLocateOrderData .= "";
$xmlLocateOrderData .= "" . $orderNumberArray[$i][0] . "";
$xmlLocateOrderData .= "" . $orderNumberArray[$i][1] . "";
$xmlLocateOrderData .= "" . $orderNumberArray[$i][2] . "";
$xmlLocateOrderData .= "" . $orderNumberArray[$i][3] . "";
$xmlLocateOrderData .= "" . $orderNumberArray[$i][4] . "";
$xmlLocateOrderData .= "" . $orderNumberArray[$i][5] . "";
$xmlLocateOrderData .= "" . $orderNumberArray[$i][6] . "";
$xmlLocateOrderData .= "" . $orderNumberArray[$i][7] . "";
$xmlLocateOrderData .= "" . $orderNumberArray[$i][8] . "";
$xmlLocateOrderData .= "";
endfor;
$xmlLocateOrderData .= "";
endif;
endif;
$xmlLocateOrderData .= "";
if ($debug) :
echo "RESPONSE:
" . $xmlLocateOrderData . "
";
endif;
endif;
else :
// Authentication data not ok
$err[] = array("101", getLngt("Die Authentifizierungsdaten sind nicht in Ordnung."));
endif;
// print_r($err);
// Check existence of at least one error
$errLen = count($err);
// Output
$locateOrderDataResponse .= "";
if ($errLen > 0) :
locateOrderDataRequestLogFile("ERRORS", 1);
$locateOrderDataResponse .= "NOT OK";
$locateOrderDataResponse .= "";
for ($i = 0; $i < $errLen; $i++) :
$locateOrderDataResponse .= "";
$locateOrderDataResponse .= "" . $err[$i][0] . "";
$locateOrderDataResponse .= "";
$locateOrderDataResponse .= "";
if ($debug) :
$locateOrderDataResponse .= "" . $debugOut . "";
endif;
locateOrderDataRequestLogFile($err[$i][0] . " : " . mcEncode($err[$i][1]), 1);
endfor;
$locateOrderDataResponse .= "";
else :
$locateOrderDataResponse .= "OK" . $xmlLocateOrderData;
if ($debug) :
$locateOrderDataResponse .= "" . $debugOut . "";
endif;
endif;
$locateOrderDataResponse .= "";
// Log entries
locateOrderDataRequestLogFile($locateOrderDataResponse); // Write response into log
locateOrderDataRequestLogFile("___________________________________________________________________________________");
// Return output
echo $locateOrderDataResponse;
/*
// REQUEST
// Request for all locateOrderData of the customer
// Abschnitt für Authentifikation des Requests
[mdtr] // Zusätzliche Session-ID, die mit dem Auftragnehmer ausgehandelt wurde [mandatory]
[mdtr] // Per Algorithmus generierte Phrase, die per one-way-encryption ermittelt wird sowohl für den Versand als auch zum Abgleich bei Eingang
... // Activates debug output ("ON" or "YES")
GET|SET // Operation (GET or SET costcenter(s), default is "GET" if emty tag)
// GSP latitude
// GSP longitude
// Radius to be requested for jobs
// RESPONSE for GET
OK
// Single order
.... // votian (requested) order number
.... //
.... //
.... //
.... //
.... //
.... //
.... //
// Next single order
....
*/
?>