0) :
$dbConnectionArray["app_property"] = getDbConnectionSpecial($dbhostArray["as_intern"], "sysadmin", $dblogin, $dbpassword); // Change if migrated to another place
endif;
// Flag for "own disposition"
if ($f_cr_disposition == "" || count($f_cr_disposition) == 0) :
$f_cr_disposition = "0";
else:
$f_cr_disposition = "1";
endif;
// Flag for "own disposition"
if ($f_cr_app_blocked == "" || count($f_cr_app_blocked) == 0) :
$f_cr_app_blocked = "0";
else:
$f_cr_app_blocked = "1";
endif;
// Flag for displaying cartage in the app
if ($f_cr_price_show == "" || count($f_cr_price_show) == 0) :
$f_cr_price_show = "0";
else:
$f_cr_price_show = "1";
endif;
// Flag for no longhaul
if ($f_cmp_no_longhaul == "" || count($f_cmp_no_longhaul) == 0) :
$f_cmp_no_longhaul = "0";
else:
$f_cmp_no_longhaul = "1";
endif;
// Check displaying mode for field "cr_mobile_pda"
$parMaskCrMobilePdaEdit = getParameterValue("0", "MASK_CR_MOBILE_PDA_EDIT", $hq_id);
if ($parMaskCrMobilePdaEdit == "") :
$parMaskCrMobilePdaEdit = getParameterValue("0", "MASK_CR_MOBILE_PDA_EDIT", "0");
endif;
// Check for displaying report button for drivers associated to a parent carrier
$parMaskCrReportsHideForDriver = getParameterValue("0", "MASK_CR_REPORT_DRIVER_HIDE", $hq_id);
if ($parMaskCrReportsHideForDriver == "") :
$parMaskCrReportsHideForDriver = getParameterValue("0", "MASK_CR_REPORT_DRIVER_HIDE", "0");
endif;
// Get min length of the EID
$parMaskCrEidMinLength = getParameterValue("0", "MASK_COURIER_EID_LENGTH", $hq_id);
if ($parMaskCrEidMinLength == "") :
$parMaskCrEidMinLength = getParameterValue("0", "MASK_COURIER_EID_LENGTH", "0");
endif;
// Get max length of the EID
$parMaskCrEidMaxLength = getParameterValue("0", "MASK_COURIER_EID_MAX_LENGTH", $hq_id);
if ($parMaskCrEidMaxLength == "") :
$parMaskCrEidMaxLength = getParameterValue("0", "MASK_COURIER_EID_MAX_LENGTH", "0");
endif;
// Get mask parameter
$maskHideCrVhtInv = getParameterValue("0", "MASK_HIDE_CR_VHT_INV", $hq_id);
if ($maskHideCrVhtInv == "") :
$maskHideCrVhtInv = getParameterValue("0", "MASK_HIDE_CR_VHT_INV", "0");
endif;
// Check displaying mode for cartage matrix
$parMaskCrCartageLinksDisabled = getParameterValue("0", "MASK_CR_CARTAGE_LINKS_DISABLED", $hq_id);
if ($parMaskCrCartageLinksDisabled == "") :
$parMaskCrCartageLinksDisabled = getParameterValue("0", "MASK_CR_CARTAGE_LINKS_DISABLED", "0");
endif;
// Check mandatory fields to be filled
$checkMandatoryFieldsCr = "";
function checkMandatoryFieldsCr () {
global $f_cmp_comp, $f_cmp_contract_date_day, $f_cmp_contract_date_month, $f_cmp_contract_date_year;
global $f_usr_name, $f_usr_firstname, $f_usr_phone, $f_usr_account, $parMaskCrMobilePdaEdit, $f_cr_mobile_pda;
global $f_ad_street, $f_ad_zipcode, $f_ad_city, $f_cmp_hsno, $maskHideCrVhtInv, $f_vht_id_inv, $f_cmp_tax_idno, $f_cr_sid, $f_cr_eid, $f_cr_serialno;
$retStr = "";
$bgcol = "'red'";
/*
if ($f_cmp_comp == "") {$retStr .= "$('#f_cmp_comp').css('background-color', " . $bgcol . ");";};
if ($f_usr_name == "") {$retStr .= "$('#f_usr_name').css('background-color', " . $bgcol . ");";};
if ($f_usr_firstname == "") {$retStr .= "$('#f_usr_firstname').css('background-color', " . $bgcol . ");";};
if ($f_usr_phone == "") {$retStr .= "$('#f_usr_phone').css('background-color', " . $bgcol . ");";};
if ($f_usr_account == "") {$retStr .= "$('#f_usr_account').css('background-color', " . $bgcol . ");";};
if ($f_ad_street == "") {$retStr .= "$('#f_ad_street').css('background-color', " . $bgcol . ");";};
if ($f_cmp_hsno == "") {$retStr .= "$('#f_cmp_hsno').css('background-color', " . $bgcol . ");";};
if ($f_ad_zipcode == "") {$retStr .= "$('#f_ad_zipcode').css('background-color', " . $bgcol . ");";};
if ($f_ad_city == "") {$retStr .= "$('#f_ad_city').css('background-color', " . $bgcol . ");";};
if ($f_cmp_tax_idno == "") {$retStr .= "$('#f_cmp_tax_idno').css('background-color', " . $bgcol . ");";};
if (!(CR_SID_STATUS == "0" || $f_cr_sid != "")) {$retStr .= "$('#f_cr_sid').css('background-color', " . $bgcol . ");";};
if ($f_cr_eid == "") {$retStr .= "$('#f_cr_eid').css('background-color', " . $bgcol . ");";};
if ($f_cr_serialno == "") {$retStr .= "$('#f_cr_serialno').css('background-color', " . $bgcol . ");";};
// if ($xxxxxxxx == "") {$retStr .= "$('#xxxxxxxx').css('background-color', " . $bgcol . ");";};
if (!($parMaskCrMobilePdaEdit != "1" || $f_cr_mobile_pda != "")) {$retStr .= "$('#f_cr_mobile_pda').css('background-color', " . $bgcol . ");";};
if (!($maskHideCrVhtInv == "1" || $f_vht_id_inv != "")) {$retStr .= "$('#f_vht_id_inv').css('background-color', " . $bgcol . ");";};
*/
return $retStr;
}
// *******************************
// * Operations for the couriers *
// *******************************
// Generate log string
if ($f_act != "") :
$f_usr_name = trim($f_usr_name);
$f_usr_firstname = trim($f_usr_firstname);
$f_usr_email = trim($f_usr_email);
// Set coordinates for home zipcode or fallback address zipcode
if ($f_act == "newCourier") :
list($f_cr_gps_lat_home, $f_cr_gps_long_home) = setCrHomeCoordinatesByZipcode($f_cr_homezipcode, $f_ad_zipcode);
elseif ($f_act == "modifyCourier" && $companyId != "") :
list($f_cr_gps_lat_home, $f_cr_gps_long_home) = setCrHomeCoordinatesByZipcode($f_cr_homezipcode, $f_ad_zipcode, $companyId, "cmp");
endif;
$logString = makeLogString(array($f_cmp_authenticated,$f_cmp_comp,$f_cmp_comp2,$f_usr_name,$f_usr_firstname,$f_usr_phone,
$f_usr_phone2,$f_usr_fax,$f_usr_email,$f_cr_sid,$f_cr_eid,$f_vht_id_inv,$f_cr_maxweight,
$f_cr_outlay,$f_cmp_iln,$f_cmp_tax_idno,$f_cmp_bank,$f_cmp_bankno,$f_cmp_bankacc,
$f_cmp_bankmode,$f_usr_account,$f_ad_street,$f_cmp_hsno,$f_ad_zipcode,$f_ad_city,
$f_ad_country,$f_cr_eid_parent,$f_cr_vh_sign,$f_cr_imei,$f_cr_mobile_pda,
$f_cmp_remark,$f_cmp_remark2,$f_usr_birthdate,$f_cmp_stax_idno,$f_cmp_iban,$f_cmp_swift,
$f_usr_inv_email,$f_cr_disposition,$f_usr_country,$f_cmp_freetext1,$f_cr_price_show,
$f_cr_serialno, $f_cmp_contract_date, $f_cr_homezipcode, $f_cr_app_blocked,
$f_cr_gps_long_home, $f_cr_gps_lat_home, $f_cmp_no_longhaul), ";", "0");
endif;
// Insert new courier
if ($f_act == "newCourier") :
// Check mandatory fields to be filled
$checkMandatoryFieldsCr = checkMandatoryFieldsCr();
if ($checkMandatoryFieldsCr == "") :
// Parameter für checking company name
$parChkCmpDisabled = getParameterValue("0", "MASK_CR_CHK_CMP_EXIST_DISABLED", "0");
// Check unique account for all couriers (all data) except the current one to be updated
if ($db->getOne("SELECT usr.usr_id FROM user AS usr WHERE usr.usr_account = '" . $f_usr_account . "' ")) :
$statusMessage = "Der Benutzername existiert schon! Bitte wählen Sie einen anderen!";
elseif ($parChkCmpDisabled != "1" && $db->getOne("SELECT cmp.cmp_comp FROM company AS cmp, courier AS cr WHERE cmp.cmp_comp = '" . $f_cmp_comp . "' AND cmp.cmp_id = cr.cmp_id AND cr.hq_id = '" . $hq_id . "'")) :
$statusMessage = getLngt("Der Firmenname ist bereits vorhanden! Bitte wählen Sie einen anderen!");
// elseif ($db->getOne("SELECT cr_sid FROM courier WHERE cr_sid = '" . $f_cr_sid . "'")) :
// $statusMessage = "Die systemweit eindeutige Kuriernummer ist bereits vergeben! Bitte wählen Sie eine andere";
elseif (CR_SID_STATUS == "1" && $db->getOne("SELECT cr_sid FROM courier WHERE cr_sid = '" . $f_cr_sid . "' AND hq_id = '" . $hq_id . "'")) :
$statusMessage = getLngt("Die eindeutige Kuriernummer (SID) ist bereits vergeben! Bitte wählen Sie eine andere");
elseif ($db->getOne("SELECT cr_eid FROM courier WHERE cr_eid = '" . $f_cr_eid . "' AND hq_id = '" . $hq_id . "'")) :
$statusMessage = getLngt("Die eindeutige Kuriernummer (ExtID) ist bereits vergeben! Bitte wählen Sie eine andere");
elseif (checkPasswordValidation($f_usr_password,$f_usr_password2)) :
$addressValid = getGeoCoordinates($f_ad_street, $f_ad_zipcode, $f_ad_city, $f_cmp_hsno, $f_ad_country, "");
if ($addressValid != "") :
// Check zipcode and city
$addressValidityArray = checkCityZipcode($f_ad_zipcode, $f_ad_city, $f_ad_street);
if ($noValidationOfAddress || $addressValidityArray[0] >= 1) :
TA("B");
$currentTime = getDateTime("0");
// Insert user
$sqlStmtPwd = "INSERT INTO user (hq_id,usr_type,usr_name,usr_firstname,usr_email,usr_inv_email,usr_phone,usr_phone2,usr_fax,usr_account,usr_password,usr_password_modify,usr_birthdate,usr_country)" .
" VALUES ($hq_id,'3','$f_usr_name','$f_usr_firstname','$f_usr_email','$f_usr_inv_email','$f_usr_phone','$f_usr_phone2','$f_usr_fax','$f_usr_account',PASSWORD('$f_usr_password'),'$currentTime','$f_usr_birthdate','$f_usr_country')";
// writeDbLog($sqlStmtPwd);
$res = $db->query($sqlStmtPwd);
if (DB::isError($res)) : die ("$PHP_SELF: " . $res->getMessage()); endif;
$usr_id_new = getLastInsertID();
// Insert company
insertStmt("company", array("cmp_type", $f_cmp_type, "cmp_comp", $f_cmp_comp, "cmp_comp2", $f_cmp_comp2, "cmp_comp3", "", "cmp_comp4", "",
"cmp_hsno", $f_cmp_hsno, "cmp_iln", $f_cmp_iln, "cmp_tax_idno", $f_cmp_tax_idno, "cmp_stax_idno", $f_cmp_stax_idno,
"cmp_bank", $f_cmp_bank, "cmp_bankno", $f_cmp_bankno, "cmp_bankacc", $f_cmp_bankacc, "cmp_iban", $f_cmp_iban, "cmp_swift", $f_cmp_swift,
"cmp_authenticated", "1", "cmp_visible", "1", "cmp_no_longhaul", $f_cmp_no_longhaul, "cmp_remark", $f_cmp_remark, "cmp_remark2", $f_cmp_remark2, "cmp_freetext1", $f_cmp_freetext1,
"cmp_new_date", $currentTime, "cmp_contract_date", $f_cmp_contract_date, "cmp_modify_status", "1"));
$cmp_id_new = getLastInsertId();
// Check for mobile number
$writeLogCrMobilePda = false;
if ($parMaskCrMobilePdaEdit != "1" && $dbhostArrayLen > 0 && $dbConnectionArray["app_property"] != "") :
// Remove potential old association of the new number if it is NOT empty
$crEidWithSameMobileNo = "";
if ($f_cr_mobile_pda != "") :
$crIdWithMobileSameNo = getFieldValueFromId("courier", "cr_mobile_pda", $f_cr_mobile_pda, "cr_id");
if ($crIdWithMobileSameNo != "") :
updateStmt("courier","cr_id",$crIdWithMobileSameNo,array("cr_mobile_pda", ""));
$crEidWithSameMobileNo = getFieldValueFromId("courier", "cr_id", $crIdWithMobileSameNo, "cr_eid");
$statusMessage = getLngt("Die Mobilnummer wurde beim folgendem " . wrapPhrase("Transporteur", $objecttypemode) . " entfernt:") . " " . $crEidWithSameMobileNo;
endif;
endif;
$remDb = $db;
$db = $dbConnectionArray["app_property"];
// Make new association
updateStmt("sysadmin.conf_prop", "cp_secval", $f_cr_mobile_pda, array("usr_id", $usr_id_new), "cust_id = '" . $constGlobalDbInstNo . "' AND prop_id = '1' AND cp_secval != ''");
$db = $remDb;
// Write logdata into log database
$writeLogCrMobilePda = true;
endif;
// Insert courier
// [MC 20250908] :: Following phrase removed from following statement: "cr_sid", $f_cr_sid,
insertStmt("courier", array("cmp_id", $cmp_id_new, "hq_id", $hq_id, "usr_id", $usr_id_new, "cr_eid", $f_cr_eid,
"cr_id_parent", $f_cr_id_parent, "vht_id", "0", "vht_id_inv", $f_vht_id_inv, "cr_filter", "", "cr_vh_sign", $f_cr_vh_sign,
"cr_imei", $f_cr_imei, "cr_serialno", $f_cr_serialno, "cr_mobile_pda", $f_cr_mobile_pda, "cr_device_info", "", "cr_maxweight", $f_cr_maxweight,
"cr_outlay", $f_cr_outlay, "cr_locationzipcode", "", "cr_homezipcode", $f_cr_homezipcode, "cr_gps_long_home", $f_cr_gps_long_home, "cr_gps_lat_home", $f_cr_gps_lat_home, "cr_ar_jb_id", "0", "cr_available", $f_cr_available, "cr_mobile_cell", "",
"cr_disposition", $f_cr_disposition, "cr_price_show", $f_cr_price_show, "cr_app_blocked", $f_cr_app_blocked));
$cr_id_new = getLastInsertId();
// SET filter "VA" if $f_cr_app_blocked == "0"
if ($f_cr_app_blocked == "0") :
updateStmt("courier","cr_id",$cr_id_new,array("cr_filter", ",VA,"));
endif;
// Write log for changed mobile PDA with new cr_id
if ($writeLogCrMobilePda) :
writeToLogDB("117",$hq_id,"",$usr_id,$cr_id_new,"","","MSISDN_OLD=|MSISDN_NEW=" . $f_cr_mobile_pda . "|CR_EID_OLD=" . $crEidWithSameMobileNo);
endif;
// Insert address
$tmpArray = insertAddress($f_ad_street, $f_ad_zipcode, $f_ad_city, "", $f_ad_country, $noValidationOfAddress);
$ad_id_new = $tmpArray[0];
// Update (the new) company-entry with address-id
updateStmt("company", "cmp_id", $cmp_id_new, array("ad_id", $ad_id_new));
// Automatischer E-Mail-Versand eines systemgenerierten Passwortes ???
// Write logdata into log database
writeToLogDB("35",$hq_id,"",$usr_id,$cr_id_new,"","","OBJ_TYPE=CR|STATUS_NEW=" . $logString);
TA("C");
TA("E");
// ********** DPF **********
// Check according to personal embargo
// (NOT included in transaction)
$constDPFCourierEnabled = getParameterValue("0", "DPF_CR_ENABLED", "0"); // "Meta-Global" <=> hq_id = 0
if ($constDPFCourierEnabled == '1') :
$execEmbargoCheck = "1";
$cmpId = $cmp_id_new;
$eid = $f_cr_eid;
$usrName = $f_usr_name;
$usrFirstname = $f_usr_firstname;
$adStreet = $f_ad_street;
$cmpHsno = $f_cmp_hsno;
$adZipcode = $f_ad_zipcode;
$adCity = $f_ad_city;
// = $f_ad_country;
// Check for DPF checksum
$oldDpfChecksum = "";
$newDpfChecksum = md5($usrFirstname . $usrName . $adStreet . $cmpHsno . $adZipcode . $adCity);
updateStmt("company", "cmp_id", $cmp_id_new, array("cmp_dpf_checksum", $newDpfChecksum));
endif;
// ********** HASH **********
// Check for execute functionality
if ($GLOBAL_USAGE_HASH) :
// Get current global number of THIS database instance
$constProductionMode = getParameterValue("0", "GLOBAL_PRODUCTION_STATE", "0", "0");
if ($constProductionMode == "TEST") :
$constGlobalDbInstNo = "100";
else :
// $constGlobalDbInstNo = getParameterValue("0", "GLOBAL_UNIQUE_DB_INSTANCE_NO", "0", "0");
$constGlobalDbInstNo = getGlobalUniqueDbInstanceNo();
endif;
if ($constGlobalDbInstNo != "" && is_numeric($constGlobalDbInstNo)) :
// Generate unique hash value e.g. for newsletter of the courier
$tmpHashCR = makeMD5Hash($hq_id, $cr_id_new, $currentTime);
// Generate unique hash value e.g. for timetracking of the user
$tmpHashUSR = makeMD5Hash($hq_id, $usr_id_new, $currentTime);
// Get database instance connection data of metaobject
$constExtDbInst = getExternalMetaDbInst();
$db_conn = getDbConnectionSpecial($constExtDbInst, $dbname, $dblogin, $dbpassword);
$tmpSqlQuery = "INSERT meta_object.metaobject (mo_id_ref_db,mo_mnemonic,mo_name,mo_obj_type,mo_obj_id,mo_hash) VALUES ('" . $constGlobalDbInstNo . "','','','cr','" . $cr_id_new . "','" . $tmpHashCR . "') ";
$result = $db_conn->query($tmpSqlQuery);
$err = "";
if (DB::isError($result)) {$err = "ERR";};
if ($err == "ERR") :
// Message to system administrator...
// $statusMessage = getLngt("Message to system administrator...!");
endif;
$tmpSqlQuery = "INSERT meta_object.metaobject (mo_id_ref_db,mo_mnemonic,mo_name,mo_obj_type,mo_obj_id,mo_hash) VALUES ('" . $constGlobalDbInstNo . "','','','usr','" . $usr_id_new . "','" . $tmpHashUSR . "') ";
$result = $db_conn->query($tmpSqlQuery);
$err = "";
if (DB::isError($result)) {$err = "ERR";};
if ($err == "ERR") :
// Message to system administrator...
// $statusMessage = getLngt("Message to system administrator...!");
endif;
endif;
endif;
// Reset fields of form-parameters
clearParameters($httpVisualVars);
$f_usr_birthdate = "";
$f_cmp_contract_date = "";
$statusMessage = getLngt("Der Datensatz wurde gespeichert!");
else :
$statusMessage = getLngt("Die Postleitzahl passt nicht zu dem angegebenen Ort!");
$addressValidationErr = "1";
endif;
else :
$statusMessage = getLngt("Der Adress-Server kennt die eingebene Adresse nicht oder besitzt keine Geocodierung!");
endif;
endif;
else :
$statusMessage = getLngt("Bitte geben Sie alle mit * gekennzeichneten Felder ein!");
endif;
endif;
// Modify courier
if ($f_act == "modifyCourier" && $companyId != "") :
// Check mandatory fields to be filled
$checkMandatoryFieldsCr = checkMandatoryFieldsCr();
if ($checkMandatoryFieldsCr == "") :
if ($db->getOne("SELECT usr.usr_id FROM user AS usr WHERE usr.usr_account = '" . $f_usr_account . "' AND usr.usr_id != $f_usr_id")) :
$statusMessage = getLngt("Der Benutzername existiert schon! Bitte wählen Sie einen anderen!");
else :
$sqlquery = "SELECT cmp.cmp_comp, cr.cr_id, usr.usr_id, cr.cr_mobile_pda "
. " FROM user AS usr, courier AS cr, company AS cmp"
. " WHERE cmp.cmp_id = " . $companyId
. " AND cr.cmp_id = cmp.cmp_id"
. " AND usr.usr_id = cr.usr_id";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
while ($row = $result->fetch_assoc()):
$v_cmp_comp = $row["cmp_comp"];
$v_cr_id = $row["cr_id"];
$v_usr_id = $row["usr_id"];
$v_cr_mobile_pda = $row["cr_mobile_pda"];
endwhile;
$result->free();
if ($v_cr_id != "" && $v_usr_id != "") :
if (CR_SID_STATUS == "1" && $db->getOne("SELECT cr_sid FROM courier WHERE cr_sid = '" . $f_cr_sid . "' AND "
. " NOT (cr_id = '" . $v_cr_id . "') AND "
. " hq_id = '" . $hq_id . "'")) :
$statusMessage = getLngt("Die eindeutige Kuriernummer (SID) ist bereits vergeben! Bitte wählen Sie eine andere");
elseif ($db->getOne("SELECT cr_eid FROM courier WHERE cr_eid = '" . $f_cr_eid . "' AND "
. " NOT (cr_id = '" . $v_cr_id . "') AND "
. " hq_id = '" . $hq_id . "'")) :
$statusMessage = getLngt("Die eindeutige Kuriernummer (ExtID) ist bereits vergeben! Bitte wählen Sie eine andere");
else :
$addressValid = getGeoCoordinates($f_ad_street, $f_ad_zipcode, $f_ad_city, $f_cmp_hsno, $f_ad_country, "");
if ($addressValid != "") :
// Check zipcode and city
$addressValidityArray = checkCityZipcode($f_ad_zipcode, $f_ad_city, $f_ad_street);
if ($noValidationOfAddress || $addressValidityArray[0] >= 1) :
TA("B");
// Get current state in cmp_modify_status because it is equal to "1" then do NOT change
$modifyStatus = getFieldValueFromId("company", "cmp_id", $companyId, "cmp_modify_status");
if ($modifyStatus != "1") : $modifyStatus = "2"; endif;
// Update company
$defaultFields = array("cmp_type", $f_cmp_type,"cmp_comp",$f_cmp_comp,"cmp_comp2",$f_cmp_comp2,"cmp_hsno",$f_cmp_hsno,"cmp_iln",$f_cmp_iln,"cmp_tax_idno",$f_cmp_tax_idno,"cmp_stax_idno",$f_cmp_stax_idno,
"cmp_bank",$f_cmp_bank,"cmp_bankno",$f_cmp_bankno,"cmp_bankacc",$f_cmp_bankacc,"cmp_iban",$f_cmp_iban,"cmp_swift",$f_cmp_swift, "cmp_no_longhaul", $f_cmp_no_longhaul,
"cmp_remark",$f_cmp_remark,"cmp_remark2",$f_cmp_remark2,"cmp_freetext1",$f_cmp_freetext1,"cmp_contract_date",$f_cmp_contract_date,"cmp_modify_status",$modifyStatus);
updateStmt("company","cmp_id",$companyId,$defaultFields);
// Update courier mobile number and remove old association if does exist and update usr_id in meta table "conf_prop" for mobile client association
if ($parMaskCrMobilePdaEdit != "1" && $dbhostArrayLen > 0 && $dbConnectionArray["app_property"] != "") :
if ($v_cr_mobile_pda != $f_cr_mobile_pda) :
// Remove potential old association of the new number if it is NOT empty
$crEidWithSameMobileNo = "";
if ($f_cr_mobile_pda != "") :
$crIdWithMobileSameNo = getFieldValueFromId("courier", "cr_mobile_pda", $f_cr_mobile_pda, "cr_id");
if ($crIdWithMobileSameNo != "" && $crIdWithMobileSameNo != $v_cr_id) :
updateStmt("courier","cr_id",$crIdWithMobileSameNo,array("cr_mobile_pda", ""));
$crEidWithSameMobileNo = getFieldValueFromId("courier", "cr_id", $crIdWithMobileSameNo, "cr_eid");
$statusMessage = getLngt("Die Mobilnummer wurde beim folgendem " . wrapPhrase("Transporteur", $objecttypemode) . " entfernt:") . " " . $crEidWithSameMobileNo;
endif;
endif;
$remDb = $db;
$db = $dbConnectionArray["app_property"];
// Remove current association
updateStmt("sysadmin.conf_prop", "cp_secval", $v_cr_mobile_pda, array("usr_id", ''), "cust_id = '" . $constGlobalDbInstNo . "' AND prop_id = '1' AND cp_secval != ''");
// Make new association
updateStmt("sysadmin.conf_prop", "cp_secval", $f_cr_mobile_pda, array("usr_id", $v_usr_id), "cust_id = '" . $constGlobalDbInstNo . "' AND prop_id = '1' AND cp_secval != ''");
$db = $remDb;
// Write logdata into log database
writeToLogDB("117",$hq_id,"",$usr_id,$v_cr_id,"","","MSISDN_OLD=" . $v_cr_mobile_pda . "|MSISDN_NEW=" . $f_cr_mobile_pda . "|CR_EID_OLD=" . $crEidWithSameMobileNo);
else :
$remDb = $db;
$db = $dbConnectionArray["app_property"];
// Make new association
updateStmt("sysadmin.conf_prop", "cp_secval", $f_cr_mobile_pda, array("usr_id", $v_usr_id), "cust_id = '" . $constGlobalDbInstNo . "' AND prop_id = '1' AND cp_secval != ''");
$db = $remDb;
// Write logdata into log database
writeToLogDB("117",$hq_id,"",$usr_id,$v_cr_id,"","","MSISDN_OLD=" . $v_cr_mobile_pda . "|MSISDN_NEW=" . $f_cr_mobile_pda . "|CR_EID_OLD=IDENT");
endif;
endif;
// Update courier (with new mobile number)
// [MC 20250908] :: Following phrase removed from following statement: "cr_sid", $f_cr_sid,
$defaultFields = array("cr_eid", $f_cr_eid, "vht_id_inv", $f_vht_id_inv,
"cr_maxweight", $f_cr_maxweight, "cr_outlay", $f_cr_outlay, "cr_homezipcode", $f_cr_homezipcode, "cr_gps_long_home", $f_cr_gps_long_home, "cr_gps_lat_home", $f_cr_gps_lat_home,
"cr_id_parent", $f_cr_id_parent, "cr_vh_sign", $f_cr_vh_sign,
"cr_imei", $f_cr_imei, "cr_serialno", $f_cr_serialno, "cr_mobile_pda", $f_cr_mobile_pda, "cr_disposition", $f_cr_disposition, "cr_price_show", $f_cr_price_show,
"cr_app_blocked", $f_cr_app_blocked);
updateStmt("courier","cr_id",$v_cr_id,$defaultFields);
// REMOVE filter "VA" if $f_cr_app_blocked == "1" otherwise SET filter
$crFilter = getFieldValueFromId("courier", "cr_id", $v_cr_id, "cr_filter");
if ($f_cr_app_blocked == "1") :
$crFilter = removeItemFromFilterstringWithCommata($crFilter, "VA");
updateStmt("courier","cr_id",$v_cr_id,array("cr_filter", $crFilter));
else :
if ($crFilter != "") :
if (strpos($crFilter, ",VA,") === false) :
updateStmt("courier","cr_id",$v_cr_id,array("cr_filter", $crFilter . "VA,"));
endif;
else :
updateStmt("courier","cr_id",$v_cr_id,array("cr_filter", ",VA,"));
endif;
endif;
// Update user
$defaultFields = array("usr_name",$f_usr_name,"usr_firstname",$f_usr_firstname,"usr_email",$f_usr_email,"usr_inv_email",$f_usr_inv_email,"usr_phone",$f_usr_phone,"usr_phone2",$f_usr_phone2,"usr_fax",$f_usr_fax,"usr_account",$f_usr_account,"usr_birthdate",$f_usr_birthdate,"usr_country",$f_usr_country);
updateStmt("user","usr_id",$v_usr_id,$defaultFields);
// Get current address associated to the customer
$currAdress = getAddress($companyId, "company");
if ($currAdress["street"] != $f_ad_street || $currAdress["hsno"] != $f_cmp_hsno || $currAdress["zipcode"] != $f_ad_zipcode || $currAdress["city"] != $f_ad_city) :
$statusMessage .= getLngt("Die Adresse hat sich geändert. Haben sie eine neue Steuernummer und Gewerbeummeldung angefordert?");
endif;
// Insert address
$tmpArray = insertAddress($f_ad_street, $f_ad_zipcode, $f_ad_city, "", $f_ad_country, $noValidationOfAddress);
$ad_id_new = $tmpArray[0];
// Update (the new) company-entry with address-id
updateStmt("company", "cmp_id", $companyId, array("ad_id", $ad_id_new));
// Write logdata into log database
writeToLogDB("37",$hq_id,"",$usr_id,$v_cr_id,"","","OBJ_TYPE=CR|STATUS_MODIFIED=" . $logString);
// Senbd logout-command to app server in case the courier is blocked for using the app
if ($f_cr_app_blocked == "1") :
$f_act = "logoutCourier";
endif;
TA("C");
TA("E");
// ********** DPF **********
// Check according to personal embargo
// (NOT included in transaction)
$constDPFCourierEnabled = getParameterValue("0", "DPF_CR_ENABLED", "0"); // "Meta-Global" <=> hq_id = 0
if ($constDPFCourierEnabled == '1') :
$execEmbargoCheck = "1";
$cmpId = $companyId;
$eid = $f_cr_eid;
$usrName = $f_usr_name;
$usrFirstname = $f_usr_firstname;
$adStreet = $f_ad_street;
$cmpHsno = $f_cmp_hsno;
$adZipcode = $f_ad_zipcode;
$adCity = $f_ad_city;
// = $f_ad_country;
// Check for DPF checksum
$oldDpfChecksum = getFieldValueFromId("company", "cmp_id", $companyId, "cmp_dpf_checksum");
$newDpfChecksum = md5($usrFirstname . $usrName . $adStreet . $cmpHsno . $adZipcode . $adCity);
if ($oldDpfChecksum == $newDpfChecksum) :
$execEmbargoCheck = "0";
else :
updateStmt("company", "cmp_id", $companyId, array("cmp_dpf_checksum", $newDpfChecksum));
endif;
endif;
else :
$statusMessage = getLngt("Die Postleitzahl passt nicht zu dem angegebenen Ort!");
$addressValidationErr = "1";
endif;
else :
$statusMessage = getLngt("Der Adress-Server kennt die eingebene Adresse nicht oder besitzt keine Geocodierung!");
endif;
endif;
else :
$statusMessage = getLngt("Datenfehler! Merken Sie sich bitte den Datensatz und kontaktieren uns!!!");
endif;
endif;
else :
$statusMessage = getLngt("Bitte geben Sie alle mit * gekennzeichneten Felder ein!");
endif;
endif;
// Delete courier
if ($f_act == "removeCourier" && $companyId != "") :
// Get courier ID and user ID from the company ID
$sqlquery = "SELECT cr.cr_id, usr.usr_id "
. " FROM user AS usr, courier AS cr, company AS cmp"
. " WHERE cmp.cmp_id = " . $companyId
. " AND cr.cmp_id = cmp.cmp_id"
. " AND usr.usr_id = cr.usr_id";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
while ($row = $result->fetch_assoc()):
$v_cr_id = $row["cr_id"];
$v_usr_id = $row["usr_id"];
endwhile;
$result->free();
if ($v_cr_id != "" && $v_usr_id != "") :
// Check existence of reference(s) in job
$numOfJobs = getCountOfTable("job", $whereClause = "cr_id = '" . $v_cr_id . "'");
if ($numOfJobs <= 0) :
// Check existence of vehicles
$numOfVehicles = getCountOfTable("couriervehicle", $whereClause = "cr_id = '" . $v_cr_id . "'");
if ($numOfVehicles <= 0) :
if (!existsEntry("courier",array("cr_id_parent",$v_cr_id))) :
TA("B");
deleteStmt("courierdatatransfer","cr_id = ".$v_cr_id);
deleteStmt("customercourier","cr_id = ".$v_cr_id);
deleteStmt("user","usr_id = ".$v_usr_id . " AND hq_id = '" . $hq_id . "'");
deleteStmt("company","cmp_id = ".$companyId);
updateStmt("courier","cr_id_parent",$v_cr_id,array("cr_id_parent",""));
deleteStmt("courier","cr_id = ".$v_cr_id . " AND hq_id = '" . $hq_id . "'");
// Write logdata into log database
writeToLogDB("43",$hq_id,"",$usr_id,$v_cr_id,"","","STATUS_DELETED");
TA("C");
TA("E");
// Important: Initilization of the identificator
$companyId = "";
else :
$statusMessage = getLngt("Dem " . wrapPhrase("Transporteur", $objecttypemode) . " ist mind. noch ein anderen " . wrapPhrase("Transporteur", $objecttypemode) . " zugeordnet! Bitte entfernen Sie diese Beziehung(en) erst!");
endif;
else :
$statusMessage = getLngt("Dem " . wrapPhrase("Transporteur", $objecttypemode) . " sind noch Fahrzeuge zugeordnet! Bitte löschen Sie diese erst!");
endif;
else :
$statusMessage = getLngt("Der " . wrapPhrase("Transporteur", $objecttypemode) . " darf nicht gelöscht werden, da mindestens ein Auftrag bearbeitet wurde!");
endif;
endif;
endif;
// Set status of authentication of the courier
if ($f_act == "setAuthentication") :
// Check for company
if ($companyId != "") :
if (existsEntry("company",array("cmp_id",$companyId))) :
// Check in case the courier shall be set free but he/she is noticeable according to embargo check
$currentDPFState = getFieldValueFromId("company", "cmp_id", $companyId, "cmp_dpf_state");
if ($f_cmp_authenticated == "1" && $currentDPFState >= "1" && $currentDPFState <= "9") :
// Update DPF state
// Attention: Description of the states look for "dpf.php"
$newDPFState = $currentDPFState + 10;
updateStmt("company","cmp_id",$companyId,array("cmp_dpf_state",$newDPFState));
endif;
// Update authentication-status
updateStmt("company","cmp_id",$companyId,array("cmp_authenticated",$f_cmp_authenticated));
// Write logdata into log database
$v_cr_id = getFieldValueFromId("courier", "cmp_id", $companyId, "cr_id");
writeToLogDB("39",$hq_id,"",$usr_id,$v_cr_id,"","","STATUS_AUTHENTICATION=".$f_cmp_authenticated);
else :
$statusMessage = getLngt("Der spezifizierte " . wrapPhrase("Transporteur", $objecttypemode) . " ist nicht im Datenbestand erhalten!");
endif;
else :
$statusMessage = getLngt("Sie haben keinen " . wrapPhrase("Transporteur", $objecttypemode) . " spezifiziert!");
endif;
endif;
// Set status of visibility of the courier
if ($f_act == "setVisibility") :
// Check for company
if ($companyId != "") :
if (existsEntry("company",array("cmp_id",$companyId))) :
// Update visibility status
updateStmt("company","cmp_id",$companyId,array("cmp_visible",$f_cmp_visible));
// Write logdata into log database
$v_cr_id = getFieldValueFromId("courier", "cmp_id", $companyId, "cr_id");
writeToLogDB("41",$hq_id,"",$usr_id,$v_cr_id,"","","STATUS_VISIBILITY=".$f_cmp_visible);
else :
$statusMessage = getLngt("Der spezifizierte " . wrapPhrase("Transporteur", $objecttypemode) . " ist nicht im Datenbestand erhalten!");
endif;
else :
$statusMessage = getLngt("Sie haben keinen " . wrapPhrase("Transporteur", $objecttypemode) . " spezifiziert!");
endif;
endif;
// Logout the PDA of the courier ("time-thief")
if ($f_act == "logoutCourier") :
// Check for company
if ($companyId != "") :
if (existsEntry("company",array("cmp_id",$companyId))) :
$v_cr_id = getFieldValueFromId("courier", "cmp_id", $companyId, "cr_id");
$currentTime = getDateTime("0");
// Update availability status
// updateStmt("courier","cr_id",$v_cr_id,array("cr_available","0","cr_sid",""));
updateStmt("courier","cr_id",$v_cr_id,array("cr_availabletime",$currentTime,"cr_locationzipcode","LOGOUT"));
// Insert PDA command to quit application
$currentTime = getDateTime("0");
$execTimelimit = getDateTime("datetime_plus_offset", array(0,16,0,0,0,0), $formatStr = "Y-m-d H:i:s");
insertPDACommand($hq_id, $v_cr_id, "2", "1", "", $currentTime, $execTimelimit);
// Write logdata into log database
writeToLogDB("50",$hq_id,"",$usr_id,$v_cr_id,"","","STATUS_LOGOUT=PDA-LOGOUT DURCH WEB");
else :
$statusMessage = getLngt("Der spezifizierte " . wrapPhrase("Transporteur", $objecttypemode) . " ist nicht im Datenbestand erhalten!");
endif;
else :
$statusMessage = getLngt("Sie haben keinen " . wrapPhrase("Transporteur", $objecttypemode) . " spezifiziert!");
endif;
endif;
// Reset password
if ($f_act == "resetPasswdCourier") :
// Check for company
if ($companyId != "") :
if (existsEntry("company",array("cmp_id",$companyId))) :
$v_cr_id = getFieldValueFromId("courier", "cmp_id", $companyId, "cr_id");
$v_usr_id = getFieldValueFromId("courier", "cr_id", $v_cr_id, "usr_id");
$currentTime = getDateTime("0");
// Generate password
$v_usr_password = "test" . rand(1000,9999);
// Update password of the courier
$sqlStmt = "UPDATE user SET usr_password = PASSWORD('" . $v_usr_password . "'), usr_password_modify = '" . $currentTime . "' WHERE usr_id = '" . $v_usr_id . "'";
$res = $db->query($sqlStmt);
if (DB::isError($res)) die ("$PHP_SELF:
$sqlStmt
" . $res->getMessage());
// Write logdata into log database
writeToLogDB("84",$hq_id,"",$usr_id,$v_cr_id,"","","PASSWORD=RESET DURCH WEB");
$statusMessage = getLngt("Der neue Passwort lautet:") . " " . $v_usr_password;
else :
$statusMessage = getLngt("Der spezifizierte " . wrapPhrase("Transporteur", $objecttypemode) . " ist nicht im Datenbestand erhalten!");
endif;
else :
$statusMessage = getLngt("Sie haben keinen " . wrapPhrase("Transporteur", $objecttypemode) . " spezifiziert!");
endif;
endif;
// Reset 2-FA
if ($f_act == "reset2FACourier") :
// Check for company
if ($companyId != "") :
if (existsEntry("company",array("cmp_id",$companyId))) :
$v_cr_id = getFieldValueFromId("courier", "cmp_id", $companyId, "cr_id");
$retVal = user2FARemove($v_cr_id, "cr");
$statusMessage = $retVal[1];
else :
$statusMessage = getLngt("Der spezifizierte " . wrapPhrase("Transporteur", $objecttypemode) . " ist nicht im Datenbestand erhalten!");
endif;
else :
$statusMessage = getLngt("Sie haben keinen " . wrapPhrase("Transporteur", $objecttypemode) . " spezifiziert!");
endif;
endif;
// ******************************************************************
// * Selection of the courier-data only for the current headquarter *
// ******************************************************************
if ($companyId != "") :
$sqlquery = "SELECT cmp.cmp_id, cmp.cmp_comp, cmp.cmp_comp2, cmp.cmp_hsno, cmp.cmp_iln, cmp.cmp_tax_idno, cmp.cmp_stax_idno,"
. " cmp.cmp_bank, cmp.cmp_bankno, cmp.cmp_bankacc, cmp.cmp_iban, cmp.cmp_swift,"
. " cmp.cmp_authenticated, cmp.cmp_remark, cmp.cmp_remark2, cmp.cmp_visible, cmp.cmp_no_longhaul, cmp.cmp_freetext1, cmp.cmp_contract_date,"
. " cr.cr_id, cr.cr_sid, cr.cr_eid, cr.vht_id, cr.vht_id_inv, cr.cr_maxweight, cr.cr_outlay, cr.cr_homezipcode,"
. " cr.cr_available, cr.cr_id_parent, cr.cr_vh_sign, cr.cr_imei, cr.cr_serialno, cr.cr_mobile_pda, cr.cr_disposition,"
. " cr.cr_price_show, cr.cr_app_blocked,"
. " usr.usr_id, usr.usr_name, usr.usr_firstname, usr.usr_email, usr.usr_inv_email,"
. " usr.usr_phone, usr.usr_phone2, usr.usr_fax, usr.usr_account,usr.usr_birthdate,usr.usr_country,"
. " ad.ad_street, ad.ad_zipcode, ad.ad_city, ad.ad_country"
. " FROM company AS cmp, courier AS cr, user AS usr, address AS ad"
. " WHERE cmp.cmp_id = '" . $companyId . "' AND"
. " cmp.cmp_id = cr.cmp_id AND"
. " cr.usr_id = usr.usr_id AND"
. getSQLMandatorPhrase($emp_id, "usr.hq_id = '" . $hq_id . "' AND")
. " cmp.ad_id = ad.ad_id";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
while ($row = $result->fetch_assoc()):
$f_companyId = $row["cmp_id"];
$f_cmp_comp = $row["cmp_comp"];
$f_cmp_comp2 = $row["cmp_comp2"];
$f_cmp_hsno = $row["cmp_hsno"];
$f_cmp_iln = $row["cmp_iln"];
$f_cmp_tax_idno = $row["cmp_tax_idno"];
$f_cmp_stax_idno = $row["cmp_stax_idno"];
$f_cmp_bank = $row["cmp_bank"];
$f_cmp_bankno = $row["cmp_bankno"];
$f_cmp_bankacc = $row["cmp_bankacc"];
$f_cmp_iban = $row["cmp_iban"];
$f_cmp_swift = $row["cmp_swift"];
$f_cmp_no_longhaul = $row["cmp_no_longhaul"];
$f_cmp_remark = $row["cmp_remark"];
$f_cmp_remark2 = $row["cmp_remark2"];
$f_cmp_freetext1 = $row["cmp_freetext1"];
$f_cmp_contract_date = $row["cmp_contract_date"];
$f_cmp_authenticated = $row["cmp_authenticated"];
$f_cmp_authenticated2 = 0;
if ($f_cmp_authenticated != "1") :
$f_cmp_authenticated = 0;
$f_cmp_authenticated2 = 1;
endif;
$f_cmp_visible = $row["cmp_visible"];
$f_cmp_visible2 = 0;
if ($f_cmp_visible != "1") :
$f_cmp_visible = 0;
$f_cmp_visible2 = 1;
endif;
$f_cr_id = $row["cr_id"];
$f_cr_sid = $row["cr_sid"];
$f_cr_eid = $row["cr_eid"];
$f_cr_id_parent = $row["cr_id_parent"];
$f_cr_vh_sign = $row["cr_vh_sign"];
$f_cr_imei = $row["cr_imei"];
$f_cr_serialno = $row["cr_serialno"];
$f_cr_mobile_pda = $row["cr_mobile_pda"];
$f_cr_disposition = $row["cr_disposition"];
$f_cr_price_show = $row["cr_price_show"];
$f_cr_app_blocked = $row["cr_app_blocked"];
$f_vht_id = $row["vht_id"];
$f_vht_id_inv = $row["vht_id_inv"];
$f_cr_maxweight = $row["cr_maxweight"];
$f_cr_outlay = $row["cr_outlay"];
$f_cr_homezipcode = $row["cr_homezipcode"];
$f_cr_available = $row["cr_available"];
$f_usr_id = $row["usr_id"];
$f_usr_name = $row["usr_name"];
$f_usr_firstname = $row["usr_firstname"];
$f_usr_email = $row["usr_email"];
$f_usr_inv_email = $row["usr_inv_email"];
$f_usr_phone = $row["usr_phone"];
$f_usr_phone2 = $row["usr_phone2"];
$f_usr_fax = $row["usr_fax"];
$f_usr_account = $row["usr_account"];
$f_usr_birthdate = $row["usr_birthdate"];
$f_usr_country = $row["usr_country"];
$f_ad_street = $row["ad_street"];
$f_ad_zipcode = $row["ad_zipcode"];
$f_ad_city = $row["ad_city"];
$f_ad_country = $row["ad_country"];
endwhile;
$result->free();
endif;
// Get courier-sid|eid of the parent-id
if (CR_SID_STATUS == "1") :
$f_cr_sid_parent = getFieldValueFromId("courier", "cr_id", "$f_cr_id_parent", "cr_sid");
else :
$f_cr_eid_parent = getFieldValueFromId("courier", "cr_id", "$f_cr_id_parent", "cr_eid");
endif;
// Get max-value of the EID of the current courier for inserting a new row
// The constant value "CR_EID_GENERATION" contains the prefix of the SID [SPECIAL TREATMENT]
$f_eid_maxval = "";
if (CR_EID_GENERATION != "") :
$f_eid_maxval = getMaxOfField("courier", "cr_eid", "cr_eid < '" . CR_EID_GENERATION . "'");
if (is_numeric($f_eid_maxval)) :
++$f_eid_maxval; // Increment because of the next free EID (Attention: Not TA-safe!)
else :
// Remove alphanumeric chars (e.g "HTHB123456" => "123456")
$prefixChars = ereg_replace("[^[:alpha:]+]","",$f_eid_maxval);
$f_eid_maxval = ereg_replace("[^[:digit:]+]","",$f_eid_maxval);
++$f_eid_maxval;
$f_eid_maxval = $prefixChars . $f_eid_maxval;
endif;
endif;
// Birthdate
$f_usr_birthdate_day = "";
$f_usr_birthdate_month = "";
$f_usr_birthdate_year = "";
if ($f_usr_birthdate != "" && $f_usr_birthdate != "0000-00-00") :
$f_usr_birthdate_year = substr($f_usr_birthdate,0,4);
$f_usr_birthdate_month = substr($f_usr_birthdate,5,2);
$f_usr_birthdate_day = substr($f_usr_birthdate,8,2);
endif;
// Contract date
$f_cmp_contract_date_day = "";
$f_cmp_contract_date_month = "";
$f_cmp_contract_date_year = "";
if ($f_cmp_contract_date != "" && $f_cmp_contract_date != "0000-00-00") :
$f_cmp_contract_date_year = substr($f_cmp_contract_date,0,4);
$f_cmp_contract_date_month = substr($f_cmp_contract_date,5,2);
$f_cmp_contract_date_day = substr($f_cmp_contract_date,8,2);
endif;
// Own disposition
$f_cr_disposition_0 = "";
if ($f_cr_disposition == "1") : $f_cr_disposition_0 = "checked"; endif;
// App blocked
$f_cr_app_blocked_0 = "";
if ($f_cr_app_blocked == "1") : $f_cr_app_blocked_0 = "checked"; endif;
// Display cartage in app
$f_cr_price_show_0 = "";
if ($f_cr_price_show == "1") : $f_cr_price_show_0 = "checked"; endif;
// Flag for no longhaul
$f_cmp_no_longhaul_0 = "";
if ($f_cmp_no_longhaul == "1") : $f_cmp_no_longhaul_0 = "checked"; endif;
// Only for output
$pageHeadline = getLngt("NEUER " . strtoupper(wrapPhrase("Transporteur", $objecttypemode)));
$title = $pageHeadline;
$buttonAuthentication = "";
$buttonVisibility = "";
$buttonVehicles = "";
$buttonCustomer = "";
$buttonRemove = "";
$buttonLogout = "";
$buttonResetPasswd = "";
$buttonReset2FA = "";
$buttonCrHistory = "";
$buttonMessagegroup = "";
$buttonGroup = "";
$buttonPage2 = "";
$buttonFilter = "";
$buttonDocument = "";
$buttonReport = "";
$buttonLogout = "";
$displayTextAuthentication = "";
$displayTextVisibility = "";
$confirmTextAuthentication = "";
$confirmTextVisibility = "";
if ($companyId != "") :
$title = $f_cmp_comp;
$pageHeadline = "" . strtoupper(getLngt(wrapPhrase("TRANSPORTEUR", $objecttypemode))) . "" . " " . $f_cmp_comp . ($f_cmp_comp2 != "" ? " :: " . $f_cmp_comp2 : "");
// Get path for courier documents (type "CR")
if ($importPath == "") : $importPath = getFieldValueFromId("mandator","md_id",$md_id,"md_doc_path"); endif;
$importPath = getPathForObjectData($importPath, "CR");
// Get number of documents for the current customer
$crNumOfFiles = getNumOfFilesByFilterInFolder($importPath, $f_cr_eid . "_", "1");
$buttonAuthentication = defineButtonType10(getLngt("Sperren"), "action_lock", "authenticationFinishPage();", "100", "left", "0");
$confirmTextAuthentication = "Soll der Kurier wirklich gesperrt werden?";
if ($f_cmp_authenticated != "1") :
$buttonAuthentication = defineButtonType10(getLngt("Freischalten"), "action_unlock", "authenticationFinishPage();", "100", "left", "0");
$displayTextAuthentication = getLngt("(gesperrt)");
$confirmTextAuthentication = getLngt("Soll der Kurier wirklich freigeschaltet werden?");
endif;
$buttonVisibility = defineButtonType10(getLngt("Ausblenden"), "action_visible", "visibilityFinishPage();", "100", "left", "0");
$confirmTextVisibility = getLngt("Soll der " . wrapPhrase("Transporteur", $objecttypemode) . " wirklich ausgeblendet werden?");
if ($f_cmp_visible != "1") :
$buttonVisibility = defineButtonType10(getLngt("Einblenden"), "action_visible", "visibilityFinishPage();", "100", "left", "0");
$displayTextVisibility = getLngt("(ausgeblendet)");
$confirmTextVisibility = getLngt("Soll der " . wrapPhrase("Transporteur", $objecttypemode) . " wirklich eingeblendet werden?");
endif;
$buttonVehicles = defineButtonType10(getLngt("Fahrzeuge"), "action_crvh", "openCourierVehicles('" . ec($f_cr_id) . "');", "120", "left", "0");
$buttonCustomer = defineButtonType10(getLngt("Kunden"), "action_cs", "openCourierCustomers('" . ec($f_cr_id) . "');", "120", "left", "0");
$buttonRemove = defineButtonType10(getLngt("Löschen"), "action_remove", "removeCourierFinishPage();", "120", "left", "0");
$buttonLogout = defineButtonType10(getLngt("Logout VPA / PDA"), "action_logout", "logoutCourierFinishPage();", "158", "left", "0", "", "", "150px");
$buttonResetPasswd = defineButtonType10(getLngt("Neues Passwort"), "action_passwd", "resetPasswdCourierFinishPage();", "140", "left", "0", "", "", "150px");
$buttonCrHistory = defineButtonType10(getLngt("Änderungshistorie"), "action_cr_history", "openCrHistory('" . ec($f_cr_id) . "');", "190", "left", "0");
$buttonReset2FA = defineButtonType10(getLngt("2FA zurücksetzen"), "action_2fa", "reset2FACourierFinishPage();", "140", "left", "0", "", "", "150px");
$buttonMessagegroup = defineButtonType10(getLngt("Nachrichtengruppen"), "action_msggrps", "openMessageGroups('" . ec($f_cr_id) . "');", "158", "left", "0", "", "", "170px");
$buttonGroup = defineButtonType10(getLngt("Gruppen"), "action_grp", "openGroups('" . ec($f_cr_id) . "');", "120", "left", "0", "", "", "170px");
$buttonPage2 = defineButtonType10(getLngt("2. Seite"), "action_2ndpage", "openMetaFieldSpecial('3','" . ec($f_cr_id) . "');", "120", "left", "0");
$buttonFilter = defineButtonType10(getLngt("Filter"), "action_crf", "openCourierFilters();", "120", "left", "0");
if ($f_cr_id_parent == "" || $f_cr_id_parent == "0" || $parMaskCrReportsHideForDriver != "1") :
$buttonReport = defineButtonType10(getLngt("Berichte"), "action_rp", "openCourierReports('" . $f_cr_id . "');", "120", "left", "0");
endif;
$buttonDocument = defineLinkButtonType10(getLngt("Dokumente") . ($crNumOfFiles != "-1" ? ": " . $crNumOfFiles : ""), "action_dt_cr", "../import/data_transfer.php?objType=cr&objId=" . ec($f_cr_id), "160", "left", "1", "", "", "", "", "0");
if ($parMaskCrCartageLinksDisabled != "1") :
if (MASK_CUSTOMERDETAILS_TARGET == "1") :
if (authCheckEmployeeRights($emp_id, "2")) :
$serviceLink1 = "Service (Grundpreise, Kilometer, Radien, Zuschläge, Preis-/Leistungstypen): " . getLngt("Frachtvergütungen") . "/" .
"" . getLngt("Frachtvergütungsrabatte") . "\n";
$serviceLink2 = "PLZ: " . getLngt("Frachtvergütungen") . "/" .
"" . getLngt("Frachtvergütungsrabatte") . "\n";
$serviceLink3 = "Bereiche: " . getLngt("Frachtvergütungen") . "/" .
"" . getLngt("Frachtvergütungsrabatte") . "\n";
$serviceLink4 = "\n";
else :
$serviceLink1 = getLngt("Service: Preise/Rabatte") . "\n";
$serviceLink2 = getLngt("PLZ: Preise/Rabatte") . "\n";
$serviceLink3 = getLngt("PLZ-Bereiche: Preise/Rabatte") . "\n";
$serviceLink4 = "\n";
endif;
else :
if (authCheckEmployeeRights($emp_id, "2")) :
$serviceLink1 = "