0\nOK\n";
$xmlErrOut .= "100\nRequest denied.\n";
$xmlDosErrOut .= "999\nNo sir!\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 . "\n";
endif;
$xmlOut .= "\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 .= "" . $retVal[2] . "\n";
$xmlOut .= "" . $retVal[1] . "\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 .= "" . $retVal[2] . "\n";
$xmlOut .= "" . $retVal[1] . "\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 .= "" . $retVal[4] . "\n";
$xmlOut .= "" . $retVal[3] . "\n";
$xmlOut .= "" . $retVal[2] . "\n";
$xmlOut .= "\n";
$xmlOut .= "" . $retVal[8] . "\n";
$xmlOut .= "" . $retVal[1] . "\n";
$xmlOut .= "\n";
$xmlOut .= "\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 .= "" . $retVal[2] . "\n";
$xmlOut .= "" . $retVal[1] . "\n";
$xmlOut .= "\n";
$xmlOut .= "" . $retVal[4] . "\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 .= "" . $retVal[2] . "\n";
$xmlOut .= "" . $retVal[1] . "\n";
$xmlOut .= "\n";
$xmlOut .= "" . $retVal[4] . "\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 .= "" . $retVal[4] . "\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 .= "" . $retVal[1] . "\n";
$xmlOut .= "" . $retVal[2] . "\n";
$xmlOut .= "" . $retVal[5] . "\n";
$xmlOut .= "" . $retVal[3] . "\n";
$xmlOut .= "" . $retVal[4] . "\n";
$xmlOut .= "\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 .= "\n";
for ($i = 0; $i < $tmpKeysArrayLen; $i++) :
$xmlOut .= "\n";
$xmlOut .= " \n";
$xmlOut .= "\n";
endfor;
$xmlOut .= "\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 .= "\n";
while ($row = $result->fetch_assoc()):
$xmlOut .= "\n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= "\n";
endwhile;
$result->free();
$xmlOut .= "\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 .= "\n";
for ($i = 0; $i < $tmpKeysArrayLen; $i++) :
$xmlOut .= "\n";
$xmlOut .= " \n";
$xmlOut .= "\n";
endfor;
$xmlOut .= "\n";
endif;
elseif ($functionName == "calLastWeekNumofYear") :
$retVal = call_user_func_array($functionName, array($selYear)); // Gets the last calendar week (number) of a specified year
$xmlOut .= " \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 .= " \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 .= " \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 .= " \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 .= " \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 .= " \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 .= " \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 .= "\n";
$xmlOut .= "\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 .= "\n";
$xmlOut .= "\n";
endif;
if ($tmpRemMonth != "" && $tmpRemMonth != $tmpApMonth) :
$xmlOut .= "\n";
$xmlOut .= "\n";
endif;
// if ($tmpRemYear != "" && $tmpRemYear != $tmpApYear) :
// ...
// endif;
// Opening TAGs
if ($tmpRemYear == "" || $tmpRemYear != $tmpApYear) :
$tmpRemYear = $tmpApYear;
$xmlOut .= "" . $tmpApYear . "\n";
endif;
if ($tmpRemMonth == "" || $tmpRemMonth != $tmpApMonth) :
$tmpRemMonth = $tmpApMonth;
$tmpApNewMonthBool = true;
$xmlOut .= "\n";
$xmlOut .= "" . $tmpApMonth . "\n";
$xmlOut .= "\n";
endif;
if ($tmpRemDay == "" || $tmpRemDay != $tmpApDay) :
$tmpRemDay = $tmpApDay;
$tmpApNewDayBool = true;
$xmlOut .= "\n";
$xmlOut .= "" . $tmpApDay . "\n";
$xmlOut .= "\n";
endif;
// $xmlOut .= "\n";
$xmlOut .= "\n";
$xmlOut .= "" . $retVal[$i][0] . "\n";
$xmlOut .= "\n";
$xmlOut .= "" . $retVal[$i][2] . "\n";
$xmlOut .= "" . $retVal[$i][3] . "\n";
$xmlOut .= "\n";
$xmlOut .= "\n";
$xmlOut .= "" . $retVal[$i][7] . "\n";
$xmlOut .= "" . $retVal[$i][8] . "\n";
$xmlOut .= "" . $retVal[$i][9] . "\n";
$xmlOut .= "\n";
$xmlOut .= "\n";
if (false) :
$xmlOut .= "" . $retVal[$i][12] . "\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 .= "\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 .= "\n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= "\n";
endfor;
endif;
$xmlOut .= "\n";
endif;
$xmlOut .= "" . $retVal[$i][13] . "\n";
$xmlOut .= "\n";
$xmlOut .= "\n";
$xmlOut .= "" . $retVal[$i][16] . "\n";
$xmlOut .= "" . $retVal[$i][17] . "\n";
$xmlOut .= "" . $retVal[$i][18] . "\n";
$xmlOut .= "" . $retVal[$i][19] . "\n";
$xmlOut .= "" . $retVal[$i][20] . "\n";
$xmlOut .= "" . $retVal[$i][21] . "\n";
$xmlOut .= "\n";
endfor;
// Final closing TAGs
if ($tmpApNewDayBool) :
$xmlOut .= "\n";
$xmlOut .= "\n";
endif;
if ($tmpApNewMonthBool) :
$xmlOut .= "\n";
$xmlOut .= "\n";
endif;
$xmlOut .= "\n";
$xmlOut .= "\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 .= "\n";
$xmlOut .= "\n";
$xmlOut .= "" . $action . "\n";
$xmlOut .= "" . $retVal . "\n";
$xmlOut .= "\n";
$xmlOut .= "\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 .= "\n";
$itemLen = count($retVal[0]);
for ($j = 0; $j < $itemLen; $j++) :
$xmlOut .= " \n";
endfor;
$xmlOut .= "\n";
$xmlOut .= "\n";
for ($i = 1; $i < $retValLen; $i++) :
$xmlOut .= "\n";
$itemLen = count($retVal[$i]);
for ($j = 0; $j < $itemLen; $j++) :
$xmlOut .= " \n";
endfor;
$xmlOut .= "\n";
endfor;
$xmlOut .= "\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 .= "\n";
$itemLen = count($retVal[0]);
for ($j = 0; $j < $itemLen; $j++) :
$xmlOut .= " \n";
endfor;
$xmlOut .= "\n";
*/
$xmlOut .= "\n";
for ($i = 1; $i < $retValLen; $i++) :
$xmlOut .= "\n";
$itemLen = count($retVal[$i]);
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= "\n";
endfor;
$xmlOut .= "\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 .= "\n";
for ($i = 0; $i < $retValLen; $i++) :
// $xmlOut .= "\n";
$xmlOut .= "\n";
$xmlOut .= " " . $retVal[$i][0] . "\n";
$xmlOut .= " " . $retVal[$i][2] . "\n";
$xmlOut .= " " . $retVal[$i][1] . "\n";
$xmlOut .= " \n";
$xmlOut .= " \n";
// $xmlOut .= " \n";
// $xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " " . $retVal[$i][7] . "\n";
$xmlOut .= " " . $retVal[$i][8] . "\n";
// $xmlOut .= " \n";
// $xmlOut .= " " . $retVal[$i][10] . "\n";
// $xmlOut .= " " . $retVal[$i][11] . "\n";
// $xmlOut .= " \n";
$xmlOut .= "\n";
endfor;
$xmlOut .= "\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 .= "\n";
for ($i = 0; $i < $retValLen; $i++) :
// $xmlOut .= "\n";
$xmlOut .= "\n";
$xmlOut .= " " . $retVal[$i][0] . "\n";
$xmlOut .= " " . $retVal[$i][2] . "\n";
$xmlOut .= " " . $retVal[$i][1] . "\n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " " . $retVal[$i][7] . "\n";
$xmlOut .= " " . $retVal[$i][8] . "\n";
$xmlOut .= " \n";
$xmlOut .= " " . $retVal[$i][10] . "\n";
$xmlOut .= " " . $retVal[$i][11] . "\n";
$xmlOut .= " \n";
$xmlOut .= "\n";
endfor;
$xmlOut .= "\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 .= "\n";
for ($i = 0; $i < $retValLen; $i++) :
// $xmlOut .= "\n";
$xmlOut .= "\n";
$xmlOut .= " " . $retVal[$i][0] . "\n";
$xmlOut .= " " . $retVal[$i][1] . "\n";
$xmlOut .= " " . $retVal[$i][5] . "\n";
$xmlOut .= " \n";
$xmlOut .= " " . $retVal[$i][3] . "\n";
$xmlOut .= " " . $retVal[$i][4] . "\n";
$xmlOut .= "\n";
endfor;
$xmlOut .= "\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 .= "\n";
for ($i = 0; $i < $retValLen; $i++) :
$xmlOut .= "\n";
$xmlOut .= " " . $retVal[$i][0] . "\n";
$xmlOut .= " " . $retVal[$i][1] . "\n";
$xmlOut .= " " . $retVal[$i][2] . "\n";
$xmlOut .= " " . $retVal[$i][3] . "\n";
$xmlOut .= " " . $retVal[$i][4] . "\n";
// $xmlOut .= " " . $retVal[$i][5] . "\n";
$xmlOut .= " " . $retVal[$i][6] . "\n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= "\n";
endfor;
$xmlOut .= "\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 .= "\n";
for ($i = 0; $i < $retValLen; $i++) :
// $xmlOut .= "\n";
$xmlOut .= "\n";
$xmlOut .= " " . $retVal[$i][0] . "\n";
$xmlOut .= " " . $retVal[$i][1] . "\n";
$xmlOut .= " \n";
$xmlOut .= " " . $retVal[$i][3] . "\n";
$xmlOut .= " " . $retVal[$i][4] . "\n";
$xmlOut .= " " . $retVal[$i][5] . "\n";
$xmlOut .= " " . $retVal[$i][5] . "\n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " " . $retVal[$i][8] . "\n";
$xmlOut .= " " . $retVal[$i][9] . "\n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " " . $retVal[$i][12] . "\n";
$xmlOut .= " \n";
$xmlOut .= "\n";
endfor;
$xmlOut .= "\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 .= "\n";
for ($i = 0; $i < $retValLen; $i++) :
// $xmlOut .= "\n";
$xmlOut .= "\n";
$xmlOut .= " " . $retVal[$i][0] . "\n";
$xmlOut .= " " . $retVal[$i][1] . "\n";
$xmlOut .= " \n";
$xmlOut .= " " . $retVal[$i][3] . "\n";
$xmlOut .= " " . $retVal[$i][4] . "\n";
$xmlOut .= " " . $retVal[$i][5] . "\n";
$xmlOut .= " " . $retVal[$i][5] . "\n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " " . $retVal[$i][8] . "\n";
$xmlOut .= " " . $retVal[$i][9] . "\n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " " . $retVal[$i][12] . "\n";
$xmlOut .= " \n";
$xmlOut .= "\n";
endfor;
// $xmlOut .= "\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 .= "\n";
$xmlOut .= "\n";
$xmlOut .= "" . $action . "\n";
$xmlOut .= "" . $retVal[1] . "\n";
// $xmlOut .= "" . $retVal . "\n";
$xmlOut .= "\n";
$xmlOut .= "\n";
endif;
elseif ($functionName == "getCsStatistic") :
$retVal = call_user_func_array($functionName, array($csId, $fromDateRange, $toDateRange)); // Special customer statistic: Business volume
$xmlOut .= "\n";
$xmlOut .= "" . $csId . "\n";
$xmlOut .= "" . $csEid . "\n";
$xmlOut .= "" . $retVal . "\n";
$xmlOut .= "\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 .= "\n";
for ($i = 0; $i < $retValLen; $i++) :
// $xmlOut .= "\n";
$xmlOut .= "\n";
$xmlOut .= " " . $retVal[$i][0] . "\n";
$xmlOut .= " " . $retVal[$i][2] . "\n";
$xmlOut .= " " . $retVal[$i][1] . "\n";
$xmlOut .= " \n";
$xmlOut .= " \n";
// $xmlOut .= " \n";
// $xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " " . $retVal[$i][7] . "\n";
$xmlOut .= " " . $retVal[$i][8] . "\n";
// $xmlOut .= " \n";
// $xmlOut .= " " . $retVal[$i][10] . "\n";
// $xmlOut .= " " . $retVal[$i][11] . "\n";
// $xmlOut .= " \n";
$xmlOut .= "\n";
endfor;
$xmlOut .= "\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 .= "\n";
for ($i = 0; $i < $retValLen; $i++) :
// $xmlOut .= "\n";
$xmlOut .= "\n";
$xmlOut .= " " . $retVal[$i][0] . "\n";
$xmlOut .= " " . $retVal[$i][2] . "\n";
$xmlOut .= " " . $retVal[$i][1] . "\n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " " . $retVal[$i][7] . "\n";
$xmlOut .= " " . $retVal[$i][8] . "\n";
$xmlOut .= " \n";
$xmlOut .= " " . $retVal[$i][10] . "\n";
$xmlOut .= " " . $retVal[$i][11] . "\n";
$xmlOut .= " \n";
$xmlOut .= "\n";
endfor;
$xmlOut .= "\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 .= "\n";
for ($i = 0; $i < $retValLen; $i++) :
// $xmlOut .= "\n";
$xmlOut .= "\n";
$xmlOut .= " " . $retVal[$i][0] . "\n";
$xmlOut .= " " . $retVal[$i][4] . "\n";
$xmlOut .= " " . $retVal[$i][2] . "\n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " \n";
// $xmlOut .= " \n";
// $xmlOut .= " \n";
// $xmlOut .= " \n";
$xmlOut .= "\n";
endfor;
$xmlOut .= "\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 .= "\n";
// for ($i = 0; $i < $retValLen; $i++) :
// $xmlOut .= "\n";
$xmlOut .= "\n";
$xmlOut .= " " . $retVal["crvh_id"] . "\n";
$xmlOut .= " " . $retVal["vht_id"] . "\n";
$xmlOut .= " " . $retVal["crvh_sid"] . "\n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " \n";
$xmlOut .= " " . $retVal["crvh_licence_date"] . "\n";
$xmlOut .= " " . $retVal["crvh_prov"] . "\n";
$xmlOut .= " " . $retVal["crvh_payload"] . "\n";
$xmlOut .= " " . $retVal["crvh_totalweight"] . "\n";
$xmlOut .= " " . $retVal["crvh_length"] . "\n";
$xmlOut .= " " . $retVal["crvh_width"] . "\n";
$xmlOut .= " " . $retVal["crvh_height"] . "\n";
$xmlOut .= " " . $retVal["crvh_position"] . "\n";
$xmlOut .= " " . $retVal["crvh_aperture_height_side"] . "\n";
$xmlOut .= " " . $retVal["crvh_aperture_height_rear"] . "\n";
$xmlOut .= "\n";
// endfor;
$xmlOut .= "\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 .= "" . $retVal[1] . "\n";
$xmlOut .= "" . $retVal[2] . "\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 .= "" . $retVal[1] . "\n";
$xmlOut .= "" . $retVal[2] . "\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 .= "" . $retVal[1] . "\n";
$xmlOut .= "" . $retVal[2] . "\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 .= "";
$xmlOut .= "" . $tmpArr[$i]["bc_id"] . "\n";
if ($tmpArr[$i]["bco_obj_type"] == "usr") :
$xmlOut .= "" . $tmpArr[$i]["bco_obj_id"] . "\n";
elseif ($tmpArr[$i]["bco_obj_type"] == "cmp") :
$xmlOut .= "" . $tmpArr[$i]["bco_obj_id"] . "\n";
endif;
$xmlOut .= "" . $tmpArr[$i]["bco_points"] . "\n";
$xmlOut .= "";
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 .= "";
$xmlOut .= "" . $tmpArr[$i]["bc_id"] . "\n";
if ($tmpArr[$i]["bco_obj_type"] == "usr") :
$xmlOut .= "" . $tmpArr[$i]["bco_obj_id"] . "\n";
elseif ($tmpArr[$i]["bco_obj_type"] == "cmp") :
$xmlOut .= "" . $tmpArr[$i]["bco_obj_id"] . "\n";
endif;
$xmlOut .= "" . $tmpArr[$i]["bco_points"] . "\n";
$xmlOut .= "";
endfor;
endif;
else:
$xmlOut .= "109\n";
$xmlOut .= "Special database error.\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 .= "" . $retVal[1] . "\n";
$xmlOut .= "" . $retVal[2] . "\n";
if ($retVal[3] == "usr") :
$xmlOut .= "" . $retVal[4] . "\n";
elseif ($retVal[3] == "cmp") :
$xmlOut .= "" . $retVal[4] . "\n";
endif;
$xmlOut .= "" . $retVal[5] . "\n";
$xmlOut .= "" . $retVal[6] . "\n";
$xmlOut .= "" . $retVal[7] . "\n";
$xmlOut .= "" . $retVal[8] . "\n";
$xmlOut .= "\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 .= "";
$xmlOut .= "" . $tmpArr[$i]["bcta_id"] . "\n";
$xmlOut .= "" . $tmpArr[$i]["bc_id"] . "\n";
if ($tmpArr[$i]["bcta_obj_type"] == "usr") :
$xmlOut .= "" . $tmpArr[$i]["bcta_obj_id"] . "\n";
elseif ($tmpArr[$i]["bcta_obj_type"] == "cmp") :
$xmlOut .= "" . $tmpArr[$i]["bcta_obj_id"] . "\n";
endif;
$xmlOut .= "" . $tmpArr[$i]["shp_id"] . "\n";
$xmlOut .= "" . $tmpArr[$i]["bcta_value"] . "\n";
$xmlOut .= "" . $tmpArr[$i]["bcta_points"] . "\n";
$xmlOut .= "" . $tmpArr[$i]["bcta_createtime"] . "\n";
$xmlOut .= "\n";
$xmlOut .= "";
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 .= "";
$xmlOut .= "" . $tmpArr[$i]["bcta_id"] . "\n";
$xmlOut .= "" . $tmpArr[$i]["bc_id"] . "\n";
if ($tmpArr[$i]["bcta_obj_type"] == "usr") :
$xmlOut .= "" . $tmpArr[$i]["bcta_obj_id"] . "\n";
elseif ($tmpArr[$i]["bcta_obj_type"] == "cmp") :
$xmlOut .= "" . $tmpArr[$i]["bcta_obj_id"] . "\n";
endif;
$xmlOut .= "" . $tmpArr[$i]["shp_id"] . "\n";
$xmlOut .= "" . $tmpArr[$i]["bcta_value"] . "\n";
$xmlOut .= "" . $tmpArr[$i]["bcta_points"] . "\n";
$xmlOut .= "" . $tmpArr[$i]["bcta_createtime"] . "\n";
$xmlOut .= "\n";
$xmlOut .= "";
endfor;
endif;
else:
$xmlOut .= "109\n";
$xmlOut .= "Special database error.\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 .= "" . $retVal[1] . "\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 .= "" . $retVal[1] . "\n";
$xmlOut .= "" . $retVal[2] . "\n";
$xmlOut .= "" . $retVal[3] . "\n";
$xmlOut .= "" . $retVal[4] . "\n";
$xmlOut .= "" . $retVal[5] . "\n";
$xmlOut .= "" . $retVal[6] . "\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 .= "";
$xmlOut .= "" . $tmpArr[$i]["shp_id"] . "\n";
$xmlOut .= "" . $tmpArr[$i]["hq_id"] . "\n";
$xmlOut .= "" . $tmpArr[$i]["cmp_id"] . "\n";
$xmlOut .= "" . $tmpArr[$i]["shp_bc_active"] . "\n";
$xmlOut .= "" . $tmpArr[$i]["shp_bc_factor"] . "\n";
$xmlOut .= "" . $tmpArr[$i]["shp_bc_ta_limit"] . "\n";
$xmlOut .= "";
endfor;
endif;
else:
$xmlOut .= "109\n";
$xmlOut .= "Special database error.\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 .= "" . $retVal[1] . "\n";
$xmlOut .= "" . $retVal[2] . "\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 .= "" . $retVal[1] . "\n";
$xmlOut .= "" . $retVal[2] . "\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 .= "" . $retVal[1] . "\n";
$xmlOut .= "" . $retVal[2] . "\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 .= "" . $retVal[1] . "\n";
$xmlOut .= "" . $retVal[2] . "\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 .= "" . $retVal[1] . "\n";
$xmlOut .= "" . $retVal[2] . "\n";
if ($retVal[3] == "usr") :
$xmlOut .= "" . $retVal[4] . "\n";
elseif ($retVal[3] == "cmp") :
$xmlOut .= "" . $retVal[4] . "\n";
endif;
$xmlOut .= "" . $retVal[5] . "\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 .= "";
$xmlOut .= "" . $tmpArr[$i]["cpnta_id"] . "\n";
$xmlOut .= "" . $tmpArr[$i]["cpn_id"] . "\n";
if ($tmpArr[$i]["cpnta_obj_type"] == "usr") :
$xmlOut .= "" . $tmpArr[$i]["cpnta_obj_id"] . "\n";
elseif ($tmpArr[$i]["cpnta_obj_type"] == "cmp") :
$xmlOut .= "" . $tmpArr[$i]["cpnta_obj_id"] . "\n";
endif;
$xmlOut .= "" . $tmpArr[$i]["cpnta_createtime"] . "\n";
$xmlOut .= "";
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 .= "";
$xmlOut .= "" . $tmpArr[$i]["cpnta_id"] . "\n";
$xmlOut .= "" . $tmpArr[$i]["cpn_id"] . "\n";
if ($tmpArr[$i]["cpnta_obj_type"] == "usr") :
$xmlOut .= "" . $tmpArr[$i]["cpnta_obj_id"] . "\n";
elseif ($tmpArr[$i]["cpnta_obj_type"] == "cmp") :
$xmlOut .= "" . $tmpArr[$i]["cpnta_obj_id"] . "\n";
endif;
$xmlOut .= "" . $tmpArr[$i]["cpnta_createtime"] . "\n";
$xmlOut .= "";
endfor;
endif;
else:
$xmlOut .= "109\n";
$xmlOut .= "Special database error.\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 .= "" . $retVal[1] . "\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 .= "" . $retVal[1] . "\n";
$xmlOut .= "" . $retVal[2] . "\n";
$xmlOut .= "" . $retVal[3] . "\n";
$xmlOut .= "" . $retVal[4] . "\n";
$xmlOut .= "" . $retVal[5] . "\n";
$xmlOut .= "" . $retVal[6] . "\n";
$xmlOut .= "" . $retVal[7] . "\n";
$xmlOut .= "" . $retVal[8] . "\n";
$xmlOut .= "" . $retVal[9] . "\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 .= "";
$xmlOut .= "" . $tmpArr[$i]["gcpn_id"] . "\n";
$xmlOut .= "" . $tmpArr[$i]["gcpn_code"] . "\n";
$xmlOut .= "" . $tmpArr[$i]["gcpn_recipient"] . "\n";
$xmlOut .= "" . $tmpArr[$i]["gcpn_valid"] . "\n";
$xmlOut .= "" . $tmpArr[$i]["gcpn_value"] . "\n";
$xmlOut .= "" . $tmpArr[$i]["gcpn_freetext"] . "\n";
$xmlOut .= "" . $tmpArr[$i]["gcpn_image_name"] . "\n";
$xmlOut .= "" . $tmpArr[$i]["gcpn_payment_code"] . "\n";
$xmlOut .= "" . $tmpArr[$i]["gcpn_createtime"] . "\n";
$xmlOut .= "";
endfor;
endif;
else:
$xmlOut .= "109\n";
$xmlOut .= "Special database error.\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 .= "" . $retVal[1] . "\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 .= "103\n";
// $xmlOut .= "Function does not exist in API.\n";
endif;
endif;
else :
$xmlOut .= "103\n";
$xmlOut .= "Operational database cannot be connected.\n";
endif;
else :
$xmlOut .= "102\n";
$xmlOut .= "Specified function does not exist.\n";
endif;
else :
$xmlOut .= "101\n";
$xmlOut .= "No function specified.\n";
endif;
$xmlOut .= "" . $requestKey . "\n";
$xmlOut .= "\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:
001 // Verifikation Registrierungscode ok, wenn = "0"
.... // Fehlermeldung (001 - Registrierung fehlgeschlagen!)
....
// ************************************************************
// **** [A] Registrierung und Mandantenanlage über das WEB ****
// ************************************************************
....
webRegister
Firma
Nachname
Vorname
Mailadresse
Mobilnummer
Nachname
Passwort
....
// ****************************************************************************************************
// **** [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.
appRegister
Rc34rFghZ78tx // Registrierungscode
101 // ID der APP
// Response-Bsp.
0 // Verifikation Registrierungscode ok, wenn = "0"
100 // Interne Nummer der Datenbank-Instanz, auf die der Server zugreifen muss (z.B "8")
23 // Eindeutige ID des Benutzers der korrespondierenden DB-Instanz
2. Schritt:
Nach der erfolgreichen Freischaltung erfolgt ein sich anschließender Login-Prozess.
// Request-Bsp.
login
100 // Instanz der DB, auf die zugegriffen werden muss
23 // Benutzer-ID
Rc34rFghZ78tx // Registrierungscode (wird auch wieder mitgegeben zum Abgleich ob serverseitig zurückgesetzt)
101 // ID der APP (wird mitgeführt wg. Check des Registrierungscodes)
// Response-Bsp.
0 // Login ok, wenn = "0"
....hash....
100
....
....
23
3. Schritt:
Requests für operative Daten. Senden des Events mit Koordinaten
// Request-Bsp.
setTimekeepingEvent
HASH
100
23
....
// Response-Bsp.
0 // Operation ok, wenn = "0"
....
// ********************************
// **** [C] Operative Requests ****
// ********************************
// **** Liste der Niederlassungen ****
getHeadquartersList
29142dea6c4002cc7bf88714ca4238a0b9531281ac23820dcc509a6f
100
314282
// **** Kontaktliste auf Basis des Suchbegriffs ****
// Request
getContactList
HASH
100
23
Suchbegriff
1
Niederlassungs-ID // Muss gesetzt sein
cs // cs = customer => (Alle) Kontakte mit einem Kundenbezug
77 // z.B. eine konkrete "cs_id" bei Typ "cs" => Kontakte nur dieses Kunden
yes // Wenn nur eine Präfix-Suche initiert werden soll, dann "YES" oder "1"
// Response
Bezeichnung
Bezeichnung
....
Wert
Wert
....
....
....
// **** Kundenliste auf Basis des Suchbegriffs ****
// Request
getCustomerList
HASH
100
23
Suchbegriff
Niederlassungs-ID
// Response
ID des Datensatzes
Kundennummer
....
....
// **** Daten eines Kunden ****
// Request
getCustomerSpecial
HASH
100
23
ID des Kundendatensatzes // (Entweder oder gesetzt)
Kundennummer (EID)
Niederlassungs-ID
// Response
ID des Datensatzes
Kundennummer
Hausnummer
PLZ
// **** Kostenstellen eines Kunden ****
// Request
getCostcenterListOfCustomer
HASH
100
23
ID des Kundendatensatzes // (Entweder oder gesetzt)
Kundennummer (EID)
// Response
Kostenstellen-ID des Datensatzes
ID des zugehörigen Kunden
Kundennummer
ID der übergeordneten Kostenstelle im Kostenstellenbaum
ID der Niederlassung
....
....
// **** Kostenstellenadressen einer Kostenstelle ****
// Request
getCostcenterAddressList
HASH
100
23
ID der Kostenstelle
// Response
Kostenstellen-ID
Firma
Firma2
Firma3
Firma4
// ID der Adresse
ID des Adresstyps // 1 = Postanschrift, 2 = Rechnungsanschrift, 3 = Rechnungsversandanschrift, 4 = Abhol-/Lieferadresse
....
....
// **** Transporteursliste auf Basis des Suchbegriffs ****
// Request
getCourierList
HASH
100
23
Suchbegriff
Niederlassungs-ID
// Response
ID des Datensatzes
Kundennummer
....
....
// **** Daten eines Transporteurs ****
// Request
getCourierSpecial
HASH
100
23
ID des Kundendatensatzes // (Entweder oder gesetzt)
Kundennummer (EID)
Niederlassungs-ID
// Response
ID des Datensatzes
Kundennummer
Hausnummer
PLZ
// **** Fahrzeugliste auf Basis des Suchbegriffs ****
// Request
getVehicleList
HASH
100
23
Suchbegriff
// Response
(Interne) ID des Datensatzes
(Externe) Fahrzeugnummer
(Interne) ID des Fahrers, dem das Fahrzeug zugeordnet ist
....
....
// **** Daten eines Fahrzeugs ****
// Request
getVehicle
HASH
100
23
(Interne) ID des Fahrzeugdatensatzes
// Response
(Interne) ID des Datensatzes
Nummer des Fahrzeugtypes // Erfordert Mapping !!!!
(Externe) Fahrzeugnummer
// *****************
// **** Termine ****
// *****************
// **** Initial folgend die Termin-Kategorien laden (!) ****
// Request
getApEnvironment
HASH
groupware
100
23
NL-ID
// Response
....
....
....
....
....
....
// **** Termine anfragen (eines Monats, einer Woche, eines Tages) ****
// Request (Monat)
getAppointmentsOfOneMonth
HASH
100
23
groupware // Statischer Text "groupware"
4
2017
NL-ID
23
Kunden-ID // (Entweder beides leer (default) oder oder gesetzt)
Kundennummer
// Request (Tag)
getAppointmentsOfOneDay
HASH
100
23
groupware // Statischer Text "groupware"
7
4
2017
.... siehe "getAppointmentsOfOneMonth" ....
// Request (KW)
getAppointmentsOfOneWeek
HASH
100
23
groupware // Statischer Text "groupware"
15
2017
.... siehe "getAppointmentsOfOneMonth" ....
// Response (für alle Intervalle)
2017
04
dd
ID des Termins
Terminstart
(Company(!)-)ID des Kunden, der dem Termin zugeordnet ist
Kundennummer
Terminende
ID des Erstellers
Termin bestätigt?
Telefon Kunde
Telefon Kunde
Zuordnung zur Kategorie 1
Zuordnung zur Kategorie 2
Zuordnung zur Kategorie 3
Zuordnung zur Kategorie 4
....
....
....
// **** Termin erzeugen (insert), ändern (update), entfernen (delete) ****
// Request
actionAppointment
HASH
DB
USR_ID
// "insert"|"update"|"delete"
// ID Termin, erforderlich bei "update" und "delete"
// Startzeitpunkt des Termins
// Endezeitpunkt des Termins
// Wert für Terminkategorie 1 (=> "getApEnvironment")
// Wert für Terminkategorie 2 (=> "getApEnvironment")
// Wert für Terminkategorie 3 (=> "getApEnvironment")
// Wert für Terminkategorie 4 (=> "getApEnvironment")
// Termin mit Kunden
// Teilnehmer (kommaseparierte Liste mit mit "usr_id")
// Berichtstext
// **** Berichte (eines Kunden oder eines Transporteurs) für einen spezifizierten Zeitraum ****
// Request
getReportList
HASH
DB
USR_ID
groupware // Statischer Text "groupware"
JJJJ-MM-TT
JJJJ-MM-TT
cs // Statisch "cs" wenn Kundenberichte ODER "cr" wenn Transporteursberichte
// => Vorerst Kunden
CS_ID // Interne Kunden-ID (= "cs_id") ODER Interne Transporteurs-ID (= "cr_id")
// Optional aus vorher geladenen Termin-Kategorien per "getApEnvironment":
// 1="Verschiedenes", 2="Abschluss", 3="Angebotserstellung", ... 10="Konferenz/Seminar/Urlaub", ...
// Response
Berichts-ID
Berichtstyp (numerisch)
Berichtstext
// Wenn "1", dann "vertraulich"
Ersteller-ID // DEPRICATED, "" nutzen
Ersteller-ID
// Name des Erstellers
// Vorname des Erstellers
// Telefonnr. des Erstellers
// EID des Kunden oder Transporteurs
// Firma des Kunden oder Transporteurs
// Firma2 des Kunden oder Transporteurs
// Niederlassungs-ID
// Name der Niederlassung
....
// **** Einzelner Bericht (eines Kunden oder eines Transporteurs) ****
// Request
getReport
HASH
DB
USR_ID
groupware // Statischer Text "groupware"
Berichts-ID // ID des Berichts (für den spezifizierten Objekttyp)
cs // Statisch "cs" wenn Kundenberichte ODER "cr" wenn Transporteursberichte
// => Vorerst Kunden
// Response
Berichts-ID
Berichtstyp (numerisch)
Berichtstext
// Wenn "1", dann "vertraulich"
Ersteller-ID // DEPRICATED, "" nutzen
Ersteller-ID
// Name des Erstellers
// Vorname des Erstellers
// Telefonnr. des Erstellers
// EID des Kunden oder Transporteurs
// Firma des Kunden oder Transporteurs
// Firma2 des Kunden oder Transporteurs
// Niederlassungs-ID
// Name der Niederlassung
// **** Bericht erzeugen (insert), ändern (update), entfernen (delete) ****
// Request
actionReport
HASH
DB
USR_ID
// "insert"|"update"|"delete"
// ID Bericht, erforderlich bei "update" und "delete"
// Berichtstyp, erforderlich bei "insert", optional bei "update"
// "cs"|"cr" (Bericht für Kunde|Transporteur...)
// ID Kunde/Transporteur
// Berichtstext
// Kennzeichen für "vertraulich" (= "1")
BEISPIELE:
- Bsp.: Bericht neu (insert)
actionReport
HASH
DB
USR_ID
insert
// ID Bericht wird automatisch generiert
8 // Berichtstyp wird überschrieben (=> Typen wie bei Terminen)
cs // hier Kunde
789 // ID Kunde (cs_id)
// Berichtstext
// leer, nicht "vertraulich"
- Bsp.: Bericht ändern (update)
actionReport
HASH
DB
USR_ID
update
12345 // ID Bericht, erforderlich bei "update"
4 // Berichtstyp wird überschrieben (=> Typ wie bei Termin)
// leer
// leer
// Berichtstext
1 // hier "vertraulich"
- Bsp.: Bericht entfernen (delete)
actionReport
HASH
DB
USR_ID
delete
12345 // ID Bericht, erforderlich bei "delete"
// Response
// Angeforderte Aktion ("insert"|"update"|"delete")
// Angeforderte oder erzeugte Berichts-ID
\n";
\n";
// **** Statistik eines Kunden für einen spezifizierten Zeitraum ****
// Request
getCsStatistic
HASH
DB
USR_ID
Kunden-ID // (Entweder beides leer (default) oder oder gesetzt)
Kundennummer
JJJJ-MM-TT
JJJJ-MM-TT
// Response
CS_ID
CS_EID
WERT
----------------------------------
actionAppointment
*/
?>