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

232 lines
8.1 KiB
PHP

<?php
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
$httpVars = array("f_act", "cp_rem", "submitMode", "statusMessage");
getSecHttpVars("1", $httpVars);
$deactivateMenuStatic = "1";
$pageTitel = getLngt("FAHRZEUGSPERRE AUFHEBEN");
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
// INIT
$propId = "508";
// if ($submitMode == "") : $submitMode = "0"; endif;
// Get current global number of THIS database instance
// $constGlobalDbInstNo = getParameterValue("0", "GLOBAL_UNIQUE_DB_INSTANCE_NO", "0", "0");
$constGlobalDbInstNo = getGlobalUniqueDbInstanceNo();
// Get external databases (e.g. APP properties, mobile data, etc.)
$dbhostArray = getGlobalDbEnvironments("meta_object", "metaobject", false);
$dbhostArrayLen = count($dbhostArray);
$dbConnectionArray = array();
if ($dbhostArrayLen > 0) :
$dbConnectionArray["app_property"] = getDbConnectionSpecial($dbhostArray["as_intern"], "sysadmin", $dblogin, $dbpassword); // Change if migrated to another place
endif;
// Set the specified vehicle free
// cp_id cust_id hq_id usr_id inst_id cp_prec prop_id cp_ind cp_val cp_secval cp_modify cp_rem
// 6252 1 1 871151 NULL 30 508 0 wss://localhost 2023-04-03 16:15:52 HB1027
if ($f_act == "changeState") :
if ($dbhostArrayLen > 0 && $dbConnectionArray["app_property"] != "") :
if ($cp_rem != "") :
if ($submitMode != "") :
$oldPropId = $propId;
$newPropId = "99" . $propId;
$preStatusMessage = getLngt("Die Sperre wurde aufgehoben!");
if ($submitMode == "1") :
$oldPropId = "99" . $propId;
$newPropId = $propId;
$preStatusMessage = getLngt("Die Sperre wurde gesetzt!");
endif;
$res = updateStmt("sysadmin.conf_prop", "cp_rem", $cp_rem, array("prop_id", $newPropId), "cust_id = '" . $constGlobalDbInstNo . "' AND prop_id = '" . $oldPropId . "' AND usr_id > '1'", $dbConnectionArray["app_property"]);
if ($res > 0) :
$statusMessage = $preStatusMessage;
endif;
endif;
else :
$statusMessage = getLngt("Es wurde keine Kennung angegeben!");
endif;
else :
$statusMessage = getLngt("Keine Verbindung zur internen Datenbank!");
endif;
endif;
// Get all locked and unlocked vehicles
if ($dbhostArrayLen > 0 && $dbConnectionArray["app_property"] != "") :
$outTable = "<table>";
$outTable .= "<tr>";
$outTable .= "</tr>";
$outTable .= "<td><b> cp_id </b></td>";
$outTable .= "<td><b> cust_id </b></td>";
$outTable .= "<td><b> hq_id </b></td>";
$outTable .= "<td><b> usr_id </b></td>";
$outTable .= "<td><b> cp_prec </b></td>";
$outTable .= "<td><b> prop_id </b></td>";
$outTable .= "<td><b> cp_ind </b></td>";
$outTable .= "<td><b> cp_val </b></td>";
$outTable .= "<td><b> cp_secval </b></td>";
$outTable .= "<td><b> cp_modify </b></td>";
$outTable .= "<td><b> cp_rem </b></td>";
$outTable .= "</tr>";
$sqlquery = "SELECT cp_id, cust_id, hq_id, usr_id, cp_prec, prop_id, cp_ind, cp_val, cp_secval, cp_modify, cp_rem
FROM sysadmin.conf_prop
WHERE
prop_id IN ( 99" . $propId . ", " . $propId . " ) AND
cust_id = 1 AND
usr_id > 1
ORDER BY cust_id, prop_id, hq_id, cp_rem";
$result = $dbConnectionArray["app_property"]->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
while ($row = $result->fetch_assoc()):
$outTable .= "<tr>";
$outTable .= "<td>" . $row["cp_id"] . "</td>";
$outTable .= "<td>" . $row["cust_id"] . "</td>";
$outTable .= "<td>" . $row["hq_id"] . "</td>";
$outTable .= "<td>" . $row["usr_id"] . "</td>";
$outTable .= "<td>" . $row["cp_prec"] . "</td>";
if ($row["prop_id"] == $propId) :
$outTable .= "<td>" . "<b>" . $row["prop_id"] . "</b>" . "</td>";
else :
$outTable .= "<td>" . $row["prop_id"] . "</td>";
endif;
$outTable .= "<td>" . $row["cp_ind"] . "</td>";
$outTable .= "<td>" . $row["cp_val"] . "</td>";
$outTable .= "<td>" . $row["cp_secval"] . "</td>";
$outTable .= "<td>" . $row["cp_modify"] . "</td>";
if ($row["prop_id"] == $propId) :
$outTable .= "<td>" . "<a href=\"javascript:setField('" . $row["cp_rem"] . "','0')\" style=\"color: red\">" . $row["cp_rem"] . "</a>" . "</td>";
else :
// $outTable .= "<td>" . $row["cp_rem"] . "</td>";
$outTable .= "<td>" . "<a href=\"javascript:setField('" . $row["cp_rem"] . "','1')\" style=\"color: green\">" . $row["cp_rem"] . "</a>" . "</td>";
endif;
$outTable .= "</tr>";
endwhile;
$result->free();
endif;
$outTable .= "</table>";
?>
<html>
<head>
<title><?php echo $pageTitel ?></title>
<link rel="stylesheet" type="text/css" href="../css/phoenix.css">
<style type="text/css">
<?php include_once ("../css/navigation.css.php"); ?>
</style>
<?php include_once ("../include/js_framework.inc.php"); ?>
<script src="../include/checkFormTags.js" type="text/javascript"></script>
<script src="../include/searchLists.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
// NAVIGATION
<?php echo $jsMenuOut; ?>
function clearAllFields() {
document.forms[0].cp_rem.value = '';
};
function openCourierVehicles(courierId) {
var widthPopupWin = 1000;
var heightPopupWin = 900;
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
var popupWin;
popupWin = window.open("../admin/courier_vehicle.php?courierId=" + courierId,"","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
};
function finishPage(f_act = '') {
var ok = true;
if (f_act != '') {
if (document.forms[0].cp_rem.value.length == 0) {
alert('<?php echo getLngt("Bitte geben Sie die Kennung an!") ?>');
ok = false;
}
}
if (ok) {
ok = false;
var xStr = "freischalten";
if (document.forms[0].submitMode.value == '1') {
xStr = "sperren";
}
if (f_act == '' || confirm('Den Datensatz mit der Kennung ' + document.forms[0].cp_rem.value + ' ' + xStr + '?')) {
ok = true;
}
if (ok) {
document.forms[0].f_act.value = f_act;
document.forms[0].submit();
}
}
};
function setField(num, actMode) {
document.forms[0].submitMode.value = actMode;
document.forms[0].cp_rem.value = num;
if (actMode == '0') {
$('#action_submit').css('color','#77FF77');
$('#action_submit').prop('value', 'Sperre aufheben');
} else {
$('#action_submit').css('color','red');
$('#action_submit').prop('value', 'Sperre setzen');
}
// html('<b> ' + tourSumOutput + ' ' + tourWeightOutput + ' ' + tourCountOutput + '</b>'); // body.onLoad()
}
-->
</script>
</head>
<body class="menu_bgcol" onLoad="<?php echo $phpCurrentNavigationOnLoad ?>displayStatusMessage();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="maincontent" name="maincontent" id="maincontent">
<form action="../tools/freedom4vehiclesAdmin.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="submitMode" value="">
<?php echo htmlDivLineSpacer("10px"); ?>
<div class="f10bp1_blue">
<?php echo $pageTitel ?>
</div>
<?php echo htmlDivLineSpacer("20px"); ?>
<?php echo defineButtonType08("Aktualisieren", "action_reload", "finishPage();", "150", "left", "10") ?>
<?php echo defineButtonType08("Sperre aufheben", "action_submit", "finishPage('changeState');", "150", "left", "2") ?>
<div>
<input type="text" name="cp_rem" value="" size="10" tabindex="1">
</div>
<?php echo htmlDivLineSpacer("20px"); ?>
<?php echo $outTable; ?>
</form>
</div>
</body>
</html>