Files
votianng/html/admin/employee.php
2026-03-29 10:34:57 +02:00

2103 lines
132 KiB
PHP

<?php
/*=======================================================================
*
* employee.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
include_once ("../include/inc_wording_wrapper.inc.php");
include_once ("../include/html.inc.php");
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act", "customerId", "cscIdRoot", "cscIdActual", "f_hq_id",
"emp_id_act", "usr_name", "usr_firstname", "usr_email", "usr_phone",
"usr_phone2", "usr_account", "usr_password", "usr_password2", "statusMessage",
"f_usr_birthdate_day", "f_usr_birthdate_month", "f_usr_birthdate_year",
"treeMode", "tableSort", "emp_rights", "par_stock_access",
"par_numOfJobLists", "par_modeCopyJob", "par_modeLaterJob", "par_joblistBrowseMax", "par_joblistShowUpToVht",
"par_modeJobNum", "par_modeJoblistRefresh", "par_modeJoblistGetCourierData", "par_ContentBgCols",
"par_dispoJbVhtGroup", "par_dispoJbVhtCustomer", "par_systemLanguage", "par_cc24",
"par_statusOfJobLists_1", "par_statusOfJobLists_2", "par_statusOfJobLists_3", "par_statusOfJobLists_4",
"par_locatingByPDA", "par_locatingFromHrs", "par_locatingFromMin", "par_locatingToHrs", "par_locatingToMin",
"rootStkIdForSubstkPar", "rootStkOpForSubstkPar", "par_substocks_readonly", "par_stk_article_access",
"deactivateMenu"));
// Check HTTP-Parameters for list configurations (customer, courier, ...)
$constNumOfFieldParameters = 45;
for ($j = 1; $j <= $constNumOfFieldParameters; $j++) :
// Field sequence
getSecHttpVars("1",array("par_csListConfig_" . $j));
getSecHttpVars("1",array("par_crListConfig_" . $j));
getSecHttpVars("1",array("par_jbListConfig_" . $j));
getSecHttpVars("1",array("par_cscscListConfig_" . $j));
// Field length
getSecHttpVars("1",array("par_csListLenConfig_" . $j));
getSecHttpVars("1",array("par_crListLenConfig_" . $j));
getSecHttpVars("1",array("par_jbListLenConfig_" . $j));
getSecHttpVars("1",array("par_cscscListLenConfig_" . $j));
endfor;
getLanguage(__FILE__);
$pageTitel = getLngt("MITARBEITER");
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
include_once ("../include/inc_stock.inc.php");
getCurrentScript(__FILE__);
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
$usrAccessArray["cs"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
function debug_stock ($parName, $parValue) {
echo $parName . ": ";
for ($j = 0; $j < count($parValue); $j++) :
echo getFieldValueFromId("stock","stk_id", $parValue[$j],"stk_name") . " | ";
endfor;
echo "<br>";
};
// Names of the headquarters e.g. for the global parameters
$hqNameArr = getColVectorFromDB2ArrayByClause("headquarters", "hq_name", "", "hq_id", "hq_id");
// All headquarters of the mandator and additional extended array with "0" (<=> 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;
// Get the rights of the employee logged in and check the accessibility
$empHasNoAccessToEmployees = FALSE;
$empHasNoAccessToModifyPDALocatingState = FALSE;
$empHasAccessToCC24 = FALSE;
$empHasAccessToResetPassword = FALSE;
$usrAccountReadOnly = "";
$empHasAccessToReset2FA = FALSE;
if ($userTypeName == "hq") :
if (!authCheckEmployeeRights($emp_id, "3")) : $empHasNoAccessToEmployees = TRUE; endif;
if (!authCheckEmployeeRights($emp_id, "9")) : $empHasNoAccessToModifyPDALocatingState = TRUE; endif;
if (authCheckEmployeeRights($emp_id, "34")) : $empHasAccessToCC24 = TRUE; endif;
if (authCheckEmployeeRights($emp_id, "37")) : $empHasAccessToResetPassword = TRUE; endif;
if (authCheckEmployeeRights($emp_id, "43")) : $empHasAccessToReset2FA = TRUE; endif;
elseif ($userTypeName == "cs") :
if (!authCheckEmployeeRights($emp_id, "2")) :
$empHasNoAccessToEmployees = TRUE;
endif;
$globalCustomerReadonlyDisabled = getParameterValue("0", "GLOBAL_CUSTOMER_READONLY_DISABLED", "0");
$usrDataEditable = FALSE;
$usrAccountReadOnly = " readonly";
if (authCheckEmployeeRights($emp_id, "10") || $globalCustomerReadonlyDisabled == "1") :
$usrDataEditable = TRUE;
$usrAccountReadOnly = "";
endif;
// else :
// die ("$PHP_SELF: Access denied!"); // REMARKED, because employee list will be restricted; emp. only can see himself !!!
endif;
$usrTypeEnabledFor2FA = getParameterValue("0", "USERTYPE_2FA_ENABLED", "0");
$usrNoDeactivationByUserOf2FA = getParameterValue("0", "USER_2FA_NO_DEACTIVATION", "0");
$ut2FAarr = explode(",", $usrTypeEnabledFor2FA);
// Birthdate
$f_usr_birthdate = "";
if ($f_usr_birthdate_year != "" && $f_usr_birthdate_month != "" && $f_usr_birthdate_day != "") :
$f_usr_birthdate = $f_usr_birthdate_year . "-" . pad($f_usr_birthdate_month, 2, "0") . "-" . pad($f_usr_birthdate_day, 2, "0");
endif;
// Current timestamp
$currentTime = getDateTime("0");
// Get all rights from the database
$rgtIdArray = getColVectorFromDB2ArrayByClause("rights", "rgt_id", "", "", "rgt_id");
$rgtNameArray = getColVectorFromDB2ArrayByClause("rights", "rgt_name", "", "rgt_id", "");
$rgtVipArray = getColVectorFromDB2ArrayByClause("rights", "rgt_vip", "", "rgt_id", "");
$rgtEmpVipArray = getColVectorFromDB2ArrayByClause("rights", "rgt_emp_vip", "", "rgt_id", "");
$rgtIdArrayLen = count($rgtIdArray);
// Max length of employee rights bit string
$parEmpRgtBitStrMaxLen = getParameterValue("0", "EMP_BITSTR_MAXLEN", "0");
if ($parEmpRgtBitStrMaxLen == "") : $parEmpRgtBitStrMaxLen = 50; endif;
// Check for mode of system usage
$globalParUseRelatedCustomer = getParameterValue("0", "GLOBAL_USE_RELATED_CUSTOMER", "0");
// Use right administration for employee-costcenter-matrix
$parMaskEmpCscMatrixEnabled = getParameterValue("0", "MASK_EMP_CSC_MATRIX_ENABLED", $hq_id);
if ($parMaskEmpCscMatrixEnabled == "") : $parMaskEmpCscMatrixEnabled = getParameterValue("0", "MASK_EMP_CSC_MATRIX_ENABLED", "0"); endif;
// For output only
$styleDivWidth01 = "110px";
$styleDivWidth02 = "190px"; // Container for parameterizing lists
// ********************************
// * Operations for the employees *
// ********************************
$jsRefreshEmployeeList = "0"; // Parameter for refreshing the employee list (opener)
if ($f_act != "") :
if ($f_act == "removeEmployee" || $f_act == "setPwd" || $f_act == "setRights" || $f_act == "setHqAccess" ||
($usr_name != "" && $usr_firstname != "" && $usr_account != "")) :
$jsRefreshEmployeeList = "1";
// Get the user_id of the current employee in $emp_id_act
$usrId = getFieldValueFromId("employee", "emp_id", $emp_id_act, "usr_id");
// Insert new employee
if ($f_act == "newEmployee") :
// Generate log string
$logString = makeLogString(array($userType,$usr_name,$usr_firstname,$usr_email,$usr_phone,$usr_phone2,$usr_account,$f_usr_birthdate), ";", "0");
// Check the user-account within the same customer(!)
// (Not costcenter but unique for all costcenters of a customer)
// Version for unique account for special customer
// $sqlquery = "SELECT usr.usr_id FROM user AS usr, employee AS emp, costcenter AS csc"
// . " WHERE usr_account = '" . $usr_account . "' AND emp.usr_id = usr.usr_id"
// . " AND emp.csc_id = csc.csc_id AND csc.cs_id = " . $customerId;
// Version for unique account for all customers (all data)
$sqlquery = "SELECT usr.usr_id FROM user AS usr"
. " WHERE usr.usr_account = '" . $usr_account . "' ";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
$insertFlag = TRUE;
while ($row = $result->fetch_assoc()):
$insertFlag = FALSE;
endwhile;
$result->free();
if ($insertFlag) :
if (checkPasswordValidation($usr_password,$usr_password2)) :
TA("B");
$sqlStmtPwd = "INSERT INTO user (hq_id,usr_type,usr_name,usr_firstname,usr_email,usr_phone,usr_phone2,usr_account,usr_password,usr_password_modify,usr_birthdate)" .
" VALUES ($hq_id,'$userType','$usr_name','$usr_firstname','$usr_email','$usr_phone','$usr_phone2','$usr_account',PASSWORD('$usr_password'),'$currentTime','$f_usr_birthdate')";
$res = $db->query($sqlStmtPwd);
if (DB::isError($res)) : die ("$PHP_SELF: " . $res->getMessage()); endif;
$usrId = getLastInsertID();
$sqlStmtPwd = "INSERT INTO employee (usr_id,csc_id,emp_headquarters)" .
" VALUES ($usrId,'$cscIdActual',$hq_id)";
$res = $db->query($sqlStmtPwd);
if (DB::isError($res)) : die ("$PHP_SELF: " . $res->getMessage()); endif;
$emp_id_new = getLastInsertId();
// Insert DEFAULTS in "parameter"
$mdId = getFieldValueFromId("mandatorheadquarters", "hq_id", $hq_id, "md_id");
// * Store configuration for customer list *
$csListConfigString = "cmp_comp,cmp_comp2,ad_street,ad_zipcode,cmp_match,cs_eid,usr_phone,usr_email,csc_id_jb_edit,cs_id_history,cs_id_report,cmp_authenticated_img,cs_id_jb_permanent,cmp_id_edit";
if (existsEntry("parameter",array("par_key","MASK_CS_LIST_COLS","emp_id",$emp_id_new,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_new, array("par_value", $csListConfigString), " par_key = 'MASK_CS_LIST_COLS' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MASK_CS_LIST_COLS", "emp_id", $emp_id_new, "par_value", $csListConfigString, "hq_id", $hq_id, "md_id", $mdId));
endif;
// * Store configuration for courier list *
$crListConfigString = "cr_sid,crvh_vh_sign,cr_eid,crvh_prov,usr_name,usr_firstname,usr_phone,cr_mobile_pda,cmp_authenticated_img,cr_id_history,cr_id_report,cmp_id_edit,ad_zipcode,cr_serialno";
if (existsEntry("parameter",array("par_key","MASK_CR_LIST_COLS","emp_id",$emp_id_new,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_new, array("par_value", $crListConfigString), " par_key = 'MASK_CR_LIST_COLS' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MASK_CR_LIST_COLS", "emp_id", $emp_id_new, "par_value", $crListConfigString, "hq_id", $hq_id, "md_id", $mdId));
endif;
// * Store configuration for job list *
$jbListConfigString = "jb_id,business_volume,jb_markup,jb_cr_price,jb_cr_subprice,jb_serviceprice,jb_bsg,jb_tourname,tr_comp,streethsno,jb_tourzipcodes,vht_value,jb_taketime,jb_ordertime,jb_warningtime,jb_map,jb_tr_sort,jb_reserv,jb_permanent,cr_id_favoured,jb_csc_id,cr_sid";
if (existsEntry("parameter",array("par_key","MASK_JB_LIST_COLS","emp_id",$emp_id_new,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_new, array("par_value", $jbListConfigString), " par_key = 'MASK_JB_LIST_COLS' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MASK_JB_LIST_COLS", "emp_id", $emp_id_new, "par_value", $jbListConfigString, "hq_id", $hq_id, "md_id", $mdId));
endif;
// * Store configuration for customer-costcenter list (job edit) *
$cscscListConfigString = "cmp_comp,cmp_comp2,cs_eid,csc_name,cmp_match,cmp_authenticated_img,ad_street,cscad_hsno,ad_zipcode,ad_city,cscad_remark,cscad_person,cscad_phone,statistic";
if (existsEntry("parameter",array("par_key","MASK_CSCSC_LIST_COLS","emp_id",$emp_id_new,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_new, array("par_value", $cscscListConfigString), " par_key = 'MASK_CSCSC_LIST_COLS' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MASK_CSCSC_LIST_COLS", "emp_id", $emp_id_new, "par_value", $cscscListConfigString, "hq_id", $hq_id, "md_id", $mdId));
endif;
// Automatischer E-Mail-Versand eines systemgenerierten Passwortes ???
// Associate the rights from the parent-employee automatically ??? Yes or not?
// ...
// Write logdata into log database
writeToLogDB("73",$hq_id,"",$usr_id,"","","","STATUS_NEW=" . $logString,"","",$emp_id_new);
TA("C");
TA("E");
// ********** HASH **********
// Check for execute functionality
if ($GLOBAL_USAGE_HASH) :
// Get current global number of THIS database instance
$constGlobalDbInstNo = getParameterValue("0", "GLOBAL_UNIQUE_DB_INSTANCE_NO", "0", "0");
if ($constGlobalDbInstNo != "" && is_numeric($constGlobalDbInstNo)) :
// Generate unique hash value e.g. for newsletter
$tmpHash = makeMD5Hash($hq_id, $usrId, $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_obj_type,mo_obj_id,mo_hash) VALUES ('" . $constGlobalDbInstNo . "','usr','" . $usrId . "','" . $tmpHash . "') ";
$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;
// Redirect to list view
header("Location: ../admin/employee_list.php?currentNavigationItem=zentralenmitarbeiter&emp_id_act=" . ec($emp_id) . "&customerId=" . ec($customerId) . "&cscIdRoot=" . ec($cscIdRoot) . "&cscIdActual=" . ec($cscIdActual));
endif;
else :
$statusMessage = getLngt("Der Benutzername existiert schon! Bitte wählen Sie einen anderen!");
endif;
endif;
// Modify employee
if ($f_act == "modifyEmployee" && $emp_id_act != "") :
// Check the user-account except the current to be modified in $emp_id_act
$sqlquery = "SELECT usr.usr_id FROM user AS usr, employee AS emp"
. " WHERE usr.usr_account = '" . $usr_account . "' AND usr.hq_id = " . $hq_id . " AND"
. " emp.usr_id = usr.usr_id AND"
. " emp.emp_id != $emp_id_act";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
$updateFlag = TRUE;
while ($row = $result->fetch_assoc()):
$updateFlag = FALSE;
endwhile;
$result->free();
if ($updateFlag) :
if ($usrId != "") :
$tmpUsrName = getFieldValueFromId("user", "usr_id", $usrId, "usr_name");
$tmpUsrFirstName = getFieldValueFromId("user", "usr_id", $usrId, "usr_firstname");
$tmpUsrAccount = getFieldValueFromId("user", "usr_id", $usrId, "usr_account");
$tmpUsrPassword = getFieldValueFromId("user", "usr_id", $usrId, "usr_password");
$tmpEmpActRigths = getFieldValueFromId("employee", "emp_id", $emp_id_act, "emp_rights");
$tmpUsrBirthdate = getFieldValueFromId("user", "usr_id", $usrId, "usr_birthdate");
$logString = makeLogString(array($tmpUsrName,$tmpUsrFirstName,$tmpUsrAccount,$tmpEmpActRigths,$tmpUsrPassword,$tmpEmpActRigths,$tmpUsrBirthdate), ";", "0");
$defaultFields = array("usr_name",$usr_name,"usr_firstname",$usr_firstname,"usr_email",$usr_email,"usr_phone",$usr_phone,"usr_phone2",$usr_phone2,"usr_account",$usr_account,"usr_birthdate",$f_usr_birthdate);
updateStmt("user","usr_id",$usrId,$defaultFields);
// Write logdata into log database
writeToLogDB("74",$hq_id,"",$usr_id,"","","","STATUS_MODIFIED=" . $logString,"","",$emp_id_act);
else :
$statusMessage = getLngt("Datenfehler! Löschen Sie bitte den Mitarbeiter und legen Sie ihn neu an! :-(");
endif;
else :
$statusMessage = getLngt("Der Benutzername existiert schon! Bitte wählen Sie einen anderen!");
endif;
endif;
// Change password
if ($f_act == "setPwd") :
// Get the emp_id of the root admin because he/she is allowed to change a password of an employee
$empIdRootAdmin = getEmpIdOfRootAdmin($userTypeName);
if ($emp_id == $emp_id_act || ($empIdRootAdmin != "" && $emp_id == $empIdRootAdmin) || ($empHasAccessToResetPassword && $emp_id_act != $empIdRootAdmin)) :
if (checkPasswordValidation($usr_password,$usr_password2)) :
if ($usrId != "") :
TA("B");
$tmpUsrName = getFieldValueFromId("user", "usr_id", $usrId, "usr_name");
$tmpUsrFirstName = getFieldValueFromId("user", "usr_id", $usrId, "usr_firstname");
$tmpUsrAccount = getFieldValueFromId("user", "usr_id", $usrId, "usr_account");
$logString = makeLogString(array($tmpUsrName,$tmpUsrFirstName,$tmpUsrAccount), ";", "0");
// Get old password hash (extra call of function necessary to avoid overwriting of parameter "usr_password" !)
$tmpOldPwdHash = getFieldValueFromId("user","usr_id",$usrId,"usr_password");
$sqlStmtPwd = "UPDATE user SET usr_password = PASSWORD('$usr_password'), usr_password_modify = '" . $currentTime . "' WHERE usr_id = '" . $usrId . "'";
$res = $db->query($sqlStmtPwd);
if (DB::isError($res)) : die ("$PHP_SELF: " . $res->getMessage()); endif;
// Get hash value of the new password
$tmpNewPwdHash = getFieldValueFromId("user","usr_id",$usrId,"usr_password");
// Write logdata into log database
writeToLogDB("76",$hq_id,"",$usr_id,"","","","PASSWORD_OLD=" . $tmpOldPwdHash . "|PASSWORD_NEW=" . $tmpNewPwdHash . "|USER_INFO=" . $logString,"","",$emp_id_act);
$statusMessage = getLngt("Das Passwort wurde geändert!");
TA("C");
TA("E");
else :
$statusMessage = getLngt("Datenfehler! Löschen Sie bitte den Mitarbeiter und legen Sie ihn neu an! :-(");
endif;
endif;
else :
$statusMessage = getLngt("Sie sind leider nicht autorisiert!");
endif;
endif;
// Reset 2-FA
if ($f_act == "reset2FAEmployee") :
// Get the emp_id of the root admin because he/she is allowed to change a password of an employee
$empIdRootAdmin = getEmpIdOfRootAdmin($userTypeName);
if ($emp_id == $emp_id_act || ($empIdRootAdmin != "" && $emp_id == $empIdRootAdmin) || ($empHasAccessToReset2FA && $emp_id_act != $empIdRootAdmin)) :
if ($emp_id_act != "") :
$retVal = user2FARemove($emp_id_act, "emp");
$statusMessage = $retVal[1];
else :
$statusMessage = getLngt("Der spezifizierte Mitarbeiter ist nicht im Datenbestand erhalten!");
endif;
else :
$statusMessage = getLngt("Sie haben keinen Mitarbeiter spezifiziert!");
endif;
endif;
// --- STOCK RIGHTS BEGIN ---------------------------------------------------------------
// Change access to root stocks
if ($f_act == "setAccessRootStocks") :
// Get the emp_id of the root admin because he/she is allowed to change a password of an employee
$empIdRootAdmin = getEmpIdOfRootAdmin($userTypeName);
if ($emp_id_act != $empIdRootAdmin) :
if ($emp_id_act != $emp_id) :
$allRootStocksArray = getColVectorFromDB2ArrayByClause("stock", "stk_id", "stk_pre_id = '0' AND stk_path = ''", "", "");
if (!is_array($par_stock_access) || $par_stock_access == "") : $par_stock_access = array(); endif;
$stkRootAccessIDsEmpIdArray = array();
$stkRootAccessIDsActEmpIdArray = array();
// Currrent user logged in
if ($emp_id == $empIdRootAdmin) :
$stkRootAccessIDsEmpIdArray = $allRootStocksArray;
$stkRootAccessIDsEmpId = implode(",", $stkRootAccessIDsEmpIdArray);
else :
$stkRootAccessIDsEmpId = getParameterValue($emp_id, "MASK_STK_ROOT_ACCESS");
if ($stkRootAccessIDsEmpId != "") :
$stkRootAccessIDsEmpIdArray = explode(",",$stkRootAccessIDsEmpId);
endif;
endif;
// Current user to be viewed or edited
$stkRootAccessIDsActEmpId = getParameterValue($emp_id_act, "MASK_STK_ROOT_ACCESS");
if ($stkRootAccessIDsActEmpId != "") :
$stkRootAccessIDsActEmpIdArray = explode(",",$stkRootAccessIDsActEmpId);
endif;
if (count($par_stock_access) > 0) :
// Get the elements the executing employee has access for, but wanted to be disabled for the edited employee (elements to be switched OFF)
$tmpEmpIdRestArray = array_diff($stkRootAccessIDsEmpIdArray, $par_stock_access);
// Get all elements to be switched ON for the edited employee
$tmpEmpIdActUnionArray = array_unique(array_merge($stkRootAccessIDsActEmpIdArray, $par_stock_access));
else :
// All elements the executing employee has access for will be switched OFF for the editing employee
$tmpEmpIdRestArray = $stkRootAccessIDsEmpIdArray;
// Only the existing elements the edited employee has access for are the superset of the merge
$tmpEmpIdActUnionArray = $stkRootAccessIDsActEmpIdArray;
endif;
$storeArray = array_diff($tmpEmpIdActUnionArray, $tmpEmpIdRestArray);
$storeString = implode(",", $storeArray);
if (existsEntry("parameter",array("par_key","MASK_STK_ROOT_ACCESS","emp_id",$emp_id_act,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_act, array("par_value", $storeString), " par_key = 'MASK_STK_ROOT_ACCESS' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MASK_STK_ROOT_ACCESS", "emp_id", $emp_id_act, "par_value", $storeString, "hq_id", $hq_id, "md_id", $md_id));
endif;
// Switch access state between readonly and writeable substocks if possible (only the changing employee is NOT readonly by himself!)
$tmpStkReadonlyEmpId = getParameterValue($emp_id, "MASK_STK_READONLY_WHERE_DEFINED_WRITEACCESS");
if ($tmpStkReadonlyEmpId == "") : $tmpStkReadonlyEmpId = "0"; endif;
if ($emp_id == $empIdRootAdmin || $tmpStkReadonlyEmpId == "0") :
if (existsEntry("parameter",array("par_key","MASK_STK_READONLY_WHERE_DEFINED_WRITEACCESS","emp_id",$emp_id_act,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_act, array("par_value", $par_substocks_readonly), " par_key = 'MASK_STK_READONLY_WHERE_DEFINED_WRITEACCESS' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MASK_STK_READONLY_WHERE_DEFINED_WRITEACCESS", "emp_id", $emp_id_act, "par_value", $par_substocks_readonly, "hq_id", $hq_id, "md_id", $md_id));
endif;
endif;
// Switch access state for article master data
$tmpStkArticleAccessEmpId = getParameterValue($emp_id, "MASK_STK_ARTICLE_ACCESS");
if ($tmpStkArticleAccessEmpId == "") : $tmpStkArticleAccessEmpId = "0"; endif;
if ($emp_id == $empIdRootAdmin || $tmpStkArticleAccessEmpId == "0") :
if (existsEntry("parameter",array("par_key","MASK_STK_ARTICLE_ACCESS","emp_id",$emp_id_act,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_act, array("par_value", $par_stk_article_access), " par_key = 'MASK_STK_ARTICLE_ACCESS' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MASK_STK_ARTICLE_ACCESS", "emp_id", $emp_id_act, "par_value", $par_stk_article_access, "hq_id", $hq_id, "md_id", $md_id));
endif;
endif;
else :
$statusMessage = getLngt("Ihre eigenen Lagerzugänge können Sie nicht verändern!");
endif;
else :
$statusMessage = getLngt("Sie sind leider nicht autorisiert!");
endif;
endif;
// Right management of substocks
if ($f_act == "setAccessSubtocks") :
// Get the emp_id of the root admin because he/she is allowed to change a password of an employee
$empIdRootAdmin = getEmpIdOfRootAdmin($userTypeName);
if ($emp_id_act != $empIdRootAdmin) :
if ($emp_id_act != $emp_id) :
// Get parameter of the viewed or edited emloyee to check the right for substock level
$parMaskStkSubstockActEmpIdAccess = getParameterValue($emp_id_act, "MASK_STK_SUBSTOCK_ACCESS");
// echo "PARAMETER EMP_ACT: " . $parMaskStkSubstockActEmpIdAccess . "<br>";
$parMaskStkSubstockActEmpIdAccess = str_replace("|", "--", $parMaskStkSubstockActEmpIdAccess);
$tmpPairsActEmpIdArray = explode("--", $parMaskStkSubstockActEmpIdAccess);
$tmpPairsActEmpIdArrayLen = count($tmpPairsActEmpIdArray);
// echo "rootStkIdForSubstkPar: " . $rootStkIdForSubstkPar . " &nbsp; " . getFieldValueFromId("stock","stk_id", $rootStkIdForSubstkPar,"stk_name") . "<br>";
// Get all HTTP-POST parameters for the substocks
if ($rootStkIdForSubstkPar > 0 && is_numeric($rootStkIdForSubstkPar)) :
$allRootStocksArray = getColVectorFromDB2ArrayByClause("stock", "stk_id", "stk_pre_id = '0' AND stk_path = ''", "", "");
list ($currStock) = getSecHttpVars("1",array("par_stock_access_subtree_" . $rootStkIdForSubstkPar));
// echo "currStock: " . $currStock . " &nbsp; " . getFieldValueFromId("stock","stk_id", $currStock,"stk_name") . "<br>";
// Check parameter being a root stock or a substock or it is empty
if ($currStock == "") :
// echo "DRIN 1 <br><br>";
// Current stock is empty, no parameter change
// ...
elseif (in_array($currStock, $allRootStocksArray)) :
// echo "DRIN 2 <br><br>";
// Current stock is a root stock
// Check restriction of the viewed or edited employee according to the current root stock
for ($j = 0; $j < $tmpPairsActEmpIdArrayLen; $j++) :
$tmpSubStockTupel = explode(",", $tmpPairsActEmpIdArray[$j]);
if ($tmpSubStockTupel[0] == $rootStkIdForSubstkPar) :
unset($tmpPairsActEmpIdArray[$j]);
endif;
endfor;
else :
// echo "DRIN 3 <br><br>";
// Check restriction of the viewed or edited employee according to the current root stock
$tmpFound = false;
for ($j = 0; $j < $tmpPairsActEmpIdArrayLen; $j++) :
$tmpSubStockTupel = explode(",", $tmpPairsActEmpIdArray[$j]); // E.g. "3,7,4,12,26" <=> (3 = root stock, the others substocks)
if ($tmpSubStockTupel[0] == $rootStkIdForSubstkPar) :
// echo $tmpSubStockTupel[0] . "&nbsp;=>&nbsp;";
// Update ...
$newSubstockIds = $tmpSubStockTupel;
$tmpSubStockTupelLen = count($tmpSubStockTupel);
$opDone = false;
for ($k = 1; $k < $tmpSubStockTupelLen; $k++) :
if ($currStock == $tmpSubStockTupel[$k]) :
if ($rootStkOpForSubstkPar == "add") :
// It does exist, do nothing ...
$opDone = true;
endif;
if ($rootStkOpForSubstkPar == "sub") :
unset($newSubstockIds[$k]);
$opDone = true;
endif;
endif;
if (isStkChild($currStock, $tmpSubStockTupel[$k])) :
if ($rootStkOpForSubstkPar == "add") :
$newSubstockIds[$k] = $currStock;
$opDone = true;
endif;
endif;
endfor;
if (!$opDone) :
// Add new resriction
if ($rootStkOpForSubstkPar == "add") :
$newSubstockIds[] = $currStock;
endif;
endif;
// Check for removement of all substock rights but the root stock
$newSubstockIdsStr = "";
if (count($newSubstockIds) > 1) :
$newSubstockIdsStr = implode(",", $newSubstockIds);
endif;
$tmpPairsActEmpIdArray[$j] = $newSubstockIdsStr;
// echo "tmpPairsActEmpIdArray: " . $tmpPairsActEmpIdArray[$j] . "<br>";
$tmpFound = true;
endif;
endfor;
if (!$tmpFound) :
// Insert ...
$tmpPairsActEmpIdArray[] = $rootStkIdForSubstkPar . "," . $currStock;
endif;
endif;
// Implode updated parameter value to store
$tmpPairsActEmpId = implode("|", $tmpPairsActEmpIdArray);
if (substr($tmpPairsActEmpId, 0, 1) == "|") : $tmpPairsActEmpId = substr($tmpPairsActEmpId, 1); endif;
if (substr($tmpPairsActEmpId, -1) == "|") : $tmpPairsActEmpId = substr($tmpPairsActEmpId, 0, -1); endif;
// echo "tmpPairsActEmpId: " . $tmpPairsActEmpId . "<br>";
if (existsEntry("parameter",array("par_key","MASK_STK_SUBSTOCK_ACCESS","emp_id",$emp_id_act,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_act, array("par_value", $tmpPairsActEmpId), " par_key = 'MASK_STK_SUBSTOCK_ACCESS' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MASK_STK_SUBSTOCK_ACCESS", "emp_id", $emp_id_act, "par_value", $tmpPairsActEmpId, "hq_id", $hq_id, "md_id", $md_id));
endif;
endif;
else :
$statusMessage = getLngt("Ihre eigenen Lagerzugänge können Sie nicht verändern!");
endif;
else :
$statusMessage = getLngt("Sie sind leider nicht autorisiert!");
endif;
endif;
// --- STOCK RIGHTS END -----------------------------------------------------------------
// Change parameters of the employee (... for global parameters look beyond)
if ($f_act == "setPar") :
// Get the emp_id of the root admin because he/she is allowed to change parameters of an employee
$empIdRootAdmin = getEmpIdOfRootAdmin($userTypeName);
if ($emp_id == $emp_id_act || ($empIdRootAdmin != "" && $emp_id == $empIdRootAdmin)) :
if (getDbFieldValues("employee",array("usr_id"),array("emp_id",$emp_id_act))) :
// 1. Write parameter for number of job lists (frames) to be displayed
if (is_numeric($par_numOfJobLists)) :
if (existsEntry("parameter",array("par_key","MASK_MULTI_JOBLIST","emp_id",$emp_id_act,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_act, array("par_value", $par_numOfJobLists), " par_key = 'MASK_MULTI_JOBLIST' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MASK_MULTI_JOBLIST", "emp_id", $emp_id_act, "par_value", $par_numOfJobLists, "hq_id", $hq_id, "md_id", $md_id));
endif;
else :
$statusMessage = "";
endif;
// 2. Mode to copy a job
if (is_numeric($par_modeCopyJob)) :
if (existsEntry("parameter",array("par_key","MODE_COPY_JOB","emp_id",$emp_id_act,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_act, array("par_value", $par_modeCopyJob), " par_key = 'MODE_COPY_JOB' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MODE_COPY_JOB", "emp_id", $emp_id_act, "par_value", $par_modeCopyJob, "hq_id", $hq_id, "md_id", $md_id));
endif;
else :
$statusMessage = "";
endif;
// 3. Mode to insert later jobs (flag "Nacherfassung")
if (is_numeric($par_modeLaterJob)) :
if (existsEntry("parameter",array("par_key","MODE_LATER_JOB","emp_id",$emp_id_act,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_act, array("par_value", $par_modeLaterJob), " par_key = 'MODE_LATER_JOB' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MODE_LATER_JOB", "emp_id", $emp_id_act, "par_value", $par_modeLaterJob, "hq_id", $hq_id, "md_id", $md_id));
endif;
else :
$statusMessage = "";
endif;
// 4. Max. of entries to be displayed in the joblist
if (is_numeric($par_joblistBrowseMax)) :
if (existsEntry("parameter",array("par_key","MASK_JOBLIST_BROWSE_MAX","emp_id",$emp_id_act,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_act, array("par_value", $par_joblistBrowseMax), " par_key = 'MASK_JOBLIST_BROWSE_MAX' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MASK_JOBLIST_BROWSE_MAX", "emp_id", $emp_id_act, "par_value", $par_joblistBrowseMax, "hq_id", $hq_id, "md_id", $md_id));
endif;
else :
$statusMessage = "";
endif;
// 5. Display entries only up to this vehicle type
if (is_numeric($par_joblistShowUpToVht)) :
if (existsEntry("parameter",array("par_key","MASK_JOBLIST_SHOW_UPTO_VHT","emp_id",$emp_id_act,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_act, array("par_value", $par_joblistShowUpToVht), " par_key = 'MASK_JOBLIST_SHOW_UPTO_VHT' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MASK_JOBLIST_SHOW_UPTO_VHT", "emp_id", $emp_id_act, "par_value", $par_joblistShowUpToVht, "hq_id", $hq_id, "md_id", $md_id));
endif;
else :
$statusMessage = "";
endif;
// 6. Mode to handle entering job numbers in field "job_from"
if (is_numeric($par_modeJobNum)) :
if (existsEntry("parameter",array("par_key","MASK_JOBLIST_MODE_JOB_NUM","emp_id",$emp_id_act,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_act, array("par_value", $par_modeJobNum), " par_key = 'MASK_JOBLIST_MODE_JOB_NUM' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MASK_JOBLIST_MODE_JOB_NUM", "emp_id", $emp_id_act, "par_value", $par_modeJobNum, "hq_id", $hq_id, "md_id", $md_id));
endif;
else :
$statusMessage = "";
endif;
// 7. Automatic refresh
if (is_numeric($par_modeJoblistRefresh)) :
if (existsEntry("parameter",array("par_key","MASK_JOBLIST_MODE_REFRESH","emp_id",$emp_id_act,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_act, array("par_value", $par_modeJoblistRefresh), " par_key = 'MASK_JOBLIST_MODE_REFRESH' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MASK_JOBLIST_MODE_REFRESH", "emp_id", $emp_id_act, "par_value", $par_modeJoblistRefresh, "hq_id", $hq_id, "md_id", $md_id));
endif;
else :
$statusMessage = "";
endif;
// 8. Background colors of the content
if (is_numeric($par_ContentBgCols)) :
if (existsEntry("parameter",array("par_key","MASK_CONTENT_BGCOL","emp_id",$emp_id_act,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_act, array("par_value", $par_ContentBgCols), " par_key = 'MASK_CONTENT_BGCOL' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MASK_CONTENT_BGCOL", "emp_id", $emp_id_act, "par_value", $par_ContentBgCols, "hq_id", $hq_id, "md_id", $md_id));
endif;
else :
$statusMessage = "";
endif;
// 9. System language
if (is_numeric($par_systemLanguage)) :
if (existsEntry("parameter",array("par_key","SYSTEM_LANGUAGE_DEFAULT","emp_id",$emp_id_act,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_act, array("par_value", $par_systemLanguage), " par_key = 'SYSTEM_LANGUAGE_DEFAULT' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "SYSTEM_LANGUAGE_DEFAULT", "emp_id", $emp_id_act, "par_value", $par_systemLanguage, "hq_id", $hq_id, "md_id", $md_id));
endif;
else :
$statusMessage = "";
endif;
// 10. Inclusion of courier data for columns
if (is_numeric($par_modeJoblistGetCourierData)) :
if (existsEntry("parameter",array("par_key","MASK_JOBLIST_GET_COURIER_DATA","emp_id",$emp_id_act,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_act, array("par_value", $par_modeJoblistGetCourierData), " par_key = 'MASK_JOBLIST_GET_COURIER_DATA' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MASK_JOBLIST_GET_COURIER_DATA", "emp_id", $emp_id_act, "par_value", $par_modeJoblistGetCourierData, "hq_id", $hq_id, "md_id", $md_id));
endif;
else :
$statusMessage = "";
endif;
// 11. Initial group for the (graphical) disposition
if (is_numeric($par_dispoJbVhtGroup)) :
if (existsEntry("parameter",array("par_key","MASK_DISPOSITION_INIT_GROUP","emp_id",$emp_id_act,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_act, array("par_value", $par_dispoJbVhtGroup), " par_key = 'MASK_DISPOSITION_INIT_GROUP' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MASK_DISPOSITION_INIT_GROUP", "emp_id", $emp_id_act, "par_value", $par_dispoJbVhtGroup, "hq_id", $hq_id, "md_id", $md_id));
endif;
else :
$statusMessage = "";
endif;
// 12. Initial customer for the (graphical) disposition, depending on the selected group
if (is_numeric($par_dispoJbVhtCustomer)) :
// Check dependency of group parameter "$par_dispoJbVhtGroup"
if ($par_dispoJbVhtGroup == "0") : $par_dispoJbVhtCustomer = "0"; endif;
if (existsEntry("parameter",array("par_key","MASK_DISPOSITION_INIT_CS","emp_id",$emp_id_act,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_act, array("par_value", $par_dispoJbVhtCustomer), " par_key = 'MASK_DISPOSITION_INIT_CS' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MASK_DISPOSITION_INIT_CS", "emp_id", $emp_id_act, "par_value", $par_dispoJbVhtCustomer, "hq_id", $hq_id, "md_id", $md_id));
endif;
else :
$statusMessage = "";
endif;
// Kind of list to be displayed in each frame
// $jobListArray = explode(",",MASK_JOBLIST_DEFAULTLIST); // Init components with default values
$jobListArray = explode(",",getParameterValue("0", "MASK_JOBLIST_DEFAULTLIST")); // Init components with default values
if (is_numeric($par_statusOfJobLists_1)) : $jobListArray[0] = $par_statusOfJobLists_1; endif;
if (is_numeric($par_statusOfJobLists_2)) : $jobListArray[1] = $par_statusOfJobLists_2; endif;
if (is_numeric($par_statusOfJobLists_3)) : $jobListArray[2] = $par_statusOfJobLists_3; endif;
if (is_numeric($par_statusOfJobLists_4)) : $jobListArray[3] = $par_statusOfJobLists_4; endif;
$jobListString = implode(",", $jobListArray);
if (existsEntry("parameter",array("par_key","MASK_JOBLIST_DEFAULTLIST","emp_id",$emp_id_act,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_act, array("par_value", $jobListString), " par_key = 'MASK_JOBLIST_DEFAULTLIST' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MASK_JOBLIST_DEFAULTLIST", "emp_id", $emp_id_act, "par_value", $jobListString, "hq_id", $hq_id, "md_id", $md_id));
endif;
// List configurations (customer, courier, jobs, customer-costcenter, ...)
$csListConfigArray = explode(",",getParameterValue("0", "MASK_CS_LIST_COLS")); // Init components with default values
$crListConfigArray = explode(",",getParameterValue("0", "MASK_CR_LIST_COLS")); // Dito
$jbListConfigArray = explode(",",getParameterValue("0", "MASK_JB_LIST_COLS")); // Dito
$cscscListConfigArray = explode(",",getParameterValue("0", "MASK_CSCSC_LIST_COLS")); // Dito
for ($j = 0; $j < $constNumOfFieldParameters; $j++) :
// Sequence
$tmpParCs = "par_csListConfig_" . ($j + 1);
$tmpParCr = "par_crListConfig_" . ($j + 1);
$tmpParJb = "par_jbListConfig_" . ($j + 1);
$tmpParCscsc = "par_cscscListConfig_" . ($j + 1);
$csListConfigArray[$j] = $$tmpParCs;
$crListConfigArray[$j] = $$tmpParCr;
$jbListConfigArray[$j] = $$tmpParJb;
$cscscListConfigArray[$j] = $$tmpParCscsc;
// Length
$tmpParLenCs = "par_csListLenConfig_" . ($j + 1);
$tmpParLenCr = "par_crListLenConfig_" . ($j + 1);
$tmpParLenJb = "par_jbListLenConfig_" . ($j + 1);
$tmpParLenCscsc = "par_cscscListLenConfig_" . ($j + 1);
$csListLenConfigArray[$j] = $$tmpParLenCs;
if ($csListConfigArray[$j] == "") : $csListLenConfigArray[$j] = ""; endif;
$crListLenConfigArray[$j] = $$tmpParLenCr;
if ($crListConfigArray[$j] == "") : $crListLenConfigArray[$j] = ""; endif;
$jbListLenConfigArray[$j] = $$tmpParLenJb;
if ($jbListConfigArray[$j] == "") : $jbListLenConfigArray[$j] = ""; endif;
$cscscListLenConfigArray[$j] = $$tmpParLenCscsc;
if ($cscscListConfigArray[$j] == "") : $cscscListLenConfigArray[$j] = ""; endif;
endfor;
// * Customer list *
// Sequence
$csListConfigString = implode(",", $csListConfigArray);
while (!(strpos($csListConfigString, ",,") === FALSE)):
$csListConfigString = str_replace(",,", ",", $csListConfigString);
endwhile;
while ((strlen($csListConfigString) > 0) && (substr($csListConfigString, 0, 1) == ",")):
$csListConfigString = substr($csListConfigString, 1);
endwhile;
while ((strlen($csListConfigString) > 0) && (substr($csListConfigString, -1) == ",")):
$csListConfigString = substr($csListConfigString, 0, -1);
endwhile;
// Length
$csListLenConfigString = implode(",", $csListLenConfigArray);
while (!(strpos($csListLenConfigString, ",,") === FALSE)):
$csListLenConfigString = str_replace(",,", ",", $csListLenConfigString);
endwhile;
while ((strlen($csListLenConfigString) > 0) && (substr($csListLenConfigString, 0, 1) == ",")):
$csListLenConfigString = substr($csListLenConfigString, 1);
endwhile;
while ((strlen($csListLenConfigString) > 0) && (substr($csListLenConfigString, -1) == ",")):
$csListLenConfigString = substr($csListLenConfigString, 0, -1);
endwhile;
// * Courier list *
// Sequence
$crListConfigString = implode(",", $crListConfigArray);
while (!(strpos($crListConfigString, ",,") === FALSE)):
$crListConfigString = str_replace(",,", ",", $crListConfigString);
endwhile;
while ((strlen($crListConfigString) > 0) && (substr($crListConfigString, 0, 1) == ",")):
$crListConfigString = substr($crListConfigString, 1);
endwhile;
while ((strlen($crListConfigString) > 0) && (substr($crListConfigString, -1) == ",")):
$crListConfigString = substr($crListConfigString, 0, -1);
endwhile;
// Length
$crListLenConfigString = implode(",", $crListLenConfigArray);
while (!(strpos($crListLenConfigString, ",,") === FALSE)):
$crListLenConfigString = str_replace(",,", ",", $crListLenConfigString);
endwhile;
while ((strlen($crListLenConfigString) > 0) && (substr($crListLenConfigString, 0, 1) == ",")):
$crListLenConfigString = substr($crListLenConfigString, 1);
endwhile;
while ((strlen($crListLenConfigString) > 0) && (substr($crListLenConfigString, -1) == ",")):
$crListLenConfigString = substr($crListLenConfigString, 0, -1);
endwhile;
// * Job list *
// Sequence
$jbListConfigString = implode(",", $jbListConfigArray);
while (!(strpos($jbListConfigString, ",,") === FALSE)):
$jbListConfigString = str_replace(",,", ",", $jbListConfigString);
endwhile;
while ((strlen($jbListConfigString) > 0) && (substr($jbListConfigString, 0, 1) == ",")):
$jbListConfigString = substr($jbListConfigString, 1);
endwhile;
while ((strlen($jbListConfigString) > 0) && (substr($jbListConfigString, -1) == ",")):
$jbListConfigString = substr($jbListConfigString, 0, -1);
endwhile;
// Length
$jbListLenConfigString = implode(",", $jbListLenConfigArray);
while (!(strpos($jbListLenConfigString, ",,") === FALSE)):
$jbListLenConfigString = str_replace(",,", ",", $jbListLenConfigString);
endwhile;
while ((strlen($jbListLenConfigString) > 0) && (substr($jbListLenConfigString, 0, 1) == ",")):
$jbListLenConfigString = substr($jbListLenConfigString, 1);
endwhile;
while ((strlen($jbListLenConfigString) > 0) && (substr($jbListLenConfigString, -1) == ",")):
$jbListLenConfigString = substr($jbListLenConfigString, 0, -1);
endwhile;
// * Customer costcenter list (job edit) *
// Sequence
$cscscListConfigString = implode(",", $cscscListConfigArray);
while (!(strpos($cscscListConfigString, ",,") === FALSE)):
$cscscListConfigString = str_replace(",,", ",", $cscscListConfigString);
endwhile;
while ((strlen($cscscListConfigString) > 0) && (substr($cscscListConfigString, 0, 1) == ",")):
$cscscListConfigString = substr($cscscListConfigString, 1);
endwhile;
while ((strlen($cscscListConfigString) > 0) && (substr($cscscListConfigString, -1) == ",")):
$cscscListConfigString = substr($cscscListConfigString, 0, -1);
endwhile;
// Length
$cscscListLenConfigString = implode(",", $cscscListLenConfigArray);
while (!(strpos($cscscListLenConfigString, ",,") === FALSE)):
$cscscListLenConfigString = str_replace(",,", ",", $cscscListLenConfigString);
endwhile;
while ((strlen($cscscListLenConfigString) > 0) && (substr($cscscListLenConfigString, 0, 1) == ",")):
$cscscListLenConfigString = substr($cscscListLenConfigString, 1);
endwhile;
while ((strlen($cscscListLenConfigString) > 0) && (substr($cscscListLenConfigString, -1) == ",")):
$cscscListLenConfigString = substr($cscscListLenConfigString, 0, -1);
endwhile;
// * Store configuration for customer list *
if (existsEntry("parameter",array("par_key","MASK_CS_LIST_COLS","emp_id",$emp_id_act,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_act, array("par_value", $csListConfigString), " par_key = 'MASK_CS_LIST_COLS' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MASK_CS_LIST_COLS", "emp_id", $emp_id_act, "par_value", $csListConfigString, "hq_id", $hq_id, "md_id", $md_id));
endif;
if (existsEntry("parameter",array("par_key","MASK_CS_LIST_LEN_COLS","emp_id",$emp_id_act,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_act, array("par_value", $csListLenConfigString), " par_key = 'MASK_CS_LIST_LEN_COLS' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MASK_CS_LIST_LEN_COLS", "emp_id", $emp_id_act, "par_value", $csListLenConfigString, "hq_id", $hq_id, "md_id", $md_id));
endif;
// * Store configuration for courier list *
if (existsEntry("parameter",array("par_key","MASK_CR_LIST_COLS","emp_id",$emp_id_act,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_act, array("par_value", $crListConfigString), " par_key = 'MASK_CR_LIST_COLS' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MASK_CR_LIST_COLS", "emp_id", $emp_id_act, "par_value", $crListConfigString, "hq_id", $hq_id, "md_id", $md_id));
endif;
if (existsEntry("parameter",array("par_key","MASK_CR_LIST_LEN_COLS","emp_id",$emp_id_act,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_act, array("par_value", $crListLenConfigString), " par_key = 'MASK_CR_LIST_LEN_COLS' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MASK_CR_LIST_LEN_COLS", "emp_id", $emp_id_act, "par_value", $crListLenConfigString, "hq_id", $hq_id, "md_id", $md_id));
endif;
// * Store configuration for job list *
if (existsEntry("parameter",array("par_key","MASK_JB_LIST_COLS","emp_id",$emp_id_act,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_act, array("par_value", $jbListConfigString), " par_key = 'MASK_JB_LIST_COLS' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MASK_JB_LIST_COLS", "emp_id", $emp_id_act, "par_value", $jbListConfigString, "hq_id", $hq_id, "md_id", $md_id));
endif;
if (existsEntry("parameter",array("par_key","MASK_JB_LIST_LEN_COLS","emp_id",$emp_id_act,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_act, array("par_value", $jbListLenConfigString), " par_key = 'MASK_JB_LIST_LEN_COLS' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MASK_JB_LIST_LEN_COLS", "emp_id", $emp_id_act, "par_value", $jbListLenConfigString, "hq_id", $hq_id, "md_id", $md_id));
endif;
// * Store configuration for customer-costcenter list (job edit) *
if (existsEntry("parameter",array("par_key","MASK_CSCSC_LIST_COLS","emp_id",$emp_id_act,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_act, array("par_value", $cscscListConfigString), " par_key = 'MASK_CSCSC_LIST_COLS' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MASK_CSCSC_LIST_COLS", "emp_id", $emp_id_act, "par_value", $cscscListConfigString, "hq_id", $hq_id, "md_id", $md_id));
endif;
if (existsEntry("parameter",array("par_key","MASK_CSCSC_LIST_LEN_COLS","emp_id",$emp_id_act,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id_act, array("par_value", $cscscListLenConfigString), " par_key = 'MASK_CSCSC_LIST_LEN_COLS' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "MASK_CSCSC_LIST_LEN_COLS", "emp_id", $emp_id_act, "par_value", $cscscListLenConfigString, "hq_id", $hq_id, "md_id", $md_id));
endif;
else :
$statusMessage = getLngt("Datenfehler! Löschen Sie bitte den Mitarbeiter und legen Sie ihn neu an! :-(");
endif;
else :
$statusMessage = getLngt("Sie sind leider nicht autorisiert!");
endif;
endif;
// Change GLOBAL parameters (for headquarter)
if ($f_act == "setGlobPar") :
if (authCheckEmployeeRights($emp_id, "9")) :
// 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 PDA-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 (authCheckEmployeeRights($emp_id, "45")) :
/*
$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;
endfor;
// Write logdata into log database
writeToLogDB("196",$hq_id,"",$usr_id,"","","","" . $tmpLogStr,"","","");
*/
endif;
endif;
// Set headquarters access
if ($f_act == "setHqAccess") :
// The admin user cannot be modified by a normal user
$empIdRootAdmin = getEmpIdOfRootAdmin($userTypeName);
if ($emp_id != $emp_id_act && $emp_id_act != $empIdRootAdmin) :
// Get ALL headquarter ids of the current mandator
$tmpAllHqArr = getColVectorFromDB2Array("mandatorheadquarters","md_id",$md_id,"hq_id");
// Get existing headquarters access vector of $emp_id
$tmpEmpHeadquarters = getFieldValueFromId("employee", "emp_id", $emp_id, "emp_headquarters");
$tmpEmpHqArr = explode(",", $tmpEmpHeadquarters);
// Get existing headquarters access vector of $emp_id_act
$tmpEmpActHeadquarters = getFieldValueFromId("employee", "emp_id", $emp_id_act, "emp_headquarters");
$tmpEmpActHqArr = explode(",", $tmpEmpActHeadquarters);
// Check headquarters access vector may not be empty
if ($f_hq_id == "") : $f_hq_id = array(); endif;
// If it is then set the own headquarters of the employee being edited as default!
if (count($f_hq_id) == 0) :
$empActUsrId = getFieldValueFromId("employee", "emp_id", $emp_id_act, "usr_id");
$empActHqId = getFieldValueFromId("user", "usr_id", $empActUsrId, "hq_id");
/*
if ($empActHqId != "" && is_numeric($empActHqId)) :
array_push($f_hq_id, $empActHqId);
endif;
*/
endif;
// Init by existing vector of $emp_id_act
$newHeadquartersAccessArr = $tmpEmpActHqArr;
$tmpAllHqArrLen = count($tmpAllHqArr);
for ($i = 0; $i < $tmpAllHqArrLen; $i++) :
// Check editing $emp_id has access to this headquarters
if (in_array($tmpAllHqArr[$i], $tmpEmpHqArr)) :
// Check if current headquarters is checked
if (in_array($tmpAllHqArr[$i], $f_hq_id)) :
if (!in_array($tmpAllHqArr[$i], $newHeadquartersAccessArr)) :
array_push($newHeadquartersAccessArr, $tmpAllHqArr[$i]);
endif;
else :
if (in_array($tmpAllHqArr[$i], $newHeadquartersAccessArr)) :
$newHeadquartersAccessArr = array_diff($newHeadquartersAccessArr, array($tmpAllHqArr[$i]));
endif;
endif;
endif;
endfor;
$newHeadquartersAccess = implode(",", $newHeadquartersAccessArr);
if (trim($newHeadquartersAccess) == "") : $newHeadquartersAccess = $empActHqId; endif;
updateStmt("employee","emp_id",$emp_id_act,array("emp_headquarters",$newHeadquartersAccess));
// Write logdata into log database
writeToLogDB("116",$hq_id,"",$usr_id,"","","","HQ_ACCESS_OLD=" . $tmpEmpActHeadquarters . "|HQ_ACCESS_NEW=" . $newHeadquartersAccess,"","",$emp_id_act);
$statusMessage = getLngt("Die Niederlassungsfreigaben wurden gesetzt!");
else :
$statusMessage = getLngt("Die Niederlassungsfreigaben wurden nicht gesetzt!");
endif;
endif;
// Set rights
if ($f_act == "setRights") :
if ($emp_id != $emp_id_act) :
// Get the emp_id of the root admin because he/she is allowed to change a password of an employee
$empIdRootAdmin = getEmpIdOfRootAdmin($userTypeName);
if ($userTypeName == "cs") :
// Get the rights of the employee to be modified
$tmpEmpRigths = getFieldValueFromId("employee", "emp_id", $emp_id, "emp_rights"); // Get rights of current employee logged in
$tmpEmpActRigths = getFieldValueFromId("employee", "emp_id", $emp_id_act, "emp_rights"); // Get old rights for logging
$newRights = "0000000000000000000000000000000000000000000000000000000000000000000000";
$fieldsLength = count($emp_rights);
for ($i = 0; $i < $fieldsLength; $i++) :
// Special menu for customer-employee (user-type "2")
if ($emp_rights[$i] == "csc_nav") : $newRights = substr_replace($newRights,'1',0,1); endif;
if ($emp_rights[$i] == "csc_admin") : $newRights = substr_replace($newRights,'1',1,1); endif;
if ($emp_rights[$i] == "emp") : $newRights = substr_replace($newRights,'1',2,1); endif;
if ($emp_rights[$i] == "ad") : $newRights = substr_replace($newRights,'1',3,1); endif;
if ($emp_rights[$i] == "job") : $newRights = substr_replace($newRights,'1',4,1); endif;
if ($emp_rights[$i] == "inv") : $newRights = substr_replace($newRights,'1',5,1); endif;
if ($emp_rights[$i] == "set") : $newRights = substr_replace($newRights,'1',6,1); endif;
if ($emp_rights[$i] == "exp") : $newRights = substr_replace($newRights,'1',7,1); endif;
if ($emp_rights[$i] == "st") : $newRights = substr_replace($newRights,'1',8,1); endif;
if ($emp_rights[$i] == "map") : $newRights = substr_replace($newRights,'1',9,1); endif;
if ($emp_rights[$i] == "usr_account") : $newRights = substr_replace($newRights,'1',10,1); endif;
if ($emp_rights[$i] == "download") : $newRights = substr_replace($newRights,'1',11,1); endif;
if ($emp_rights[$i] == "usr_csc_matrix") : $newRights = substr_replace($newRights,'1',12,1); endif;
if ($emp_rights[$i] == "apt") : $newRights = substr_replace($newRights,'1',13,1); endif;
if ($emp_rights[$i] == "obj_mngmnt") : $newRights = substr_replace($newRights,'1',14,1); endif;
if ($emp_rights[$i] == "imp") : $newRights = substr_replace($newRights,'1',15,1); endif;
endfor;
elseif ($userTypeName == "hq") :
// Get the rights of the employee to be modified
$tmpEmpRigths = getFieldValueFromId("employee", "emp_id", $emp_id, "emp_rights"); // Get rights of current employee logged in
$tmpEmpActRigths = getFieldValueFromId("employee", "emp_id", $emp_id_act, "emp_rights"); // Get old rights for logging
// Fill up bit string to x signs
$tmpEmpRigths = str_pad($tmpEmpRigths, $parEmpRgtBitStrMaxLen, "0");
$tmpEmpActRigths = str_pad($tmpEmpActRigths, $parEmpRgtBitStrMaxLen, "0");
$newRights = $tmpEmpActRigths;
$fieldsLength = count($emp_rights);
for ($j = 0; $j < $rgtIdArrayLen; $j++) :
$empRgt = substr($tmpEmpRigths,$j,1);
$empActRgt = substr($tmpEmpActRigths,$j,1);
// Check for VIP status of the current right to be inherited. If it is then change $tmpEmpRigths for the current right to "0"
if ($rgtVipArray[$rgtIdArray[$j]] == "1" && $empRgt == "1") :
$empRgt = "0";
// Check for whitelist user
if ($emp_id == $empIdRootAdmin || isInParameterString($emp_id, $rgtEmpVipArray[$rgtIdArray[$j]])) :
$empRgt = "1";
endif;
endif;
if ($empRgt == "0") :
// Do NOT change emp_id_act right if emp_id right equals "0"
$reqRgtByEmpRights = $empActRgt;
else :
$reqRgtByEmpRights = "0";
// Check by existence in $emp_rights
if ($empRgt == "1" && $reqRgtByEmpRights == "0") :
for ($i = 0; $i < $fieldsLength; $i++) :
if ($emp_rights[$i] == $rgtIdArray[$j]) :
$reqRgtByEmpRights = "1";
endif;
endfor;
endif;
endif;
$newRights = substr_replace($newRights,$reqRgtByEmpRights,$j,1);
endfor;
endif;
updateStmt("employee","emp_id",$emp_id_act,array("emp_rights",$newRights));
// Write logdata into log database
writeToLogDB("115",$hq_id,"",$usr_id,"","","","RIGHTS_OLD=" . $tmpEmpActRigths . "|RIGHTS_NEW=" . $newRights,"","",$emp_id_act);
$statusMessage = getLngt("Die Rechte wurden gesetzt!");
else :
$statusMessage = getLngt("Die Rechte können nicht geändert werden!");
endif;
endif;
else :
$statusMessage = getLngt("Bitte geben Sie mindestens den Namen, den Vornamen, die Mailadresse und einen Anmeldenamen ein!");
endif;
endif;
// ******************
// * Operations end *
// ******************
// Get the emp_id of the root admin, e.g. setting new passwords of employees
$empIdRootAdmin = getEmpIdOfRootAdmin($userTypeName);
// MASTER RIGHTS FOR ALL HEADQUARTERS OF A MANDATOR
// Get the rights of the employee logged in
$empRights = getRights($emp_id);
// Get the rights of the employee to be modified
$empRightsAct = getRights($emp_id_act, "1");
$empParametersArrayAct = getParameterArray($emp_id_act);
// HEADQUARTERS ACCESS
// Check accessibility to headquarters, init for headquarters logged in (also for $userTypeName != "hq")
// First check mandator of the employee logged in has to be the same (!!!) like from the employee edited !!!!
$empActUsrId = getFieldValueFromId("employee", "emp_id", $emp_id_act, "usr_id");
$empActHqId = getFieldValueFromId("user", "usr_id", $empActUsrId, "hq_id");
$empIdActMdId = getFieldValueFromId("mandatorheadquarters", "hq_id", $empActHqId, "md_id");
$empHqAccessArray = array($hq_id);
$empActHqAccessArray = array($hq_id);
$headQuartersOut = "";
if ($emp_id_act != $emp_id && $emp_id_act != $empIdRootAdmin && $empIdActMdId != "" && is_numeric($empIdActMdId) && $empIdActMdId == $md_id) :
if ($userTypeName == "hq") :
// All headquarters of the mandator
$f_hq_id = getColVectorFromDB2Array("mandatorheadquarters","md_id",$md_id,"hq_id");
// Access to headquarters of the employee logged in
if ($emp_id == $empIdRootAdmin) :
$empHqAccessArray = $f_hq_id; // Grant access to all headquarters to the root user (for the current mandator ONLY)
else :
$empHqAccess = getFieldValueFromId("employee","emp_id",$emp_id,"emp_headquarters");
$empHqAccessArray = explode(",", $empHqAccess);
endif;
// Access to headquarters of the current edited employee
$empActHqAccess = getFieldValueFromId("employee","emp_id",$emp_id_act,"emp_headquarters");
$empActHqAccessArray = explode(",", $empActHqAccess);
// The employee edited has to be granted to his default headquarters
/*
if (!in_array($empActHqId, $empActHqAccessArray)) :
array_push($empActHqAccessArray, $empActHqId);
endif;
*/
// Get headquarters to be disabled because the employee logged in has no access to
$hqDisabledArray = array_diff($f_hq_id, $empHqAccessArray); // $f_hq_id "minus" $empHqAccessArray
// The default headquarters of the user be edited ($empActHqId) has to be disabled! Changes by the root user possible only!
/*
if ($emp_id != $empIdRootAdmin) :
if (!in_array($empActHqId, $hqDisabledArray)) :
array_push($hqDisabledArray, $empActHqId);
endif;
endif;
*/
// Output
$headQuartersOut = addCheckboxesFromTable("f_hq_id","headquarters AS hq, mandatorheadquarters AS mdhq","hq.hq_id","hq.hq_mnemonic","hq.hq_mnemonic","mdhq.md_id = '" . $md_id . "' AND hq.hq_id = mdhq.hq_id",$empActHqAccessArray, "&nbsp;&nbsp;&nbsp;", $hqDisabledArray);
endif;
endif;
// Secure-check of the association between customer and costcenter
$tmpFields = array("cs_id",$customerId,"csc_id",$cscIdActual);
if ($userTypeName == "hq" || existsEntry("costcenter",$tmpFields)) :
$cscNameActual = my_str_check(getFieldValueFromId("costcenter","csc_id",$cscIdActual,"csc_name"));
// Selection of the employee if emp_id_act is not null
if ($emp_id_act != "") :
if ($userTypeName == "hq") :
$sqlquery = "SELECT usr.usr_name, usr.usr_firstname, usr.usr_email, usr.usr_phone,"
. " usr.usr_phone2, usr.usr_account, usr.usr_birthdate"
. " FROM user AS usr, employee AS emp"
. " WHERE emp.emp_id = '$emp_id_act' AND usr.usr_id = emp.usr_id AND emp.csc_id = 0"
. " ORDER BY usr.usr_name";
endif;
if ($userTypeName == "cs") :
$sqlquery = "SELECT usr.usr_name, usr.usr_firstname, usr.usr_email, usr.usr_phone,"
. " usr.usr_phone2, usr.usr_account, usr.usr_birthdate"
. " FROM user AS usr, employee AS emp, costcenter AS csc"
. " WHERE emp.emp_id = '$emp_id_act' AND usr.usr_id = emp.usr_id AND emp.csc_id = csc.csc_id AND"
. " (csc.csc_path LIKE '%//$cscNameActual//%' OR emp.csc_id = '$cscIdActual')"
. " ORDER BY usr.usr_name";
endif;
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: [$sqlquery]" . $result->getMessage());
while ($row = $result->fetch_assoc()):
$usr_name = $row["usr_name"];
$usr_firstname = $row["usr_firstname"];
$usr_email = $row["usr_email"];
$usr_phone = $row["usr_phone"];
$usr_phone2 = $row["usr_phone2"];
$usr_account = $row["usr_account"];
$f_usr_birthdate = $row["usr_birthdate"];
endwhile;
$result->free();
$userToBeModified = getLngt("Benutzerkonto") . ": " . $usr_account;
else :
$userToBeModified = getLngt("Neuer Mitarbeiter für die Kostenstelle") . " " . $cscNameActual;
endif;
// Administrate the special right for CC-24 access.
$changeCC24State = "";
if ($userTypeName == "hq" || !existsEntry("customer",array("cs_admin",$emp_id_act))) :
if ($emp_id_act != "" && $emp_id_act != $empIdRootAdmin) :
// Check right to administrate CC-24 state of the displayed employee
if ($empHasAccessToCC24) :
// Get current state of the displayed employee
$empIdActCC24State = "0";
$empHqList = getParameterValue("0", "HEADQUARTERS_MULTIPLE_ACCESS_EMPLOYEES", "0");
if ($empHqList != "") :
$showMultipleHqSelection = isInParameterString($emp_id_act, $empHqList);
if ($showMultipleHqSelection) :
$empIdActCC24State = "1";
endif;
endif;
// Store new state
if ($f_act == "setCC24") :
// Take value in $par_cc24 and modify
if ($par_cc24 == "") : $par_cc24 = "0"; endif;
// Change parameter if existing state differs from requested state
if ($empIdActCC24State != $par_cc24) :
if ($par_cc24 == "0") :
// Remove user from parameter "HEADQUARTERS_MULTIPLE_ACCESS_EMPLOYEES"
$empHqList = removeItemStringList($empHqList, $emp_id_act);
setParameterValue("HEADQUARTERS_MULTIPLE_ACCESS_EMPLOYEES", $empHqList, "", "", "0", "0");
elseif ($par_cc24 == "1") :
// Add user to parameter "HEADQUARTERS_MULTIPLE_ACCESS_EMPLOYEES"
// $constIdCC24 = getParameterId("HEADQUARTERS_MULTIPLE_ACCESS_EMPLOYEES", "0", "0");
setParameterValue("HEADQUARTERS_MULTIPLE_ACCESS_EMPLOYEES", $empHqList . "|" . $emp_id_act, "", "", "0", "0");
endif;
endif;
$empIdActCC24State = $par_cc24;
endif;
$changeCC24State .= "<div style=\"float:left;width:100px\">" . getLngt("CC-24-Zugang:") . "</div><div><select name=\"par_cc24\" onChange=\"finishPage('" . ec("setCC24") . "');\">" . addOptionsGenericText(array(getLngt("Nein"),getLngt("Ja")),$empIdActCC24State,"") . "</select><br><br></div>\n";
endif;
endif;
endif;
// Administrate the rights of the displayed user.
// One only can set or remove rights if oneself has the same right!
// Nobody can change his own rights!!!
// The root-master cannot be changed, too! Also not by himself/herself, because all rights are enabled!
$changeRights = "";
if ($userTypeName == "hq" || !existsEntry("customer",array("cs_admin",$emp_id_act))) :
if ($emp_id_act != "" && $emp_id != $emp_id_act && $emp_id_act != $empIdRootAdmin) :
for ($i = 0; $i < strlen($empRights); $i++) :
$emp_tmp_checked[$i] = "";
$emp_tmp_disabled[$i] = "";
if (substr($empRightsAct,$i,1) == "1"): $emp_tmp_checked[$i] = "checked"; endif;
if (substr($empRights,$i,1) != "1"): $emp_tmp_disabled[$i] = "disabled"; endif;
// Check right for VIP staus to inherit
if ($emp_id != $empIdRootAdmin && $emp_tmp_disabled[$i] == "") :
if ($rgtVipArray[$rgtIdArray[$i]] == "1") :
// Check for whitelist user
if (!isInParameterString($emp_id, $rgtEmpVipArray[$rgtIdArray[$i]])) :
$emp_tmp_disabled[$i] = "disabled";
endif;
endif;
endif;
endfor;
if ($userTypeName == "hq") :
$changeRights = "";
for ($i = 0; $i < $rgtIdArrayLen; $i++) :
$changeRights .= "<div><input type=\"checkbox\" name=\"emp_rights[]\" value=\"". $rgtIdArray[$i] ."\" ".$emp_tmp_checked[$i]." ".$emp_tmp_disabled[$i]."> " . getLngt($rgtNameArray[$rgtIdArray[$i]]) . "</div>\n";
endfor;
$changeRights .= "<div>&nbsp;</div>\n";
$changeRights .= defineButtonType10(getLngt("Rechte&nbsp;setzen"), "action_rights", "finishPage('" . ec("setRights") . "');", "150", "left");
endif;
if ($userTypeName == "cs") :
$changeRights = "<div><input type=\"checkbox\" name=\"emp_rights[]\" value=\"csc_nav\" ".$emp_tmp_checked[0]." ".$emp_tmp_disabled[0]."> " . getLngt("Kostenstellennavigation") . "</div>\n" .
"<div><input type=\"checkbox\" name=\"emp_rights[]\" value=\"csc_admin\" ".$emp_tmp_checked[1]." ".$emp_tmp_disabled[1]."> " . getLngt("Kostenstellenverwaltung") . "</div>\n" .
"<div><input type=\"checkbox\" name=\"emp_rights[]\" value=\"emp\" ".$emp_tmp_checked[2]." ".$emp_tmp_disabled[2]."> " . getLngt("Mitarbeiter") . "</div>\n" .
"<div><input type=\"checkbox\" name=\"emp_rights[]\" value=\"ad\" ".$emp_tmp_checked[3]." ".$emp_tmp_disabled[3]."> " . getLngt("Adressen") . "</div>\n" .
"<div><input type=\"checkbox\" name=\"emp_rights[]\" value=\"job\" ".$emp_tmp_checked[4]." ".$emp_tmp_disabled[4]."> " . getLngt("Aufträge") . "</div>\n" .
"<div><input type=\"checkbox\" name=\"emp_rights[]\" value=\"inv\" ".$emp_tmp_checked[5]." ".$emp_tmp_disabled[5]."> " . getLngt("Rechnungen") . "</div>\n" .
"<div><input type=\"checkbox\" name=\"emp_rights[]\" value=\"set\" ".$emp_tmp_checked[6]." ".$emp_tmp_disabled[6]."> " . getLngt("Intervall") . "</div>\n" .
"<div><input type=\"checkbox\" name=\"emp_rights[]\" value=\"exp\" ".$emp_tmp_checked[7]." ".$emp_tmp_disabled[7]."> " . getLngt("Export") . "</div>\n" .
"<div><input type=\"checkbox\" name=\"emp_rights[]\" value=\"st\" ".$emp_tmp_checked[8]." ".$emp_tmp_disabled[8]."> " . getLngt("Statistik") . "</div>\n" .
"<div><input type=\"checkbox\" name=\"emp_rights[]\" value=\"map\" ".$emp_tmp_checked[9]." ".$emp_tmp_disabled[9]."> " . getLngt("Kartenübersicht") . "</div>\n" .
"<div><input type=\"checkbox\" name=\"emp_rights[]\" value=\"usr_account\" ".$emp_tmp_checked[10]." ".$emp_tmp_disabled[10]."> " . getLngt("Benutzerkonten ändern") . "</div>\n" .
"<div><input type=\"checkbox\" name=\"emp_rights[]\" value=\"download\" ".$emp_tmp_checked[11]." ".$emp_tmp_disabled[11]."> " . getLngt("Dokumente") . "</div>\n" .
"<div><input type=\"checkbox\" name=\"emp_rights[]\" value=\"usr_csc_matrix\" ".$emp_tmp_checked[12]." ".$emp_tmp_disabled[12]."> " . getLngt("Benutzer-Kostenstellen-Matrix") . "</div>\n" .
"<div><input type=\"checkbox\" name=\"emp_rights[]\" value=\"apt\" ".$emp_tmp_checked[13]." ".$emp_tmp_disabled[13]."> " . getLngt("Termine") . "</div>\n" .
"<div><input type=\"checkbox\" name=\"emp_rights[]\" value=\"obj_mngmnt\" ".$emp_tmp_checked[14]." ".$emp_tmp_disabled[14]."> " . getLngt("Scan-Objektmanagement") . "</div>\n" .
"<div><input type=\"checkbox\" name=\"emp_rights[]\" value=\"imp\" ".$emp_tmp_checked[15]." ".$emp_tmp_disabled[15]."> " . getLngt("Import") . "</div>\n" .
"<div>&nbsp;</div>\n";
$changeRights .= defineButtonType10(getLngt("Rechte&nbsp;setzen"), "action_rights", "finishPage('" . ec("setRights") . "');", "150", "left");
endif;
endif;
endif;
// If administrating employee is equal to the employee displayed or(!) the current employee is the root admin,
// the option has to be offered to change the password.
$changePasswordOutput = "";
$changeParameters = "";
$changeParametersListCs = "";
$changeParametersListCr = "";
$changeParametersListCsCsc = "";
$changeParametersListJb = "";
$changeGlobalParameters = "";
$changeEmployeeCostcenterOutput = "";
if ($emp_id_act != "" && ($emp_id == $emp_id_act || ($empIdRootAdmin != "" && $emp_id == $empIdRootAdmin) || ($empHasAccessToResetPassword && $emp_id_act != $empIdRootAdmin))) :
if ($userTypeName == "hq" || ($userTypeName == "cs" && $usrDataEditable)) :
$changePasswordOutput = "<div style=\"float:left;width:" . $styleDivWidth01 . ";\">" . getLngt("Passwort:") . "</div><div><input type=\"text\" name=\"usr_password\" value=\"\"></div>\n" .
"<div style=\"float:left;width:" . $styleDivWidth01 . ";\">" . getLngt("Wiederholung:") . "</div><div><input type=\"text\" name=\"usr_password2\" value=\"\"></div>\n" .
"<div>&nbsp;</div>\n" .
defineButtonType10(getLngt("Neues&nbsp;Passwort"), "action_pwd", "finishPage('" . ec("setPwd") . "');", "150", "left");
// To display the button the user logged in has to be (customer) root user
if ($parMaskEmpCscMatrixEnabled == "1" && $emp_id != $emp_id_act && authCheckEmployeeRights($emp_id, "12")) : // || $globalCustomerReadonlyDisabled == "1"
$changeEmployeeCostcenterOutput = defineButtonType10(getLngt("Kostenstellenfreigabe"), "action_csc_access", "openCscAccess('" . ec($emp_id_act) . "');", "180", "left");
endif;
endif;
if ($userTypeName == "hq") :
$parCurrNumOfLists = $empParametersArrayAct["MASK_MULTI_JOBLIST"][1]; // Number of lists (frames) displayed in job lists
$parModeCopyJob = $empParametersArrayAct["MODE_COPY_JOB"][1]; // Mode for "copy job"
$parModeLaterJob = $empParametersArrayAct["MODE_LATER_JOB"][1]; // Mode for later jobs (flag "Nacherfassung")
$parJoblistBrowseMax = $empParametersArrayAct["MASK_JOBLIST_BROWSE_MAX"][1]; // Max. of entries to be displayed in the joblist
$parJoblistShowUpToVht = $empParametersArrayAct["MASK_JOBLIST_SHOW_UPTO_VHT"][1]; // Display entries only up to this vehicle type
$parModeJobNum = $empParametersArrayAct["MASK_JOBLIST_MODE_JOB_NUM"][1]; // If a job number is entered in "job_from", "job_to" will automatically set with the same value
$parModeJoblistRefresh = $empParametersArrayAct["MASK_JOBLIST_MODE_REFRESH"][1]; // Automatic refresh is active after reload or depends on the setting
$parModeJoblistGetCourierData = $empParametersArrayAct["MASK_JOBLIST_GET_COURIER_DATA"][1]; // Inclusion of courier data into the joblist
$parSystemLanguage = $empParametersArrayAct["SYSTEM_LANGUAGE_DEFAULT"][1]; // System language
$parContentBgCols = $empParametersArrayAct["MASK_CONTENT_BGCOL"][1]; // Background colors of the content
$parDispoJbVhtGroup = $empParametersArrayAct["MASK_DISPOSITION_INIT_GROUP"][1]; // Graphical disposition: Initial group displayed
$parDispoJbVhtCustomer = $empParametersArrayAct["MASK_DISPOSITION_INIT_CS"][1]; // Graphical disposition: Initial customer displayed (depending on the selected group)
// List to be shown into the individual frame
$listStatus = getParameterValue($emp_id_act, "MASK_JOBLIST_DEFAULTLIST");
if ($listStatus == "") : $listStatus = MASK_JOBLIST_DEFAULTLIST; endif;
$listStatus = explode(",",$listStatus);
$changeParameters = "<div style=\"float:left;width:100px;\">" . getLngt("Anzahl Auftragslisten:") . "</div><div><select name=\"par_numOfJobLists\">" . addOptionsFromRange("1",MASK_MULTI_JOBLIST_MAX,$parCurrNumOfLists,"") . "</select></div>\n";
$changeParameters .= "<div style=\"clear:left\"><br></div>";
for ($j = 0; $j < MASK_MULTI_JOBLIST_MAX; $j++) :
$changeParameters .= "<div style=\"width:240px;\">" . getLngt("Liste") . " " . ($j + 1) . ":&nbsp;<select name=\"par_statusOfJobLists_" . ($j + 1) . "\">" . addOptionsFromTable("metatype","mt_sort","mt_value","mt_sort","mt_type = 'job_status'",$listStatus[$j]) . "</select></div>\n";
endfor;
$changeParameters .= "<div style=\"clear:left\"><br></div>";
$changeParameters .= "<div style=\"float:left;width:100px;\">" . getLngt("Modus Auftragskopie:") . "</div><div><select name=\"par_modeCopyJob\">" . addOptionsGenericText(array(getLngt("Disposition"),getLngt("Buchhaltung")),$parModeCopyJob,"") . "</select></div><div style=\"clear:left\">&nbsp;</div>\n" .
"<div style=\"float:left;width:100px;\">" . getLngt("Modus Nacherfassung:") . "</div><div><select name=\"par_modeLaterJob\">" . addOptionsGenericText(array(getLngt("Disposition"),getLngt("Buchhaltung")),$parModeLaterJob,"") . "</select></div><div style=\"clear:left\">&nbsp;</div>\n" .
"<div style=\"float:left;width:100px;\">" . getLngt("Max. Anzahl Einträge in der Auftragsliste:") . "</div><div><select name=\"par_joblistBrowseMax\">" . addOptionsFromArray(array("100","200","300","400","500","600","700","800","900","1000"),$parJoblistBrowseMax,"") . "</select></div><div style=\"clear:left\">&nbsp;</div>\n" .
"<div style=\"float:left;width:100px;\">" . getLngt("Nur Anzeige Einträge in der Auftragsliste bis inkl. Fahrzeugtyp:") . "</div><div><select name=\"par_joblistShowUpToVht\">" . addOptionsFromTable("metatype","mt_sort","mt_value","mt_sort","mt_type = 'vehicletype'",$parJoblistShowUpToVht) . "</select></div><div style=\"clear:left\"><br></div>\n" .
"<div style=\"float:left;width:100px;\">" . getLngt("Modus Auftragsnummer:") . "</div><div><select name=\"par_modeJobNum\">" . addOptionsGenericText(array(getLngt("Keine Übernahme"),getLngt("Übernahme")),$parModeJobNum,"") . "</select></div><div style=\"clear:left\">&nbsp;</div>\n" .
"<div style=\"float:left;width:100px;\">" . getLngt("Modus Refreshing nach Reload:") . "</div><div><select name=\"par_modeJoblistRefresh\">" . addOptionsGenericText(array(getLngt("Immer aktiv"),getLngt("Nach Einstellung")),$parModeJoblistRefresh,"") . "</select></div><div style=\"clear:left\">&nbsp;</div>\n" .
"<div style=\"float:left;width:100px;\">" . getLngt("Einbezug Transporteurdaten in der Auftragsliste:") . "</div><div><select name=\"par_modeJoblistGetCourierData\">" . addOptionsGenericText(array(getLngt("Nein"),getLngt("Ja")),$parModeJoblistGetCourierData,"") . "</select></div><div style=\"clear:left\">&nbsp;</div>\n" .
"<div style=\"float:left;width:100px;\">" . getLngt("Sprache:") . "</div><div><select name=\"par_systemLanguage\">" . addOptionsFromTable("phoenix_special.language","lng_num","lng_text","lng_num","",$parSystemLanguage) . "</select></div><div style=\"clear:left\"><br></div>\n" .
"<div style=\"float:left;width:100px;\">" . getLngt("Darstellung:") . "</div><div><select name=\"par_ContentBgCols\">" . addOptionsGenericText(array(getLngt("Blau"),getLngt("Grau")),$parContentBgCols,"") . "</select></div><div style=\"clear:left\">&nbsp;</div>\n";
// Disposition with user interface (drag and drop jobs on vehicle timelines)
$changeParameters .= "<div style=\"float:left;width:100px;\">" . getLngt("Standard-Gruppe") . "</div>\n" .
"<div><select class=\"f8np1\" name=\"par_dispoJbVhtGroup\" id=\"grpId\"><option value=\"0\"" . ($parDispoJbVhtGroup == "" || $parDispoJbVhtGroup == "0" ? "selected" : "") . ">" . getLngt("----") . "</option>" . addOptionsFromTable("groups AS grp","grp.grp_id","grp.grp_name","grp.grp_id","grp.md_id = '" . $md_id . "' AND grp.grp_system = '1'",$parDispoJbVhtGroup) . "</select></div>\n" .
"<div style=\"clear:left\">&nbsp;</div>\n";
$tmpWhereClause = "";
if ($emp_id != $empIdRootAdmin) : $tmpWhereClause = "cs.hq_id IN " . getSQLMandatorArray($empHqAccessArray) . " AND "; endif;
/*
$changeParameters .= "<div style=\"float:left;width:100px;\">" . getLngt("Standard-Kunde") . "</div>\n" .
"<div><select class=\"f8np1\" name=\"par_dispoJbVhtCustomer\" id=\"csId\"><option value=\"0\"" . ($parDispoJbVhtCustomer == "" || $parDispoJbVhtCustomer == "0" ? "selected" : "") . ">" . getLngt("----") . "</option>" . ($parDispoJbVhtGroup != "" ? addOptionsFromTable("customer AS cs, company AS cmp","cs.cs_id","cmp.cmp_comp","cmp.cmp_comp",$tmpWhereClause . "cmp.cmp_id = cs.cmp_id AND cmp.cmp_comp != 'EXTERN' AND cs.cs_id_parent != '0' AND NOT isnull(cs.cs_id_parent) AND cs_group LIKE '%," . $parDispoJbVhtGroup . ",%'",$parDispoJbVhtCustomer) : "") . "</select></div>\n" .
"<div style=\"clear:left\">&nbsp;</div>\n";
*/
$parMaskCmpFieldDisplayed = getParameterValue("0", "MASK_EMPLOYEE_CMP_FIELD_DISPLAYED", $hq_id);
if ($parMaskCmpFieldDisplayed == "") : $parMaskCmpFieldDisplayed = getParameterValue("0", "MASK_EMPLOYEE_CMP_FIELD_DISPLAYED", "0"); endif;
$changeParameters .= "<div style=\"float:left;width:100px;\">" . getLngt("Standard-Kunde") . "</div>\n" .
"<div><select class=\"f8np1\" name=\"par_dispoJbVhtCustomer\" id=\"csId\"><option value=\"0\"" . ($parDispoJbVhtCustomer == "" || $parDispoJbVhtCustomer == "0" ? "selected" : "") . ">" . getLngt("----") . "</option>" . ($parDispoJbVhtGroup != "" ? addOptionsFromTable("customer AS cs, company AS cmp","cs.cs_id","cmp.cmp_comp" . $parMaskCmpFieldDisplayed,"cmp.cmp_comp" . $parMaskCmpFieldDisplayed,$tmpWhereClause . "cmp.cmp_id = cs.cmp_id AND cmp.cmp_comp != 'EXTERN' AND cs.cs_id_parent != '0' AND NOT isnull(cs.cs_id_parent) AND cs.cs_group LIKE '%," . $parDispoJbVhtGroup . ",%'",$parDispoJbVhtCustomer) : "") . "</select></div>\n" .
"<div style=\"clear:left\">&nbsp;</div>\n";
// Button to set parameters
$changeParameters .= defineButtonType10(getLngt("Parameter&nbsp;setzen"), "action_rights", "finishPage('" . ec("setPar") . "');", "150", "left");
// * Customer list *
// Define sequence
$cslistConfigStatus = getParameterValue($emp_id_act, "MASK_CS_LIST_COLS");
// if ($cslistConfigStatus == "") : $cslistConfigStatus = MASK_CS_LIST_COLS; endif;
$cslistConfigStatus = explode(",",$cslistConfigStatus);
$tmpDefaultCsFieldArray = array("cmp_comp","cmp_comp2","cmp_comp3","cmp_comp4","ad_street","ad_zipcode","ad_city","cmp_match","cs_eid","usr_phone","usr_email","csc_id_jb_edit","cs_id_history","cs_id_report","cmp_authenticated_img","cs_id_jb_permanent","cmp_id_edit","cmp_hsno","usr_name","usr_firstname","cs_num_of_documents","br_key","br_name","cs_discount","cs_eid_old","cs_become_cs_date","usr_inv_email","usr_reminder_email","cmp_sustainability_email","cmp_stax_idno","tx_sign","tx_value","cmp_inv2hq","mt_value_payment_term");
$tmpDefaultCsTextArray = array(getLngt("Firma"),getLngt("Firma2"),getLngt("Firma3"),getLngt("Firma4"),getLngt("Strasse"),getLngt("PLZ"),getLngt("Ort"),getLngt("Freitext"),getLngt("EID"),getLngt("Tel."),getLngt("Email"),getLngt("Auftrag"),getLngt("Historie"),getLngt("Berichte"),getLngt("Kundenstatus"),getLngt("Dauerauftrag"),getLngt("Bearbeiten"),getLngt("Hausnr."),getLngt("Name"),getLngt("Vorname"),getLngt("Dokumente"),getLngt("Branchenschlüssel"),getLngt("Branche"),getLngt("Rabatt"),getLngt("Alt-EID"),getLngt("Kunde&nbsp;seit"),getLngt("Rechnungs-Email"),getLngt("Mahn-Email"),getLngt("Nachhaltigk.-Email"),getLngt("USt-IdNr."),getLngt("USt-Kennnz."),getLngt("USt-Satz"),getLngt("Einzelrechnung"),getLngt("Zahlungsbedingung"));
// Define field length
$cslistConfigLenStatus = getParameterValue($emp_id_act, "MASK_CS_LIST_LEN_COLS");
// if ($cslistConfigLenStatus == "") : $cslistConfigLenStatus = MASK_CS_LIST_LEN_COLS; endif;
$cslistConfigLenStatus = explode(",",$cslistConfigLenStatus);
// Output
$changeParametersListCs .= "<div>" . getLngt("Verwaltung Kundenliste:") . "</div>\n";
$changeParametersListCs .= "<div>" . getLngt("Lfd.&nbsp;&nbsp;Feld&nbsp;&nbsp;Länge") . "</div>\n";
$tmpDefaultCsFieldArrayLen = count($tmpDefaultCsFieldArray);
for ($j = 0; $j < $tmpDefaultCsFieldArrayLen; $j++) :
mcArrIsSet($cslistConfigStatus, $j);
$changeParametersListCs .= "<div>" . pad(($j + 1), "2", "0") . ".&nbsp;&nbsp;<select name=\"par_csListConfig_" . ($j + 1) . "\">" . addOptionsAndTextsFromArrays($tmpDefaultCsFieldArray,$tmpDefaultCsTextArray,$cslistConfigStatus[$j],"1") . "</select></div>\n";
// $changeParametersListCs .= "<select name=\"par_csListLenConfig_" . ($j + 1) . "\">" . addOptionsFromRange("0","50",$cslistConfigLenStatus[$j],"1") . "</select>";
endfor;
$changeParametersListCs .= "<div><br></div>\n";
// * Courier list *
// Define sequence
$crlistConfigStatus = getParameterValue($emp_id_act, "MASK_CR_LIST_COLS");
// if ($crlistConfigStatus == "") : $crlistConfigStatus = MASK_CR_LIST_COLS; endif;
$crlistConfigStatus = explode(",",$crlistConfigStatus);
$tmpDefaultCrFieldArray = array("cr_sid","crvh_vh_sign","cr_eid","crvh_prov","usr_name","usr_firstname","usr_phone","cr_mobile_pda","cmp_authenticated_img","cr_id_history","cr_id_report","cmp_id_edit","ad_street","ad_zipcode","ad_city","crvh_remark","crvh_freetext_1","crvh_measurement","crvh_length","crvh_width","crvh_height","crvh_position","usr_account","cr_num_of_documents","crvh_num_of_documents","crvh_payload","crvh_env_badge_level","crvh_corporate_identity","crvh_licence_date","crvh_comm_no","cmp_comp","cr_imei","cmp_freetext1","crvh_drivetype","vht_id_inv","usr_email","crvh_totalweight","cr_serialno");
$tmpDefaultCrTextArray = array(getLngt("SID"),getLngt("Kennz."),getLngt("EID"),getLngt("Prov."),getLngt("Name"),getLngt("Vorname"),getLngt("Tel."),getLngt("Mobil-PDA"),getLngt("Freigabe"),getLngt("Historie"),getLngt("Berichte"),getLngt("Bearbeiten"),getLngt("Straße"),getLngt("PLZ"),getLngt("Ort"),getLngt("Fzg.Bemerkung"),getLngt("Fzg.Freitext"),getLngt("Fzg.Maße"),getLngt("Fzg.Länge"),getLngt("Fzg.Breite"),getLngt("Fzg.Höhe"),getLngt("Fzg.Stellplätze"),getLngt("Anmeldename"),getLngt("Tp.Dokumente"),getLngt("Fzg.Dokumente"),getLngt("Fzg.Nutzlast"),getLngt("Umweltstufe"),getLngt("CI"),getLngt("Fzg.Erstzulassung"),getLngt("Fzg.Kommiss.nr."),getLngt("Firma"),getLngt("IMEI"),getLngt(wrapPhrase("Freitext", "cr_list")),getLngt("Antriebsart"),getLngt("Rechn.fzg.typ"),getLngt("Email"),getLngt("Fzg.Zul.Gewicht"),getLngt("Seriennr."));
// Define field length
$crlistConfigLenStatus = getParameterValue($emp_id_act, "MASK_CR_LIST_LEN_COLS");
// if ($crlistConfigLenStatus == "") : $crlistConfigLenStatus = MASK_CR_LIST_LEN_COLS; endif;
$crlistConfigLenStatus = explode(",",$crlistConfigLenStatus);
// Output
$changeParametersListCr .= "<div>" . getLngt("Verwaltung Transporteursliste:") . "</div>\n";
$changeParametersListCr .= "<div>" . getLngt("Lfd.&nbsp;&nbsp;Feld&nbsp;&nbsp;Länge") . "</div>\n";
$tmpDefaultCrFieldArrayLen = count($tmpDefaultCrFieldArray);
for ($j = 0; $j < $tmpDefaultCrFieldArrayLen; $j++) :
mcArrIsSet($crlistConfigStatus, $j);
$changeParametersListCr .= "<div>" . pad(($j + 1), "2", "0") . ".&nbsp;&nbsp;<select name=\"par_crListConfig_" . ($j + 1) . "\">" . addOptionsAndTextsFromArrays($tmpDefaultCrFieldArray,$tmpDefaultCrTextArray,$crlistConfigStatus[$j],"1") . "</select></div>\n";
// $changeParametersListCr .= "<select name=\"par_crListLenConfig_" . ($j + 1) . "\">" . addOptionsFromRange("0","50",$crlistConfigLenStatus[$j],"1") . "</select><br>";
endfor;
$changeParametersListCr .= "<div><br></div>\n";
// * Job list *
// Define sequence
$jblistConfigStatus = getParameterValue($emp_id_act, "MASK_JB_LIST_COLS");
// if ($jblistConfigStatus == "") : $jblistConfigStatus = MASK_JB_LIST_COLS; endif;
$jblistConfigStatus = explode(",",$jblistConfigStatus);
// Check for mode of system usage
if ($globalParUseRelatedCustomer == "1") :
$tmpDefaultJbFieldArray = array("jb_id","business_volume_gross","jb_cr_price_gross","tr_comp","tr_comp2","streethsno","jb_tourzipcodes","vht_value","jb_ordertime","jb_csc_id","cr_sid","jb_taketime","jb_storno","jb_edit","ad_zipcode","ad2_zipcode","jb_lastzipcode","jb_tourcities","jb_dispoinfo","jb_bsg","jb_cs_report","jb_warningtime","jb_emp_hq_id","jb_cs_documents","jb_map","tr2_comp","gdc_addmont_content","gdc_addmont_context","gdc_toll_content","business_volume_gross_with_toll","jb_cr_price_gross_with_toll");
$tmpDefaultJbTextArray = array(getLngt("Nr."),getLngt("Preis"),getLngt("Frachtverg."),getLngt("Firma"),getLngt("Firma2"),getLngt("Startadresse"),getLngt("PLZn"),getLngt("Fahrz."),getLngt("Auftragszeit"),getLngt("K."),getLngt("Fahrzeug"),getLngt("Annahme"),getLngt("Storno"),getLngt("Bearb."),getLngt("Start-PLZ"),getLngt("2. PLZ"),getLngt("Ziel-PLZ"),getLngt("Orte"),getLngt("Dispoinfo"),getLngt("BSG-Quote"),getLngt("Berichte"),getLngt("Warnzeit"),getLngt("Callcenter"),getLngt("Dokumente"),getLngt("Karte"),getLngt("Kunde"),getLngt("RZM"),getLngt("GZM"),getLngt("Maut"),getLngt("Preis&nbsp;m.M."),getLngt("FV.m.M."));
else :
$tmpDefaultJbFieldArray = array("jb_id","business_volume","jb_cr_price","jb_tourname","tr_comp","tr_comp2","streethsno","jb_tourzipcodes","vht_value","jb_ordertime","jb_reserv","jb_permanent","cr_id_favoured","jb_csc_id","cr_sid","jb_taketime","jb_storno","jb_edit","ad_zipcode","ad2_zipcode","jb_lastzipcode","jb_tourcities","jb_dispoinfo","jb_bsg","jb_cs_report","jb_warningtime","jb_emp_hq_id","jb_cs_documents","jb_map","gdc_toll_content","business_volume_with_toll","jb_cr_price_with_toll","jb_cr_subprice_with_toll","jb_tr_sort","jb_serviceprice","jb_markup","jb_finishtime","jb_km","jb_co2e","tr_commission_no","jb_traveltime","zipcodecity","streethsno2","zipcodecity2","tr2_comp","jb_km_zone","jb_hq_id_bsg","jb_hq_id_exec_bsg","jb_hq_id");
$tmpDefaultJbTextArray = array(getLngt("Nr."),getLngt("Preis"),getLngt("Frachtverg."),getLngt("Tourenname"),getLngt("Firma"),getLngt("Firma2"),getLngt("Startadresse"),getLngt("PLZn"),getLngt("Fahrz."),getLngt("Auftragszeit"),getLngt("R."),getLngt("D."),getLngt("B."),getLngt("K."),getLngt("Kurier"),getLngt("Annahme"),getLngt("Storno"),getLngt("Bearb."),getLngt("Start-PLZ"),getLngt("2. PLZ"),getLngt("Ziel-PLZ"),getLngt("Orte"),getLngt("Dispoinfo"),getLngt("BSG-Quote"),getLngt("Berichte"),getLngt("Warnzeit"),getLngt("C."),getLngt("Dokumente"),getLngt("Karte"),getLngt("Maut"),getLngt("Preis&nbsp;m.M."),getLngt("FV&nbsp;m.M."),getLngt("FV&nbsp;o.Z.m.M."),getLngt("Sortierung"),getLngt("Service-Preis"),getLngt("TSZ"),getLngt("Erledigungszeit"),getLngt("KM"),getLngt("CO2/äq"),getLngt("KommNr.Abhol."),getLngt("Vorlaufzeit"),getLngt("Start-PLZ/Ort"),getLngt("2.Adresse"),getLngt("2.PLZ/Ort"),getLngt("2.Firma"),getLngt("Preis-KM"),getLngt("BSG-Erf.NL"),getLngt("BSG-Ausf.NL"),getLngt("Erf.-NL"));
endif;
// Check for inclusion of courier data
$maskJoblistGetCourierData = getParameterValue($emp_id, "MASK_JOBLIST_GET_COURIER_DATA");
if ($maskJoblistGetCourierData == "1") :
$tmpDefaultJbFieldArray = array_merge ($tmpDefaultJbFieldArray, array("cr_cmp_remark","cr_cmp_remark2"));
$tmpDefaultJbTextArray = array_merge ($tmpDefaultJbTextArray, array("Transp.Bemerk","Transp.Int.Bemerk."));
endif;
// Define field length
$jblistConfigLenStatus = getParameterValue($emp_id_act, "MASK_JB_LIST_LEN_COLS");
// if ($jblistConfigLenStatus == "") : $jblistConfigLenStatus = MASK_JB_LIST_LEN_COLS; endif;
$jblistConfigLenStatus = explode(",",$jblistConfigLenStatus);
// Output
$changeParametersListJb .= "<div>" . getLngt("Auftragsliste:") . "</td></tr></div>\n";
$changeParametersListJb .= "<div>" . getLngt("Lfd.&nbsp;&nbsp;Feld&nbsp;&nbsp;Länge") . "</div>\n";
$tmpArrayLen = count($tmpDefaultJbFieldArray);
for ($j = 0; $j < $tmpArrayLen; $j++) :
mcArrIsSet($jblistConfigStatus, $j);
$changeParametersListJb .= "<div>" . pad(($j + 1), "2", "0") . ".&nbsp;&nbsp;<select name=\"par_jbListConfig_" . ($j + 1) . "\">" . addOptionsAndTextsFromArrays($tmpDefaultJbFieldArray,$tmpDefaultJbTextArray,$jblistConfigStatus[$j],"1") . "</select></div>\n";
// $changeParametersListJb .= "<select name=\"par_jbListLenConfig_" . ($j + 1) . "\">" . addOptionsFromRange("0","50",$jblistConfigLenStatus[$j],"1") . "</select><br>";
endfor;
$changeParametersListJb .= "<div><br></div>\n";
// * Customer-Costcenter list *
// Define sequence
$cscsclistConfigStatus = getParameterValue($emp_id_act, "MASK_CSCSC_LIST_COLS");
// if ($cscsclistConfigStatus == "") : $cscsclistConfigStatus = MASK_CSCSC_LIST_COLS; endif;
$cscsclistConfigStatus = explode(",",$cscsclistConfigStatus);
$tmpDefaultCscscFieldArray = array("cmp_comp","cmp_comp2","cs_eid","csc_name","cmp_match","cmp_authenticated_img","ad_street","cscad_hsno","ad_zipcode","ad_city","cscad_remark","cscad_person","cscad_phone","statistic","cs_report");
$tmpDefaultCscscTextArray = array(getLngt("Firma"),getLngt("Firma2"),getLngt("ExtID"),getLngt("Kostenstelle"),getLngt("Freitext"),getLngt("Freigabe"),getLngt("Straße"),getLngt("Hausnr."),getLngt("PLZ"),getLngt("Ort"),getLngt("Bemerkung"),getLngt("Person"),getLngt("Telefon"),getLngt("Statistik"),getLngt("Berichte"));
// Define field length
$cscsclistConfigLenStatus = getParameterValue($emp_id_act, "MASK_CSCSC_LIST_LEN_COLS");
// if ($cscsclistConfigLenStatus == "") : $cscsclistConfigLenStatus = MASK_CSCSC_LIST_LEN_COLS; endif;
$cscsclistConfigLenStatus = explode(",",$cscsclistConfigLenStatus);
// Output
$changeParametersListCsCsc .= "<div>" . getLngt("Kundenkostenstellenliste Auftragserfassung:") . "</div>\n";
$changeParametersListCsCsc .= "<div>" . getLngt("Lfd.&nbsp;&nbsp;Feld&nbsp;&nbsp;Länge") . "</div>\n";
$tmpDefaultCscscFieldArrayLen = count($tmpDefaultCscscFieldArray);
$tmpDefaultCscscFieldArrayLen = ($tmpDefaultCscscFieldArrayLen + 6); // Special treatment
for ($j = 0; $j < $tmpDefaultCscscFieldArrayLen; $j++) :
mcArrIsSet($cscsclistConfigStatus, $j);
mcArrIsSet($cscsclistConfigLenStatus, $j);
$changeParametersListCsCsc .= "<div>" . pad(($j + 1), "2", "0") . ".&nbsp;&nbsp;<select name=\"par_cscscListConfig_" . ($j + 1) . "\">" . addOptionsAndTextsFromArrays($tmpDefaultCscscFieldArray,$tmpDefaultCscscTextArray,$cscsclistConfigStatus[$j],"1") . "</select>";
$changeParametersListCsCsc .= "<select name=\"par_cscscListLenConfig_" . ($j + 1) . "\">" . addOptionsFromRange("0","50",$cscsclistConfigLenStatus[$j],"1") . "</select></div>\n";
endfor;
$changeParametersListCsCsc .= "<div><br></div>\n";
endif;
// Button for setting GLOBAL PARAMETERS
$changeGlobalParameters .= defineButtonType10(getLngt("Globale&nbsp;Parameter&nbsp;setzen"), "action_globs", "finishPage('" . ec("setGlobPar") . "');", "200", "left");
$changeGlobalParameters .= "<div><br><br><br><br></div>";
// Change PDA locating state
if ($userTypeName == "hq" && !$empHasNoAccessToModifyPDALocatingState) :
// Get current state of locating mode
$locatingByPDA = getParameterValue("0", "LOCATING_PDA_ENABLED"); // Get hq value from table "parameter"
if ($locatingByPDA == "" || !is_numeric($locatingByPDA) || !($locatingByPDA == "0" || $locatingByPDA == "1")) :
$locatingByPDA = LOCATING_PDA_ENABLED;
if (!is_numeric($locatingByPDA) || !($locatingByPDA == "0" || $locatingByPDA == "1")) :
$locatingByPDA = "1"; // Enable per default
endif;
endif;
// Get interval of locating mode if mode is activated
$intervalStatus = array();
$locatingInterval = getParameterValue("0", "LOCATING_PDA_INTERVAL"); // Get corresponding interval
if ($locatingInterval == "") :
$locatingInterval = LOCATING_PDA_INTERVAL;
endif;
if ($locatingInterval != "") :
$intervalStatus = explode(",",$locatingInterval);
endif;
$changeGlobalParameters .= "<div style=\"float:left;width:80px\">" . getLngt("PDA-Ortung:") . "</div><div><select name=\"par_locatingByPDA\">" . addOptionsGenericText(array(getLngt("Aus"),getLngt("An")),$locatingByPDA,"") . "</select><br><br></div>\n";
// $changeGlobalParameters .= "<div style=\"float:left;width:100px\">" . getLngt("Intervall bei<br>Aktivierung:") . "</div>" .
$changeGlobalParameters .= "<div style=\"float:left;width:80px\">" . getLngt("Intervall bei<br>Aktivierung:") . "</div>" .
"<div>" .
"<select name=\"par_locatingFromHrs\">" . addOptionsFromRange("0","23",$intervalStatus[0],"1") . "</select> : " .
"<select name=\"par_locatingFromMin\">" . addOptionsFromRange("0","59",$intervalStatus[1],"1") . "</select>" .
"&nbsp;&nbsp;(" . getLngt("von") . ")" .
"</div>" .
"<div style=\"float:left;width:80px\">&nbsp;</div>" .
"<div>" .
"<select name=\"par_locatingToHrs\">" . addOptionsFromRange("0","23",$intervalStatus[2],"1") . "</select> : " .
"<select name=\"par_locatingToMin\">" . addOptionsFromRange("0","59",$intervalStatus[3],"1") . "</select>" .
"&nbsp;&nbsp;(" . getLngt("bis") . ")" . "<br><br>" .
"</div>\n" .
"</div>\n";
// BWV-Hotline and GLN
if (authCheckEmployeeRights($emp_id, "45")) :
/*
$par_GLN_HQ_ALL = getParameterValue("0", "GLN_HQ_ALL", "0");
for ($f = 0; $f < $f_hq_id_ext_len; $f++) :
// BWV-Hotline
$par_BWV_phone = getParameterValue("0", "BWV_PHONE_NO", (string) $f_hq_id_ext[$f]);
$changeGlobalParameters .= "<div style=\"width:300px\">" . ($f_hq_id_ext[$f] == "0" ? getLngt("BWV-Hotline bundesweit:") : getLngt("BWV-Hotline") . "&nbsp;" . $hqNameArr[$f_hq_id_ext[$f]]) . "<br>";
if (($emp_id == $emp_id_act || ($empIdRootAdmin != "" && $emp_id == $empIdRootAdmin)) && authCheckEmployeeRights($emp_id, "45")) :
$changeGlobalParameters .= "<input type=\"text\" name=\"par_BWV_phone_" . $f_hq_id_ext[$f] . "\" value=\"" . $par_BWV_phone . "\">";
else :
$changeGlobalParameters .= $par_BWV_phone;
endif;
$changeGlobalParameters .= "<br>\n";
// GLN
$hq_gln = "";
if ($f > 0) :
$hq_gln = getFieldValueFromId("headquarters","hq_id", $f_hq_id_ext[$f],"hq_gln");
endif;
$changeGlobalParameters .= ($f_hq_id_ext[$f] == "0" ? getLngt("GLN bundesweit:") : getLngt("GLN") . "&nbsp;" . $hqNameArr[$f_hq_id_ext[$f]]) . "<br>";
if (($emp_id == $emp_id_act || ($empIdRootAdmin != "" && $emp_id == $empIdRootAdmin)) && authCheckEmployeeRights($emp_id, "45")) :
if ($f == 0) :
$changeGlobalParameters .= "<input type=\"text\" name=\"par_GLN_0\" value=\"" . $par_GLN_HQ_ALL . "\">";
else :
$changeGlobalParameters .= "<input type=\"text\" name=\"par_GLN_" . $f_hq_id_ext[$f] . "\" value=\"" . $hq_gln . "\">";
endif;
else :
if ($f == 0) :
$changeGlobalParameters .= $par_GLN_HQ_ALL;
else :
$changeGlobalParameters .= $hq_gln;
endif;
endif;
$changeGlobalParameters .= "<br><br></div>\n";
endfor;
*/
endif;
endif;
endif;
// Manage access to root stocks
$changeParametersAccessStk = "";
if ($userTypeName == "hq") :
if ($emp_id_act != "" && $emp_id_act != $empIdRootAdmin) :
// Init
$allRootStocksArray = getColVectorFromDB2ArrayByClause("stock", "stk_id", "stk_pre_id = '0' AND stk_path = ''", "", "");
$allRootStocksArrayLen = count($allRootStocksArray);
if ($allRootStocksArrayLen > 0) :
$stkRootAccessIDsEmpIdArray = array();
$stkRootAccessIDsEmpId = "";
$stkRootAccessIDsActEmpIdArray = array();
$stkRootAccessIDsActEmpId = "";
// Check for being admin to get access to all root stocks
if (existsEntry("headquarters",array("hq_admin",$emp_id))) :
// Get all root stock IDs
$stkRootAccessIDsEmpIdArray = $allRootStocksArray;
// if (count($stkRootAccessIDsEmpIdArray) > 0) :
// $stkRootAccessIDsEmpId = implode(",",$stkRootAccessIDsEmpIdArray);
// endif;
else :
// Currrent user logged in
$stkRootAccessIDsEmpId = getParameterValue($emp_id, "MASK_STK_ROOT_ACCESS");
if ($stkRootAccessIDsEmpId != "") :
$stkRootAccessIDsEmpIdArray = explode(",",$stkRootAccessIDsEmpId);
endif;
endif;
// Current user to be viewed or edited
$stkRootAccessIDsActEmpId = getParameterValue($emp_id_act, "MASK_STK_ROOT_ACCESS");
if ($stkRootAccessIDsActEmpId != "") :
$stkRootAccessIDsActEmpIdArray = explode(",",$stkRootAccessIDsActEmpId);
endif;
$stkRootAccessIDsArray = array_diff($allRootStocksArray, $stkRootAccessIDsEmpIdArray);
$stkRootAccessIDs = implode(",", $stkRootAccessIDsArray);
// Output
if ($emp_id == $emp_id_act) :
$stkRootAccessIDsArray = $allRootStocksArray;
endif;
$changeParametersAccessStk .= "<div>" . getLngt("Zugang Hauptläger:") . "</div>\n";
// $changeParametersAccessStk .= "<div>" . addCheckboxesFromTable("par_stock_access", "stock", "stk_id", "stk_name", "stk_name", "stk_pre_id = '0' AND stk_path = ''", $stkRootAccessIDsActEmpIdArray, "<br>", $stkRootAccessIDsArray) . "</div>\n";
// RIGHT MANAGEMENT OF SUBSTOCKS (BEGIN)
$changeParametersAccessStk .= "<div>" . addCheckboxesFromTable("par_stock_access", "stock", "stk_id", "stk_name", "stk_name", "stk_pre_id = '0' AND stk_path = ''", $stkRootAccessIDsActEmpIdArray, "<br>", $stkRootAccessIDsArray) . "</div>\n";
$changeParametersAccessStk .= "<div>\n";
$changeParametersAccessStk .= "<div><br></div>\n";
$changeParametersAccessStk .= defineButtonType10(getLngt("Lagerzugänge&nbsp;setzen"), "action_rights", "finishPage('" . ec("setAccessRootStocks") . "');", "150", "");
$changeParametersAccessStk .= "<div><br><br></div>\n";
$par_substocks_readonly = getParameterValue($emp_id_act, "MASK_STK_READONLY_WHERE_DEFINED_WRITEACCESS");
if ($par_substocks_readonly == "") : $par_substocks_readonly = "0"; endif;
$changeParametersAccessStk .= "<div style=\"float:left;width:200px;\">" . getLngt("Nur Leseberechtigung auf unten definierte Unterläger:") . "</div><div><select name=\"par_substocks_readonly\">" . addOptionsGenericText(array(getLngt("Nein"),getLngt("Ja")),$par_substocks_readonly,"") . "</select></div><div style=\"clear:left\">&nbsp;</div>\n";
$changeParametersAccessStk .= "<div><br></div>\n";
$par_stk_article_access = getParameterValue($emp_id_act, "MASK_STK_ARTICLE_ACCESS");
if ($par_stk_article_access == "") : $par_stk_article_access = "0"; endif;
$changeParametersAccessStk .= "<div style=\"float:left;width:200px;\">" . getLngt("Berechtigung zur Artikelverwaltung:") . "</div><div><select name=\"par_stk_article_access\">" . addOptionsGenericText(array(getLngt("Nein"),getLngt("Ja")),$par_stk_article_access,"") . "</select></div><div style=\"clear:left\">&nbsp;</div>\n";
$changeParametersAccessStk .= "<div><br></div>\n";
$changeParametersAccessStk .= "<div>" . getLngt("Einschränkung auf Unterläger:") . "</div>\n";
$changeParametersAccessStk .= "<div>\n";
// Get parameter of the currrent executing emloyee logged in to check the right for substock level
$parMaskStkSubstockEmpIdAccess = getParameterValue($emp_id, "MASK_STK_SUBSTOCK_ACCESS"); // => E.G.: "10,11|13,17|21,23" <=> Pairs of "...|root stock, substock|..."
$parMaskStkSubstockEmpIdAccess = str_replace("|", "--", $parMaskStkSubstockEmpIdAccess);
$tmpPairsEmpIdArray = explode("--", $parMaskStkSubstockEmpIdAccess);
$tmpPairsEmpIdArrayLen = count($tmpPairsEmpIdArray);
// Get parameter of the viewed or edited emloyee to check the right for substock level
$parMaskStkSubstockActEmpIdAccess = getParameterValue($emp_id_act, "MASK_STK_SUBSTOCK_ACCESS"); // => E.G.: "10,11|13,17|21,23" <=> Pairs of "...|root stock, substock|..."
$parMaskStkSubstockActEmpIdAccess = str_replace("|", "--", $parMaskStkSubstockActEmpIdAccess);
$tmpPairsActEmpIdArray = explode("--", $parMaskStkSubstockActEmpIdAccess);
$tmpPairsActEmpIdArrayLen = count($tmpPairsActEmpIdArray);
$stkRootAccessIDsEmpIdArrayLen = count($stkRootAccessIDsEmpIdArray);
for ($i = 0; $i < $stkRootAccessIDsEmpIdArrayLen; $i++) :
// Init with root stock id
$stkIdToGetTheSubtreeFor = array($stkRootAccessIDsEmpIdArray[$i]);
$stkIdToGetTheSubtreeFor2 = array($stkRootAccessIDsEmpIdArray[$i]);
// Check restriction of the executing employee according to the current root stock
for ($j = 0; $j < $tmpPairsEmpIdArrayLen; $j++) :
$tmpSubStockTupel = explode(",", $tmpPairsEmpIdArray[$j]);
if ($tmpSubStockTupel[0] == $stkRootAccessIDsEmpIdArray[$i]) :
$stkIdToGetTheSubtreeFor = array();
$tmpSubStockTupelLen = count($tmpSubStockTupel);
for ($k = 1; $k < $tmpSubStockTupelLen; $k++) :
$stkIdToGetTheSubtreeFor[] = $tmpSubStockTupel[$k];
endfor;
endif;
endfor;
// Check restriction of the viewed or edited employee according to the current root stock
for ($j = 0; $j < $tmpPairsActEmpIdArrayLen; $j++) :
$tmpSubStockTupel = explode(",", $tmpPairsActEmpIdArray[$j]);
if ($tmpSubStockTupel[0] == $stkRootAccessIDsEmpIdArray[$i]) :
$stkIdToGetTheSubtreeFor2 = array();
$tmpSubStockTupelLen = count($tmpSubStockTupel);
for ($k = 1; $k < $tmpSubStockTupelLen; $k++) :
$stkIdToGetTheSubtreeFor2[] = $tmpSubStockTupel[$k];
endfor;
endif;
endfor;
// Check for relation between both sub stock access values of executing and viewed employee
// VERY IMPORTANT:
// 1. The <select>-field appears if the right of the viewed employee is less than the right of the executing employee AND
// the right of the stock id of the executing employee does exist in the path of the stock id of the edited employee
// 2. The <select>-field appears if the rights of both (executing and viewed employee) are equal
// 3. The <select>-field appears if the viewed employee has NO access to the stock but the executing employee
$stkIdToGetTheSubtreeForLen = count($stkIdToGetTheSubtreeFor);
$stkIdToGetTheSubtreeFor2Len = count($stkIdToGetTheSubtreeFor2);
// Check these points:
$tmpCheckA = false;
$tmpCheckB = false;
for ($j = 0; $j < $stkIdToGetTheSubtreeForLen; $j++) :
for ($k = 0; $k < $stkIdToGetTheSubtreeFor2Len; $k++) :
if (isStkChild($stkIdToGetTheSubtreeFor[$j], $stkIdToGetTheSubtreeFor2[$k], "1")) :
$tmpCheckA = true;
endif;
if (isStkChild($stkIdToGetTheSubtreeFor2[$j], $stkIdToGetTheSubtreeFor[$k], "1")) :
$tmpCheckB = true;
endif;
endfor;
endfor;
if ($tmpCheckA || ($tmpCheckB && in_array($stkRootAccessIDsEmpIdArray[$i], array_diff($stkRootAccessIDsEmpIdArray, $stkRootAccessIDsActEmpIdArray))) ) :
$stkIdTreeArray = array();
for ($j = 0; $j < $stkIdToGetTheSubtreeForLen; $j++) :
getTreeStockData($stkIdToGetTheSubtreeFor[$j]);
// Add current stock
$stkIdTreeArray[$stkIdToGetTheSubtreeFor[$j]] = getFieldValueFromId("stock","stk_id", $stkIdToGetTheSubtreeFor[$j],"stk_name");
endfor;
$changeParametersAccessStk .= "<div>\n";
$changeParametersAccessStk .= getFieldValueFromId("stock","stk_id", $stkRootAccessIDsEmpIdArray[$i],"stk_name") . ":";
$changeParametersAccessStk .= "</div>\n";
for ($j = 0; $j < $stkIdToGetTheSubtreeFor2Len; $j++) :
if (!in_array($stkIdToGetTheSubtreeFor2[$j], $allRootStocksArray)) :
$changeParametersAccessStk .= "<div>\n";
$changeParametersAccessStk .= "-&nbsp;" . getFieldValueFromId("stock","stk_id", $stkIdToGetTheSubtreeFor2[$j],"stk_name");
$changeParametersAccessStk .= "</div>\n";
endif;
endfor;
$changeParametersAccessStk .= defineButtonType08("+", "action_substk_add", "changeSubStock('" . $stkRootAccessIDsEmpIdArray[$i] . "','add');", "20", "left", "2");
$changeParametersAccessStk .= defineButtonType08("-", "action_substk_sub", "changeSubStock('" . $stkRootAccessIDsEmpIdArray[$i] . "','sub');", "20", "left", "2");
$changeParametersAccessStk .= "<div>\n";
$changeParametersAccessStk .= "<select name=\"par_stock_access_subtree_" . $stkRootAccessIDsEmpIdArray[$i] . "\">\n";
$changeParametersAccessStk .= addOptionsFromAssociativeArray($stkIdTreeArray, $stkIdToGetTheSubtreeFor2, "1", "", "");
$changeParametersAccessStk .= "</select>";
$changeParametersAccessStk .= "</div>\n";
endif;
endfor;
$changeParametersAccessStk .= "</div>\n";
// RIGHT MANAGEMENT OF SUBSTOCKS (END)
$changeParametersAccessStk .= "<div><br></div>\n";
// $changeParametersAccessStk .= defineButtonType10(getLngt("Lagerzugänge&nbsp;setzen"), "action_rights", "finishPage('" . ec("setAccessRootStocks") . "');", "150", "");
endif;
endif;
endif;
endif;
?>
<html>
<head>
<title><?php echo $pageTitel ?> <?php echo $usr_account ?></title>
<style type="text/css">
<?php include_once ("../css/phoenix.css.php"); ?>
<?php include_once ("../css/navigation.css.php"); ?>
<?php include_once ("../css/mc.css.php"); ?>
</style>
<?php include_once ("../include/js_framework.inc.php"); ?>
<script src="../include/checkFormTags.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
// NAVIGATION
<?php echo $jsMenuOut; ?>
function checkDate(checkObj,mode) {
var resetValue = checkDateFields(checkObj,mode);
if (resetValue) {
checkObj.value = '';
checkObj.focus();
};
};
function finishPage(f_act) {
document.forms[0].f_act.value = f_act;
document.forms[0].submit();
};
function refreshOpener(execFlag) {
if (execFlag == '1') {
opener.location.href = "employee_list.php?currentNavigationItem=zentralenmitarbeiter&customerId=<?php echo ec($customerId) ?>&cscIdRoot=<?php echo ec($cscIdRoot) ?>&cscIdActual=<?php echo ec($cscIdActual) ?>";
};
};
function newEmployee() {
document.location.href = "employee.php?customerId=<?php echo ec($customerId) ?>&cscIdRoot=<?php echo ec($cscIdRoot) ?>&cscIdActual=<?php echo ec($cscIdActual) ?>&currentNavigationItem=zentralenmitarbeiter" ;
};
function openGroups(empIdAct) {
var widthPopupWin = 800;
var heightPopupWin = 700;
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
var popupWin;
popupWin = window.open("../admin/groupmembers.php?itemType=emp&itemId=" + empIdAct,"","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
};
function changeSubStock(rootStockId ,op) {
document.forms[0].rootStkIdForSubstkPar.value = rootStockId;
document.forms[0].rootStkOpForSubstkPar.value = op;
finishPage("setAccessSubtocks");
}
function openCscAccess(empIdAct) {
var widthPopupWin = 800;
var heightPopupWin = 700;
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
var popupWin;
popupWin = window.open("../admin/employee_csc_rights.php?emp_id_act=" + empIdAct + "&customerId=<?php echo ec($customerId) ?>&cscIdRoot=<?php echo ec($cscIdRoot) ?>&cscIdActual=<?php echo ec($cscIdActual) ?>","","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
};
function reset2FAEmployeeFinishPage() {
if (confirm('<?php echo getLngt("Möchten Sie 2-Faktor-Authentifikation des Mitarbeiters wirklich zurücksetzen?") ?>')) {
document.forms[0].f_act.value='reset2FAEmployee';
document.forms[0].submit();
}
};
-->
</script>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>displayStatusMessage();refreshOpener('<?php echo $jsRefreshEmployeeList ?>');">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="mc_page-header" id="mc_page-header">
<?php echo $userToBeModified ?>
</div>
<div class="maincontent2 mc_elem" name="maincontent" id="maincontent">
<form action="../admin/employee.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="customerId" value="<?php echo ec($customerId) ?>">
<input type="hidden" name="cscIdRoot" value="<?php echo ec($cscIdRoot) ?>">
<input type="hidden" name="cscIdActual" value="<?php echo ec($cscIdActual) ?>">
<input type="hidden" name="emp_id_act" value="<?php echo ec($emp_id_act) ?>">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<input type="hidden" name="rootStkIdForSubstkPar" value="">
<input type="hidden" name="rootStkOpForSubstkPar" value="">
<?php echo htmlDivLineSpacer("20px"); ?>
<?php if ($headQuartersOut != "") : ?>
<div class="f10np1" style="float:left">
<?php echo $headQuartersOut ?>
</div>
<?php echo defineButtonType10(getLngt("Niederlassungsfreigaben&nbsp;setzen"), "action_hq_access", "finishPage('" . ec("setHqAccess") . "');", "250", "left"); ?>
<?php echo htmlDivLineSpacer("20px", "", "left"); ?>
<?php endif; ?>
<div>
<!-- 1. column -->
<div <?php echo setStyleHtmlDiv("300px","left"); ?>>
<!-- Basic data (name, firstname, etc.) -->
<div>
<div <?php echo setStyleHtmlDiv($styleDivWidth01,"left"); ?>><?php echo getLngt("Name*") ?>:</div>
<div><input type="text" name="usr_name" value="<?php echo $usr_name ?>" <?php echo $usrAccountReadOnly ?>></div>
</div>
<div>
<div <?php echo setStyleHtmlDiv($styleDivWidth01,"left"); ?>><?php echo getLngt("Vorname*") ?>:</div>
<div><input type="text" name="usr_firstname" value="<?php echo $usr_firstname ?>" <?php echo $usrAccountReadOnly ?>></div>
</div>
<div>
<div <?php echo setStyleHtmlDiv($styleDivWidth01,"left"); ?>><?php echo getLngt("E-Mail*") ?>:</div>
<div><input type="text" name="usr_email" value="<?php echo $usr_email ?>" <?php echo $usrAccountReadOnly ?>></div>
</div>
<div>
<div <?php echo setStyleHtmlDiv($styleDivWidth01,"left"); ?>><?php echo getLngt("Telefon") ?>:</div>
<div><input type="text" name="usr_phone" value="<?php echo $usr_phone ?>" <?php echo $usrAccountReadOnly ?>></div>
</div>
<div>
<div <?php echo setStyleHtmlDiv($styleDivWidth01,"left"); ?>><?php echo getLngt("Mobil") ?>:</div>
<div><input type="text" name="usr_phone2" value="<?php echo $usr_phone2 ?>" <?php echo $usrAccountReadOnly ?>></div>
</div>
<div>
<div <?php echo setStyleHtmlDiv($styleDivWidth01,"left"); ?>><?php echo getLngt("Anmeldename*") ?>:</div>
<div><input type="text" name="usr_account" value="<?php echo $usr_account ?>" <?php echo $usrAccountReadOnly ?>></div>
</div>
<?php
if ($userTypeName == "hq") :
// Birthdate
if ($f_usr_birthdate != "") :
$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;
?>
<div>
<div <?php echo setStyleHtmlDiv($styleDivWidth01,"left"); ?>><?php echo getLngt("Geburtstag") ?>:<br><?php echo getLngt("TT-MM-JJJJ") ?></div>
<div>
<input type="text" name="f_usr_birthdate_day" value="<?php echo $f_usr_birthdate_day ?>" size="2" maxlength="2" onBlur="checkDate(this,'day')">&nbsp;
<input type="text" name="f_usr_birthdate_month" value="<?php echo $f_usr_birthdate_month ?>" size="2" maxlength="2" onBlur="checkDate(this,'month')">&nbsp;&nbsp;
<input type="text" name="f_usr_birthdate_year" value="<?php echo $f_usr_birthdate_year ?>" size="4" maxlength="4">
</div>
</div>
<?php endif; ?>
<?php if ($emp_id_act == "") : ?>
<div>
<div <?php echo setStyleHtmlDiv($styleDivWidth01,"left"); ?>><?php echo getLngt("Passwort*") ?>:</div>
<div><input type="text" name="usr_password" value=""></div>
</div>
<div>
<div <?php echo setStyleHtmlDiv($styleDivWidth01,"left"); ?>><?php echo getLngt("Wiederholung*") ?>:</div>
<div><input type="text" name="usr_password2" value=""></div>
</div>
<?php endif; ?>
<?php echo htmlDivLineSpacer("10px", "", "left"); ?>
<?php
if (isset($emp_id_act) && $emp_id_act != "") :
$valueText = getLngt("Ändern"); $f_actText = "modifyEmployee";
else :
$valueText = getLngt("Speichern"); $f_actText = "newEmployee";
endif;
if (!$empHasNoAccessToEmployees) :
echo defineButtonType10($valueText, "action_save", "finishPage('" . $f_actText . "');", "120", "left");
echo defineButtonType10(getLngt("Zurücksetzen"), "action_reset", "newEmployee();", "120");
if ($userTypeName == "hq" && $emp_id_act != "") :
echo htmlDivLineSpacer("10px", "", "left");
echo defineButtonType10(getLngt("Gruppen"), "action_grp", "openGroups('" . ec($emp_id_act) . "');", "120", "left");
if ($emp_id != $emp_id_act) :
echo defineLinkButtonType10(getLngt("Rechte"), "action_emp_rgt", "../admin/employee_rights.php?deactivateMenu=1&emp_id_act=" . ec($emp_id_act), "120", "left", "0", "", "", "", "", "18");
endif;
endif;
echo htmlDivLineSpacer("10px", "", "left");
endif;
?>
<?php echo htmlDivLineSpacer("10px", "", "left"); ?>
<div>
<?php
echo $changeRights;
if ($userTypeName == "hq" && $empHasAccessToCC24) :
echo htmlDivLineSpacer("20px", "", "left");
echo $changeCC24State;
endif;
?>
</div>
<?php echo htmlDivLineSpacer("20px", "", "left"); ?>
<div>
<?php echo $changePasswordOutput ?>
</div>
<?php echo htmlDivLineSpacer("20px", "", "left"); ?>
<div>
<?php
if (($emp_id == $emp_id_act && $userTypeName == "cs") || ($empIdRootAdmin != "" && $emp_id == $empIdRootAdmin) || ($empHasAccessToReset2FA && $emp_id_act != $empIdRootAdmin)) :
echo defineButtonType10(getLngt("2FA&nbsp;zurücksetzen"), "action_2FA_reset", "reset2FAEmployeeFinishPage();", "150", "left", "3", "", "", "150px");
endif;
?>
</div>
<?php echo htmlDivLineSpacer("20px", "", "left"); ?>
<div>
<?php echo $changeEmployeeCostcenterOutput ?>
</div>
<?php echo htmlDivLineSpacer("30px", "", "left"); ?>
</div>
<!-- 2. column -->
<div <?php echo setStyleHtmlDiv("250px","left"); ?>>
<div>
<?php echo $changeParameters ?>
</div>
<?php echo htmlDivLineSpacer("30px", "", "left"); ?>
<div>
<?php echo $changeGlobalParameters ?>
</div>
</div>
<!-- 3. column -->
<div <?php echo setStyleHtmlDiv($styleDivWidth02,"left"); ?>>
<div>
<?php echo $changeParametersListCs ?>
</div>
</div>
<!-- 4. column -->
<div <?php echo setStyleHtmlDiv($styleDivWidth02,"left"); ?>>
<div>
<?php echo $changeParametersListCr ?>
</div>
</div>
<!-- 5. column -->
<div <?php echo setStyleHtmlDiv($styleDivWidth02,"left"); ?>>
<div>
<?php echo $changeParametersListJb ?>
</div>
</div>
<!-- 6. column -->
<div <?php echo setStyleHtmlDiv($styleDivWidth02,"left"); ?>>
<div>
<?php echo $changeParametersListCsCsc ?>
</div>
</div>
<!-- 7. column -->
<div <?php echo setStyleHtmlDiv("280px","left"); ?>>
<div>
<?php echo $changeParametersAccessStk ?>
</div>
</div>
</div>
</form>
</div>
</body>
</html>