2542 lines
115 KiB
PHP
2542 lines
115 KiB
PHP
<?php
|
||
/*=======================================================================
|
||
*
|
||
* serviceXML.php
|
||
*
|
||
* Autor: Marc Vollmann
|
||
*
|
||
=======================================================================*/
|
||
|
||
|
||
// ******************
|
||
// **** Includes ****
|
||
// ******************
|
||
|
||
include_once ("../include/mcglobal.inc.php");
|
||
// include_once ("../include/auth.inc.php");
|
||
include_once ("../include/inc_parseXML.inc.php");
|
||
include_once ("../include/inc_APP.inc.php");
|
||
include_once ("../include/inc_WEB.inc.php");
|
||
include_once ("../include/inc_SRVC.inc.php");
|
||
// include_once ("../include/email/htmlMimeMail.php");
|
||
|
||
|
||
// Relevant include files to find functions [NOT in array: "inc_article", "html"]
|
||
/*
|
||
$includeArray = array("ftp", "image", "inc_calendar", "inc_customer", "inc_courier", "inc_file", "inc_filters", "inc_group", "inc_job", "inc_parseXML", "inc_services", "inc_pnpoly", "inc_stock", "inc_vehicle", "inc_html2pdf");
|
||
$includeArrayLen = count($includeArray);
|
||
for ($inc = 0; $inc < $includeArrayLen; $inc++) :
|
||
include_once ("../include/" . $includeArray[$inc] . ".inc.php");
|
||
endfor;
|
||
*/
|
||
include_once ("../include/ftp.inc.php");
|
||
include_once ("../include/inc_customer.inc.php");
|
||
include_once ("../include/inc_courier.inc.php");
|
||
include_once ("../include/inc_file.inc.php");
|
||
include_once ("../include/inc_filters.inc.php");
|
||
include_once ("../include/inc_group.inc.php");
|
||
include_once ("../include/inc_job.inc.php");
|
||
include_once ("../include/inc_services.inc.php");
|
||
include_once ("../include/inc_pnpoly.inc.php");
|
||
include_once ("../include/inc_stock.inc.php");
|
||
include_once ("../include/inc_vehicle.inc.php");
|
||
include_once ("../include/inc_html2pdf.inc.php");
|
||
include_once ("../include/image.inc.php");
|
||
include_once ("../include/services_func.inc.php");
|
||
include_once ("../include/inc_calendar.php");
|
||
include_once ("../groupware/calendar.php");
|
||
include_once ("../statistic/statistic_sql.inc.php");
|
||
|
||
|
||
|
||
// *************************
|
||
// **** Initialisations ****
|
||
// *************************
|
||
|
||
// $messageReqRawData = file_get_contents('php://input');
|
||
getSecHttpVars("1", array("data"));
|
||
$messageReq = $data;
|
||
// $messageReq = mcDecode($messageReq);
|
||
$messageReq = str_replace("'", "", $messageReq); // Remove all tics für DB security
|
||
|
||
$currentTime = getDateTime("0");
|
||
$currentClientIP = trim($_SERVER['REMOTE_ADDR']);
|
||
$constMaxLoginTrialsDefault = 5;
|
||
writeToFile("../log/mobile.log", $currentTime . " | " . $currentClientIP);
|
||
// writeToFile("../log/mobile.log", $messageReqRawData);
|
||
writeToFile("../log/mobile.log", $messageReq);
|
||
writeToFile("../log/mobile.log", "-------------------------------------------------------------------------------------------");
|
||
|
||
// *** Parse request ***
|
||
$reqArray = xml2array($messageReq);
|
||
|
||
$serviceContext = convertSpecial($reqArray["adsg_req"]["service_context"]);
|
||
$requestKey = convertSpecial($reqArray["adsg_req"]["req_key"]);
|
||
$functionName = convertSpecial($reqArray["adsg_req"]["id"]);
|
||
$licKey = convertSpecial($reqArray["adsg_req"]["licencekey"]);
|
||
$moId = convertSpecial($reqArray["adsg_req"]["mo_id"]);
|
||
$usrSession = convertSpecial($reqArray["adsg_req"]["session"]);
|
||
$appKey = convertSpecial($reqArray["adsg_req"]["app_key"]);
|
||
$appId = convertSpecial($reqArray["adsg_req"]["app_id"]);
|
||
$usrId = convertSpecial($reqArray["adsg_req"]["usr_id"]);
|
||
$sessionId = convertSpecial($reqArray["adsg_req"]["sessionId"]);
|
||
$passPhrase = convertSpecial($reqArray["adsg_req"]["passPhrase"]);
|
||
$appusrStatus = convertSpecial($reqArray["adsg_req"]["appusr_status"]);
|
||
$cmpComp = convertSpecial($reqArray["adsg_req"]["payload"]["company"]);
|
||
$cmpComp2 = convertSpecial($reqArray["adsg_req"]["payload"]["company2"]);
|
||
$usrName = convertSpecial($reqArray["adsg_req"]["payload"]["usr_name"]);
|
||
$usrFirstname = convertSpecial($reqArray["adsg_req"]["payload"]["usr_firstname"]);
|
||
$usrEmail = convertSpecial($reqArray["adsg_req"]["payload"]["usr_email"]);
|
||
$usrMobile = convertSpecial($reqArray["adsg_req"]["payload"]["usr_mobile"]);
|
||
$usrAccount = convertSpecial($reqArray["adsg_req"]["payload"]["account"]);
|
||
$usrPassword = convertSpecial($reqArray["adsg_req"]["payload"]["password"]);
|
||
$usrPassword2 = convertSpecial($reqArray["adsg_req"]["payload"]["password2"]);
|
||
$cmpId = convertSpecial($reqArray["adsg_req"]["payload"]["cmp_id"]);
|
||
$hqId = convertSpecial($reqArray["adsg_req"]["payload"]["hq_id"]);
|
||
$dateFrom = convertSpecial($reqArray["adsg_req"]["payload"]["date_from"]);
|
||
$dateTo = convertSpecial($reqArray["adsg_req"]["payload"]["date_to"]);
|
||
$adStreet = convertSpecial($reqArray["adsg_req"]["payload"]["ad_street"]);
|
||
$adHsno = convertSpecial($reqArray["adsg_req"]["payload"]["ad_hsno"]);
|
||
$adZipcode = convertSpecial($reqArray["adsg_req"]["payload"]["ad_zipcode"]);
|
||
$adCity = convertSpecial($reqArray["adsg_req"]["payload"]["ad_city"]);
|
||
$adCountry = convertSpecial($reqArray["adsg_req"]["payload"]["ad_country"]);
|
||
$mtfcId = convertSpecial($reqArray["adsg_req"]["payload"]["mtfc_id"]);
|
||
$category = convertSpecial($reqArray["adsg_req"]["payload"]["category"]);
|
||
$objType = convertSpecial($reqArray["adsg_req"]["payload"]["obj_type"]);
|
||
$objId = convertSpecial($reqArray["adsg_req"]["payload"]["obj_id"]);
|
||
$whereClause = convertSpecial($reqArray["adsg_req"]["payload"]["where_clause"]);
|
||
$orderByClause = convertSpecial($reqArray["adsg_req"]["payload"]["orderby_clause"]);
|
||
// ----------------------------------------------------------------------------------------------
|
||
$ttEvent = convertSpecial($reqArray["adsg_req"]["payload"]["tt_event"]);
|
||
$ttTimestamp = convertSpecial($reqArray["adsg_req"]["payload"]["tt_timestamp"]);
|
||
$gpsLong = convertSpecial($reqArray["adsg_req"]["payload"]["gps_long"]);
|
||
$gpsLat = convertSpecial($reqArray["adsg_req"]["payload"]["gps_lat"]);
|
||
// ----------------------------------------------------------------------------------------------
|
||
$selYear = convertSpecial($reqArray["adsg_req"]["payload"]["year"]);
|
||
$selMonth = convertSpecial($reqArray["adsg_req"]["payload"]["month"]);
|
||
$selWeek = convertSpecial($reqArray["adsg_req"]["payload"]["week"]);
|
||
$selDay = convertSpecial($reqArray["adsg_req"]["payload"]["day"]);
|
||
$apId = convertSpecial($reqArray["adsg_req"]["payload"]["ap_id"]);
|
||
$apText = convertSpecial($reqArray["adsg_req"]["payload"]["ap_text"]);
|
||
$execDatetime = convertSpecial($reqArray["adsg_req"]["payload"]["execdatetime"]);
|
||
$endDatetime = convertSpecial($reqArray["adsg_req"]["payload"]["enddatetime"]);
|
||
$csId = convertSpecial($reqArray["adsg_req"]["payload"]["cs_id"]);
|
||
$csEid = convertSpecial($reqArray["adsg_req"]["payload"]["cs_eid"]);
|
||
$cscId = convertSpecial($reqArray["adsg_req"]["payload"]["csc_id"]);
|
||
$crId = convertSpecial($reqArray["adsg_req"]["payload"]["cr_id"]);
|
||
$crEid = convertSpecial($reqArray["adsg_req"]["payload"]["cr_eid"]);
|
||
$crvhId = convertSpecial($reqArray["adsg_req"]["payload"]["crvh_id"]);
|
||
$apCat1 = convertSpecial($reqArray["adsg_req"]["payload"]["ap_cat1"]);
|
||
$apCat2 = convertSpecial($reqArray["adsg_req"]["payload"]["ap_cat2"]);
|
||
$apCat3 = convertSpecial($reqArray["adsg_req"]["payload"]["ap_cat3"]);
|
||
$apCat4 = convertSpecial($reqArray["adsg_req"]["payload"]["ap_cat4"]);
|
||
$viewMode = convertSpecial($reqArray["adsg_req"]["payload"]["view"]);
|
||
$action = convertSpecial($reqArray["adsg_req"]["payload"]["action"]);
|
||
$actionMode = convertSpecial($reqArray["adsg_req"]["payload"]["actionmode"]);
|
||
$usrIdsParticipants = convertSpecial($reqArray["adsg_req"]["payload"]["participants"]);
|
||
$search = convertSpecial($reqArray["adsg_req"]["payload"]["search"]);
|
||
$prefix = convertSpecial($reqArray["adsg_req"]["payload"]["prefix"]);
|
||
$fromDateRange = convertSpecial($reqArray["adsg_req"]["payload"]["fromdaterange"]);
|
||
$toDateRange = convertSpecial($reqArray["adsg_req"]["payload"]["todaterange"]);
|
||
$rpId = convertSpecial($reqArray["adsg_req"]["payload"]["rp_id"]);
|
||
$rpType = convertSpecial($reqArray["adsg_req"]["payload"]["rp_type"]);
|
||
$rpObjType = convertSpecial($reqArray["adsg_req"]["payload"]["rp_obj_type"]);
|
||
$rpObjId = convertSpecial($reqArray["adsg_req"]["payload"]["rp_obj_id"]);
|
||
$rpConfidential = convertSpecial($reqArray["adsg_req"]["payload"]["rp_confidential"]);
|
||
$rpText = convertSpecial($reqArray["adsg_req"]["payload"]["rp_text"]);
|
||
// ----------------------------------------------------------------------------------------------
|
||
$prsId = convertSpecial($reqArray["adsg_req"]["payload"]["prs_id"]);
|
||
$cntrId = convertSpecial($reqArray["adsg_req"]["payload"]["cntr_id"]); // equals $hqId !!!!
|
||
$bcId = convertSpecial($reqArray["adsg_req"]["payload"]["bc_id"]);
|
||
$bcCode = convertSpecial($reqArray["adsg_req"]["payload"]["bc_code"]);
|
||
$bcoPoints = convertSpecial($reqArray["adsg_req"]["payload"]["bco_points"]);
|
||
$bctaId = convertSpecial($reqArray["adsg_req"]["payload"]["bcta_id"]);
|
||
$bctaValue = convertSpecial($reqArray["adsg_req"]["payload"]["bcta_value"]);
|
||
$bctaPoints = convertSpecial($reqArray["adsg_req"]["payload"]["bcta_points"]);
|
||
$bctaRemark = convertSpecial($reqArray["adsg_req"]["payload"]["bcta_remark"]);
|
||
$shpId = convertSpecial($reqArray["adsg_req"]["payload"]["shp_id"]);
|
||
$shpName = convertSpecial($reqArray["adsg_req"]["payload"]["shp_name"]);
|
||
$shpBcActive = convertSpecial($reqArray["adsg_req"]["payload"]["shp_bc_active"]);
|
||
$shpBcFactor = convertSpecial($reqArray["adsg_req"]["payload"]["shp_bc_factor"]);
|
||
$shpBcTaLimit = convertSpecial($reqArray["adsg_req"]["payload"]["shp_bc_ta_limit"]);
|
||
$cpnId = convertSpecial($reqArray["adsg_req"]["payload"]["cpn_id"]);
|
||
$cpnCode = convertSpecial($reqArray["adsg_req"]["payload"]["cpn_code"]);
|
||
$gcpn_id = convertSpecial($reqArray["adsg_req"]["payload"]["gcpn_id"]);
|
||
$gcpnCode = convertSpecial($reqArray["adsg_req"]["payload"]["gcpn_code"]);
|
||
$gcpnRecipient = convertSpecial($reqArray["adsg_req"]["payload"]["gcpn_recipient"]);
|
||
$gcpnValue = convertSpecial($reqArray["adsg_req"]["payload"]["gcpn_value"]);
|
||
$gcpnImageName = convertSpecial($reqArray["adsg_req"]["payload"]["gcpn_image_name"]);
|
||
$gcpnValid = convertSpecial($reqArray["adsg_req"]["payload"]["gcpn_valid"]);
|
||
$gcpnFreetext = convertSpecial($reqArray["adsg_req"]["payload"]["gcpn_freetext"]);
|
||
$gcpnPaymentCode = convertSpecial($reqArray["adsg_req"]["payload"]["gcpn_payment_code"]);
|
||
// ----------------------------------------------------------------------------------------------
|
||
|
||
|
||
|
||
// Check for requested prefix search
|
||
$prefix = "%";
|
||
if ($prefix == "1" || trim(strtolower($prefix)) == "yes") :
|
||
$prefix = "";
|
||
endif;
|
||
|
||
|
||
// if ($serviceContext == "metafield") :
|
||
// Check setting according to the headquarters dependency
|
||
/*
|
||
$gHqId = false;
|
||
$constFormSingleHQ = getParameterValue("0", "SYSTEM_FORM_SINGLE_HQ", "0");
|
||
if ($constFormSingleHQ == "" || $constFormSingleHQ == "0") :
|
||
$gHqId = true;
|
||
endif;
|
||
*/
|
||
$gHqId = true;
|
||
$constFormSingleHQ = getParameterValue("0", "SYSTEM_FORM_SINGLE_HQ_" . $category, "0");
|
||
if ($constFormSingleHQ != "" && $constFormSingleHQ != "0") :
|
||
$gHqId = false;
|
||
else :
|
||
$constFormSingleHQ = getParameterValue("0", "SYSTEM_FORM_SINGLE_HQ", "0");
|
||
if ($constFormSingleHQ != "" && $constFormSingleHQ != "0") :
|
||
$gHqId = false;
|
||
endif;
|
||
endif;
|
||
// endif;
|
||
|
||
|
||
// if ($serviceContext == "groupware") :
|
||
// Headquarters filter
|
||
if ($f_hq_id == "") : $f_hq_id = array(); endif;
|
||
if (count($f_hq_id) == 0 && $hqId != "" && is_numeric($hqId)) : array_push($f_hq_id, $hqId); endif;
|
||
|
||
if ($selYear == "") : $selYear = date("Y"); endif;
|
||
if ($selMonth == "") : $selMonth = date("m"); endif;
|
||
if ($selWeek == "") : $selWeek = date("W"); endif;
|
||
if ($selDay == "") : $selDay = date("d"); endif;
|
||
|
||
// Check ranges of time. All fields have to be set
|
||
if ($f_hour == "" || $f_minute == "" || $f_hour_to == "" || $f_minute_to == "") :
|
||
$f_hour = "00";
|
||
$f_minute = "00";
|
||
$f_hour_to = "23";
|
||
$f_minute_to = "59";
|
||
endif;
|
||
$f_hour = pad($f_hour,2);
|
||
$f_minute = pad($f_minute,2);
|
||
$f_hour_to = pad($f_hour_to,2);
|
||
$f_minute_to = pad($f_minute_to,2);
|
||
|
||
// Time range
|
||
if ($fromTimeRange == "" && $f_hour != "" && $f_minute != "") :
|
||
$fromTimeRange = " " . $f_hour . ":" . $f_minute . ":00";
|
||
endif;
|
||
if ($toTimeRange == "" && $f_hour != "" && $f_minute != "") :
|
||
$toTimeRange = " " . $f_hour . ":" . $f_minute . ":59";
|
||
endif;
|
||
|
||
// Date range
|
||
if ($fromDateRange == "" && $f_year != "" && $f_month != "" && $f_day != "") :
|
||
$fromDateRange = $f_year . "-" . pad($f_month,2) . "-" . pad($f_day,2) . $fromTimeRange;
|
||
endif;
|
||
if ($toDateRange == "" && $f_year_to != "" && $f_month_to != "" && $f_day_to != "") :
|
||
$toDateRange = $f_year_to . "-" . pad($f_month_to,2) . "-" . pad($f_day_to,2) . $toTimeRange;
|
||
endif;
|
||
// endif;
|
||
|
||
|
||
// if ($serviceContext == "customer" || $serviceContext == "groupware") :
|
||
if ($csEid != "" && $csId == "") :
|
||
$csId = getFieldValueFromId("customer", "cs_eid", $csEid, "cs_id");
|
||
endif;
|
||
if ($csEid == "" && $csId != "") :
|
||
$csEid = getFieldValueFromId("customer", "cs_id", $csId, "cs_eid");
|
||
endif;
|
||
// endif;
|
||
|
||
// if ($serviceContext == "courier" || $serviceContext == "groupware") :
|
||
if ($crEid != "" && $crId == "") :
|
||
$crId = getFieldValueFromId("courier", "cr_eid", $crEid, "cr_id");
|
||
endif;
|
||
if ($crEid == "" && $crId != "") :
|
||
$crEid = getFieldValueFromId("courier", "cr_id", $crId, "cr_eid");
|
||
endif;
|
||
// endif;
|
||
|
||
|
||
// *************
|
||
// * GROUPWARE *
|
||
// *************
|
||
if ($serviceContext == "groupware") :
|
||
|
||
// Conversion
|
||
$execDatetime = substr($execDatetime, 0, 4) . "-" . substr($execDatetime, 4, 2) . "-" . substr($execDatetime, 6, 2) . " " . substr($execDatetime, 8, 2) . ":" . substr($execDatetime, 10, 2) . ":" . substr($execDatetime, 12, 2);
|
||
$endDatetime = substr($endDatetime, 0, 4) . "-" . substr($endDatetime, 4, 2) . "-" . substr($endDatetime, 6, 2) . " " . substr($endDatetime, 8, 2) . ":" . substr($endDatetime, 10, 2) . ":" . substr($endDatetime, 12, 2);
|
||
|
||
if (!isset($hqId) || $hqId == "") : $hqId = ""; endif; // Empty for default
|
||
$f_selUsrId = "0"; // No user selected
|
||
if ($usrId != "") :
|
||
$f_selUsrId = $usrId;
|
||
endif;
|
||
if (!isset($rpObjType) || $rpObjType == "") : $rpObjType = "cs"; endif; // "cs" default (for test)
|
||
|
||
// Mode for output if requested
|
||
if ($viewMode == "") : $viewMode = "1"; endif;
|
||
|
||
// Report
|
||
if ($rpObjType == "cs") :
|
||
// Customer of the report
|
||
if ($csEid != "" && $rpObjId == "") :
|
||
$rpObjId = getFieldValueFromId("customer", "cs_eid", $csEid, "cs_id");
|
||
endif;
|
||
if ($csEid == "" && $rpObjId != "") :
|
||
$csEid = getFieldValueFromId("customer", "cs_id", $rpObjId, "cs_eid");
|
||
endif;
|
||
elseif ($rpObjType == "cr") :
|
||
// Customer of the report
|
||
if ($crEid != "" && $rpObjId == "") :
|
||
$rpObjId = getFieldValueFromId("courier", "cr_eid", $crEid, "cr_id");
|
||
endif;
|
||
if ($crEid == "" && $rpObjId != "") :
|
||
$crEid = getFieldValueFromId("courier", "cr_id", $rpObjId, "cr_eid");
|
||
endif;
|
||
endif;
|
||
|
||
// Appointment categories
|
||
if ($apCat1 == "") : $apCat1 = "1"; endif; // State: Business (default), private
|
||
if ($apCat2 == "") : $apCat2 = "1"; endif; // Visibility: Participants, only author, everybody
|
||
if ($apCat3 == "") : $apCat3 = "1"; endif; // Kind: Misc., Meeting, reminder, ...
|
||
if ($apCat4 == "") : $apCat4 = "0"; endif; // Deadline monitoring on/off
|
||
|
||
// Participants
|
||
/*
|
||
$usrIdsParticipants = array();
|
||
if ($usrIdsParticipantsString != "") :
|
||
$usrIdsParticipants = spliti(",", $usrIdsParticipantsString);
|
||
endif;
|
||
*/
|
||
endif;
|
||
|
||
|
||
// Decode
|
||
$search = mcDecode($search);
|
||
$usrName = mcDecode($usrName);
|
||
$usrPassword = mcDecode($usrPassword);
|
||
$usrPassword2 = mcDecode($usrPassword2);
|
||
$appKey = mcDecode($appKey);
|
||
|
||
if ($objType != "" && $objId != "" && is_numeric($objId)) :
|
||
// Do nothing, it´s ok, function can be called!
|
||
elseif ($usrId != "" && is_numeric($usrId)) :
|
||
$objType = "usr";
|
||
$objId = $usrId;
|
||
elseif ($cmpId != "" && is_numeric($cmpId)) :
|
||
$objType = "cmp";
|
||
$objId = $cmpId;
|
||
else :
|
||
$objType = "";
|
||
$objId = "";
|
||
endif;
|
||
|
||
if ($whereClause != "") :
|
||
if (substr($whereClause,0,6) != "WHERE ") :
|
||
$whereClause = ""; // If empty avoid execution of function with where clause
|
||
else :
|
||
$whereClause = substr($whereClause,5); // Remove prefix "WHERE"
|
||
endif;
|
||
endif;
|
||
|
||
|
||
/*
|
||
$functionName = "appRegister";
|
||
$appKey = "AAAAAAAAAA";
|
||
$appId = "1";
|
||
*/
|
||
/*
|
||
$functionName = "login";
|
||
$moId = "6";
|
||
// $usrIdAuth = "18086";
|
||
$usrId = "18086";
|
||
$appKey = "AAAAAAAAAA";
|
||
$appId = "1";
|
||
*/
|
||
|
||
/*
|
||
$functionName = "setTimekeepingEvent";
|
||
$usrSession = "495f2fdc997fe9da827107e64218434d";
|
||
$moId = "6";
|
||
// $usrIdAuth = "18086";
|
||
$usrId = "18086";
|
||
$ttEvent = "1";
|
||
$ttTimestamp = "2014-01-01 10:00:00";
|
||
$gpsLong = "53.000001";
|
||
$gpsLat = "9.000001";
|
||
*/
|
||
|
||
|
||
// ------------------------------------------------------------------------------------------------------
|
||
|
||
|
||
// ********************
|
||
// **** XML Output ****
|
||
// ********************
|
||
|
||
$retVal = "";
|
||
$xmlOut = "";
|
||
$xmlNoErrOut .= "<err_no>0</err_no>\n<err_desc>OK</err_desc>\n";
|
||
$xmlErrOut .= "<err_no>100</err_no>\n<err_desc>Request denied.</err_desc>\n";
|
||
$xmlDosErrOut .= "<err_no>999</err_no>\n<err_desc>No sir!</err_desc>\n";
|
||
|
||
$accessBySeesionIdAndPassphrase = false;
|
||
if (checkRequestAuthenticationData2($sessionId, $passPhrase)) :
|
||
$accessBySeesionIdAndPassphrase = true;
|
||
endif;
|
||
|
||
if ($accessBySeesionIdAndPassphrase || $functionName == "appRegister" || $functionName == "webRegister" || $functionName == "login" || $functionName == "insertUser" || checkAccess($usrSession, $moId, $usrId)) :
|
||
// if ($functionName == "appRegister" || $functionName == "webRegister" || $functionName == "login" || $functionName == "insertUser" || (checkAccess($usrSession, $moId, $usrId) && accessRightsUser($moId, $usrId, $appKey, $appId))) :
|
||
|
||
if ($transactionHandle != "") :
|
||
// $xmlOut .= "<transaction_no>" . $transaction_no . "</transaction_no>\n";
|
||
endif;
|
||
|
||
$xmlOut .= "<data>\n";
|
||
|
||
if ($functionName != "") :
|
||
if (function_exists($functionName)) :
|
||
|
||
// Get requested operational database instance via metaobject for each called service functions
|
||
// global $dbname, $dblogin, $dbpassword;
|
||
$db_op_conn = "";
|
||
if ($moId != "") :
|
||
$moValue = getOperationalDatabase($moId);
|
||
if ($moValue != "") :
|
||
$db_op_conn = getDbConnectionSpecial($moValue, $dbname, $dblogin, $dbpassword);
|
||
if ($db_op_conn != "" && is_object($db_op_conn)) : $db = $db_op_conn; endif;
|
||
endif;
|
||
endif;
|
||
|
||
if (true || ($db != "" && is_object($db))) :
|
||
|
||
if ($functionName == "appRegister") :
|
||
|
||
// Check access trials
|
||
$constMaxLoginTrials = getParameterValue("0", "MAXIMUM_LOGIN_TRIALS", "0", "0");
|
||
if ($constMaxLoginTrials == "") : $constMaxLoginTrials = $constMaxLoginTrialsDefault; endif;
|
||
$loginTrials = checkClientLoginTrials();
|
||
if ($loginTrials <= $constMaxLoginTrials) :
|
||
$retVal = call_user_func_array($functionName, array($appKey, $appId)); // Register APP and get mo_id, usr_id and hq_id for response
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
updateClientLoginTrials(); // Login-trial failed! Update table "ipsecurity"
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
$xmlOut .= "<mo_id>" . $retVal[2] . "</mo_id>\n";
|
||
$xmlOut .= "<usr_id>" . $retVal[1] . "</usr_id>\n";
|
||
endif;
|
||
else :
|
||
$xmlOut .= $xmlDosErrOut;
|
||
endif;
|
||
|
||
elseif ($functionName == "webRegister") :
|
||
$retVal = call_user_func_array($functionName, array($cmpComp, $usrName, $usrFirstname, $usrEmail, $usrMobile, $usrAccount, $usrPassword)); // Register WEB, generate mandator
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
$xmlOut .= "<mo_id>" . $retVal[2] . "</mo_id>\n";
|
||
$xmlOut .= "<usr_id>" . $retVal[1] . "</usr_id>\n";
|
||
endif;
|
||
|
||
elseif ($functionName == "login") :
|
||
$retVal = call_user_func_array($functionName, array($moId, $usrId, $appKey, $appId)); // Check requested user and APP data
|
||
|
||
// Check access trials
|
||
$constMaxLoginTrials = getParameterValue("0", "MAXIMUM_LOGIN_TRIALS", "0", "0");
|
||
if ($constMaxLoginTrials == "") : $constMaxLoginTrials = $constMaxLoginTrialsDefault; endif;
|
||
$loginTrials = checkClientLoginTrials();
|
||
if ($loginTrials <= $constMaxLoginTrials) :
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
updateClientLoginTrials(); // Login-trial failed! Update table "ipsecurity"
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
$xmlOut .= "<session>" . $retVal[4] . "</session>\n";
|
||
$xmlOut .= "<mo_id>" . $retVal[3] . "</mo_id>\n";
|
||
$xmlOut .= "<hq_id>" . $retVal[2] . "</hq_id>\n";
|
||
$xmlOut .= "<hq_name><![CDATA[" . mcEncode($retVal[7]) . "]]></hq_name>\n";
|
||
$xmlOut .= "<hqmnemonic>" . $retVal[8] . "</hqmnemonic>\n";
|
||
$xmlOut .= "<usr_id>" . $retVal[1] . "</usr_id>\n";
|
||
$xmlOut .= "<usr_name><![CDATA[" . mcEncode($retVal[5]) . "]]></usr_name>\n";
|
||
$xmlOut .= "<usr_firstname><![CDATA[" . mcEncode($retVal[6]) . "]]></usr_firstname>\n";
|
||
endif;
|
||
else :
|
||
$xmlOut .= $xmlDosErrOut;
|
||
endif;
|
||
|
||
elseif ($functionName == "insertUser") :
|
||
$retVal = call_user_func_array($functionName, array($appId, $moId, $usrEmail, $usrMobile, $appusrStatus, $usrAccount, $usrPassword, $usrPassword2, $usrName, $usrFirstname, $adStreet, $adHsno, $adZipcode, $adCity, $adCountry, $cmpComp, $cmpComp2, $hqName, $hqMnemonic));
|
||
|
||
// Check access trials
|
||
$constMaxLoginTrials = getParameterValue("0", "MAXIMUM_LOGIN_TRIALS", "0", "0");
|
||
if ($constMaxLoginTrials == "") : $constMaxLoginTrials = $constMaxLoginTrialsDefault; endif;
|
||
$loginTrials = checkClientLoginTrials();
|
||
if ($loginTrials <= $constMaxLoginTrials) :
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
updateClientLoginTrials(); // Login-trial failed! Update table "ipsecurity"
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
$xmlOut .= "<mo_id>" . $retVal[2] . "</mo_id>\n";
|
||
$xmlOut .= "<usr_id>" . $retVal[1] . "</usr_id>\n";
|
||
$xmlOut .= "<app_key><![CDATA[" . mcEncode($retVal[3]) . "]]></app_key>\n";
|
||
$xmlOut .= "<appusr_status>" . $retVal[4] . "</appusr_status>\n";
|
||
endif;
|
||
else :
|
||
$xmlOut .= $xmlDosErrOut;
|
||
endif;
|
||
|
||
elseif ($functionName == "getUser") :
|
||
$retVal = call_user_func_array($functionName, array($appId, $moId, $usrId));
|
||
|
||
// Check access trials
|
||
$constMaxLoginTrials = getParameterValue("0", "MAXIMUM_LOGIN_TRIALS", "0", "0");
|
||
// if ($constMaxLoginTrials == "") : $constMaxLoginTrials = $constMaxLoginTrialsDefault; endif;
|
||
// $loginTrials = checkClientLoginTrials();
|
||
// if ($loginTrials <= $constMaxLoginTrials) :
|
||
$retVal = call_user_func_array($functionName, array($appKey, $appId)); // Register APP and get mo_id, usr_id and hq_id for response
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
updateClientLoginTrials(); // Login-trial failed! Update table "ipsecurity"
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
$xmlOut .= "<mo_id>" . $retVal[2] . "</mo_id>\n";
|
||
$xmlOut .= "<usr_id>" . $retVal[1] . "</usr_id>\n";
|
||
$xmlOut .= "<app_key><![CDATA[" . mcEncode($retVal[3]) . "]]></app_key>\n";
|
||
$xmlOut .= "<appusr_status>" . $retVal[4] . "</appusr_status>\n";
|
||
endif;
|
||
// else :
|
||
// $xmlOut .= $xmlDosErrOut;
|
||
// endif;
|
||
|
||
|
||
// *****************
|
||
// * TIME TRACKING *
|
||
// *****************
|
||
|
||
elseif ($functionName == "setTimekeepingEvent" || $functionName == "setTimetrackingEvent") :
|
||
$retVal = call_user_func_array($functionName, array($moId, $usrId, $ttEvent, $ttTimestamp, $gpsLong, $gpsLat, "", $cscId)); // Set timetracking event
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
|
||
// $xmlOut .= "<session>" . $retVal[4] . "</session>\n";
|
||
endif;
|
||
|
||
elseif ($functionName == "getLastTimetrackingEvent") :
|
||
$retVal = call_user_func_array($functionName, array($moId, $usrId)); // Get last timetracking event
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
$xmlOut .= "<tt_datetime>" . $retVal[1] . "</tt_datetime>\n";
|
||
$xmlOut .= "<tt_event>" . $retVal[2] . "</tt_event>\n";
|
||
$xmlOut .= "<csc_id>" . $retVal[5] . "</csc_id>\n";
|
||
$xmlOut .= "<gps_long>" . $retVal[3] . "</gps_long>\n";
|
||
$xmlOut .= "<gps_lat>" . $retVal[4] . "</gps_lat>\n";
|
||
$xmlOut .= "<description><![CDATA[" . mcEncode($retVal[5]) . "]]></description>\n";
|
||
endif;
|
||
|
||
|
||
// *************
|
||
// * GROUPWARE *
|
||
// *************
|
||
|
||
elseif ($functionName == "getApEnvironment") :
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
|
||
// Appointment categories
|
||
for ($j = 1; $j <= 4; $j++) :
|
||
$tmpApCatArray = getColVectorFromDB2ArrayByClause("metatype", "mt_value", "mt_type = 'appointment_category_" . $j . "'", "mt_sort", "mt_sort");
|
||
$tmpKeysArray = array_keys($tmpApCatArray);
|
||
$tmpKeysArrayLen = count($tmpKeysArray);
|
||
$xmlOut .= "<apcat" . $j . "_list>\n";
|
||
for ($i = 0; $i < $tmpKeysArrayLen; $i++) :
|
||
$xmlOut .= "<apcat" . $j . " id=\"" . $tmpKeysArray[$i] . "\">\n";
|
||
$xmlOut .= " <name><![CDATA[" . mcEncode($tmpApCatArray[$tmpKeysArray[$i]]) . "]]></name>\n";
|
||
$xmlOut .= "</apcat" . $j . ">\n";
|
||
endfor;
|
||
$xmlOut .= "</apcat" . $j . "_list>\n";
|
||
endfor;
|
||
|
||
// Participants
|
||
if ($hqId != "") :
|
||
$sqlquery = "SELECT usr_id, usr_firstname, usr_name FROM user WHERE usr_type = '1' AND hq_id = '" . $hqId . "'";
|
||
$result = $db->query($sqlquery);
|
||
if (DB::isError($result)) die ("$PHP_SELF: [$sqlquery]" . $result->getMessage());
|
||
$xmlOut .= "<possible_participants_list>\n";
|
||
while ($row = $result->fetch_assoc()):
|
||
$xmlOut .= "<possible_participant id=\"" . $row["usr_id"] . "\">\n";
|
||
$xmlOut .= " <usr_firstname><![CDATA[" . mcEncode($row["usr_firstname"]) . "]]></usr_firstname>\n";
|
||
$xmlOut .= " <usr_name><![CDATA[" . mcEncode($row["usr_name"]) . "]]></usr_name>\n";
|
||
$xmlOut .= "</possible_participant>\n";
|
||
endwhile;
|
||
$result->free();
|
||
$xmlOut .= "</possible_participants_list>\n";
|
||
endif;
|
||
|
||
// Report types
|
||
$tmpApCatArray = getColVectorFromDB2ArrayByClause("metatype", "mt_value", "mt_type = 'report_type'", "mt_sort", "mt_sort");
|
||
$tmpKeysArray = array_keys($tmpApCatArray);
|
||
$tmpKeysArrayLen = count($tmpKeysArray);
|
||
$xmlOut .= "<reporttype_list>\n";
|
||
for ($i = 0; $i < $tmpKeysArrayLen; $i++) :
|
||
$xmlOut .= "<reporttype id=\"" . $tmpKeysArray[$i] . "\">\n";
|
||
$xmlOut .= " <name><![CDATA[" . mcEncode($tmpApCatArray[$tmpKeysArray[$i]]) . "]]></name>\n";
|
||
$xmlOut .= "</reporttype>\n";
|
||
endfor;
|
||
$xmlOut .= "</reporttype_list>\n";
|
||
endif;
|
||
|
||
elseif ($functionName == "calLastWeekNumofYear") :
|
||
$retVal = call_user_func_array($functionName, array($selYear)); // Gets the last calendar week (number) of a specified year
|
||
$xmlOut .= " <val><![CDATA[" . mcEncode($retVal) . "]]></val>\n";
|
||
elseif ($functionName == "calFirstWeekNumofMonth") :
|
||
$retVal = call_user_func_array($functionName, array($selMonth, $selYear)); // Gets the first calendar week (number) of a specified month and year (calendar week of the 01.01.YYYY)
|
||
$xmlOut .= " <val><![CDATA[" . mcEncode($retVal) . "]]></val>\n";
|
||
elseif ($functionName == "calFirstDayNumOfMonth") :
|
||
$retVal = call_user_func_array($functionName, array($selMonth, $selYear)); // Gets the first day (number) of a specified month and year
|
||
$xmlOut .= " <val><![CDATA[" . mcEncode($retVal) . "]]></val>\n";
|
||
elseif ($functionName == "calFirstDayNumOfFirstCalendarWeekOfYear") :
|
||
$retVal = call_user_func_array($functionName, array($selYear)); // Gets the first day (number) of the first calendar week of a specified year, it has to be a "Monday"
|
||
$xmlOut .= " <val><![CDATA[" . mcEncode($retVal) . "]]></val>\n";
|
||
elseif ($functionName == "calFirstDayNumOfWeek") :
|
||
$retVal = call_user_func_array($functionName, array($selWeek, $selYear)); // Gets the first day (number) of a specified calendar week and year
|
||
$xmlOut .= " <val><![CDATA[" . mcEncode($retVal) . "]]></val>\n";
|
||
elseif ($functionName == "getDaysWithAppointments") :
|
||
$retVal = call_user_func_array($functionName, array($selYear, $selMonth)); // Gets an array with days of a specified month (and year), where there is at least one appointment per day
|
||
$xmlOut .= " <val><![CDATA[" . mcEncode($retVal) . "]]></val>\n";
|
||
elseif ($functionName == "modifyIntervalAppointments2SingleDayAppointments") :
|
||
$retVal = call_user_func_array($functionName, array($apArray, $lowerRangeDate, $upperRangeDate)); // Modifies array according to the appointments starting and ending on different days
|
||
$xmlOut .= " <val><![CDATA[" . mcEncode($retVal) . "]]></val>\n";
|
||
elseif ($functionName == "getAppointmentsOfOneDay" || $functionName == "getAppointmentsOfOneWeek" || $functionName == "getAppointmentsOfOneMonth" || $functionName == "getAppointmentsOfOneYear") :
|
||
|
||
if ($functionName == "getAppointmentsOfOneDay") :
|
||
$retVal = call_user_func_array($functionName, array($selYear, $selMonth, $selDay, $csId)); // Gets the appointments of one day
|
||
elseif ($functionName == "getAppointmentsOfOneWeek") :
|
||
$retVal = call_user_func_array($functionName, array($selWeek, $selYear, $selMonth, $selDay, $csId)); // Gets the appointments of one week
|
||
elseif ($functionName == "getAppointmentsOfOneMonth") :
|
||
$retVal = call_user_func_array($functionName, array($selYear, $selMonth, $csId)); // Gets the appointments of one month
|
||
elseif ($functionName == "getAppointmentsOfOneYear") :
|
||
$retVal = call_user_func_array($functionName, array($selYear, $csId)); // Gets the appointments of one year
|
||
endif;
|
||
$retValLen = count($retVal);
|
||
if ($retValLen > 0) :
|
||
$xmlOut .= "<appointment_list id=\"APL\">\n";
|
||
$xmlOut .= "<yeardata>\n";
|
||
|
||
$tmpRemYear = ""; $tmpRemMonth = ""; $tmpRemDay = "";
|
||
$tmpApNewYearBool = false; $tmpApNewMonthBool = false; $tmpApNewDayBool = false;
|
||
|
||
for ($i = 0; $i < $retValLen; $i++) :
|
||
$tmpApYear = substr($retVal[$i][2],0,4);
|
||
$tmpApMonth = substr($retVal[$i][2],5,2);
|
||
$tmpApDay = substr($retVal[$i][2],8,2);
|
||
|
||
// Closing TAGs
|
||
if ($tmpRemDay != "" && $tmpRemDay != $tmpApDay) :
|
||
$xmlOut .= "</appointments>\n";
|
||
$xmlOut .= "</daydata>\n";
|
||
endif;
|
||
if ($tmpRemMonth != "" && $tmpRemMonth != $tmpApMonth) :
|
||
$xmlOut .= "</days>\n";
|
||
$xmlOut .= "</monthdata>\n";
|
||
endif;
|
||
// if ($tmpRemYear != "" && $tmpRemYear != $tmpApYear) :
|
||
// ...
|
||
// endif;
|
||
|
||
// Opening TAGs
|
||
if ($tmpRemYear == "" || $tmpRemYear != $tmpApYear) :
|
||
$tmpRemYear = $tmpApYear;
|
||
$xmlOut .= "<year>" . $tmpApYear . "</year>\n";
|
||
endif;
|
||
if ($tmpRemMonth == "" || $tmpRemMonth != $tmpApMonth) :
|
||
$tmpRemMonth = $tmpApMonth;
|
||
$tmpApNewMonthBool = true;
|
||
$xmlOut .= "<monthdata>\n";
|
||
$xmlOut .= "<month>" . $tmpApMonth . "</month>\n";
|
||
$xmlOut .= "<days>\n";
|
||
endif;
|
||
if ($tmpRemDay == "" || $tmpRemDay != $tmpApDay) :
|
||
$tmpRemDay = $tmpApDay;
|
||
$tmpApNewDayBool = true;
|
||
$xmlOut .= "<daydata>\n";
|
||
$xmlOut .= "<day>" . $tmpApDay . "</day>\n";
|
||
$xmlOut .= "<appointments>\n";
|
||
endif;
|
||
|
||
// $xmlOut .= "<appointment id=\"" . $retVal[$i][0] . "\">\n";
|
||
$xmlOut .= "<appointment>\n";
|
||
$xmlOut .= "<ap_id>" . $retVal[$i][0] . "</ap_id>\n";
|
||
$xmlOut .= "<ap_text><![CDATA[" . mcEncode($retVal[$i][1]) . "]]></ap_text>\n";
|
||
$xmlOut .= "<ap_execdate>" . $retVal[$i][2] . "</ap_execdate>\n";
|
||
$xmlOut .= "<cmp_id>" . $retVal[$i][3] . "</cmp_id>\n";
|
||
$xmlOut .= "<cmp_comp><![CDATA[" . mcEncode($retVal[$i][4]) . "]]></cmp_comp>\n";
|
||
$xmlOut .= "<cmp_comp2><![CDATA[" . mcEncode($retVal[$i][5]) . "]]></cmp_comp2>\n";
|
||
$xmlOut .= "<cs_eid>" . $retVal[$i][7] . "</cs_eid>\n";
|
||
$xmlOut .= "<ap_enddate>" . $retVal[$i][8] . "</ap_enddate>\n";
|
||
$xmlOut .= "<usr_id>" . $retVal[$i][9] . "</usr_id>\n";
|
||
$xmlOut .= "<usr_firstname><![CDATA[" . mcEncode($retVal[$i][10]) . "]]></usr_firstname>\n";
|
||
$xmlOut .= "<usr_name><![CDATA[" . mcEncode($retVal[$i][11]) . "]]></usr_name>\n";
|
||
if (false) :
|
||
$xmlOut .= "<ap_participants>" . $retVal[$i][12] . "</ap_participants>\n";
|
||
else :
|
||
$tmpParticipantsIDs = $retVal[$i][12];
|
||
// Remove commas at the beginning and at the end if do exist
|
||
if (substr($tmpParticipantsIDs, 0, 1) == ",") : $tmpParticipantsIDs = substr($tmpParticipantsIDs, 1); endif;
|
||
if (substr($tmpParticipantsIDs, -1) == ",") : $tmpParticipantsIDs = substr($tmpParticipantsIDs, 0, strlen($tmpParticipantsIDs)-1); endif;
|
||
$xmlOut .= "<ap_participants>\n";
|
||
if ($tmpParticipantsIDs != "") :
|
||
$tmpParticipantsArray = spliti(",", $tmpParticipantsIDs);
|
||
$tmpParticipantsArrayLen = count($tmpParticipantsArray);
|
||
for ($j = 0; $j < $tmpParticipantsArrayLen; $j++) :
|
||
$usrRealName = getFieldValueFromId("user", "usr_id", $tmpParticipantsArray[$j], "usr_name");
|
||
$usrRealFirstname = getFieldValueFromId("user", "usr_id", $tmpParticipantsArray[$j], "usr_firstname");
|
||
$xmlOut .= "<ap_participant id=\"" . $tmpParticipantsArray[$j] . "\">\n";
|
||
$xmlOut .= " <name><![CDATA[" . mcEncode($usrRealName) . "]]></name>\n";
|
||
$xmlOut .= " <firstname><![CDATA[" . mcEncode($usrRealFirstname) . "]]></firstname>\n";
|
||
$xmlOut .= "</ap_participant>\n";
|
||
endfor;
|
||
endif;
|
||
$xmlOut .= "</ap_participants>\n";
|
||
endif;
|
||
$xmlOut .= "<ap_confirmed>" . $retVal[$i][13] . "</ap_confirmed>\n";
|
||
$xmlOut .= "<cs_usr_name><![CDATA[" . mcEncode($retVal[$i][14]) . "]]></cs_usr_name>\n";
|
||
$xmlOut .= "<cs_usr_firstname><![CDATA[" . mcEncode($retVal[$i][15]) . "]]></cs_usr_firstname>\n";
|
||
$xmlOut .= "<cs_usr_phone>" . $retVal[$i][16] . "</cs_usr_phone>\n";
|
||
$xmlOut .= "<cs_usr_phone2>" . $retVal[$i][17] . "</cs_usr_phone2>\n";
|
||
$xmlOut .= "<ap_category_1>" . $retVal[$i][18] . "</ap_category_1>\n";
|
||
$xmlOut .= "<ap_category_2>" . $retVal[$i][19] . "</ap_category_2>\n";
|
||
$xmlOut .= "<ap_category_3>" . $retVal[$i][20] . "</ap_category_3>\n";
|
||
$xmlOut .= "<ap_category_4>" . $retVal[$i][21] . "</ap_category_4>\n";
|
||
$xmlOut .= "</appointment>\n";
|
||
endfor;
|
||
|
||
// Final closing TAGs
|
||
if ($tmpApNewDayBool) :
|
||
$xmlOut .= "</appointments>\n";
|
||
$xmlOut .= "</daydata>\n";
|
||
endif;
|
||
if ($tmpApNewMonthBool) :
|
||
$xmlOut .= "</days>\n";
|
||
$xmlOut .= "</monthdata>\n";
|
||
endif;
|
||
|
||
$xmlOut .= "</yeardata>\n";
|
||
$xmlOut .= "</appointment_list>\n";
|
||
endif;
|
||
|
||
elseif ($functionName == "getAppointmentHeader") :
|
||
$retVal = call_user_func_array($functionName, array($viewMode, $selYear, $selMonth, $selDay, $selWeek)); // Gets the headline with the current day
|
||
$xmlOut .= $xmlErrOut;
|
||
|
||
elseif ($functionName == "getAppointmentTitle") :
|
||
$retVal = call_user_func_array($functionName, array($viewMode)); // Gets the title of the output table
|
||
$xmlOut .= $xmlErrOut;
|
||
|
||
elseif ($functionName == "actionAppointment") :
|
||
$retVal = call_user_func_array($functionName, array($action, $apId, $apText, $execDatetime, $endDatetime, $hqId, $usrId, $csId, $usrIdsParticipants, $apCat1, $apCat2, $apCat3, $apCat4)); // DB actions for an appointment
|
||
$xmlOut .= "<appointments>\n";
|
||
$xmlOut .= "<appointment>\n";
|
||
$xmlOut .= "<action>" . $action . "</action>\n";
|
||
$xmlOut .= "<ap_id>" . $retVal . "</ap_id>\n";
|
||
$xmlOut .= "</appointment>\n";
|
||
$xmlOut .= "</appointments>\n";
|
||
|
||
|
||
// ******************
|
||
// * METAFIELD DATA *
|
||
// ******************
|
||
|
||
elseif ($functionName == "getContactList" || $functionName == "getContactListOfObject") :
|
||
$retVal = call_user_func_array($functionName, array($search, $category, $prefix, $objType, $objId)); // Gets the contact list
|
||
$retValLen = count($retVal);
|
||
|
||
if (!is_array($retVal[0])) :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
if ($retValLen > 1) :
|
||
$xmlOut .= "<contact_header>\n";
|
||
$itemLen = count($retVal[0]);
|
||
for ($j = 0; $j < $itemLen; $j++) :
|
||
$xmlOut .= " <label_" . $j . "><![CDATA[" . mcEncode($retVal[0][$j]) . "]]></label_" . $j . ">\n";
|
||
endfor;
|
||
$xmlOut .= "</contact_header>\n";
|
||
$xmlOut .= "<contact_list>\n";
|
||
for ($i = 1; $i < $retValLen; $i++) :
|
||
$xmlOut .= "<contact>\n";
|
||
$itemLen = count($retVal[$i]);
|
||
for ($j = 0; $j < $itemLen; $j++) :
|
||
$xmlOut .= " <value_" . $j . "><![CDATA[" . mcEncode($retVal[$i][$j]) . "]]></value_" . $j . ">\n";
|
||
endfor;
|
||
$xmlOut .= "</contact>\n";
|
||
endfor;
|
||
$xmlOut .= "</contact_list>\n";
|
||
endif;
|
||
endif;
|
||
|
||
|
||
// *****************
|
||
// * DB TABLE DATA *
|
||
// *****************
|
||
|
||
elseif ($functionName == "getHeadquartersList") :
|
||
$retVal = call_user_func_array($functionName, array()); // Gets the headquarters list
|
||
$retValLen = count($retVal);
|
||
|
||
if (!is_array($retVal[0])) :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
if ($retValLen > 1) :
|
||
/*
|
||
$xmlOut .= "<headquarters_header>\n";
|
||
$itemLen = count($retVal[0]);
|
||
for ($j = 0; $j < $itemLen; $j++) :
|
||
$xmlOut .= " <label_" . $j . "><![CDATA[" . $retVal[0][$j] . "]]></label_" . $j . ">\n";
|
||
endfor;
|
||
$xmlOut .= "</headquarters_header>\n";
|
||
*/
|
||
$xmlOut .= "<headquarters_list>\n";
|
||
for ($i = 1; $i < $retValLen; $i++) :
|
||
$xmlOut .= "<headquarters>\n";
|
||
$itemLen = count($retVal[$i]);
|
||
$xmlOut .= " <hq_id><![CDATA[" . $retVal[$i]["hq_id"] . "]]></hq_id>\n";
|
||
$xmlOut .= " <hq_mnemonic><![CDATA[" . mcEncode($retVal[$i]["hq_mnemonic"]) . "]]></hq_mnemonic>\n";
|
||
$xmlOut .= " <hq_name><![CDATA[" . mcEncode($retVal[$i]["hq_name"]) . "]]></hq_name>\n";
|
||
$xmlOut .= "</headquarters>\n";
|
||
endfor;
|
||
$xmlOut .= "</headquarters_list>\n";
|
||
endif;
|
||
endif;
|
||
|
||
|
||
// ************
|
||
// * CUSTOMER *
|
||
// ************
|
||
|
||
elseif ($functionName == "getCustomerList") :
|
||
$retVal = call_user_func_array($functionName, array($search)); // Gets the customer list
|
||
$retValLen = count($retVal);
|
||
|
||
if (!is_array($retVal[0]) && $retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
// if ($retValLen > 0) :
|
||
$xmlOut .= "<customer_list>\n";
|
||
for ($i = 0; $i < $retValLen; $i++) :
|
||
// $xmlOut .= "<customer id=\"" . $retVal[$i][0] . "\">\n";
|
||
$xmlOut .= "<customer>\n";
|
||
$xmlOut .= " <cs_id>" . $retVal[$i][0] . "</cs_id>\n";
|
||
$xmlOut .= " <cs_eid>" . $retVal[$i][2] . "</cs_eid>\n";
|
||
$xmlOut .= " <cmp_type>" . $retVal[$i][1] . "</cmp_type>\n";
|
||
$xmlOut .= " <cmp_comp><![CDATA[" . mcEncode($retVal[$i][3]) . "]]></cmp_comp>\n";
|
||
$xmlOut .= " <cmp_comp2><![CDATA[" . mcEncode($retVal[$i][4]) . "]]></cmp_comp2>\n";
|
||
// $xmlOut .= " <cmp_comp3><![CDATA[" . mcEncode($retVal[$i][13]) . "]]></cmp_comp3>\n";
|
||
// $xmlOut .= " <cmp_comp4><![CDATA[" . mcEncode($retVal[$i][14]) . "]]></cmp_comp4>\n";
|
||
$xmlOut .= " <usr_name><![CDATA[" . mcEncode($retVal[$i][5]) . "]]></usr_name>\n";
|
||
$xmlOut .= " <usr_firstname><![CDATA[" . mcEncode($retVal[$i][6]) . "]]></usr_firstname>\n";
|
||
$xmlOut .= " <usr_phone>" . $retVal[$i][7] . "</usr_phone>\n";
|
||
$xmlOut .= " <usr_phone2>" . $retVal[$i][8] . "</usr_phone2>\n";
|
||
// $xmlOut .= " <ad_street><![CDATA[" . mcEncode($retVal[$i][9]) . "]]></ad_street>\n";
|
||
// $xmlOut .= " <ad_houseno>" . $retVal[$i][10] . "</ad_houseno>\n";
|
||
// $xmlOut .= " <ad_zipcode>" . $retVal[$i][11] . "</ad_zipcode>\n";
|
||
// $xmlOut .= " <ad_city><![CDATA[" . mcEncode($retVal[$i][12]) . "]]></ad_city>\n";
|
||
$xmlOut .= "</customer>\n";
|
||
endfor;
|
||
$xmlOut .= "</customer_list>\n";
|
||
// endif;
|
||
endif;
|
||
|
||
elseif ($functionName == "getCustomerSpecial") :
|
||
$retVal = call_user_func_array($functionName, array($csId)); // Gets a single customer
|
||
$retValLen = count($retVal);
|
||
|
||
if (!is_array($retVal[0]) && $retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
// if ($retValLen > 0) :
|
||
$xmlOut .= "<customer_special>\n";
|
||
for ($i = 0; $i < $retValLen; $i++) :
|
||
// $xmlOut .= "<customer id=\"" . $retVal[$i][0] . "\">\n";
|
||
$xmlOut .= "<customer>\n";
|
||
$xmlOut .= " <cs_id>" . $retVal[$i][0] . "</cs_id>\n";
|
||
$xmlOut .= " <cs_eid>" . $retVal[$i][2] . "</cs_eid>\n";
|
||
$xmlOut .= " <cmp_type>" . $retVal[$i][1] . "</cmp_type>\n";
|
||
$xmlOut .= " <cmp_comp><![CDATA[" . mcEncode($retVal[$i][3]) . "]]></cmp_comp>\n";
|
||
$xmlOut .= " <cmp_comp2><![CDATA[" . mcEncode($retVal[$i][4]) . "]]></cmp_comp2>\n";
|
||
$xmlOut .= " <cmp_comp3><![CDATA[" . mcEncode($retVal[$i][13]) . "]]></cmp_comp3>\n";
|
||
$xmlOut .= " <cmp_comp4><![CDATA[" . mcEncode($retVal[$i][14]) . "]]></cmp_comp4>\n";
|
||
$xmlOut .= " <usr_name><![CDATA[" . mcEncode($retVal[$i][5]) . "]]></usr_name>\n";
|
||
$xmlOut .= " <usr_firstname><![CDATA[" . mcEncode($retVal[$i][6]) . "]]></usr_firstname>\n";
|
||
$xmlOut .= " <usr_phone>" . $retVal[$i][7] . "</usr_phone>\n";
|
||
$xmlOut .= " <usr_phone2>" . $retVal[$i][8] . "</usr_phone2>\n";
|
||
$xmlOut .= " <ad_street><![CDATA[" . mcEncode($retVal[$i][9]) . "]]></ad_street>\n";
|
||
$xmlOut .= " <ad_houseno>" . $retVal[$i][10] . "</ad_houseno>\n";
|
||
$xmlOut .= " <ad_zipcode>" . $retVal[$i][11] . "</ad_zipcode>\n";
|
||
$xmlOut .= " <ad_city><![CDATA[" . mcEncode($retVal[$i][12]) . "]]></ad_city>\n";
|
||
$xmlOut .= "</customer>\n";
|
||
endfor;
|
||
$xmlOut .= "</customer_special>\n";
|
||
// endif;
|
||
endif;
|
||
|
||
elseif ($functionName == "getCostcenterListOfCustomer") :
|
||
$retVal = call_user_func_array($functionName, array($csId)); // Gets the costcenter list of a special customer
|
||
$retValLen = count($retVal);
|
||
|
||
if (!is_array($retVal[0]) && $retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
// if ($retValLen > 0) :
|
||
$xmlOut .= "<costcenter_list>\n";
|
||
for ($i = 0; $i < $retValLen; $i++) :
|
||
// $xmlOut .= "<customer id=\"" . $retVal[$i][0] . "\">\n";
|
||
$xmlOut .= "<costcenter>\n";
|
||
$xmlOut .= " <csc_id>" . $retVal[$i][0] . "</csc_id>\n";
|
||
$xmlOut .= " <cs_id>" . $retVal[$i][1] . "</cs_id>\n";
|
||
$xmlOut .= " <cs_eid>" . $retVal[$i][5] . "</cs_eid>\n";
|
||
$xmlOut .= " <csc_name><![CDATA[" . mcEncode($retVal[$i][2]) . "]]></csc_name>\n";
|
||
$xmlOut .= " <csc_pre_id>" . $retVal[$i][3] . "</csc_pre_id>\n";
|
||
$xmlOut .= " <hq_id>" . $retVal[$i][4] . "</hq_id>\n";
|
||
$xmlOut .= "</costcenter>\n";
|
||
endfor;
|
||
$xmlOut .= "</costcenter_list>\n";
|
||
// endif;
|
||
endif;
|
||
|
||
elseif ($functionName == "getCostcenterAddressList") :
|
||
$retVal = call_user_func_array($functionName, array($cscId)); // Gets the costcenter list of a special customer
|
||
$retValLen = count($retVal);
|
||
|
||
if (!is_array($retVal[0]) && $retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
// if ($retValLen > 0) :
|
||
$xmlOut .= "<costcenteraddress_list>\n";
|
||
for ($i = 0; $i < $retValLen; $i++) :
|
||
$xmlOut .= "<costcenteraddress>\n";
|
||
$xmlOut .= " <csc_id>" . $retVal[$i][0] . "</csc_id>\n";
|
||
$xmlOut .= " <cscad_comp>" . $retVal[$i][1] . "</cscad_comp>\n";
|
||
$xmlOut .= " <cscad_comp2>" . $retVal[$i][2] . "</cscad_comp2>\n";
|
||
$xmlOut .= " <cscad_comp3>" . $retVal[$i][3] . "</cscad_comp3>\n";
|
||
$xmlOut .= " <cscad_comp4>" . $retVal[$i][4] . "</cscad_comp4>\n";
|
||
// $xmlOut .= " <ad_id>" . $retVal[$i][5] . "</ad_id>\n";
|
||
$xmlOut .= " <adt_id>" . $retVal[$i][6] . "</adt_id>\n";
|
||
$xmlOut .= " <ad_street><![CDATA[" . mcEncode($retVal[$i][7]) . "]]></ad_street>\n";
|
||
$xmlOut .= " <cscad_hsno><![CDATA[" . mcEncode($retVal[$i][8]) . "]]></cscad_hsno>\n";
|
||
$xmlOut .= " <ad_zipcode><![CDATA[" . mcEncode($retVal[$i][9]) . "]]></ad_zipcode>\n";
|
||
$xmlOut .= " <ad_city><![CDATA[" . mcEncode($retVal[$i][10]) . "]]></ad_city>\n";
|
||
$xmlOut .= " <cscad_floor><![CDATA[" . mcEncode($retVal[$i][11]) . "]]></cscad_floor>\n";
|
||
$xmlOut .= " <cscad_remark><![CDATA[" . mcEncode($retVal[$i][12]) . "]]></cscad_remark>\n";
|
||
$xmlOut .= " <cscad_person><![CDATA[" . mcEncode($retVal[$i][13]) . "]]></cscad_person>\n";
|
||
$xmlOut .= " <cscad_phone><![CDATA[" . mcEncode($retVal[$i][14]) . "]]></cscad_phone>\n";
|
||
$xmlOut .= " <cscad_email><![CDATA[" . mcEncode($retVal[$i][15]) . "]]></cscad_email>\n";
|
||
$xmlOut .= "</costcenteraddress>\n";
|
||
endfor;
|
||
$xmlOut .= "</costcenteraddress_list>\n";
|
||
// endif;
|
||
endif;
|
||
|
||
// ***********
|
||
// * REPORTS *
|
||
// ***********
|
||
|
||
elseif ($functionName == "getReportList") :
|
||
$retVal = call_user_func_array($functionName, array($fromDateRange, $toDateRange, $rpObjType, $rpObjId, $rpType)); // Gets the report list
|
||
$retValLen = count($retVal);
|
||
|
||
if (!is_array($retVal[0]) && $retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
// if ($retValLen > 0) :
|
||
$xmlOut .= "<report_list>\n";
|
||
for ($i = 0; $i < $retValLen; $i++) :
|
||
// $xmlOut .= "<report id=\"" . $retVal[$i][0] . "\">\n";
|
||
$xmlOut .= "<report>\n";
|
||
$xmlOut .= " <id>" . $retVal[$i][0] . "</id>\n";
|
||
$xmlOut .= " <type>" . $retVal[$i][1] . "</type>\n";
|
||
$xmlOut .= " <text><![CDATA[" . mcEncode($retVal[$i][2]) . "]]></text>\n";
|
||
$xmlOut .= " <confidential>" . $retVal[$i][3] . "</confidential>\n";
|
||
$xmlOut .= " <createtime>" . $retVal[$i][4] . "</createtime>\n";
|
||
$xmlOut .= " <usrid>" . $retVal[$i][5] . "</usrid>\n";
|
||
$xmlOut .= " <usr_id>" . $retVal[$i][5] . "</usr_id>\n";
|
||
$xmlOut .= " <name><![CDATA[" . mcEncode($retVal[$i][6]) . "]]></name>\n";
|
||
$xmlOut .= " <firstname><![CDATA[" . mcEncode($retVal[$i][7]) . "]]></firstname>\n";
|
||
$xmlOut .= " <phone>" . $retVal[$i][8] . "</phone>\n";
|
||
$xmlOut .= " <eid>" . $retVal[$i][9] . "</eid>\n";
|
||
$xmlOut .= " <comp><![CDATA[" . mcEncode($retVal[$i][10]) . "]]></comp>\n";
|
||
$xmlOut .= " <comp2><![CDATA[" . mcEncode($retVal[$i][11]) . "]]></comp2>\n";
|
||
$xmlOut .= " <hq_id>" . $retVal[$i][12] . "</hq_id>\n";
|
||
$xmlOut .= " <hq_name><![CDATA[" . mcEncode($retVal[$i][13]) . "]]></hq_name>\n";
|
||
$xmlOut .= "</report>\n";
|
||
endfor;
|
||
$xmlOut .= "</report_list>\n";
|
||
// endif;
|
||
endif;
|
||
|
||
elseif ($functionName == "getReport") :
|
||
$retVal = call_user_func_array($functionName, array($rpId, $rpObjType)); // Gets the single report
|
||
$retValLen = count($retVal);
|
||
|
||
if (!is_array($retVal[0]) && $retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
// if ($retValLen > 0) :
|
||
// $xmlOut .= "<report_list>\n";
|
||
for ($i = 0; $i < $retValLen; $i++) :
|
||
// $xmlOut .= "<report id=\"" . $retVal[$i][0] . "\">\n";
|
||
$xmlOut .= "<report>\n";
|
||
$xmlOut .= " <id>" . $retVal[$i][0] . "</id>\n";
|
||
$xmlOut .= " <type>" . $retVal[$i][1] . "</type>\n";
|
||
$xmlOut .= " <text><![CDATA[" . mcEncode($retVal[$i][2]) . "]]></text>\n";
|
||
$xmlOut .= " <confidential>" . $retVal[$i][3] . "</confidential>\n";
|
||
$xmlOut .= " <createtime>" . $retVal[$i][4] . "</createtime>\n";
|
||
$xmlOut .= " <usrid>" . $retVal[$i][5] . "</usrid>\n";
|
||
$xmlOut .= " <usr_id>" . $retVal[$i][5] . "</usr_id>\n";
|
||
$xmlOut .= " <name><![CDATA[" . mcEncode($retVal[$i][6]) . "]]></name>\n";
|
||
$xmlOut .= " <firstname><![CDATA[" . mcEncode($retVal[$i][7]) . "]]></firstname>\n";
|
||
$xmlOut .= " <phone>" . $retVal[$i][8] . "</phone>\n";
|
||
$xmlOut .= " <eid>" . $retVal[$i][9] . "</eid>\n";
|
||
$xmlOut .= " <comp><![CDATA[" . mcEncode($retVal[$i][10]) . "]]></comp>\n";
|
||
$xmlOut .= " <comp2><![CDATA[" . mcEncode($retVal[$i][11]) . "]]></comp2>\n";
|
||
$xmlOut .= " <hq_id>" . $retVal[$i][12] . "</hq_id>\n";
|
||
$xmlOut .= " <hq_name><![CDATA[" . mcEncode($retVal[$i][13]) . "]]></hq_name>\n";
|
||
$xmlOut .= "</report>\n";
|
||
endfor;
|
||
// $xmlOut .= "</report_list>\n";
|
||
// endif;
|
||
endif;
|
||
|
||
elseif ($functionName == "actionReport") :
|
||
$retVal = call_user_func_array($functionName, array($action, $rpId, $rpType, $rpObjType, $rpObjId, $rpText, $rpConfidential, $hqId, $usrId)); // DB actions for a report
|
||
$retValLen = count($retVal);
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= "<reports>\n";
|
||
$xmlOut .= "<report>\n";
|
||
$xmlOut .= "<action>" . $action . "</action>\n";
|
||
$xmlOut .= "<rp_id>" . $retVal[1] . "</rp_id>\n";
|
||
// $xmlOut .= "<state>" . $retVal . "</state>\n";
|
||
$xmlOut .= "</report>\n";
|
||
$xmlOut .= "</reports>\n";
|
||
endif;
|
||
|
||
elseif ($functionName == "getCsStatistic") :
|
||
$retVal = call_user_func_array($functionName, array($csId, $fromDateRange, $toDateRange)); // Special customer statistic: Business volume
|
||
$xmlOut .= "<customer_statistic>\n";
|
||
$xmlOut .= "<cs_id>" . $csId . "</cs_id>\n";
|
||
$xmlOut .= "<cs_eid>" . $csEid . "</cs_eid>\n";
|
||
$xmlOut .= "<statistic_value>" . $retVal . "</statistic_value>\n";
|
||
$xmlOut .= "</customer_statistic>\n";
|
||
|
||
// ************
|
||
// * COURIERS *
|
||
// ************
|
||
|
||
elseif ($functionName == "getCourierList") :
|
||
$retVal = call_user_func_array($functionName, array($search)); // Gets the customer list
|
||
$retValLen = count($retVal);
|
||
|
||
if (!is_array($retVal[0]) && $retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
// if ($retValLen > 0) :
|
||
$xmlOut .= "<courier_list>\n";
|
||
for ($i = 0; $i < $retValLen; $i++) :
|
||
// $xmlOut .= "<courier id=\"" . $retVal[$i][0] . "\">\n";
|
||
$xmlOut .= "<courier>\n";
|
||
$xmlOut .= " <cr_id>" . $retVal[$i][0] . "</cr_id>\n";
|
||
$xmlOut .= " <cr_eid>" . $retVal[$i][2] . "</cr_eid>\n";
|
||
$xmlOut .= " <cmp_type>" . $retVal[$i][1] . "</cmp_type>\n";
|
||
$xmlOut .= " <cmp_comp><![CDATA[" . mcEncode($retVal[$i][3]) . "]]></cmp_comp>\n";
|
||
$xmlOut .= " <cmp_comp2><![CDATA[" . mcEncode($retVal[$i][4]) . "]]></cmp_comp2>\n";
|
||
// $xmlOut .= " <cmp_comp3><![CDATA[" . mcEncode($retVal[$i][13]) . "]]></cmp_comp3>\n";
|
||
// $xmlOut .= " <cmp_comp4><![CDATA[" . mcEncode($retVal[$i][14]) . "]]></cmp_comp4>\n";
|
||
$xmlOut .= " <usr_name><![CDATA[" . mcEncode($retVal[$i][5]) . "]]></usr_name>\n";
|
||
$xmlOut .= " <usr_firstname><![CDATA[" . mcEncode($retVal[$i][6]) . "]]></usr_firstname>\n";
|
||
$xmlOut .= " <usr_phone>" . $retVal[$i][7] . "</usr_phone>\n";
|
||
$xmlOut .= " <usr_phone2>" . $retVal[$i][8] . "</usr_phone2>\n";
|
||
// $xmlOut .= " <ad_street><![CDATA[" . mcEncode($retVal[$i][9]) . "]]></ad_street>\n";
|
||
// $xmlOut .= " <ad_houseno>" . $retVal[$i][10] . "</ad_houseno>\n";
|
||
// $xmlOut .= " <ad_zipcode>" . $retVal[$i][11] . "</ad_zipcode>\n";
|
||
// $xmlOut .= " <ad_city><![CDATA[" . mcEncode($retVal[$i][12]) . "]]></ad_city>\n";
|
||
$xmlOut .= "</courier>\n";
|
||
endfor;
|
||
$xmlOut .= "</courier_list>\n";
|
||
// endif;
|
||
endif;
|
||
|
||
elseif ($functionName == "getCourierSpecial") :
|
||
|
||
$retVal = call_user_func_array($functionName, array($crId)); // Gets a single courier
|
||
$retValLen = count($retVal);
|
||
|
||
if (!is_array($retVal[0]) && $retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
// if ($retValLen > 0) :
|
||
$xmlOut .= "<courier_special>\n";
|
||
for ($i = 0; $i < $retValLen; $i++) :
|
||
// $xmlOut .= "<courier id=\"" . $retVal[$i][0] . "\">\n";
|
||
$xmlOut .= "<courier>\n";
|
||
$xmlOut .= " <cr_id>" . $retVal[$i][0] . "</cr_id>\n";
|
||
$xmlOut .= " <cr_eid>" . $retVal[$i][2] . "</cr_eid>\n";
|
||
$xmlOut .= " <cmp_type>" . $retVal[$i][1] . "</cmp_type>\n";
|
||
$xmlOut .= " <cmp_comp><![CDATA[" . mcEncode($retVal[$i][3]) . "]]></cmp_comp>\n";
|
||
$xmlOut .= " <cmp_comp2><![CDATA[" . mcEncode($retVal[$i][4]) . "]]></cmp_comp2>\n";
|
||
$xmlOut .= " <cmp_comp3><![CDATA[" . mcEncode($retVal[$i][13]) . "]]></cmp_comp3>\n";
|
||
$xmlOut .= " <cmp_comp4><![CDATA[" . mcEncode($retVal[$i][14]) . "]]></cmp_comp4>\n";
|
||
$xmlOut .= " <usr_name><![CDATA[" . mcEncode($retVal[$i][5]) . "]]></usr_name>\n";
|
||
$xmlOut .= " <usr_firstname><![CDATA[" . mcEncode($retVal[$i][6]) . "]]></usr_firstname>\n";
|
||
$xmlOut .= " <usr_phone>" . $retVal[$i][7] . "</usr_phone>\n";
|
||
$xmlOut .= " <usr_phone2>" . $retVal[$i][8] . "</usr_phone2>\n";
|
||
$xmlOut .= " <ad_street><![CDATA[" . mcEncode($retVal[$i][9]) . "]]></ad_street>\n";
|
||
$xmlOut .= " <ad_houseno>" . $retVal[$i][10] . "</ad_houseno>\n";
|
||
$xmlOut .= " <ad_zipcode>" . $retVal[$i][11] . "</ad_zipcode>\n";
|
||
$xmlOut .= " <ad_city><![CDATA[" . mcEncode($retVal[$i][12]) . "]]></ad_city>\n";
|
||
$xmlOut .= "</courier>\n";
|
||
endfor;
|
||
$xmlOut .= "</courier_special>\n";
|
||
// endif;
|
||
endif;
|
||
|
||
// *******************
|
||
// * COURIERVEHICLES *
|
||
// *******************
|
||
|
||
elseif ($functionName == "getVehicleList") :
|
||
$searchClause = " (crvh.crvh_sid LIKE '%" . $search . "%' OR crvh.crvh_comm_no LIKE '%" . $search . "%' OR "
|
||
. " crvh.crvh_vh_sign LIKE '%" . $search . "%' OR crvh.crvh_vh_name LIKE '%" . $search . "%' OR "
|
||
. " crvh.crvh_remark LIKE '%" . $search . "%' OR crvh.crvh_freetext_1 LIKE '%" . $search . "%')";
|
||
$retVal = call_user_func_array($functionName, array($searchClause, "crvh.crvh_sid")); // Gets the couriervehicle list
|
||
$retValLen = count($retVal);
|
||
|
||
if (!is_array($retVal[0]) && $retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
// if ($retValLen > 0) :
|
||
$xmlOut .= "<vehicle_list>\n";
|
||
for ($i = 0; $i < $retValLen; $i++) :
|
||
// $xmlOut .= "<courier id=\"" . $retVal[$i][0] . "\">\n";
|
||
$xmlOut .= "<vehicle>\n";
|
||
$xmlOut .= " <crvh_id>" . $retVal[$i][0] . "</crvh_id>\n";
|
||
$xmlOut .= " <crvh_sid>" . $retVal[$i][4] . "</crvh_sid>\n";
|
||
$xmlOut .= " <cr_id>" . $retVal[$i][2] . "</cr_id>\n";
|
||
$xmlOut .= " <crvh_comm_no><![CDATA[" . mcEncode($retVal[$i][5]) . "]]></crvh_comm_no>\n";
|
||
$xmlOut .= " <crvh_vh_sign><![CDATA[" . mcEncode($retVal[$i][6]) . "]]></crvh_vh_sign>\n";
|
||
$xmlOut .= " <crvh_vh_name><![CDATA[" . mcEncode($retVal[$i][7]) . "]]></crvh_vh_name>\n";
|
||
// $xmlOut .= " <crvh_remark><![CDATA[" . mcEncode($retVal[$i][25]) . "]]></crvh_remark>\n";
|
||
// $xmlOut .= " <crvh_freetext><![CDATA[" . mcEncode($retVal[$i][26]) . "]]></crvh_freetext>\n";
|
||
// $xmlOut .= " <crvh_special><![CDATA[" . mcEncode($retVal[$i][27]) . "]]></crvh_special>\n";
|
||
$xmlOut .= "</vehicle>\n";
|
||
endfor;
|
||
$xmlOut .= "</vehicle_list>\n";
|
||
// endif;
|
||
endif;
|
||
|
||
elseif ($functionName == "getVehicle") :
|
||
$retVal = getVehicle($crvhId, "", "", "1"); // Gets a single vehicle
|
||
$retValLen = count($retVal);
|
||
|
||
if ($retValLen == 0) :
|
||
// $xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
// if ($retValLen > 0) :
|
||
$xmlOut .= "<vehicle_special>\n";
|
||
// for ($i = 0; $i < $retValLen; $i++) :
|
||
// $xmlOut .= "<vehicle id=\"" . $retVal[0] . "\">\n";
|
||
$xmlOut .= "<vehicle>\n";
|
||
$xmlOut .= " <crvh_id>" . $retVal["crvh_id"] . "</crvh_id>\n";
|
||
$xmlOut .= " <vht_id>" . $retVal["vht_id"] . "</vht_id>\n";
|
||
$xmlOut .= " <crvh_sid>" . $retVal["crvh_sid"] . "</crvh_sid>\n";
|
||
$xmlOut .= " <crvh_comm_no><![CDATA[" . mcEncode($retVal["crvh_comm_no"]) . "]]></crvh_comm_no>\n";
|
||
$xmlOut .= " <crvh_vh_sign><![CDATA[" . mcEncode($retVal["crvh_vh_sign"]) . "]]></crvh_vh_sign>\n";
|
||
$xmlOut .= " <crvh_vh_name><![CDATA[" . mcEncode($retVal["crvh_vh_name"]) . "]]></crvh_vh_name>\n";
|
||
$xmlOut .= " <crvh_licence_date>" . $retVal["crvh_licence_date"] . "</crvh_licence_date>\n";
|
||
$xmlOut .= " <crvh_prov>" . $retVal["crvh_prov"] . "</crvh_prov>\n";
|
||
$xmlOut .= " <crvh_payload>" . $retVal["crvh_payload"] . "</crvh_payload>\n";
|
||
$xmlOut .= " <crvh_totalweight>" . $retVal["crvh_totalweight"] . "</crvh_totalweight>\n";
|
||
$xmlOut .= " <crvh_length>" . $retVal["crvh_length"] . "</crvh_length>\n";
|
||
$xmlOut .= " <crvh_width>" . $retVal["crvh_width"] . "</crvh_width>\n";
|
||
$xmlOut .= " <crvh_height>" . $retVal["crvh_height"] . "</crvh_height>\n";
|
||
$xmlOut .= " <crvh_position>" . $retVal["crvh_position"] . "</crvh_position>\n";
|
||
$xmlOut .= " <crvh_aperture_height_side>" . $retVal["crvh_aperture_height_side"] . "</crvh_aperture_height_side>\n";
|
||
$xmlOut .= " <crvh_aperture_height_rear>" . $retVal["crvh_aperture_height_rear"] . "</crvh_aperture_height_rear>\n";
|
||
$xmlOut .= "</vehicle>\n";
|
||
// endfor;
|
||
$xmlOut .= "</vehicle_special>\n";
|
||
// endif;
|
||
endif;
|
||
|
||
// *************************
|
||
// * SHOPS AND BONUS CARDS *
|
||
// *************************
|
||
|
||
/*
|
||
elseif ($functionName == "getBonusCard") :
|
||
$retVal = call_user_func_array($functionName, array($bcId, $bcCode));
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
|
||
$xmlOut .= "<bc_id>" . $retVal[1] . "</bc_id>\n";
|
||
$xmlOut .= "<bc_code>" . $retVal[2] . "</bc_code>\n";
|
||
endif;
|
||
|
||
elseif ($functionName == "insertBonusCard") :
|
||
$retVal = call_user_func_array($functionName, array($bcCode));
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
|
||
$xmlOut .= "<bc_id>" . $retVal[1] . "</bc_id>\n";
|
||
$xmlOut .= "<bc_code>" . $retVal[2] . "</bc_code>\n";
|
||
endif;
|
||
|
||
elseif ($functionName == "updateBonusCard") :
|
||
$retVal = call_user_func_array($functionName, array($bcId, $bcCode));
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
|
||
$xmlOut .= "<bc_id>" . $retVal[1] . "</bc_id>\n";
|
||
$xmlOut .= "<bc_code>" . $retVal[2] . "</bc_code>\n";
|
||
endif;
|
||
|
||
elseif ($functionName == "getBonusCardOwner") :
|
||
$retVal = call_user_func_array($functionName, array($bcId, $objType, $objId, $orderByClause));
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
|
||
$tmpArr = $retVal[1];
|
||
$tmpArrLen = count($tmpArr);
|
||
for ($i = 0; $i < $tmpArrLen; $i++) :
|
||
$xmlOut .= "<bco_item>";
|
||
$xmlOut .= "<bc_id>" . $tmpArr[$i]["bc_id"] . "</bc_id>\n";
|
||
if ($tmpArr[$i]["bco_obj_type"] == "usr") :
|
||
$xmlOut .= "<usr_id>" . $tmpArr[$i]["bco_obj_id"] . "</usr_id>\n";
|
||
elseif ($tmpArr[$i]["bco_obj_type"] == "cmp") :
|
||
$xmlOut .= "<cmp_id>" . $tmpArr[$i]["bco_obj_id"] . "</cmp_id>\n";
|
||
endif;
|
||
$xmlOut .= "<bco_points>" . $tmpArr[$i]["bco_points"] . "</bco_points>\n";
|
||
$xmlOut .= "</bco_item>";
|
||
endfor;
|
||
endif;
|
||
|
||
elseif ($functionName == "getBonusCardOwnerByClause") :
|
||
|
||
if ($whereClause != "") :
|
||
$retVal = call_user_func_array($functionName, array($whereClause, $orderByClause));
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
|
||
$tmpArr = $retVal[1];
|
||
$tmpArrLen = count($tmpArr);
|
||
for ($i = 0; $i < $tmpArrLen; $i++) :
|
||
$xmlOut .= "<bco_item>";
|
||
$xmlOut .= "<bc_id>" . $tmpArr[$i]["bc_id"] . "</bc_id>\n";
|
||
if ($tmpArr[$i]["bco_obj_type"] == "usr") :
|
||
$xmlOut .= "<usr_id>" . $tmpArr[$i]["bco_obj_id"] . "</usr_id>\n";
|
||
elseif ($tmpArr[$i]["bco_obj_type"] == "cmp") :
|
||
$xmlOut .= "<cmp_id>" . $tmpArr[$i]["bco_obj_id"] . "</cmp_id>\n";
|
||
endif;
|
||
$xmlOut .= "<bco_points>" . $tmpArr[$i]["bco_points"] . "</bco_points>\n";
|
||
$xmlOut .= "</bco_item>";
|
||
endfor;
|
||
endif;
|
||
else:
|
||
$xmlOut .= "<err_no>109</err_no>\n";
|
||
$xmlOut .= "<err_desc>Special database error.</err_desc>\n";
|
||
endif;
|
||
|
||
elseif ($functionName == "setBonusCardOwner") :
|
||
$retVal = call_user_func_array($functionName, array($bcId, $objType, $objId, $bcoPoints));
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
endif;
|
||
|
||
elseif ($functionName == "addBonusCardOwnerPoints") :
|
||
$retVal = call_user_func_array($functionName, array($bcId, $objType, $objId, $bcoPoints));
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
endif;
|
||
|
||
elseif ($functionName == "getBonusCardSingleTransaction") :
|
||
$retVal = call_user_func_array($functionName, array($bctaId));
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
|
||
$xmlOut .= "<bcta_id>" . $retVal[1] . "</bcta_id>\n";
|
||
$xmlOut .= "<bc_id>" . $retVal[2] . "</bc_id>\n";
|
||
if ($retVal[3] == "usr") :
|
||
$xmlOut .= "<usr_id>" . $retVal[4] . "</usr_id>\n";
|
||
elseif ($retVal[3] == "cmp") :
|
||
$xmlOut .= "<cmp_id>" . $retVal[4] . "</cmp_id>\n";
|
||
endif;
|
||
$xmlOut .= "<shp_id>" . $retVal[5] . "</shp_id>\n";
|
||
$xmlOut .= "<bcta_value>" . $retVal[6] . "</bcta_value>\n";
|
||
$xmlOut .= "<bcta_points>" . $retVal[7] . "</bcta_points>\n";
|
||
$xmlOut .= "<bcta_createtime>" . $retVal[8] . "</bcta_createtime>\n";
|
||
$xmlOut .= "<bcta_remark><![CDATA[" . mcEncode($retVal[9]) . "]]></bcta_remark>\n";
|
||
endif;
|
||
|
||
elseif ($functionName == "getBonusCardTransactionList") :
|
||
$retVal = call_user_func_array($functionName, array($dateFrom, $dateTo, $orderByClause, $objType, $objId, $shpId));
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
|
||
$tmpArr = $retVal[1];
|
||
$tmpArrLen = count($tmpArr);
|
||
for ($i = 0; $i < $tmpArrLen; $i++) :
|
||
$xmlOut .= "<bcta_item>";
|
||
$xmlOut .= "<bcta_id>" . $tmpArr[$i]["bcta_id"] . "</bcta_id>\n";
|
||
$xmlOut .= "<bc_id>" . $tmpArr[$i]["bc_id"] . "</bc_id>\n";
|
||
if ($tmpArr[$i]["bcta_obj_type"] == "usr") :
|
||
$xmlOut .= "<usr_id>" . $tmpArr[$i]["bcta_obj_id"] . "</usr_id>\n";
|
||
elseif ($tmpArr[$i]["bcta_obj_type"] == "cmp") :
|
||
$xmlOut .= "<cmp_id>" . $tmpArr[$i]["bcta_obj_id"] . "</cmp_id>\n";
|
||
endif;
|
||
$xmlOut .= "<shp_id>" . $tmpArr[$i]["shp_id"] . "</shp_id>\n";
|
||
$xmlOut .= "<bcta_value>" . $tmpArr[$i]["bcta_value"] . "</bcta_value>\n";
|
||
$xmlOut .= "<bcta_points>" . $tmpArr[$i]["bcta_points"] . "</bcta_points>\n";
|
||
$xmlOut .= "<bcta_createtime>" . $tmpArr[$i]["bcta_createtime"] . "</bcta_createtime>\n";
|
||
$xmlOut .= "<bcta_remark><![CDATA[" . mcEncode($tmpArr[$i]["bcta_remark"]) . "]]></bcta_remark>\n";
|
||
$xmlOut .= "</bcta_item>";
|
||
endfor;
|
||
endif;
|
||
|
||
elseif ($functionName == "getBonusCardTransactionListByClause") :
|
||
|
||
if ($whereClause != "") :
|
||
$retVal = call_user_func_array($functionName, array($whereClause, $orderByClause));
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
|
||
$tmpArr = $retVal[1];
|
||
$tmpArrLen = count($tmpArr);
|
||
for ($i = 0; $i < $tmpArrLen; $i++) :
|
||
$xmlOut .= "<bcta_item>";
|
||
$xmlOut .= "<bcta_id>" . $tmpArr[$i]["bcta_id"] . "</bcta_id>\n";
|
||
$xmlOut .= "<bc_id>" . $tmpArr[$i]["bc_id"] . "</bc_id>\n";
|
||
if ($tmpArr[$i]["bcta_obj_type"] == "usr") :
|
||
$xmlOut .= "<usr_id>" . $tmpArr[$i]["bcta_obj_id"] . "</usr_id>\n";
|
||
elseif ($tmpArr[$i]["bcta_obj_type"] == "cmp") :
|
||
$xmlOut .= "<cmp_id>" . $tmpArr[$i]["bcta_obj_id"] . "</cmp_id>\n";
|
||
endif;
|
||
$xmlOut .= "<shp_id>" . $tmpArr[$i]["shp_id"] . "</shp_id>\n";
|
||
$xmlOut .= "<bcta_value>" . $tmpArr[$i]["bcta_value"] . "</bcta_value>\n";
|
||
$xmlOut .= "<bcta_points>" . $tmpArr[$i]["bcta_points"] . "</bcta_points>\n";
|
||
$xmlOut .= "<bcta_createtime>" . $tmpArr[$i]["bcta_createtime"] . "</bcta_createtime>\n";
|
||
$xmlOut .= "<bcta_remark><![CDATA[" . mcEncode($tmpArr[$i]["bcta_remark"]) . "]]></bcta_remark>\n";
|
||
$xmlOut .= "</bcta_item>";
|
||
endfor;
|
||
endif;
|
||
else:
|
||
$xmlOut .= "<err_no>109</err_no>\n";
|
||
$xmlOut .= "<err_desc>Special database error.</err_desc>\n";
|
||
endif;
|
||
|
||
elseif ($functionName == "setBonusCardSingleTransaction") :
|
||
$retVal = call_user_func_array($functionName, array($bcId, $objType, $objId, $shpId, $bctaValue, $bctaPoints, $bctaRemark));
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
|
||
$xmlOut .= "<bcta_id>" . $retVal[1] . "</bcta_id>\n";
|
||
endif;
|
||
|
||
elseif ($functionName == "getShop") :
|
||
$retVal = call_user_func_array($functionName, array($shpId));
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
|
||
$xmlOut .= "<shp_id>" . $retVal[1] . "</shp_id>\n";
|
||
$xmlOut .= "<hq_id>" . $retVal[2] . "</hq_id>\n";
|
||
$xmlOut .= "<cmp_id>" . $retVal[3] . "</cmp_id>\n";
|
||
$xmlOut .= "<shp_bc_active>" . $retVal[4] . "</shp_bc_active>\n";
|
||
$xmlOut .= "<shp_bc_factor>" . $retVal[5] . "</shp_bc_factor>\n";
|
||
$xmlOut .= "<shp_bc_ta_limit>" . $retVal[6] . "</shp_bc_ta_limit>\n";
|
||
endif;
|
||
|
||
elseif ($functionName == "getShopByClause") :
|
||
|
||
if ($whereClause != "") :
|
||
$retVal = call_user_func_array($functionName, array($whereClause, $orderByClause));
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
|
||
$tmpArr = $retVal[1];
|
||
$tmpArrLen = count($tmpArr);
|
||
for ($i = 0; $i < $tmpArrLen; $i++) :
|
||
$xmlOut .= "<shp_item>";
|
||
$xmlOut .= "<shp_id>" . $tmpArr[$i]["shp_id"] . "</shp_id>\n";
|
||
$xmlOut .= "<hq_id>" . $tmpArr[$i]["hq_id"] . "</hq_id>\n";
|
||
$xmlOut .= "<cmp_id>" . $tmpArr[$i]["cmp_id"] . "</cmp_id>\n";
|
||
$xmlOut .= "<shp_bc_active>" . $tmpArr[$i]["shp_bc_active"] . "</shp_bc_active>\n";
|
||
$xmlOut .= "<shp_bc_factor>" . $tmpArr[$i]["shp_bc_factor"] . "</shp_bc_factor>\n";
|
||
$xmlOut .= "<shp_bc_ta_limit>" . $tmpArr[$i]["shp_bc_ta_limit"] . "</shp_bc_ta_limit>\n";
|
||
$xmlOut .= "</shp_item>";
|
||
endfor;
|
||
endif;
|
||
else:
|
||
$xmlOut .= "<err_no>109</err_no>\n";
|
||
$xmlOut .= "<err_desc>Special database error.</err_desc>\n";
|
||
endif;
|
||
|
||
elseif ($functionName == "insertShop") :
|
||
$retVal = call_user_func_array($functionName, array($shpName, $cntrId, $shpBcActive, $shpBcFactor, $shpBcTaLimit));
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
|
||
$xmlOut .= "<shp_id>" . $retVal[1] . "</shp_id>\n";
|
||
$xmlOut .= "<cmp_id>" . $retVal[2] . "</cmp_id>\n";
|
||
endif;
|
||
|
||
elseif ($functionName == "updateShop") :
|
||
$retVal = call_user_func_array($functionName, array($shp_id, $shpName, $shpBcActive, $shpBcFactor, $shpBcTaLimit));
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
endif;
|
||
|
||
elseif ($functionName == "getCoupon") :
|
||
$retVal = call_user_func_array($functionName, array($cpnId, $cpnCode));
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
|
||
$xmlOut .= "<cpn_id>" . $retVal[1] . "</cpn_id>\n";
|
||
$xmlOut .= "<cpn_code>" . $retVal[2] . "</cpn_code>\n";
|
||
endif;
|
||
|
||
elseif ($functionName == "insertCoupon") :
|
||
$retVal = call_user_func_array($functionName, array($cpnCode));
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
|
||
$xmlOut .= "<cpn_id>" . $retVal[1] . "</cpn_id>\n";
|
||
$xmlOut .= "<cpn_code>" . $retVal[2] . "</cpn_code>\n";
|
||
endif;
|
||
|
||
elseif ($functionName == "updateCoupon") :
|
||
$retVal = call_user_func_array($functionName, array($cpnId, $cpnCode));
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
|
||
$xmlOut .= "<cpn_id>" . $retVal[1] . "</cpn_id>\n";
|
||
$xmlOut .= "<cpn_code>" . $retVal[2] . "</cpn_code>\n";
|
||
endif;
|
||
|
||
elseif ($functionName == "getCouponSingleTransaction") :
|
||
$retVal = call_user_func_array($functionName, array($bctaId));
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
|
||
$xmlOut .= "<cpnta_id>" . $retVal[1] . "</cpnta_id>\n";
|
||
$xmlOut .= "<cpn_id>" . $retVal[2] . "</cpn_id>\n";
|
||
if ($retVal[3] == "usr") :
|
||
$xmlOut .= "<usr_id>" . $retVal[4] . "</usr_id>\n";
|
||
elseif ($retVal[3] == "cmp") :
|
||
$xmlOut .= "<cmp_id>" . $retVal[4] . "</cmp_id>\n";
|
||
endif;
|
||
$xmlOut .= "<cpnta_createtime>" . $retVal[5] . "</cpnta_createtime>\n";
|
||
endif;
|
||
|
||
elseif ($functionName == "getCouponTransactionList") :
|
||
$retVal = call_user_func_array($functionName, array($dateFrom, $dateTo, $orderByClause, $objType, $objId));
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
|
||
$tmpArr = $retVal[1];
|
||
$tmpArrLen = count($tmpArr);
|
||
for ($i = 0; $i < $tmpArrLen; $i++) :
|
||
$xmlOut .= "<cpnta_item>";
|
||
$xmlOut .= "<cpnta_id>" . $tmpArr[$i]["cpnta_id"] . "</cpnta_id>\n";
|
||
$xmlOut .= "<cpn_id>" . $tmpArr[$i]["cpn_id"] . "</cpn_id>\n";
|
||
if ($tmpArr[$i]["cpnta_obj_type"] == "usr") :
|
||
$xmlOut .= "<usr_id>" . $tmpArr[$i]["cpnta_obj_id"] . "</usr_id>\n";
|
||
elseif ($tmpArr[$i]["cpnta_obj_type"] == "cmp") :
|
||
$xmlOut .= "<cmp_id>" . $tmpArr[$i]["cpnta_obj_id"] . "</cmp_id>\n";
|
||
endif;
|
||
$xmlOut .= "<cpnta_createtime>" . $tmpArr[$i]["cpnta_createtime"] . "</cpnta_createtime>\n";
|
||
$xmlOut .= "</cpnta_item>";
|
||
endfor;
|
||
endif;
|
||
|
||
elseif ($functionName == "getCouponTransactionListByClause") :
|
||
|
||
if ($whereClause != "") :
|
||
$retVal = call_user_func_array($functionName, array($whereClause, $orderByClause));
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
|
||
$tmpArr = $retVal[1];
|
||
$tmpArrLen = count($tmpArr);
|
||
for ($i = 0; $i < $tmpArrLen; $i++) :
|
||
$xmlOut .= "<cpnta_item>";
|
||
$xmlOut .= "<cpnta_id>" . $tmpArr[$i]["cpnta_id"] . "</cpnta_id>\n";
|
||
$xmlOut .= "<cpn_id>" . $tmpArr[$i]["cpn_id"] . "</cpn_id>\n";
|
||
if ($tmpArr[$i]["cpnta_obj_type"] == "usr") :
|
||
$xmlOut .= "<usr_id>" . $tmpArr[$i]["cpnta_obj_id"] . "</usr_id>\n";
|
||
elseif ($tmpArr[$i]["cpnta_obj_type"] == "cmp") :
|
||
$xmlOut .= "<cmp_id>" . $tmpArr[$i]["cpnta_obj_id"] . "</cmp_id>\n";
|
||
endif;
|
||
$xmlOut .= "<cpnta_createtime>" . $tmpArr[$i]["cpnta_createtime"] . "</cpnta_createtime>\n";
|
||
$xmlOut .= "</cpnta_item>";
|
||
endfor;
|
||
endif;
|
||
else:
|
||
$xmlOut .= "<err_no>109</err_no>\n";
|
||
$xmlOut .= "<err_desc>Special database error.</err_desc>\n";
|
||
endif;
|
||
|
||
elseif ($functionName == "setCouponSingleTransaction") :
|
||
$retVal = call_user_func_array($functionName, array($cpnId, $objType, $objId));
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
|
||
$xmlOut .= "<cpnta_id>" . $retVal[1] . "</cpnta_id>\n";
|
||
endif;
|
||
|
||
elseif ($functionName == "getGiftCoupon") :
|
||
$retVal = call_user_func_array($functionName, array($gcpnId, $gcpnCode));
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
|
||
$xmlOut .= "<gcpn_id>" . $retVal[1] . "</gcpn_id>\n";
|
||
$xmlOut .= "<gcpn_code>" . $retVal[2] . "</gcpn_code>\n";
|
||
$xmlOut .= "<gcpn_recipient>" . $retVal[3] . "</gcpn_recipient>\n";
|
||
$xmlOut .= "<gcpn_valid>" . $retVal[4] . "</gcpn_valid>\n";
|
||
$xmlOut .= "<gcpn_value>" . $retVal[5] . "</gcpn_value>\n";
|
||
$xmlOut .= "<gcpn_freetext>" . $retVal[6] . "</gcpn_freetext>\n";
|
||
$xmlOut .= "<gcpn_image_name>" . $retVal[7] . "</gcpn_image_name>\n";
|
||
$xmlOut .= "<gcpn_payment_code>" . $retVal[8] . "</gcpn_payment_code>\n";
|
||
$xmlOut .= "<gcpn_createtime>" . $retVal[9] . "</gcpn_createtime>\n";
|
||
endif;
|
||
|
||
elseif ($functionName == "getGiftCouponByClause") :
|
||
|
||
if ($whereClause != "") :
|
||
$retVal = call_user_func_array($functionName, array($whereClause, $orderByClause));
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
|
||
$tmpArr = $retVal[1];
|
||
$tmpArrLen = count($tmpArr);
|
||
for ($i = 0; $i < $tmpArrLen; $i++) :
|
||
$xmlOut .= "<gcpn_item>";
|
||
$xmlOut .= "<gcpn_id>" . $tmpArr[$i]["gcpn_id"] . "</gcpn_id>\n";
|
||
$xmlOut .= "<gcpn_code>" . $tmpArr[$i]["gcpn_code"] . "</gcpn_code>\n";
|
||
$xmlOut .= "<gcpn_recipient>" . $tmpArr[$i]["gcpn_recipient"] . "</gcpn_recipient>\n";
|
||
$xmlOut .= "<gcpn_valid>" . $tmpArr[$i]["gcpn_valid"] . "</gcpn_valid>\n";
|
||
$xmlOut .= "<gcpn_value>" . $tmpArr[$i]["gcpn_value"] . "</gcpn_value>\n";
|
||
$xmlOut .= "<gcpn_freetext>" . $tmpArr[$i]["gcpn_freetext"] . "</gcpn_freetext>\n";
|
||
$xmlOut .= "<gcpn_image_name>" . $tmpArr[$i]["gcpn_image_name"] . "</gcpn_image_name>\n";
|
||
$xmlOut .= "<gcpn_payment_code>" . $tmpArr[$i]["gcpn_payment_code"] . "</gcpn_payment_code>\n";
|
||
$xmlOut .= "<gcpn_createtime>" . $tmpArr[$i]["gcpn_createtime"] . "</gcpn_createtime>\n";
|
||
$xmlOut .= "</gcpn_item>";
|
||
endfor;
|
||
endif;
|
||
else:
|
||
$xmlOut .= "<err_no>109</err_no>\n";
|
||
$xmlOut .= "<err_desc>Special database error.</err_desc>\n";
|
||
endif;
|
||
|
||
elseif ($functionName == "insertGiftCoupon") :
|
||
$retVal = call_user_func_array($functionName, array($gcpnCode, $gcpnRecipient, $gcpnValue, $gcpnImageName, $gcpnValid, $gcpnFreetext, $gcpnPaymentCode));
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
|
||
$xmlOut .= "<gcpn_id>" . $retVal[1] . "</gcpn_id>\n";
|
||
endif;
|
||
|
||
elseif ($functionName == "updateGiftCoupon") :
|
||
$retVal = call_user_func_array($functionName, array($gcpnId, $gcpnCode, $gcpnRecipient, $gcpnValue, $gcpnImageName, $gcpnValid, $gcpnFreetext, $gcpnPaymentCode));
|
||
|
||
if ($retVal[0] != "0") :
|
||
$xmlOut .= $retVal[1] . $retVal[2];
|
||
else :
|
||
$xmlOut .= $xmlNoErrOut;
|
||
endif;
|
||
*/
|
||
|
||
else :
|
||
|
||
// ****************
|
||
// * GENERIC PART *
|
||
// ****************
|
||
|
||
if ($serviceContext == "____generic____") :
|
||
|
||
// Get number of arguments of requested function
|
||
$fct = new ReflectionFunction($functionName);
|
||
$numOfFunctionArguments = $fct->getNumberOfRequiredParameters();
|
||
$argumentArray = array();
|
||
for ($i = 1; $i <= $numOfFunctionArguments; $i++) :
|
||
$parName = "par_" . pad($i, 2);
|
||
${($parName)} = getSingleTagContent($messageReq, "<" . $parName . ">", "</" . $parName . ">");
|
||
array_push($argumentArray, ${($parName)});
|
||
endfor;
|
||
|
||
// Call function with arguments
|
||
$retVal = call_user_func_array($functionName, $argumentArray);
|
||
if (!is_array($retValue)) :
|
||
$retVal = array($retVal);
|
||
endif;
|
||
|
||
// Generate XML
|
||
$xmlOut .= mcArray2Xml($retVal, "");
|
||
|
||
// $xmlOut .= "<err_no>103</err_no>\n";
|
||
// $xmlOut .= "<err_desc>Function does not exist in API.</err_desc>\n";
|
||
endif;
|
||
endif;
|
||
else :
|
||
$xmlOut .= "<err_no>103</err_no>\n";
|
||
$xmlOut .= "<err_desc>Operational database cannot be connected.</err_desc>\n";
|
||
endif;
|
||
else :
|
||
$xmlOut .= "<err_no>102</err_no>\n";
|
||
$xmlOut .= "<err_desc>Specified function does not exist.</err_desc>\n";
|
||
endif;
|
||
else :
|
||
$xmlOut .= "<err_no>101</err_no>\n";
|
||
$xmlOut .= "<err_desc>No function specified.</err_desc>\n";
|
||
endif;
|
||
|
||
$xmlOut .= "<req_key>" . $requestKey . "</req_key>\n";
|
||
$xmlOut .= "</data>\n";
|
||
else :
|
||
$xmlOut .= $xmlErrOut;
|
||
endif;
|
||
|
||
echo $xmlOut;
|
||
|
||
|
||
/*
|
||
ALLGEMEIN:
|
||
|
||
Folgend werden nur die positiven Requests beschrieben.
|
||
Im Fehlerfall werden die Fehlernummer und die Fehlerbeschreibung zurückgegeben:
|
||
<data>
|
||
<err_no>001</err_no> // Verifikation Registrierungscode ok, wenn = "0"
|
||
<err_desc>....<err_desc> // Fehlermeldung (001 - Registrierung fehlgeschlagen!)
|
||
....
|
||
</data>
|
||
|
||
|
||
// ************************************************************
|
||
// **** [A] Registrierung und Mandantenanlage über das WEB ****
|
||
// ************************************************************
|
||
|
||
....
|
||
<id>webRegister</id>
|
||
<company>Firma</company>
|
||
<usr_name>Nachname</usr_name>
|
||
<usr_firstname>Vorname</usr_firstname>
|
||
<usr_email>Mailadresse</usr_email>
|
||
<usr_mobile>Mobilnummer</usr_mobile>
|
||
<account>Nachname</account>
|
||
<password>Passwort</password>
|
||
....
|
||
|
||
|
||
// ****************************************************************************************************
|
||
// **** [B] Ablaufschritte für die Einzelfreischaltung der APP (= "Registrierung" der App-Instanz) ****
|
||
// ****************************************************************************************************
|
||
|
||
|
||
1. Schritt:
|
||
|
||
Die Freischaltungsanfrage bei einer neu heruntergeladenen APP oder bei einer manuellen
|
||
Deaktivierung des APP-Schlüssels durch autorisierte Personen sendet den neuen eingegebenen
|
||
Freischaltungscode an den Server.
|
||
Die APP-ID ist vorerst statisch die "101" (ADSG-APP).
|
||
|
||
// Request-Bsp.
|
||
<adsg_req>
|
||
<id>appRegister</id>
|
||
<app_key>Rc34rFghZ78tx</app_key> // Registrierungscode
|
||
<app_id>101</app_id> // ID der APP
|
||
</adsg_req>
|
||
|
||
// Response-Bsp.
|
||
<data>
|
||
<err_no>0</err_no> // Verifikation Registrierungscode ok, wenn = "0"
|
||
<mo_id>100</mo_id> // Interne Nummer der Datenbank-Instanz, auf die der Server zugreifen muss (z.B "8")
|
||
<usr_id>23</usr_id> // Eindeutige ID des Benutzers der korrespondierenden DB-Instanz
|
||
</data>
|
||
|
||
|
||
2. Schritt:
|
||
|
||
Nach der erfolgreichen Freischaltung erfolgt ein sich anschließender Login-Prozess.
|
||
|
||
// Request-Bsp.
|
||
<adsg_req>
|
||
<id>login</id>
|
||
<mo_id>100</mo_id> // Instanz der DB, auf die zugegriffen werden muss
|
||
<usr_id>23</usr_id> // Benutzer-ID
|
||
<app_key>Rc34rFghZ78tx</app_key> // Registrierungscode (wird auch wieder mitgegeben zum Abgleich ob serverseitig zurückgesetzt)
|
||
<app_id>101</app_id> // ID der APP (wird mitgeführt wg. Check des Registrierungscodes)
|
||
</adsg_req>
|
||
|
||
// Response-Bsp.
|
||
<data>
|
||
<err_no>0</err_no> // Login ok, wenn = "0"
|
||
<session>....hash....</session>
|
||
<mo_id>100</mo_id>
|
||
<hq_id>....</hq_id>
|
||
<hq_name><![CDATA[....]]></hq_name>
|
||
<hqmnemonic>....</hqmnemonic>
|
||
<usr_id>23</usr_id>
|
||
<usr_name><![CDATA[....]]></usr_name>
|
||
<usr_firstname><![CDATA[....]]></usr_firstname>
|
||
<usr_type><![CDATA[....]]></usr_type>
|
||
</data>
|
||
|
||
|
||
3. Schritt:
|
||
|
||
Requests für operative Daten. Senden des Events mit Koordinaten
|
||
|
||
// Request-Bsp.
|
||
<adsg_req>
|
||
<id>setTimekeepingEvent</id>
|
||
<session>HASH</session>
|
||
<mo_id>100</mo_id>
|
||
<usr_id>23</usr_id>
|
||
....
|
||
</adsg_req>
|
||
|
||
// Response-Bsp.
|
||
<data>
|
||
<err_no>0</err_no> // Operation ok, wenn = "0"
|
||
....
|
||
</data>
|
||
|
||
|
||
// ********************************
|
||
// **** [C] Operative Requests ****
|
||
// ********************************
|
||
|
||
// **** Liste der Niederlassungen ****
|
||
|
||
<adsg_req>
|
||
<id>getHeadquartersList</id>
|
||
<session>29142dea6c4002cc7bf88714ca4238a0b9531281ac23820dcc509a6f</session>
|
||
<mo_id>100</mo_id>
|
||
<usr_id>314282</usr_id>
|
||
<payload>
|
||
</payload>
|
||
</adsg_req>
|
||
|
||
|
||
// **** Kontaktliste auf Basis des Suchbegriffs ****
|
||
|
||
// Request
|
||
<adsg_req>
|
||
<id>getContactList</id>
|
||
<session>HASH</session>
|
||
<mo_id>100</mo_id>
|
||
<usr_id>23</usr_id>
|
||
<payload>
|
||
<search>Suchbegriff</search>
|
||
<category>1</category>
|
||
<hq_id>Niederlassungs-ID</hq_id> // Muss gesetzt sein
|
||
<obj_type>cs</obj_type> // cs = customer => (Alle) Kontakte mit einem Kundenbezug
|
||
<obj_id>77</obj_d> // z.B. eine konkrete "cs_id" bei Typ "cs" => Kontakte nur dieses Kunden
|
||
<prefix>yes</prefix> // Wenn nur eine Präfix-Suche initiert werden soll, dann "YES" oder "1"
|
||
</payload>
|
||
</adsg_req>
|
||
|
||
// Response
|
||
<data>
|
||
<contact_header>
|
||
<label_1>Bezeichnung</label_1>
|
||
<label_2>Bezeichnung</label_2>
|
||
....
|
||
</contact_header>
|
||
<contact_list>
|
||
<contact>
|
||
<val_1>Wert</val_1>
|
||
<val_2>Wert</val_2>
|
||
....
|
||
</contact>
|
||
<contact>
|
||
....
|
||
</contact>
|
||
....
|
||
</contact_list>
|
||
</data>
|
||
|
||
|
||
// **** Kundenliste auf Basis des Suchbegriffs ****
|
||
|
||
// Request
|
||
<adsg_req>
|
||
<id>getCustomerList</id>
|
||
<session>HASH</session>
|
||
<mo_id>100</mo_id>
|
||
<usr_id>23</usr_id>
|
||
<payload>
|
||
<search>Suchbegriff</search>
|
||
<hq_id>Niederlassungs-ID</hq_id>
|
||
</payload>
|
||
</adsg_req>
|
||
|
||
// Response
|
||
<data>
|
||
<customer_list>
|
||
<customer>
|
||
<cs_id>ID des Datensatzes</cs_id>
|
||
<cs_eid>Kundennummer</cs_eid>
|
||
<cmp_type></cmp_type>
|
||
<cmp_comp><![CDATA[Firma]]></cmp_comp>
|
||
<cmp_comp2><![CDATA[Firma2]]></cmp_comp2>
|
||
<usr_name><![CDATA[Nachname]]></usr_name>
|
||
<usr_firstname><![CDATA[Vorname]]></usr_firstname>
|
||
<usr_phone></usr_phone>
|
||
<usr_phone2></usr_phone2>
|
||
</customer>
|
||
<customer>
|
||
....
|
||
</customer>
|
||
....
|
||
</customer_list>
|
||
</data>
|
||
|
||
|
||
// **** Daten eines Kunden ****
|
||
|
||
// Request
|
||
<adsg_req>
|
||
<id>getCustomerSpecial</id>
|
||
<session>HASH</session>
|
||
<mo_id>100</mo_id>
|
||
<usr_id>23</usr_id>
|
||
<payload>
|
||
<cs_id>ID des Kundendatensatzes</cs_id> // (Entweder <cs_id> oder <cs_eid> gesetzt)
|
||
<cs_eid>Kundennummer (EID)</cs_eid>
|
||
<hq_id>Niederlassungs-ID</hq_id>
|
||
</payload>
|
||
</adsg_req>
|
||
|
||
// Response
|
||
<data>
|
||
<customer_special>
|
||
<customer>
|
||
<cs_id>ID des Datensatzes</cs_id>
|
||
<cs_eid>Kundennummer</cs_eid>
|
||
<cmp_type></cmp_type>
|
||
<cmp_comp><![CDATA[Firma]]></cmp_comp>
|
||
<cmp_comp2><![CDATA[Firma2]]></cmp_comp2>
|
||
<cmp_comp3><![CDATA[Firma3]]></cmp_comp3>
|
||
<cmp_comp4><![CDATA[Firma4]]></cmp_comp4>
|
||
<usr_name><![CDATA[Nachname]]></usr_name>
|
||
<usr_firstname><![CDATA[Vorname]]></usr_firstname>
|
||
<usr_phone></usr_phone>
|
||
<usr_phone2></usr_phone2>
|
||
<ad_street><![CDATA[Straße]]></ad_street>
|
||
<ad_houseno>Hausnummer<ad_houseno>
|
||
<ad_zipcode>PLZ<ad_zipcode>
|
||
<ad_city><![CDATA[Ort]]></ad_city>
|
||
</customer>
|
||
</customer_special>
|
||
</data>
|
||
|
||
|
||
// **** Kostenstellen eines Kunden ****
|
||
|
||
// Request
|
||
<adsg_req>
|
||
<id>getCostcenterListOfCustomer</id>
|
||
<session>HASH</session>
|
||
<mo_id>100</mo_id>
|
||
<usr_id>23</usr_id>
|
||
<payload>
|
||
<cs_id>ID des Kundendatensatzes</cs_id> // (Entweder <cs_id> oder <cs_eid> gesetzt)
|
||
<cs_eid>Kundennummer (EID)</cs_eid>
|
||
</payload>
|
||
</adsg_req>
|
||
|
||
// Response
|
||
<data>
|
||
<costcenter_list>
|
||
<costcenter>
|
||
<csc_id>Kostenstellen-ID des Datensatzes</csc_id>
|
||
<cs_id>ID des zugehörigen Kunden</cs_id>
|
||
<cs_eid>Kundennummer</cs_eid>
|
||
<csc_name><![CDATA[Kostenstellenname]]></csc_name>
|
||
<csc_pre_id>ID der übergeordneten Kostenstelle im Kostenstellenbaum</csc_pre_id>
|
||
<hq_id>ID der Niederlassung</hq_id>
|
||
</costcenter>
|
||
<costcenter>
|
||
....
|
||
</costcenter>
|
||
....
|
||
</costcenter_list>
|
||
</data>
|
||
|
||
// **** Kostenstellenadressen einer Kostenstelle ****
|
||
|
||
// Request
|
||
<adsg_req>
|
||
<id>getCostcenterAddressList</id>
|
||
<session>HASH</session>
|
||
<mo_id>100</mo_id>
|
||
<usr_id>23</usr_id>
|
||
<payload>
|
||
<csc_id>ID der Kostenstelle</csc_id>
|
||
</payload>
|
||
</adsg_req>
|
||
|
||
// Response
|
||
<data>
|
||
<costcenteraddress_list>
|
||
<costcenteraddress>
|
||
<csc_id>Kostenstellen-ID</csc_id>
|
||
<cscad_comp>Firma</cscad_comp>
|
||
<cscad_comp2>Firma2</cscad_comp2>
|
||
<cscad_comp3>Firma3</cscad_comp3>
|
||
<cscad_comp4>Firma4</cscad_comp4>
|
||
// <ad_id>ID der Adresse</ad_id>
|
||
<adt_id>ID des Adresstyps</adt_id> // 1 = Postanschrift, 2 = Rechnungsanschrift, 3 = Rechnungsversandanschrift, 4 = Abhol-/Lieferadresse
|
||
<ad_street><![CDATA[Straße]]></ad_street>
|
||
<cscad_hsno><![CDATA[Hausnummer]]></cscad_hsno>
|
||
<ad_zipcode><![CDATA[PLZ]]></ad_zipcode>
|
||
<ad_city><![CDATA[Ort]]></ad_city>
|
||
<cscad_floor><![CDATA[Etage]]></cscad_floor>
|
||
<cscad_remark><![CDATA[Bemerkung]]></cscad_remark>
|
||
<cscad_person><![CDATA[Person]]></cscad_person>
|
||
<cscad_phone><![CDATA[Telefon]]></cscad_phone>
|
||
<cscad_email><![CDATA[Email-Adresse]]></cscad_email>
|
||
</costcenteraddress>
|
||
<costcenteraddress>
|
||
....
|
||
</costcenteraddress>
|
||
....
|
||
</costcenteraddress_list>
|
||
</data>
|
||
|
||
|
||
// **** Transporteursliste auf Basis des Suchbegriffs ****
|
||
|
||
// Request
|
||
<adsg_req>
|
||
<id>getCourierList</id>
|
||
<session>HASH</session>
|
||
<mo_id>100</mo_id>
|
||
<usr_id>23</usr_id>
|
||
<payload>
|
||
<search>Suchbegriff</search>
|
||
<hq_id>Niederlassungs-ID</hq_id>
|
||
</payload>
|
||
</adsg_req>
|
||
|
||
// Response
|
||
<data>
|
||
<courier_list>
|
||
<courier>
|
||
<cr_id>ID des Datensatzes</cr_id>
|
||
<cr_eid>Kundennummer</cr_eid>
|
||
<cmp_type></cmp_type>
|
||
<cmp_comp><![CDATA[Firma]]></cmp_comp>
|
||
<cmp_comp2><![CDATA[Firma2]]></cmp_comp2>
|
||
<usr_name><![CDATA[Nachname]]></usr_name>
|
||
<usr_firstname><![CDATA[Vorname]]></usr_firstname>
|
||
<usr_phone></usr_phone>
|
||
<usr_phone2></usr_phone2>
|
||
</courier>
|
||
<courier>
|
||
....
|
||
</courier>
|
||
....
|
||
</courier_list>
|
||
</data>
|
||
|
||
|
||
// **** Daten eines Transporteurs ****
|
||
|
||
// Request
|
||
<adsg_req>
|
||
<id>getCourierSpecial</id>
|
||
<session>HASH</session>
|
||
<mo_id>100</mo_id>
|
||
<usr_id>23</usr_id>
|
||
<payload>
|
||
<cr_id>ID des Kundendatensatzes</cr_id> // (Entweder <cr_id> oder <cr_eid> gesetzt)
|
||
<cr_eid>Kundennummer (EID)</cr_eid>
|
||
<hq_id>Niederlassungs-ID</hq_id>
|
||
</payload>
|
||
</adsg_req>
|
||
|
||
// Response
|
||
<data>
|
||
<courier_special>
|
||
<courier>
|
||
<cs_id>ID des Datensatzes</cs_id>
|
||
<cs_eid>Kundennummer</cs_eid>
|
||
<cmp_type></cmp_type>
|
||
<cmp_comp><![CDATA[Firma]]></cmp_comp>
|
||
<cmp_comp2><![CDATA[Firma2]]></cmp_comp2>
|
||
<cmp_comp3><![CDATA[Firma3]]></cmp_comp3>
|
||
<cmp_comp4><![CDATA[Firma4]]></cmp_comp4>
|
||
<usr_name><![CDATA[Nachname]]></usr_name>
|
||
<usr_firstname><![CDATA[Vorname]]></usr_firstname>
|
||
<usr_phone></usr_phone>
|
||
<usr_phone2></usr_phone2>
|
||
<ad_street><![CDATA[Straße]]></ad_street>
|
||
<ad_houseno>Hausnummer<ad_houseno>
|
||
<ad_zipcode>PLZ<ad_zipcode>
|
||
<ad_city><![CDATA[Ort]]></ad_city>
|
||
</courier>
|
||
</courier_special>
|
||
</data>
|
||
|
||
|
||
// **** Fahrzeugliste auf Basis des Suchbegriffs ****
|
||
|
||
// Request
|
||
<adsg_req>
|
||
<id>getVehicleList</id>
|
||
<session>HASH</session>
|
||
<mo_id>100</mo_id>
|
||
<usr_id>23</usr_id>
|
||
<payload>
|
||
<search>Suchbegriff</search>
|
||
</payload>
|
||
</adsg_req>
|
||
|
||
// Response
|
||
<data>
|
||
<vehicle_list>
|
||
<vehicle>
|
||
<crvh_id>(Interne) ID des Datensatzes</crvh_id>
|
||
<crvh_sid>(Externe) Fahrzeugnummer</crvh_sid>
|
||
<cr_id>(Interne) ID des Fahrers, dem das Fahrzeug zugeordnet ist</cr_id>
|
||
<crvh_comm_no><![CDATA[Kommissionsnummer]]></crvh_comm_no>
|
||
<crvh_vh_sign><![CDATA[Kennzeichen]]></crvh_vh_sign>
|
||
<crvh_vh_name><![CDATA[Fahrzeugbezeichnung]]></crvh_vh_name>
|
||
</vehicle>
|
||
<vehicle>
|
||
....
|
||
</vehicle>
|
||
....
|
||
</vehicle_list>
|
||
</data>
|
||
|
||
|
||
// **** Daten eines Fahrzeugs ****
|
||
|
||
// Request
|
||
<adsg_req>
|
||
<id>getVehicle</id>
|
||
<session>HASH</session>
|
||
<mo_id>100</mo_id>
|
||
<usr_id>23</usr_id>
|
||
<payload>
|
||
<crvh_id>(Interne) ID des Fahrzeugdatensatzes</crvh_id>
|
||
</payload>
|
||
</adsg_req>
|
||
|
||
// Response
|
||
<data>
|
||
<vehicle_special>
|
||
<vehicle>
|
||
<crvh_id>(Interne) ID des Datensatzes</crvh_id>
|
||
<vht_id>Nummer des Fahrzeugtypes</vht_id> // Erfordert Mapping !!!!
|
||
<crvh_sid>(Externe) Fahrzeugnummer</crvh_sid>
|
||
<crvh_comm_no><![CDATA[Firma]]></crvh_comm_no>
|
||
<crvh_vh_sign><![CDATA[Kommissionsnummer]]></crvh_vh_sign>
|
||
<crvh_vh_name><![CDATA[Fahrzeugbezeichnung]]></crvh_vh_name>
|
||
<crvh_licence_date><![CDATA[Datum]]></crvh_licence_date>
|
||
<crvh_prov><![CDATA[Provision]]></crvh_prov>
|
||
<crvh_payload><![CDATA[Nutzlast]]></crvh_payload>
|
||
<crvh_totalweight><![CDATA[Gesamtgewicht]]></crvh_totalweight>
|
||
<crvh_length><![CDATA[Länge]]></crvh_length>
|
||
<crvh_width><![CDATA[Breite]]></crvh_width>
|
||
<crvh_height><![CDATA[Höhe]]></crvh_height>
|
||
<crvh_position><![CDATA[Stellplätze]]></crvh_position>
|
||
<crvh_aperture_height_side><![CDATA[Ladebreite]]></crvh_aperture_height_side>
|
||
<crvh_aperture_height_rear><![CDATA[Ladelänge]]></crvh_aperture_height_rear>
|
||
</vehicle>
|
||
<vehicle_special>
|
||
</data>
|
||
|
||
|
||
// *****************
|
||
// **** Termine ****
|
||
// *****************
|
||
|
||
// **** Initial folgend die Termin-Kategorien laden (!) ****
|
||
|
||
// Request
|
||
<adsg_req>
|
||
<id>getApEnvironment</id>
|
||
<session>HASH</session>
|
||
<service_context>groupware</service_context>
|
||
<mo_id>100</mo_id>
|
||
<usr_id>23</usr_id>
|
||
<payload>
|
||
<hq_id>NL-ID</hq_id>
|
||
</payload>
|
||
</adsg_req>
|
||
|
||
// Response
|
||
<data>
|
||
<apcat1_list>
|
||
<apcat1 id="1">
|
||
<name><![CDATA[geschäftlich]></name>
|
||
</apcat1 id="1">
|
||
<apcat1 id="2">
|
||
<name><![CDATA[privat]></name>
|
||
<apcat1 id="2">
|
||
....
|
||
</apcat1_list>
|
||
<apcat2_list>
|
||
<apcat2 id="1">
|
||
<name><![CDATA[nur für Teilnehmer]></name>
|
||
</apcat2 id="1">
|
||
<apcat2 id="2">
|
||
<name><![CDATA[nur für mich]></name>
|
||
</apcat2 id="2">
|
||
<apcat2 id="3">
|
||
<name><![CDATA[für alle]></name>
|
||
</apcat2 id="3">
|
||
....
|
||
</apcat2_list>
|
||
<apcat3_list>
|
||
<apcat3 id="1">
|
||
<name><![CDATA[Verschiedenes]></name>
|
||
</apcat3 id="1">
|
||
<apcat3 id="2">
|
||
<name><![CDATA[Abschluss]></name>
|
||
</apcat3 id="2">
|
||
<apcat3 id="3">
|
||
<name><![CDATA[Angebotserstellung]></name>
|
||
</apcat3 id="3">
|
||
....
|
||
</apcat3_list>
|
||
<apcat4_list>
|
||
<apcat4 id="1">
|
||
<name><![CDATA[Keine Terminüberwachung]></name>
|
||
</apcat4 id="1">
|
||
<apcat4 id="2">
|
||
<name><![CDATA[Terminüberwachung aktiviert]></name>
|
||
</apcat4 id="2">
|
||
....
|
||
</apcat4_list>
|
||
....
|
||
<possible_participants_list>
|
||
<possible_participant id="usr_id">
|
||
<usr_firstname><![CDATA[Vorname]]></usr_firstname>
|
||
<usr_name><![CDATA[Nachname]]></usr_name>
|
||
</possible_participant>
|
||
....
|
||
</possible_participants_list>
|
||
</data>
|
||
|
||
|
||
// **** Termine anfragen (eines Monats, einer Woche, eines Tages) ****
|
||
|
||
// Request (Monat)
|
||
<adsg_req>
|
||
<id>getAppointmentsOfOneMonth</id>
|
||
<session>HASH</session>
|
||
<mo_id>100</mo_id>
|
||
<usr_id>23</usr_id>
|
||
<service_context>groupware</service_context> // Statischer Text "groupware"
|
||
<payload>
|
||
<month>4</month>
|
||
<year>2017</year>
|
||
<hq_id>NL-ID</hq_id>
|
||
<usr_id>23</usr_id>
|
||
<cs_id>Kunden-ID</cs_id> // (Entweder beides leer (default) oder <cr_id> oder <cr_eid> gesetzt)
|
||
<cs_eid>Kundennummer</cs_eid>
|
||
</payload>
|
||
</adsg_req>
|
||
|
||
// Request (Tag)
|
||
<adsg_req>
|
||
<id>getAppointmentsOfOneDay</id>
|
||
<session>HASH</session>
|
||
<mo_id>100</mo_id>
|
||
<usr_id>23</usr_id>
|
||
<service_context>groupware</service_context> // Statischer Text "groupware"
|
||
<payload>
|
||
<day>7</day>
|
||
<month>4</month>
|
||
<year>2017</year>
|
||
.... siehe "getAppointmentsOfOneMonth" ....
|
||
</payload>
|
||
</adsg_req>
|
||
|
||
// Request (KW)
|
||
<adsg_req>
|
||
<id>getAppointmentsOfOneWeek</id>
|
||
<session>HASH</session>
|
||
<mo_id>100</mo_id>
|
||
<usr_id>23</usr_id>
|
||
<service_context>groupware</service_context> // Statischer Text "groupware"
|
||
<payload>
|
||
<week>15</week>
|
||
<year>2017</year>
|
||
.... siehe "getAppointmentsOfOneMonth" ....
|
||
</payload>
|
||
</adsg_req>
|
||
|
||
// Response (für alle Intervalle)
|
||
<data>
|
||
<appointment_list id=\"APL\">
|
||
<yeardata>
|
||
<year>2017</year>
|
||
<monthdata>
|
||
<month>04</month>
|
||
<days>
|
||
<daydata>
|
||
<day>dd</day>
|
||
<appointments>
|
||
<appointment>
|
||
<ap_id>ID des Termins</ap_id>
|
||
<ap_text><![CDATA[Termintext]]></ap_text>
|
||
<ap_execdate>Terminstart</ap_execdate>
|
||
<cmp_id>(Company(!)-)ID des Kunden, der dem Termin zugeordnet ist</cmp_id>
|
||
<cmp_comp><![CDATA[Firma]]></cmp_comp>
|
||
<cmp_comp2><![CDATA[Firma2]]></cmp_comp2>
|
||
<cs_eid>Kundennummer</cs_eid>
|
||
<ap_enddate>Terminende</ap_enddate>
|
||
<usr_id>ID des Erstellers</usr_id>
|
||
<usr_firstname><![CDATA[Vorname des Erstellers]]></usr_firstname>
|
||
<usr_name><![CDATA[Nachname des Erstellers]]></usr_name>
|
||
<ap_participants>
|
||
<ap_participant id=\"" . $tmpParticipantsArray[$j] . "\">
|
||
<name><![CDATA[Nachname des Teilnehmers]]></name>
|
||
<firstname><![CDATA[Vorname des Teilnehmers]]></firstname>
|
||
</ap_participant>
|
||
</ap_participants>
|
||
<ap_confirmed>Termin bestätigt?</ap_confirmed>
|
||
<cs_usr_name><![CDATA[Nachname Kunde]]></cs_usr_name>
|
||
<cs_usr_firstname><![CDATA[Vorname Kunde]]></cs_usr_firstname>
|
||
<cs_usr_phone>Telefon Kunde</cs_usr_phone>
|
||
<cs_usr_phone2>Telefon Kunde</cs_usr_phone2>
|
||
<ap_category_1>Zuordnung zur Kategorie 1</ap_category_1>
|
||
<ap_category_2>Zuordnung zur Kategorie 2</ap_category_2>
|
||
<ap_category_3>Zuordnung zur Kategorie 3</ap_category_3>
|
||
<ap_category_4>Zuordnung zur Kategorie 4</ap_category_4>
|
||
</appointment>
|
||
....
|
||
</appointments>
|
||
</daydata>
|
||
....
|
||
</days>
|
||
</monthdata>
|
||
....
|
||
</yeardata>
|
||
</appointment_list>
|
||
</data>
|
||
|
||
|
||
// **** Termin erzeugen (insert), ändern (update), entfernen (delete) ****
|
||
|
||
// Request
|
||
<adsg_req>
|
||
<id>actionAppointment</id>
|
||
<session>HASH</session>
|
||
<mo_id>DB</mo_id>
|
||
<usr_id>USR_ID</usr_id>
|
||
<payload>
|
||
<action></action> // "insert"|"update"|"delete"
|
||
<ap_id></ap_id> // ID Termin, erforderlich bei "update" und "delete"
|
||
<execdatetime></execdatetime> // Startzeitpunkt des Termins
|
||
<enddatetime></enddatetime> // Endezeitpunkt des Termins
|
||
<ap_cat1></ap_cat1> // Wert für Terminkategorie 1 (=> "getApEnvironment")
|
||
<ap_cat2></ap_cat2> // Wert für Terminkategorie 2 (=> "getApEnvironment")
|
||
<ap_cat3></ap_cat3> // Wert für Terminkategorie 3 (=> "getApEnvironment")
|
||
<ap_cat4></ap_cat4> // Wert für Terminkategorie 4 (=> "getApEnvironment")
|
||
<hq_id></hq_id>
|
||
<cs_id></cs_id> // Termin mit Kunden
|
||
<participants></participants> // Teilnehmer (kommaseparierte Liste mit mit "usr_id")
|
||
<ap_text><![CDATA[....]]></ap_text> // Berichtstext
|
||
</payload>
|
||
</adsg_req>
|
||
|
||
|
||
// **** Berichte (eines Kunden oder eines Transporteurs) für einen spezifizierten Zeitraum ****
|
||
|
||
// Request
|
||
<adsg_req>
|
||
<id>getReportList</id>
|
||
<session>HASH</session>
|
||
<mo_id>DB</mo_id>
|
||
<usr_id>USR_ID</usr_id>
|
||
<service_context>groupware</service_context> // Statischer Text "groupware"
|
||
<payload>
|
||
<fromdaterange>JJJJ-MM-TT</fromdaterange>
|
||
<todaterange>JJJJ-MM-TT</todaterange>
|
||
<rp_obj_type>cs</rp_obj_type> // Statisch "cs" wenn Kundenberichte ODER "cr" wenn Transporteursberichte
|
||
// => Vorerst Kunden
|
||
<rp_obj_id>CS_ID</rp_obj_id> // Interne Kunden-ID (= "cs_id") ODER Interne Transporteurs-ID (= "cr_id")
|
||
<rp_type></rp_type> // Optional aus vorher geladenen Termin-Kategorien per "getApEnvironment":
|
||
// 1="Verschiedenes", 2="Abschluss", 3="Angebotserstellung", ... 10="Konferenz/Seminar/Urlaub", ...
|
||
</payload>
|
||
</adsg_req>
|
||
|
||
// Response
|
||
<data>
|
||
<report_list>
|
||
<report>
|
||
<id>Berichts-ID</id>
|
||
<type>Berichtstyp (numerisch)</type>
|
||
<text>Berichtstext</text>
|
||
<confidential></confidential> // Wenn "1", dann "vertraulich"
|
||
<usrid>Ersteller-ID</usrid> // DEPRICATED, "<usr_id></usr_id>" nutzen
|
||
<usr_id>Ersteller-ID</usr_id>
|
||
<name></name> // Name des Erstellers
|
||
<firstname></firstname> // Vorname des Erstellers
|
||
<phone></phone> // Telefonnr. des Erstellers
|
||
<eid></eid> // EID des Kunden oder Transporteurs
|
||
<comp></comp> // Firma des Kunden oder Transporteurs
|
||
<comp2></comp2> // Firma2 des Kunden oder Transporteurs
|
||
<hq_id></hq_id> // Niederlassungs-ID
|
||
<hq_name></hq_name> // Name der Niederlassung
|
||
</report>
|
||
<report>
|
||
....
|
||
</report>
|
||
</report_list>
|
||
</data>
|
||
|
||
|
||
// **** Einzelner Bericht (eines Kunden oder eines Transporteurs) ****
|
||
|
||
// Request
|
||
<adsg_req>
|
||
<id>getReport</id>
|
||
<session>HASH</session>
|
||
<mo_id>DB</mo_id>
|
||
<usr_id>USR_ID</usr_id>
|
||
<service_context>groupware</service_context> // Statischer Text "groupware"
|
||
<payload>
|
||
<rp_id>Berichts-ID</rp_id> // ID des Berichts (für den spezifizierten Objekttyp)
|
||
<rp_obj_type>cs</rp_obj_type> // Statisch "cs" wenn Kundenberichte ODER "cr" wenn Transporteursberichte
|
||
// => Vorerst Kunden
|
||
</payload>
|
||
</adsg_req>
|
||
|
||
// Response
|
||
<data>
|
||
<report>
|
||
<id>Berichts-ID</id>
|
||
<type>Berichtstyp (numerisch)</type>
|
||
<text>Berichtstext</text>
|
||
<confidential></confidential> // Wenn "1", dann "vertraulich"
|
||
<usrid>Ersteller-ID</usrid> // DEPRICATED, "<usr_id></usr_id>" nutzen
|
||
<usr_id>Ersteller-ID</usr_id>
|
||
<name></name> // Name des Erstellers
|
||
<firstname></firstname> // Vorname des Erstellers
|
||
<phone></phone> // Telefonnr. des Erstellers
|
||
<eid></eid> // EID des Kunden oder Transporteurs
|
||
<comp></comp> // Firma des Kunden oder Transporteurs
|
||
<comp2></comp2> // Firma2 des Kunden oder Transporteurs
|
||
<hq_id></hq_id> // Niederlassungs-ID
|
||
<hq_name></hq_name> // Name der Niederlassung
|
||
</report>
|
||
</data>
|
||
|
||
|
||
// **** Bericht erzeugen (insert), ändern (update), entfernen (delete) ****
|
||
|
||
// Request
|
||
<adsg_req>
|
||
<id>actionReport</id>
|
||
<session>HASH</session>
|
||
<mo_id>DB</mo_id>
|
||
<usr_id>USR_ID</usr_id>
|
||
<payload>
|
||
<action></action> // "insert"|"update"|"delete"
|
||
<rp_id></rp_id> // ID Bericht, erforderlich bei "update" und "delete"
|
||
<rp_type></rp_type> // Berichtstyp, erforderlich bei "insert", optional bei "update"
|
||
<rp_obj_type></rp_obj_type> // "cs"|"cr" (Bericht für Kunde|Transporteur...)
|
||
<rp_obj_id></rp_obj_id> // ID Kunde/Transporteur
|
||
<rp_text><![CDATA[....]]></rp_text> // Berichtstext
|
||
<rp_confidential></rp_confidential> // Kennzeichen für "vertraulich" (= "1")
|
||
</payload>
|
||
</adsg_req>
|
||
|
||
BEISPIELE:
|
||
- Bsp.: Bericht neu (insert)
|
||
<adsg_req>
|
||
<id>actionReport</id>
|
||
<session>HASH</session>
|
||
<mo_id>DB</mo_id>
|
||
<usr_id>USR_ID</usr_id>
|
||
<payload>
|
||
<action>insert</action>
|
||
<rp_id></rp_id> // ID Bericht wird automatisch generiert
|
||
<rp_type>8</rp_type> // Berichtstyp wird überschrieben (=> Typen wie bei Terminen)
|
||
<rp_obj_type>cs</rp_obj_type> // hier Kunde
|
||
<rp_obj_id>789</rp_obj_id> // ID Kunde (cs_id)
|
||
<rp_text><![CDATA[Blah]]></rp_text> // Berichtstext
|
||
<rp_confidential></rp_confidential> // leer, nicht "vertraulich"
|
||
</payload>
|
||
</adsg_req>
|
||
- Bsp.: Bericht ändern (update)
|
||
<adsg_req>
|
||
<id>actionReport</id>
|
||
<session>HASH</session>
|
||
<mo_id>DB</mo_id>
|
||
<usr_id>USR_ID</usr_id>
|
||
<payload>
|
||
<action>update</action>
|
||
<rp_id>12345</rp_id> // ID Bericht, erforderlich bei "update"
|
||
<rp_type>4</rp_type> // Berichtstyp wird überschrieben (=> Typ wie bei Termin)
|
||
<rp_obj_type></rp_obj_type> // leer
|
||
<rp_obj_id></rp_obj_id> // leer
|
||
<rp_text><![CDATA[Blah]]></rp_text> // Berichtstext
|
||
<rp_confidential>1</rp_confidential> // hier "vertraulich"
|
||
</payload>
|
||
</adsg_req>
|
||
- Bsp.: Bericht entfernen (delete)
|
||
<adsg_req>
|
||
<id>actionReport</id>
|
||
<session>HASH</session>
|
||
<mo_id>DB</mo_id>
|
||
<usr_id>USR_ID</usr_id>
|
||
<payload>
|
||
<action>delete</action>
|
||
<rp_id>12345</rp_id> // ID Bericht, erforderlich bei "delete"
|
||
</payload>
|
||
</adsg_req>
|
||
|
||
// Response
|
||
<data>
|
||
<reports>
|
||
<report>
|
||
<action></action> // Angeforderte Aktion ("insert"|"update"|"delete")
|
||
<rp_id></rp_id> // Angeforderte oder erzeugte Berichts-ID
|
||
</report>\n";
|
||
</reports>\n";
|
||
</data>
|
||
|
||
|
||
// **** Statistik eines Kunden für einen spezifizierten Zeitraum ****
|
||
|
||
// Request
|
||
<adsg_req>
|
||
<id>getCsStatistic</id>
|
||
<session>HASH</session>
|
||
<mo_id>DB</mo_id>
|
||
<usr_id>USR_ID</usr_id>
|
||
<payload>
|
||
<cs_id>Kunden-ID</cs_id> // (Entweder beides leer (default) oder <cr_id> oder <cr_eid> gesetzt)
|
||
<cs_eid>Kundennummer</cs_eid>
|
||
<fromdaterange>JJJJ-MM-TT</fromdaterange>
|
||
<todaterange>JJJJ-MM-TT</todaterange>
|
||
</payload>
|
||
</adsg_req>
|
||
|
||
// Response
|
||
<data>
|
||
<customer_statistic>
|
||
<cs_id>CS_ID</cs_id>
|
||
<cs_eid>CS_EID</cs_eid>
|
||
<statistic_value>WERT</statistic_value>
|
||
</customer_statistic>
|
||
</data>
|
||
|
||
|
||
----------------------------------
|
||
|
||
actionAppointment
|
||
|
||
*/
|
||
?>
|