all headquarters) $f_hq_id_ext_len = 0; if ($userTypeName == "hq") : // Extended field needed for global parameters $f_hq_id_ext = getColVectorFromDB2Array("mandatorheadquarters","md_id",$md_id,"hq_id"); array_unshift($f_hq_id_ext, 0); $f_hq_id_ext_len = count($f_hq_id_ext); endif; // Special rights $empHasGeneralAccessToHeadquartersAdministration = authCheckEmployeeRights($emp_id, "47"); // General access to headquarters administration $empHasAccessregardingHeadquartersManager = authCheckEmployeeRights($emp_id, "32"); // Headquarters manager $empHasAccessToModifyPDALocatingState = authCheckEmployeeRights($emp_id, "9"); // VPA locating $empHasAccessToHeadquarters = authCheckEmployeeRights($emp_id, "10"); // Access to all headquarters $empHasAccessToEditBwvHotlineNumbers = authCheckEmployeeRights($emp_id, "45"); // BWV hotline // Current timestamp $currentTime = getDateTime("0"); // Get the emp_id of the root admin, e.g. setting new passwords of employees $empIdRootAdmin = getEmpIdOfRootAdmin($userTypeName); // For output only $styleDivWidth01 = "190px"; // Container for parameterizing lists if ($f_act != "") : // Change GLOBAL parameters (for headquarter) if ($f_act == "setGlobPar") : if ($empHasGeneralAccessToHeadquartersAdministration) : $tmpLogStr = ""; for ($f = 1; $f < $f_hq_id_ext_len; $f++) : getSecHttpVars("1",array("hq_data_cmp_comp_" . $f_hq_id_ext[$f], "hq_data_cmp_comp2_" . $f_hq_id_ext[$f], "hq_data_cmp_comp3_" . $f_hq_id_ext[$f], "hq_data_cmp_comp4_" . $f_hq_id_ext[$f], "hq_data_ad_street_" . $f_hq_id_ext[$f], "hq_data_cmp_hsno_" . $f_hq_id_ext[$f], "hq_data_ad_zipcode_" . $f_hq_id_ext[$f], "hq_data_ad_city_" . $f_hq_id_ext[$f])); $cmpComp = trim(${("hq_data_cmp_comp_" . $f_hq_id_ext[$f])}); $cmpComp2 = trim(${("hq_data_cmp_comp2_" . $f_hq_id_ext[$f])}); $cmpComp3 = trim(${("hq_data_cmp_comp3_" . $f_hq_id_ext[$f])}); $cmpComp4 = trim(${("hq_data_cmp_comp4_" . $f_hq_id_ext[$f])}); $adStreet = trim(${("hq_data_ad_street_" . $f_hq_id_ext[$f])}); $cmpHsno = trim(${("hq_data_cmp_hsno_" . $f_hq_id_ext[$f])}); $adZipcode = trim(${("hq_data_ad_zipcode_" . $f_hq_id_ext[$f])}); $adCity = trim(${("hq_data_ad_city_" . $f_hq_id_ext[$f])}); $hqCmpId = getFieldValueFromId("headquarters","hq_id", $f_hq_id_ext[$f],"cmp_id"); if ($hqCmpId != "" && is_numeric($hqCmpId) && $hqCmpId > 0) : updateStmt("company", "cmp_id", $hqCmpId, array("cmp_comp", $cmpComp, "cmp_comp2", $cmpComp2, "cmp_comp3", $cmpComp3, "cmp_comp4", $cmpComp4, "cmp_hsno", $cmpHsno)); $hqAdId = getFieldValueFromId("company","cmp_id", $hqCmpId,"ad_id"); if ($hqAdId != "" && is_numeric($hqAdId) && $hqAdId > 0) : updateStmt("address", "ad_id", $hqAdId, array("ad_street", $adStreet, "ad_zipcode", $adZipcode, "ad_city", $adCity)); else : insertStmt("address", array("ad_street", $adStreet, "ad_zipcode", $adZipcode, "ad_city", $adCity)); $adIdNew = getLastInsertID(); updateStmt("company", "cmp_id", $hqCmpId, array("ad_id", $adIdNew)); endif; endif; if ($tmpLogStr != "") : $tmpLogStr .= "|"; endif; $tmpLogStr .= $f . "=" . $hqCmpId . ";" . $hqAdId . ";" . $cmpComp . ";" . $cmpComp2 . ";" . $cmpComp3 . ";" . $cmpComp4 . ";" . $adStreet . ";" . $cmpHsno . ";" . $adZipcode . ";" . $adCity; endfor; // Write logdata into log database writeToLogDB("199",$hq_id,"",$usr_id,"","","","" . $tmpLogStr,"","",""); endif; if ($empHasGeneralAccessToHeadquartersAdministration && $empHasAccessToModifyPDALocatingState) : /* // Store value to enable/disable the PDA locating if (is_numeric($par_locatingByPDA)) : if (existsEntry("parameter",array("par_key","LOCATING_PDA_ENABLED","emp_id","0","hq_id",$hq_id))) : updateStmt("parameter", "emp_id", "0", array("par_value", $par_locatingByPDA), " par_key = 'LOCATING_PDA_ENABLED' AND hq_id = '" . $hq_id . "'"); else: insertStmt("parameter", array("par_key", "LOCATING_PDA_ENABLED", "emp_id", "0", "par_value", $par_locatingByPDA, "hq_id", $hq_id, "md_id", $md_id)); endif; else : $statusMessage = getLngt("Der Status konnte nicht geändert werden."); endif; // Store interval for the PDA locating if ($par_locatingFromHrs == "" || !is_numeric($par_locatingFromHrs)) : $par_locatingFromHrs = "0"; endif; if ($par_locatingFromMin == "" || !is_numeric($par_locatingFromMin)) : $par_locatingFromMin = "0"; endif; if ($par_locatingToHrs == "" || !is_numeric($par_locatingToHrs)) : $par_locatingToHrs = "23"; endif; if ($par_locatingToMin == "" || !is_numeric($par_locatingToMin)) : $par_locatingToMin = "59"; endif; // Check for from-time <= to-time if ($par_locatingToHrs < $par_locatingFromHrs || ($par_locatingToHrs == $par_locatingFromHrs && $par_locatingToMin < $par_locatingFromMin)) : $statusMessage = getLngt("Die obere Intervallgrenze für die VPA-Ortung ist kleiner als die untere. Bitte neu eingeben!"); else : if (existsEntry("parameter",array("par_key","LOCATING_PDA_INTERVAL","emp_id","0","hq_id",$hq_id))) : updateStmt("parameter", "emp_id", "0", array("par_value", $par_locatingFromHrs . "," . $par_locatingFromMin . "," . $par_locatingToHrs . "," . $par_locatingToMin), " par_key = 'LOCATING_PDA_INTERVAL' AND hq_id = '" . $hq_id . "'"); else: insertStmt("parameter", array("par_key", "LOCATING_PDA_INTERVAL", "emp_id", "0", "par_value", $par_locatingFromHrs . "," . $par_locatingFromMin . "," . $par_locatingToHrs . "," . $par_locatingToMin, "hq_id", $hq_id, "md_id", $md_id)); endif; endif; // Write logdata into log database writeToLogDB("194",$hq_id,"",$usr_id,"","","","LOC_GLOB_PAR_STATE=" . $par_locatingByPDA . "|LOC_GLOB_PAR_INTERVAL=" . $par_locatingFromHrs . "," . $par_locatingFromMin . "," . $par_locatingToHrs . "," . $par_locatingToMin,"","",""); */ endif; if ($empHasGeneralAccessToHeadquartersAdministration && $empHasAccessToEditBwvHotlineNumbers) : $tmpLogStr = ""; for ($f = 0; $f < $f_hq_id_ext_len; $f++) : // BWV-Hotline getSecHttpVars("1",array("par_BWV_phone_" . $f_hq_id_ext[$f])); $par_BWV_phone = ${("par_BWV_phone_" . $f_hq_id_ext[$f])}; if (existsEntry("parameter",array("par_key","BWV_PHONE_NO","emp_id","0","hq_id",$f_hq_id_ext[$f]))) : updateStmt("parameter", "emp_id", "0", array("par_value", $par_BWV_phone), " par_key = 'BWV_PHONE_NO' AND hq_id = '" . $f_hq_id_ext[$f] . "'"); else: insertStmt("parameter", array("par_key", "BWV_PHONE_NO", "emp_id", "0", "par_value", $par_BWV_phone, "hq_id", $f_hq_id_ext[$f], "md_id", $md_id)); endif; if ($tmpLogStr != "") : $tmpLogStr .= "|"; endif; $tmpLogStr .= $f . "=" . $par_BWV_phone; // GLN getSecHttpVars("1",array("par_GLN_" . $f_hq_id_ext[$f])); $par_GLN = ${("par_GLN_" . $f_hq_id_ext[$f])}; if ($f == 0) : if (existsEntry("parameter",array("par_key","GLN_HQ_ALL","emp_id","0","hq_id",$f_hq_id_ext[$f]))) : updateStmt("parameter", "emp_id", "0", array("par_value", $par_GLN), " par_key = 'GLN_HQ_ALL' AND hq_id = '" . $f_hq_id_ext[$f] . "'"); else: insertStmt("parameter", array("par_key", "GLN_HQ_ALL", "emp_id", "0", "par_value", $par_GLN, "hq_id", $f_hq_id_ext[$f], "md_id", $md_id)); endif; else : updateStmt("headquarters", "hq_id", $f_hq_id_ext[$f], array("hq_gln", $par_GLN), ""); endif; if ($tmpLogStr != "") : $tmpLogStr .= "|"; endif; $tmpLogStr .= "," . $par_GLN; // DUNS getSecHttpVars("1",array("par_DUNS_" . $f_hq_id_ext[$f])); $par_DUNS = ${("par_DUNS_" . $f_hq_id_ext[$f])}; if ($f == 0) : if (existsEntry("parameter",array("par_key","DUNS_HQ_ALL","emp_id","0","hq_id",$f_hq_id_ext[$f]))) : updateStmt("parameter", "emp_id", "0", array("par_value", $par_DUNS), " par_key = 'DUNS_HQ_ALL' AND hq_id = '" . $f_hq_id_ext[$f] . "'"); else: insertStmt("parameter", array("par_key", "DUNS_HQ_ALL", "emp_id", "0", "par_value", $par_DUNS, "hq_id", $f_hq_id_ext[$f], "md_id", $md_id)); endif; else : updateStmt("headquarters", "hq_id", $f_hq_id_ext[$f], array("hq_duns", $par_DUNS), ""); endif; if ($tmpLogStr != "") : $tmpLogStr .= "|"; endif; $tmpLogStr .= "," . $par_DUNS; endfor; // Write logdata into log database writeToLogDB("196",$hq_id,"",$usr_id,"","","","" . $tmpLogStr,"","",""); endif; endif; endif; // Button for setting GLOBAL PARAMETERS $buttonGlobalSettings = defineButtonType10(getLngt("Speichern"), "action_save_globs", "finishPage('" . ec("setGlobPar") . "');", "140", "left"); $outHqAddress = ""; $outHotlineBWV = ""; $outGLN = ""; $outDUNS = ""; $outVHT = ""; $outLocatingVPA = ""; if ($userTypeName == "hq") : // Headquarters master data (address, etc.) if ($empHasGeneralAccessToHeadquartersAdministration || $empHasAccessToHeadquarters) : $outHqAddress .= ""; for ($f = 1; $f < $f_hq_id_ext_len; $f++) : $hqCmpId = getFieldValueFromId("headquarters","hq_id", $f_hq_id_ext[$f],"cmp_id"); $hqCmpFields = getFieldsValueFromId("company", "cmp_id", $hqCmpId, array("cmp_comp","cmp_comp2","cmp_comp3","cmp_comp4","ad_id","cmp_hsno")); $cmpAdId = $hqCmpFields[4]; $hqAdFields = getFieldsValueFromId("address", "ad_id", $cmpAdId, array("ad_street","ad_zipcode","ad_city","ad_country")); $outHqAddress .= "