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($f_usr_password,$f_usr_password2)) : TA("B"); $sqlStmtPwd = "INSERT INTO user (hq_id,usr_type,usr_name,usr_firstname,usr_email,usr_phone,usr_phone2,usr_fax,usr_account,usr_password,usr_birthdate)" . " VALUES ($hq_id,'$userListOfType','$f_usr_name','$f_usr_firstname','$f_usr_email','$f_usr_phone','$f_usr_phone2','$f_usr_fax','$f_usr_account',PASSWORD('$f_usr_password'),'$f_usr_birthdate')"; $res = $db->query($sqlStmtPwd); if (DB::isError($res)) : die ("$PHP_SELF: " . $res->getMessage()); endif; $usr_id_new = getLastInsertId(); $sqlStmtEmp = "INSERT INTO employee (usr_id,csc_id,emp_rights)" . " VALUES ($usr_id_new,'$cscIdActual','00000000000000000000000000000000000000000000000000')"; $res = $db->query($sqlStmtEmp); if (DB::isError($res)) : die ("$PHP_SELF: " . $res->getMessage()); endif; $emp_id_new = getLastInsertId(); // Automatischer E-Mail-Versand eines systemgenerierten Passwortes ??? // *** Special treatment *** if ($userListOfType == "4") : if ($f_selectRootStock != "") : // Insert the stock associated to the warehouseman insertStmt("stockuser", array("stk_id", $f_selectRootStock, "usr_id", $usr_id_new)); endif; // Set state of accessibility to substocks to readonly by default insertStmt("parameter", array("par_key", "MASK_STK_READONLY_WHERE_DEFINED_WRITEACCESS", "emp_id", $emp_id_new, "par_value", "1", "hq_id", $hq_id)); $f_act = "setAccessRootStocks"; endif; // Write logdata into log database writeToLogDB("73",$hq_id,"",$usr_id,"","","","STATUS_NEW=" . $logString,"","",""); TA("C"); TA("E"); $clearUserFields = true; endif; else : $statusMessage = getLngt("Der Benutzername existiert schon! Bitte wählen Sie einen anderen!"); endif; endif; // Modify user if ($f_act == "modifyUser" && $usr_id_curr != "") : // Check the user-account except the current to be modified in $usr_id_curr $sqlquery = "SELECT usr.usr_id FROM user AS usr" . " WHERE usr.usr_account = '" . $f_usr_account . "' AND" . " usr.usr_id != '" . $usr_id_curr . "'"; $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) : $tmpUsrName = getFieldValueFromId("user", "usr_id", $usr_id_curr, "usr_name"); $tmpUsrFirstName = getFieldValueFromId("user", "usr_id", $usr_id_curr, "usr_firstname"); $tmpUsrAccount = getFieldValueFromId("user", "usr_id", $usr_id_curr, "usr_firstname"); $tmpUsrPassword = getFieldValueFromId("user", "usr_id", $usr_id_curr, "usr_password"); $tmpUsrBirthdate = getFieldValueFromId("user", "usr_id", $usr_id_curr, "usr_birthdate"); $tmpUsrPhone = getFieldValueFromId("user", "usr_id", $usr_id_curr, "usr_phone"); $tmpUsrPhone2 = getFieldValueFromId("user", "usr_id", $usr_id_curr, "usr_phone2"); $tmpUsrFax = getFieldValueFromId("user", "usr_id", $usr_id_curr, "usr_fax"); $logString = makeLogString(array($tmpUsrName,$tmpUsrFirstName,$tmpUsrAccount,$tmpUsrPassword,$tmpUsrBirthdate,$tmpUsrPhone,$tmpUsrPhone2,$tmpUsrFax), ";", "0"); $defaultFields = array("usr_name",$f_usr_name,"usr_firstname",$f_usr_firstname,"usr_email",$f_usr_email,"usr_phone",$f_usr_phone,"usr_phone2",$f_usr_phone2,"usr_fax",$f_usr_fax,"usr_account",$f_usr_account,"usr_birthdate",$f_usr_birthdate); updateStmt("user","usr_id",$usr_id_curr,$defaultFields); // *** Special treatment *** if ($userListOfType == "4" && $f_selectRootStock != "") : if (existsEntry("stockuser",array("usr_id",$usr_id_curr))) : // Update the stock associated to the warehouseman updateStmt("stockuser","usr_id",$usr_id_curr,array("stk_id",$f_selectRootStock)); else : // Insert the stock associated to the warehouseman insertStmt("stockuser", array("stk_id", $f_selectRootStock, "usr_id", $usr_id_curr)); endif; $f_act = "setAccessRootStocks"; endif; // Write logdata into log database writeToLogDB("74",$hq_id,"",$usr_id,"","","","STATUS_MODIFIED=" . $logString,"","",""); // $clearUserFields = true; else : $statusMessage = getLngt("Der Benutzername existiert schon! Bitte wählen Sie einen anderen!"); endif; endif; // Remove user if ($f_act == "removeUser" && $usr_id_curr != "") : TA("B"); $tmpUsrName = getFieldValueFromId("user", "usr_id", $usr_id_curr, "usr_name"); $tmpUsrFirstName = getFieldValueFromId("user", "usr_id", $usr_id_curr, "usr_firstname"); $tmpUsrAccount = getFieldValueFromId("user", "usr_id", $usr_id_curr, "usr_firstname"); $tmpUsrPassword = getFieldValueFromId("user", "usr_id", $usr_id_curr, "usr_password"); $tmpUsrType = getFieldValueFromId("user", "usr_id", $usr_id_curr, "usr_type"); $logString = makeLogString(array($tmpUsrName,$tmpUsrFirstName,$tmpUsrAccount,$tmpEmpRigths,$tmpUsrPassword), ";", "0"); // *** Special treatment *** if ($userListOfType == "4") : deleteStmt("stockuser","usr_id = ".$usr_id_curr); endif; deleteStmt("user","usr_id = ".$usr_id_curr); deleteStmt("employee","usr_id = ".$usr_id_curr); // Write logdata into log database writeToLogDB("75",$hq_id,"",$usr_id,"","","","STATUS_DELETED=" . $logString . "|TYPE=" . $tmpUsrType,"","",$usr_id_curr); TA("C"); TA("E"); $clearUserFields = true; endif; // Stock employee (warehousemen) if ($userListOfType == "4") : // Change access to root stocks $allRootStocksArray = getColVectorFromDB2ArrayByClause("stock", "stk_id", "stk_pre_id = '0' AND stk_path = ''", "", ""); if ($f_act == "setAccessRootStocks" && $usr_id_curr != "" && $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 ($emp_id_act != $empIdRootAdmin) : if ($emp_id_act != $emp_id) : 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) : $tmpEmpIdRestArray = array_diff($stkRootAccessIDsEmpIdArray, $par_stock_access); $tmpEmpIdActUnionArray = array_unique(array_merge($stkRootAccessIDsActEmpIdArray, $par_stock_access)); else : $tmpEmpIdRestArray = $stkRootAccessIDsEmpIdArray; $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)); 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", $f_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", $f_substocks_readonly, "hq_id", $hq_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", $f_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", $f_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" && $usr_id_curr != "" && $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 ($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 . "
"; $parMaskStkSubstockActEmpIdAccess = str_replace("|", "--", $parMaskStkSubstockActEmpIdAccess); $tmpPairsActEmpIdArray = explode("--", $parMaskStkSubstockActEmpIdAccess); $tmpPairsActEmpIdArrayLen = count($tmpPairsActEmpIdArray); // echo "rootStkIdForSubstkPar: " . $rootStkIdForSubstkPar . "   " . getFieldValueFromId("stock","stk_id", $rootStkIdForSubstkPar,"stk_name") . "
"; // 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 . "   " . getFieldValueFromId("stock","stk_id", $currStock,"stk_name") . "
"; // Check parameter being a root stock or a substock or it is empty if ($currStock == "") : // echo "DRIN 1

"; // Current stock is empty, no parameter change // ... elseif (in_array($currStock, $allRootStocksArray)) : // echo "DRIN 2

"; // 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

"; // 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] . " => "; // 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] . "
"; $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 . "
"; 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)); 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; // ------------------------------------------------------------------------------------- endif; // *********************************************************************** // * Selection of all users of the requested user type ($userListOfType) * // *********************************************************************** if ($tableSort == "") : $tableSort = "usr_name"; endif; // Stock employee (warehousemen) if ($userListOfType == "4") : $sqlquery = "SELECT usr.usr_id, usr.usr_name, usr.usr_firstname, usr.usr_email, usr.usr_phone," . " usr.usr_phone2, usr.usr_fax, usr.usr_account, hq.hq_mnemonic, emp.emp_id AS emp_id_act, par.par_value, par2.par_value AS par2_value, par3.par_value AS par3_value, par4.par_value AS par4_value" . " FROM user AS usr, headquarters AS hq, employee AS emp LEFT JOIN parameter AS par ON par.par_key = 'MASK_STK_ROOT_ACCESS' AND par.hq_id = '" . $hq_id . "' AND par.emp_id = emp.emp_id" . " LEFT JOIN parameter AS par2 ON par2.par_key = 'MASK_STK_SUBSTOCK_ACCESS' AND par2.hq_id = '" . $hq_id . "' AND par2.emp_id = emp.emp_id" . " LEFT JOIN parameter AS par3 ON par3.par_key = 'MASK_STK_READONLY_WHERE_DEFINED_WRITEACCESS' AND par3.hq_id = '" . $hq_id . "' AND par3.emp_id = emp.emp_id" . " LEFT JOIN parameter AS par4 ON par4.par_key = 'MASK_STK_ARTICLE_ACCESS' AND par4.hq_id = '" . $hq_id . "' AND par4.emp_id = emp.emp_id" . " WHERE emp.usr_id = usr.usr_id AND usr.hq_id = hq.hq_id AND hq.hq_id IN " . getSQLMandatorArray($f_hq_id) . " AND usr.usr_type = '" . $userListOfType . "'" . " ORDER BY $tableSort"; else : $sqlquery = "SELECT usr.usr_id, usr.usr_name, usr.usr_firstname, usr.usr_email, usr.usr_phone," . " usr.usr_phone2, usr.usr_fax, usr.usr_account, hq.hq_mnemonic, emp.emp_id AS emp_id_act" . " FROM user AS usr, headquarters AS hq, employee AS emp" . " WHERE emp.usr_id = usr.usr_id AND usr.hq_id = hq.hq_id AND hq.hq_id IN " . getSQLMandatorArray($f_hq_id) . " AND usr.usr_type = '" . $userListOfType . "'" . " ORDER BY $tableSort"; endif; // echo "

" . $sqlquery . "

"; $result = $db->query($sqlquery); if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage()); // Maintable with header $numOfUser = 0; $tableOfUsers = "\n"; $tableOfUsers .= ""; // if (authCheckEmployeeRights($emp_id, "10")) : $tableOfUsers .= ""; $tableOfUsers .= ""; if ($userTypeName == "hq" && authCheckEmployeeRights($emp_id, "10")) : $tableOfUsers .= ""; endif; $tableOfUsers .= ""; $tableOfUsers .= ""; $tableOfUsers .= ""; $tableOfUsers .= ""; $tableOfUsers .= ""; $tableOfUsers .= ""; // endif; $tableOfUsers .= "\n"; $rowCounter = 0; $lineToggler = 0; while ($row = $result->fetch_assoc()): $numOfUser++; $cellColor = getListColor($numOfUser, $lineToggler); $tableOfUsers .= ""; $tableOfUsers .= ""; $tableOfUsers .= ""; if ($userTypeName == "hq" && authCheckEmployeeRights($emp_id, "10")) : $tableOfUsers .= ""; endif; $tableOfUsers .= ""; $tableOfUsers .= ""; $tableOfUsers .= ""; $tableOfUsers .= ""; $tableOfUsers .= ""; if ($userListOfType == "4") : $currStkId = getFieldValueFromId("stockuser","usr_id",$row["usr_id"],"stk_id"); $tableOfUsers .= ""; else : $tableOfUsers .= ""; endif; $tableOfUsers .= "\n"; $usrName = $row["usr_name"]; $usrFirstname = $row["usr_firstname"]; endwhile; $tableOfUsers .= "
 " . getLngt("Name") . " " . getLngt("Vorname") . " " . getLngt("Niederlassung") . " " . getLngt("E-Mail") . " " . getLngt("Telefon") . " " . getLngt("Mobil") . " " . getLngt("Anmeldename") . " " . getLngt("Löschen") . " " . getLngt("Bearbeiten") . "
 " . $row["usr_name"] . " " . $row["usr_firstname"] . " " . $row["hq_mnemonic"] . " " . $row["usr_email"] . " " . $row["usr_phone"] . " " . $row["usr_phone2"] . " " . $row["usr_account"] . "" . "" . "" . " " . "" . "" . "" . " " . "" . "" . "" . "
\n"; $result->free(); // ******************************************************************** // * Special fields and operations according to the current user type * // ******************************************************************** $specialOutput = ""; // $allRootStocksArray = getColVectorFromDB2ArrayByClause("stock", "stk_id", "stk_pre_id = '0' AND stk_path = ''", "", ""); // Stock employee (warehousemen) if ($userListOfType == "4") : $specialOutput .= "
"; $specialOutput .= "
" . getLngt("Hauptlager") . ":
"; $specialOutput .= "
"; $specialOutput .= " "; $specialOutput .= "
"; $specialOutput .= "
"; // Manage access to root stocks $changeParametersAccessStk = ""; if ($userTypeName == "hq") : // if ($emp_id_act != $empIdRootAdmin) : // Init if (count($allRootStocksArray) > 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 .= "
"; $changeParametersAccessStk .= "
" . getLngt("Zugang Hauptläger:") . "
\n"; // $changeParametersAccessStk .= "
" . addCheckboxesFromTable("par_stock_access", "stock", "stk_id", "stk_name", "stk_name", "stk_pre_id = '0' AND stk_path = ''", $stkRootAccessIDsActEmpIdArray, "
", $stkRootAccessIDsArray) . "
\n"; // $changeParametersAccessStk .= "

\n"; // $changeParametersAccessStk .= defineButtonType10(getLngt("Lagerzugänge setzen"), "action_rights", "finishPage('" . ec("setAccessRootStocks") . "');", "150", ""); // RIGHT MANAGEMENT OF SUBSTOCKS (BEGIN) $changeParametersAccessStk .= "
" . addCheckboxesFromTable("par_stock_access", "stock", "stk_id", "stk_name", "stk_name", "stk_pre_id = '0' AND stk_path = ''", $stkRootAccessIDsActEmpIdArray, "
", $stkRootAccessIDsArray) . "
\n"; if ($f_substocks_readonly == "") : $f_substocks_readonly = "1"; endif; $changeParametersAccessStk .= "
" . getLngt("Nur Leseberechtigung
auf definierte Unterläger:") . "
\n"; if ($f_stk_article_access == "") : $f_stk_article_access = "0"; endif; $changeParametersAccessStk .= "

" . getLngt("Berechtigung zur Artikelverwaltung:") . "
\n"; $changeParametersAccessStk .= "
\n"; $changeParametersAccessStk .= "
\n"; $changeParametersAccessStk .= "
" . getLngt("Einschränkung auf Unterläger:") . "
\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 -field appears if the rights of both (executing and viewed employee) are equal // 3. The \n"; $changeParametersAccessStk .= addOptionsFromAssociativeArray($stkIdTreeArray, $stkIdToGetTheSubtreeFor2, "1", "", ""); $changeParametersAccessStk .= ""; $changeParametersAccessStk .= "
\n"; endif; endfor; $changeParametersAccessStk .= "\n"; // RIGHT MANAGEMENT OF SUBSTOCKS (END) endif; // endif; endif; endif; endif; endif; ?> <?php echo $pageTitel ?> displayStatusMessage();">


>:
>:
>:
>:
>:
>:
>:
   
>:
>:
>: