1. Import
This commit is contained in:
215
html/tools/enableDevice.php
Normal file
215
html/tools/enableDevice.php
Normal file
@@ -0,0 +1,215 @@
|
||||
<?php
|
||||
|
||||
include_once ("../include/mcglobal.inc.php");
|
||||
include_once ("../include/auth.inc.php");
|
||||
|
||||
|
||||
$httpVars = array("f_act", "cp_rem", "statusMessage");
|
||||
|
||||
|
||||
getSecHttpVars("1", $httpVars);
|
||||
|
||||
$deactivateMenuStatic = "1";
|
||||
$pageTitel = getLngt("GERÄTESPERRE AUFHEBEN");
|
||||
include_once ("../admin/menu.php");
|
||||
include_once ("../include/html.inc.php");
|
||||
|
||||
|
||||
// INIT
|
||||
$propId = "508";
|
||||
|
||||
// Termination condition(s)
|
||||
if ($hq_id == "" || !is_numeric($hq_id)) : die(); 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 == "setFree") :
|
||||
if ($dbhostArrayLen > 0 && $dbConnectionArray["app_property"] != "") :
|
||||
if ($cp_rem != "") :
|
||||
$res = updateStmt("sysadmin.conf_prop", "cp_rem", $cp_rem, array("prop_id", "99" . $propId), "cust_id = '" . $constGlobalDbInstNo . "' AND prop_id = '" . $propId . "' AND usr_id > '1'", $dbConnectionArray["app_property"]);
|
||||
if ($res > 0) :
|
||||
$statusMessage = getLngt("Die Sperre wurde aufgehoben!");
|
||||
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 .= "<td><b> DERZEIT GESPERRTE GERÄTE: </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 AND
|
||||
hq_id = '" . $hq_id . "'
|
||||
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"] . "')\">" . $row["cp_rem"] . "</a>" . "</td>";
|
||||
else :
|
||||
// $outTable .= "<td>" . $row["cp_rem"] . "</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;
|
||||
if (f_act == '' || confirm('Den Datensatz mit der Kennung ' + document.forms[0].cp_rem.value + ' zurücksetzen?')) {
|
||||
ok = true;
|
||||
}
|
||||
if (ok) {
|
||||
document.forms[0].f_act.value = f_act;
|
||||
document.forms[0].submit();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function setField(num) {
|
||||
document.forms[0].cp_rem.value = num;
|
||||
}
|
||||
|
||||
-->
|
||||
</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/enableDevice.php" method="post">
|
||||
<input type="hidden" name="f_act" 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('setFree');", "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>
|
||||
Reference in New Issue
Block a user