" . getLngt("Bitte kontrollieren Sie noch einmal die Eingabe.");
if ($trackingID == "") :
$out = getLngt("Bitte geben Sie Ihre Sendungsnummer ein.");
endif;
if ($trackingID != "") :
// Get the array for formatting the database-values for the output according to the defined type
$outputFormatField = defineOutputFormats();
// Check existence of the hash value
if (existsEntry("meta_object.metaobject",array("mo_hash",$trackingID))) :
$moId = getFieldValueFromId("meta_object.metaobject", "mo_hash", $trackingID, "mo_id");
$moIdRefDB = getFieldValueFromId("meta_object.metaobject", "mo_id", $moId, "mo_id_ref_db");
$objType = getFieldValueFromId("meta_object.metaobject", "mo_id", $moId, "mo_obj_type");
$objId = getFieldValueFromId("meta_object.metaobject", "mo_id", $moId, "mo_obj_id");
$moValue = getFieldValueFromId("meta_object.metaobject", "mo_id", $moId, "mo_value");
if ($moId != "" && $moId > "0") :
// Get database instance
$dbInst = getFieldValueFromId("meta_object.metaobject", "mo_id", $moIdRefDB, "mo_value");
if ($dbInst != "") :
// Get database connection
$db_conn = getDbConnectionSpecial($dbInst, $dbname, $dblogin, $dbpassword);
if (substr($objType, 0, 5) == "track") : // Could be "track", "track_job", ...
// Charset
$result = $db_conn->query("SET NAMES LATIN1");
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
// *** PACKAGE TRACKING ***
if ($objType == "track") :
// Get tracking data
$sqlquery = "SELECT trat.trat_id, trat.jb_id, trat.tr_sort, trat.trat_state, trat.trat_remark,"
. " tratp.tratp_type, tratp.tratp_state, tratp.tratp_remark, tratp.tratp_createtime,"
. " tr.tr_signname, tr.tr_hsno,"
. " ad.ad_street, ad.ad_zipcode, ad.ad_city, ad.ad_country"
. " FROM phoenix.tourarticle AS trat, phoenix.tourarticleprocess AS tratp, phoenix.tour AS tr, phoenix.address AS ad"
. " WHERE trat.trat_serialno = '" . $moValue . "' AND"
. " trat.trat_id = tratp.trat_id AND"
. " trat.jb_id = tr.jb_id AND"
. " trat.tr_sort = tr.tr_sort AND"
. " tr.ad_id = ad.ad_id"
. " ORDER BY tratp.tratp_createtime";
$result = $db_conn->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
while ($row = $result->fetch_assoc()):
$tratpOut .= "
\n";
$tratpOut .= " | \n";
$tratpOut .= " " . $eventMsgArray["EVENT_" . $row["tratp_type"]] . "\n";
$tratpOut .= " | \n";
$tratpOut .= " \n";
if ($row["tratp_state"] >= "1") :
$tratpOut .= " " . getLngt("erledigt") . "\n";
else :
$tratpOut .= " " . getLngt("offen") . "\n";
endif;
$tratpOut .= " | \n";
$tratpOut .= " \n";
$tratpOut .= " " . formatOutput($row["tratp_createtime"],$outputFormatField["tratp_createtime"]) . "\n";
$tratpOut .= " | \n";
$tratpOut .= "
\n";
$tratpOut .= " |
\n";
endwhile;
$result->free();
// -------------------------------------
// Get delivery address and data of the end customer
$sqlquery = "SELECT trat.jb_id, trat.tr_sort,"
. " tr.tr_signname, tr.tr_hsno, tr.tr_person,"
. " ad.ad_street, ad.ad_zipcode, ad.ad_city, ad.ad_country"
. " FROM phoenix.tourarticle AS trat, phoenix.tour AS tr, phoenix.address AS ad"
. " WHERE trat.trat_serialno = '" . $moValue . "' AND"
. " trat.jb_id = tr.jb_id AND"
. " trat.tr_sort = tr.tr_sort AND"
. " tr.ad_id = ad.ad_id"
. " ORDER BY trat.jb_id, trat.tr_sort";
$result = $db_conn->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
// The last row is the youngest order with the corresponding station no.
while ($row = $result->fetch_assoc()):
$jbIdOfDelivery = $row["jb_id"];
$trSortOfDelivery = $row["tr_sort"];
$adStreetOfDelivery = $row["ad_street"];
$trHsnoOfDelivery = $row["tr_hsno"];
$adZipcodeOfDelivery = $row["ad_zipcode"];
$adCityOfDelivery = $row["ad_city"];
$adCountryOfDelivery = $row["ad_country"];
$trPersonOfDelivery = $row["tr_person"];
endwhile;
$result->free();
if ($jbIdOfDelivery != "") :
if ($trPersonOfDelivery != "") :
$csEndOut .= $trPersonOfDelivery . "
\n";
endif;
$csEndOut .= $adStreetOfDelivery . " " . $trHsnoOfDelivery . "
\n";
$csEndOut .= $adZipcodeOfDelivery . " " . $adCityOfDelivery . "\n";
endif;
endif;
// *** JOB TRACKING ***
if ($objType == "track_job") :
// Get stations delivered before current requested station requested by end customer
$sqlquery = "SELECT tr.tr_sort, tr.tr_status, tr.tr_finishtime, tr.tr_hsno,"
. " ad.ad_street, ad.ad_zipcode, ad.ad_city, ad.ad_country"
. " FROM phoenix.tour AS tr, phoenix.address AS ad"
. " WHERE tr.jb_id = '" . $objId . "' AND"
. " tr.ad_id = ad.ad_id"
. " ORDER BY tr.tr_sort";
$result = $db_conn->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
while ($row = $result->fetch_assoc()):
$trOut .= "\n";
$trOut .= " \n";
$trOut .= " " . $row["tr_sort"] . ". " . getLngt("Station") . " \n";
$trOut .= $row["ad_street"] . " " . $row["tr_hsno"] . " \n";
$trOut .= $row["ad_zipcode"] . " " . $row["ad_city"] . "\n";
$trOut .= " \n";
$trOut .= " | \n";
$trOut .= " \n";
if ($row["tr_status"] == "1") :
$trOut .= " " . getLngt("erledigt") . "\n";
else :
$trOut .= " " . getLngt("offen") . "\n";
endif;
$trOut .= " | \n";
$trOut .= " \n";
if ($row["tr_status"] == "1") :
$trOut .= " " . formatOutput($row["tr_finishtime"],$outputFormatField["tr_finishtime"]) . "\n";
endif;
$trOut .= " | \n";
$trOut .= "
\n";
$trOut .= " |
\n";
endwhile;
$result->free();
endif;
// ---------------------------------
// Get contractor (seller) data (e.g. Amazon) of the carrier (e.g. Stadtbote) for visualisation for the end customer
// Get process of all events of the tracking ID
$sqlquery = "SELECT cmp.cmp_comp, cmp.cmp_comp2, hq.hq_name, cmp2.cmp_comp AS cmp2_comp,"
. " cmp2.cmp_comp2 AS cmp2_comp2, cmp2.cmp_logo AS cmp2_logo, cmp2.cmp_logo_width AS cmp2_logo_width, cmp2.cmp_logo_height AS cmp2_logo_height"
. " FROM phoenix.job AS jb, phoenix.costcenter AS csc, phoenix.customer AS cs, phoenix.company AS cmp, phoenix.headquarters AS hq, phoenix.company AS cmp2"
. " WHERE jb.jb_id = '" . $objId . "' AND"
. " jb.csc_id_payer = csc.csc_id AND"
. " csc.cs_id = cs.cs_id AND"
. " cs.cmp_id = cmp.cmp_id AND"
. " cs.hq_id = hq.hq_id AND"
. " hq.cmp_id = cmp2.cmp_id";
$result = $db_conn->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
while ($row = $result->fetch_assoc()):
// $cmpOut .= $row["cmp_comp"] . " " . $row["cmp_comp2"] . "
\n";
/*
$cmpOut .= "\n";
$cmpOut .= " \n";
$cmpOut .= " " . $row["cmp_comp"] . " " . $row["cmp_comp2"] . "\n";
$cmpOut .= " | \n";
$cmpOut .= "
\n";
$cmpOut .= " |
\n";
*/
/*
$row["hq_name"] $row["cmp2_logo"] $row["cmp2_logo_width"] $row["cmp2_logo_height"]
$cmp2Out .= "\n";
$cmp2Out .= " \n";
$cmp2Out .= " " . $row["cmp2_comp"] . " " . $row["cmp2_comp2"] . "\n";
$cmp2Out .= " | \n";
$cmp2Out .= "
\n";
$cmp2Out .= " |
\n";
*/
endwhile;
$result->free();
else :
// Write logdata into log database
// writeToLogDB("97",$hqId,"","","","",$objId,"STATUS=OBJTYPE_NOT_FOUND|IP=" . $currentClientIP . "|MO_ID" . $moId);
endif;
else :
// database not specified in metaobject row
// writeToLogDB("97","","","","","","","STATUS=DB_NOT_SPECIFIED|IP=" . $currentClientIP . "|MO_ID" . $moId);
endif;
else :
// HASH nicht gefunden um Zuordnung herzustellen
endif;
endif;
else :
// Write logdata into log database
// writeToLogDB("97","","","","","","","STATUS=EMPTY_OPCODE|IP=" . $currentClientIP . "|MO_ID" . $moId);
endif;
?>