1. Import

This commit is contained in:
2026-03-29 10:34:57 +02:00
parent b0e00c1259
commit a1129565af
4899 changed files with 3007593 additions and 0 deletions

BIN
html/admin/Courier_New.ttf Normal file

Binary file not shown.

View File

@@ -0,0 +1,237 @@
<?php
/*
TOTP :: Register a new code
*/
include_once "../include/global.inc.php";
$authDoNotCheck2FA = true;
include_once "../include/auth.inc.php";
require_once "../include/GoogleAuthenticator.php";
getSecHttpVars("1", array("f_act", "statusMessage", "deactivateMenu", "activated2FA", "f_2faCode"));
getLanguage(__FILE__);
$deactivateMenuStatic = "1";
$pageTitel = getLngt("[2FA]-Registrierung");
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
getCurrentScript(__FILE__);
$debug = false;
if ($debug) : echo "usr_id = " . $usr_id . "</br>"; endif;
if ($debug) : echo "hq_id = " . $hq_id . "</br>"; endif;
$usrAccount = "";
$jsAction = "";
if (isset($usr_id) && $usr_id != "" && is_numeric($usr_id) && $usr_id > 0 &&
isset($hq_id) && $hq_id != "" && is_numeric($hq_id) && $hq_id > 0) :
$usrHqId = getFieldValueFromId("user", "usr_id", $usr_id, "hq_id");
$usrAccount = getFieldValueFromId("user", "usr_id", $usr_id, "usr_account");
$usrTotpSecretOld = getFieldValueFromId("user", "usr_id", $usr_id, "usr_totp_secret");
if ($debug) : echo "usrHqId = " . $usrHqId . "</br>"; endif;
if ($debug) : echo "usrAccount = " . $usrAccount . "</br>"; endif;
if ($debug) : echo "usrTotpSecretOld = " . $usrTotpSecretOld . "</br>"; endif;
if (!isset($activated2FA) || $activated2FA == "") : $activated2FA = "0"; endif;
if (!isset($f_2faCode)) : $f_2faCode = ""; endif;
$ga = new GoogleAuthenticator();
if ($f_act == "verify" && $f_2faCode != "") :
// Verify code to check the user scanned code with authentication app
$verificationOK = false;
$usrTotpSecret = getFieldValueFromId("user", "usr_id", $usr_id, "usr_totp_secret");
if ($usrTotpSecret != "") :
$currentCode = $ga->getCode($usrTotpSecret);
if ($f_2faCode == $currentCode) :
$verificationOK = true;
endif;
endif;
if ($verificationOK) :
$res = updateStmt("user","usr_id",$usr_id,array("usr_totp_activated", "1"), "usr_totp_secret != ''");
if ($res > 0) :
$tmpNum = rand(0,getrandmax());
$tmpSessionHash = md5($tmpNum);
updateStmt("user", "usr_id", $usr_id, array("usr_totp_sessionkey", $tmpSessionHash));
$_SESSION["sessionkey_2fa"] = $tmpSessionHash;
$jsAction = "opener.location.reload(); alert('" . getLngt("Das hat geklappt! Eine Deaktivierung können Sie auf der Startseite vornehmen!") . "'); this.close();";
else :
$statusMessage = getLngt("Die Aktivierung hat leider nicht geklappt! Beginnen Sie bitte erneut oder wenden Sie sich bitte an Ihren Ansprechpartner!");
$res = updateStmt("user","usr_id",$usr_id,array("usr_totp_secret", "", "usr_totp_activated", "0"));
endif;
else :
$statusMessage = getLngt("Das war leider nicht der korrekte Code. Geben Sie bitte die in der App angezeigte Zahlenfolge erneut ein!");
if ($debug) : echo "VERIFICATION NOT OK:</br>"; endif;
if ($debug) : echo "f_2faCode = " . $f_2faCode . "</br>"; endif;
if ($debug) : echo "currentCode = " . $currentCode . "</br>"; endif;
endif;
else :
// Generate secret
$secret = $ga->createSecret();
if ($debug) : echo "secret = " . $secret . "</br>"; endif;
if ($hq_id == $usrHqId) :
$res = updateStmt("user","usr_id",$usr_id,array("usr_totp_secret", $secret));
if ($res > 0) :
$qrCodeUrl = $ga->getQRCodeGoogleUrl("Stadtbote:votian", $secret);
if ($debug) : echo "qrCodeUrl = " . $qrCodeUrl . "</br>"; endif;
$oneCode = $ga->getCode($secret);
if ($debug) : echo "Checking Code '$oneCode' and Secret '$secret':</br>"; endif;
$checkResult = $ga->verifyCode($secret, $oneCode, 2); // 2 = 2*30sec clock tolerance
if ($checkResult) {
if ($debug) : echo 'OK'; endif;
} else {
if ($debug) : echo 'FAILED'; endif;
}
else :
$statusMessage = getLngt("Ein Schlüssel konnte nicht erstellt werden!");
endif;
else :
$statusMessage = getLngt("Ihre aktuelle Niederlassung entspricht nicht der Ihrem Account zugeordneten! Ggfs. vor Aufruf bitte wechseln!");
endif;
endif;
endif;
?>
<?php if ($usrAccount != "") : ?>
<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; ?>
<?php echo $jsAction ?>
function finishPage() {
if (document.forms[0].f_2faCode.value != '') {
document.forms[0].f_act.value = 'verify';
document.forms[0].submit();
} else {
alert('<?php echo getLngt("Bitte geben Sie den 2-FA-Code ein!"); ?>');
}
};
function bodyOnLoad () {
// Key event listener
document.forms[0].addEventListener("keydown", function(event) {
// Return key (13)
if (event.keyCode === 13) {
finishPage();
}
});
// Set focus
document.forms[0].f_2faCode.focus();
};
-->
</script>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>bodyOnLoad();displayStatusMessage();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="maincontent" name="maincontent" id="maincontent">
<form action="../admin/GA_generateBarcode.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="activated2FA" value="<?php echo $activated2FA ?>">
<input type="hidden" name="customerId" value="<?php echo $customerId ?>">
<input type="hidden" name="cscIdRoot" value="<?php echo $cscIdRoot ?>">
<input type="hidden" name="cscIdActual" value="<?php echo $cscIdActual ?>">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<?php echo htmlDivLineSpacer("20px"); ?>
<div>
<center>
<table border="0" cellpadding="0">
<tr>
<td class="f12np1" align="center" width="300"></br></br><span class="f12bp1_blue"><?php echo $pageTitel ?></span></br></br></br></td>
</tr>
<tr>
<td align="center">
<?php echo getLngt("Öffnen Sie die Authenticator-App und richten Sie</br>ein neues Konto ein. Scannen Sie dazu mit der App</br>den folgenden QR-Code:") ?>
</br></br>
</td>
<tr>
<tr>
<td align="center"><img src="<?php echo $qrCodeUrl ?>" border="0"></br></br></br></td>
</tr>
<tr>
<td align="center">
<?php echo getLngt("Bitte geben Sie den Code ein, der in</br>Ihrer 2-Faktor-Authentifizierzungs-App</br>angezeigt wird, und bestätigen Sie diesen!") ?>
</br></br>
</td>
<tr>
<tr>
<td align="center">
<span class="f10bp1_red">&gt;&gt;</span>&nbsp;&nbsp;
<input type="text" id="f_2faCode" name="f_2faCode" value="" maxlength="6" size="6">&nbsp;&nbsp;&nbsp;&nbsp;
<span class="f10bp1_blue"><a href="javascript:finishPage();"><?php echo getLngt("Bestätigen") ?></a></span>
&nbsp;&nbsp;<span class="f10bp1_red">&lt;&lt;</span>
</br></br></br>
</td>
<tr>
<td align="center">
<?php echo getLngt("Sie können einen neuen Code erzeugen,</br>falls der angezeigte sich nicht scannen lässt.") ?>
</br></br>
</td>
<tr>
<td align="center"><span class="f10bp1_blue"><a href="javascript:document.forms[0].submit();"><?php echo getLngt("Neuen QR-Code generieren") ?></a></span></td>
</tr>
<tr>
<td align="center"></br></br></br><span class="f10bp1_blue"><a href="javascript:this.close();"><?php echo getLngt("Schließen") ?></a></span></td>
</tr>
</table>
</center>
</div>
<?php echo htmlDivLineSpacer("15px"); ?>
</form>
</div>
</body>
</html>
<?php else :
header("Location: ../admin/start.php");
endif; ?>

View File

@@ -0,0 +1,186 @@
<?php
/*
TOTP :: Verification of the OTP-Codes
*/
include_once "../include/global.inc.php";
$authDoNotCheck2FA = true;
include_once "../include/auth.inc.php";
require_once "../include/GoogleAuthenticator.php";
getSecHttpVars("1", array("f_act", "f_2faCode", "statusMessage", "deactivateMenu"));
getLanguage(__FILE__);
$deactivateMenuStatic = "1";
$pageTitel = getLngt("[2FA]-Bestätigung");
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
getCurrentScript(__FILE__);
$debug = false;
$statusMessage = "";
if ($debug) : echo "usr_id = " . $usr_id . "</br>"; endif;
if ($debug) : echo "hq_id = " . $hq_id . "</br>"; endif;
// The session has to be set, otherwise go back to login page!
if (isset($_SESSION['usr_id']) && isset($_SESSION['hq_id']) &&
isset($usr_id) && $usr_id != "" && is_numeric($usr_id) && $usr_id > 0 &&
isset($hq_id) && $hq_id != "" && is_numeric($hq_id) && $hq_id > 0) :
if ($f_act == "verify") :
$f_act = "";
$verificationOK = false;
if ($f_2faCode != "") :
$usrTotpSecret = getFieldValueFromId("user", "usr_id", $usr_id, "usr_totp_secret");
if ($usrTotpSecret != "") :
$ga = new GoogleAuthenticator();
$currentCode = $ga->getCode($usrTotpSecret);
if ($f_2faCode == $currentCode) :
$tmpNum = rand(0,getrandmax());
$tmpSessionHash = md5($tmpNum);
updateStmt("user", "usr_id", $usr_id, array("usr_totp_sessionkey", $tmpSessionHash));
$_SESSION["sessionkey_2fa"] = $tmpSessionHash;
$verificationOK = true;
endif;
endif;
endif;
if ($verificationOK) :
header("Location: ../admin/start.php");
else :
session_destroy();
header("Location: ../admin/login.php");
if ($debug) : echo "VERIFICATION NOT OK:</br>"; endif;
if ($debug) : echo "f_2faCode = " . $f_2faCode . "</br>"; endif;
if ($debug) : echo "currentCode = " . $currentCode . "</br>"; endif;
endif;
endif;
else :
session_destroy();
header("Location: ../admin/login.php");
endif;
?>
<?php if (true) : ?>
<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 type="text/javascript">
<!--
// NAVIGATION
<?php echo $jsMenuOut; ?>
function finishPage() {
if (document.forms[0].f_2faCode.value != '') {
document.forms[0].f_act.value = 'verify';
document.forms[0].submit();
} else {
alert('<?php echo getLngt("Bitte geben Sie den 2-FA-Code ein!"); ?>');
}
};
function bodyOnLoad () {
// Key event listener
document.forms[0].addEventListener("keydown", function(event) {
// Return key (13)
if (event.keyCode === 13) {
finishPage();
}
});
// Set focus
document.forms[0].f_2faCode.focus();
};
-->
</script>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>bodyOnLoad();displayStatusMessage();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="maincontent" name="maincontent" id="maincontent">
<form action="../admin/GA_verification.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="customerId" value="<?php echo $customerId ?>">
<input type="hidden" name="cscIdRoot" value="<?php echo $cscIdRoot ?>">
<input type="hidden" name="cscIdActual" value="<?php echo $cscIdActual ?>">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<?php echo htmlDivLineSpacer("20px"); ?>
<div>
<center>
<tableborder="0" cellpadding="0">
<tr>
<td class="f12np1" align="center"></br></br><span class="f12bp1_blue"><?php echo $pageTitel ?></span></br></br></br></br></br></td>
</tr>
<tr>
<td align="center">
<span class="f10bp1_red">&gt;&gt;</span>&nbsp;&nbsp;
<input type="text" id="f_2faCode" name="f_2faCode" value="" maxlength="6" size="6">&nbsp;&nbsp;&nbsp;&nbsp;
<span class="f10bp1_blue"><a href="javascript:finishPage();"><?php echo getLngt("Bestätigen") ?></a></span>
&nbsp;&nbsp;<span class="f10bp1_red">&lt;&lt;</span>
</br></br></br></br>
</td>
</tr>
<tr>
<td align="center">
<?php echo getLngt("Bitte geben Sie den Code ein, der in Ihrer</br>2-Faktor-Authentifikations-App</br>angezeigt wird!") ?>
</br></br></br></br></br>
</td>
</tr>
<!--
<tr>
<td align="center">
<?php echo getLngt("Sollten Sie nicht an Ihre Authentifikations-App bzw.</br>Ihren Code herankommen, können Sie sich mit dem</br>folgenden Link Ihre hinterlegte Email-Adresse schicken lassen.") ?>
</br></br>
<?php echo getLngt("In dieser Email erhalten Sie einen Einmal-Code,</br>den Sie auf der folgenden Seite eingeben können.") ?></br>
<?php echo getLngt("Nach der Eingabe und Bestätigung werden autorisierte Mitarbeiter informiert") ?></br>
</br></br>
<span class="f10bp1_blue"><a href="javascript:finishPage();"><?php echo getLngt("Bestätigen") ?></a></span>
</br></br></br></br>
</td>
</tr>
-->
</table>
</center>
</div>
<?php echo htmlDivLineSpacer("15px"); ?>
</form>
</div>
</body>
</html>
<?php else :
session_destroy();
header("Location: ../admin/login.php");
endif; ?>

View File

@@ -0,0 +1,39 @@
<?php
include_once ("../include/dbglobal.inc.php");
getLanguage(__FILE__);
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="../css/phoenix.css">
</head>
<body bgcolor="#FFFFFA" leftmargin="1" topmargin="1" marginwidth="0" marginheight="0" link="#990000" vlink="#990000" alink="#990000">
<table border="0" height="100%" width="100%" align="center" cellspacing="0" cellpadding="0" vspace="0" hspace="0">
<tr>
<td width=20%><img src="../images/spacer_lightgray.jpg" width="100%" height="100%"></td>
<td width=60% align=center valign=center><img src="../images/logo_main.png" alt="votian"></td>
<td width=20%><img src="../images/spacer_lightgray.jpg" width="100%" height="100%"></td>
</tr>
<tr>
<td width=20%><img src="../images/spacer_lightgray.jpg" width="100%" height="100%"></td>
<td class="f10bp1_red" align="center">
<?php
echo getLngt("Wegen der extremen Anzahl an Login-Fehlversuchen wurde<br>der Zugang bis zum morgigen Tage gesperrt.<br>");
echo getLngt("Diese Sicherheitsmaßnahme ist leider notwendig!<br><br>");
echo getLngt("Wir bitten um Ihr Verständnis!<br><br>");
echo getLngt("Um eine vorzeitige Freischaltung zu erhalten,<br>wenden Sie sich bitte an die Zentrale!");
?>
</td>
<td width=20%><img src="../images/spacer_lightgray.jpg" width="100%" height="100%"></td>
</table>
</body>
</html>

394
html/admin/ad_admin.php Normal file
View File

@@ -0,0 +1,394 @@
<?php
/*=======================================================================
*
* ad_admin.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
include_once ("../geo/geocode.inc.php");
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act", "customerId", "cscIdRoot", "cscIdActual",
"f_id", "f_street", "f_zipcode", "f_city", "f_country",
"f_street_new", "f_zipcode_new", "f_city_new", "f_country_new",
"f_st_id_remove",
"orderClauseDefault", "statusMessage", "deactivateMenu"));
getLanguage(__FILE__);
$pageTitel = getLngt("ADRESSEN");
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
if (!authCheckEmployeeRights($emp_id, "0")) : die ("$PHP_SELF: Access denied!"); endif;
$numOfRows = 0;
$numOfRows2 = 0;
mcTrim($f_street); mcTrim($f_zipcode); mcTrim($f_city);
$searchValues = $f_street . $f_zipcode . $f_city; // If called e.g. by the first time with empty search-fields
// If no search-field has content then take default-city of the headquarter
$hqAddress = getAddress($hq_id, "hq");
if ($f_city == "") :
$f_city = mcArrTrim($hqAddress, "city");
endif;
// Initialize output
$out = "";
$out2 = "";
// Update single address
if ($f_act == "update") :
if ($f_id != "") :
if ($f_street_new != "" && $f_zipcode_new != "" && $f_city_new != "") :
if ($f_country_new == "") : $f_country_new = "DE"; endif;
updateStmt("address", "ad_id", $f_id, array("ad_street", $f_street_new, "ad_zipcode", $f_zipcode_new, "ad_city", $f_city_new, "ad_country", $f_country_new));
else :
$statusMessage = getLngt("Unvollständige Adressen werden nicht abgespeichert!");
endif;
else :
$statusMessage = getLngt("Wählen Sie bitte eine Adresse aus! Wählen Sie dazu bitte in dem Suchergebnis den jeweiligen Bearbeitungs-Link!");
endif;
// Init new search with updated address
$f_act = "search";
endif;
// Inserts address to table "street" for correct validation in the future
if ($f_act == "validated") :
if ($f_street_new != "" && $f_zipcode_new != "" && $f_city_new != "") :
if (!existsEntry("phoenix_special.street",array("st_street",$f_street_new,"st_zipcode",$f_zipcode_new,"st_city",$f_city_new))) :
insertStmt("phoenix_special.street", array("st_street",$f_street_new,"st_zipcode",$f_zipcode_new,"st_city",$f_city_new));
else :
$statusMessage = getLngt("Die Adresse existiert schon für die Validierung!");
endif;
else :
$statusMessage = getLngt("Unvollständige Adressen werden nicht abgespeichert!");
endif;
// Init new search with updated address
$f_act = "search";
endif;
// Removes entry from table "street"
if ($f_act == "removeEntryFromStreet") :
if ($f_st_id_remove != "") :
deleteStmt("phoenix_special.street","st_id = ".$f_st_id_remove);
else :
$statusMessage = getLngt("Der Eintrag kann nicht gelöscht werden!");
endif;
// Init new search with updated address
$f_act = "search";
endif;
// Generate search-resultset
if ($f_act == "search" && $searchValues != "") :
if (strlen($f_street) > 4 || (strlen($f_street) > 1 && (strlen($f_zipcode) > 1 || strlen($f_city) > 1))) :
// *********************************************************************
// * Selection of the costcenters of the current customer for the list *
// *********************************************************************
$whereClause = "";
if ($f_street != "") : $whereClause .= "ad_street LIKE '" . $f_street . "%'"; endif;
if ($whereClause != "" && $f_zipcode != "") : $whereClause .= " AND "; endif;
if ($f_zipcode != "") : $whereClause .= "ad_zipcode LIKE '" . $f_zipcode . "%'"; endif;
if ($whereClause != "" && $f_city != "") : $whereClause .= " AND "; endif;
if ($f_city != "") : $whereClause .= "ad_city LIKE '" . $f_city . "%'"; endif;
if ($whereClause != "" && $f_country != "") : $whereClause .= " AND "; endif;
if ($f_country != "") : $whereClause .= "ad_country LIKE '" . $f_country . "%'"; endif;
// if ($whereClause != "") : $whereClause = " AND " . $whereClause; endif;
if ($orderClauseDefault == "") :
$orderClause = "ad_street, ad_zipcode";
else :
$orderClause = "ad_" . $orderClauseDefault;
endif;
// *******************
// * TABLE "address" *
// *******************
$sqlquery = "SELECT ad.ad_id, ad.ad_street, ad.ad_zipcode, ad.ad_city, ad.ad_country"
. " FROM address AS ad"
. " WHERE " . $whereClause
. " ORDER BY " . $orderClause;
$lineToggler = 0;
$result = $db->dbQ($sqlquery);
while ($row = $result->fetch_assoc()):
$numOfRows++;
if ($lineToggler == 0) : $lineToggler = 1; else : $lineToggler = 0; endif;
$cellColor = getListColor($numOfRows, $lineToggler);
$v_ad_id = $row["ad_id"];
$v_ad_street = $row["ad_street"];
$v_ad_zipcode = $row["ad_zipcode"];
$v_ad_city = $row["ad_city"];
$v_ad_country = $row["ad_country"];
$out .= "<tr class=\"f10bp1\">";
$out .= "<td bgcolor=\"" . $cellColor ."\"> $v_ad_street &nbsp;</td> ";
$out .= "<td bgcolor=\"" . $cellColor ."\"> $v_ad_zipcode &nbsp;</td> ";
$out .= "<td bgcolor=\"" . $cellColor ."\"> $v_ad_city &nbsp;</td> ";
$out .= "<td bgcolor=\"" . $cellColor ."\"> $v_ad_country &nbsp;</td> ";
// $out .= "<td class=\"f8np1_red\" bgcolor=\"" . $cellColor ."\"> $v_ad_district &nbsp;</td> ";
$out .= "<td bgcolor=\"" . $cellColor ."\">&nbsp;" . "<a href=\"javascript:changeAddress('".$v_ad_id."','".my_str_check_js($v_ad_street)."','".my_str_check_js($v_ad_zipcode)."','".my_str_check_js($v_ad_city)."','".my_str_check_js($v_ad_country)."');\">"
. getLngt("Bearbeiten") . "</a>&nbsp;</td>";
$out .= "</tr>\n";
endwhile;
$result->free();
// **************************************************************************************
// * TABLE "street" Selection of the costcenter based on a search by companyname-prefix *
// **************************************************************************************
if (TRUE) :
$whereClause = "";
if ($f_street != "") : $whereClause .= "st_street LIKE '" . $f_street . "%'"; endif;
if ($whereClause != "" && $f_zipcode != "") : $whereClause .= " AND "; endif;
if ($f_zipcode != "") : $whereClause .= "st_zipcode LIKE '" . $f_zipcode . "%'"; endif;
if ($whereClause != "" && $f_city != "") : $whereClause .= " AND "; endif;
if ($f_city != "") : $whereClause .= "st_city LIKE '" . $f_city . "%'"; endif;
if ($whereClause != "" && $f_country != "") : $whereClause .= " AND "; endif;
if ($f_country != "") : $whereClause .= "st_country LIKE '" . $f_country . "%'"; endif;
// if ($whereClause != "") : $whereClause = " AND " . $whereClause; endif;
if ($orderClauseDefault == "") :
$orderClause = "st_street, st_zipcode";
else :
$orderClause = "st_" . $orderClauseDefault;
endif;
$sqlquery = "SELECT st_id, st_district, st_street, st_zipcode, st_city, st_country"
. " FROM phoenix_special.street"
. " WHERE " . $whereClause
. " ORDER BY " . $orderClause;
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
$lineToggler = 0;
while ($row = $result->fetch_assoc()):
$numOfRows2++;
if ($lineToggler == 0) : $lineToggler = 1; else : $lineToggler = 0; endif;
$cellColor = getListColor($numOfRows2, $lineToggler);
$v_ad_id = $row["st_id"];
$v_ad_district = $row["st_district"];
$v_ad_street = $row["st_street"];
$v_ad_zipcode = $row["st_zipcode"];
$v_ad_city = $row["st_city"];
$v_ad_country = $row["st_country"];
$out2 .= "<tr class=\"f10bp1\">";
// $out2 .= "<td class=\"f10bp1_red\" bgcolor=\"" . $cellColor ."\"> $v_csc_name </td> ";
$out2 .= "<td bgcolor=\"" . $cellColor ."\">&nbsp;" . "<a href=\"javascript:finishPage('".my_str_check_js($v_ad_district)."','".my_str_check_js($v_ad_street)."','".my_str_check_js($v_ad_zipcode)."','".my_str_check_js($v_ad_city)."','".my_str_check_js($v_ad_country)."','".mcIsSet($tourno)."');\">"
. $v_ad_street . "</a>" . "&nbsp;</td>";
$out2 .= "<td bgcolor=\"" . $cellColor ."\"> $v_ad_zipcode &nbsp;</td> ";
$out2 .= "<td bgcolor=\"" . $cellColor ."\"> $v_ad_city &nbsp;</td> ";
// $out2 .= "<td bgcolor=\"" . $cellColor ."\"> $v_ad_country &nbsp;</td> ";
// $out2 .= "<td bgcolor=\"" . $cellColor ."\"> $v_ad_district &nbsp;</td> ";
$out2 .= "<td bgcolor=\"" . $cellColor ."\">&nbsp;" . "<a href=\"javascript:removeEntryFromStreet('".$v_ad_id."');\">" . getLngt("Löschen") . "</a>&nbsp;</td>";
$out2 .= "</tr>\n";
endwhile;
$result->free();
endif; // if (FALSE)
else :
$statusMessage = getLngt("Eingabe entw. mind. 5 Zeichen bei Straße oder mind. 2 Zeichen bei Straße in Verbindung mit mind. 2 Zeichen bei Ort oder PLZ!");
endif;
endif;
?>
<html>
<head>
<title><?php echo $pageTitel ?></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 type="text/javascript">
<!--
// NAVIGATION
<?php echo $jsMenuOut; ?>
var v_district = '';
var v_street = '';
var v_zipcode = '';
var v_city = '';
var v_country = '';
function changeAddress(id,street,zipcode,city,country) {
document.forms[0].f_id.value = id;
document.forms[0].f_street_new.value = street;
document.forms[0].f_zipcode_new.value = zipcode;
document.forms[0].f_city_new.value = city;
document.forms[0].f_country_new.value = country;
};
function removeEntryFromStreet(id) {
if (confirm('<?php echo getLngt("Soll der Eintrag gelöscht werden?") ?>')) {
document.forms[0].f_st_id_remove.value = id;
document.forms[0].f_act.value = 'removeEntryFromStreet';
document.forms[0].submit();
}
};
function displayStatusMessage() {
if (statusMessage != "") {
alert(statusMessage);
}
};
function clearFields() {
document.forms[0].f_id.value = '';
document.forms[0].f_street.value = '';
document.forms[0].f_zipcode.value = '';
document.forms[0].f_city.value = '<?php echo $hqAddress["city"] ?>';
document.forms[0].f_country.value = '';
if (document.forms[0].f_district) {document.forms[0].f_district.value = '';};
};
-->
</script>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>displayStatusMessage();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="mc_page-header">
<?php echo getLngt("Allgemeine Adressen") ?>
</div>
<div class="maincontent mc_elem" name="maincontent" id="maincontent">
<form action="ad_admin.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="customerId" value="<?php echo $customerId ?>">
<input type="hidden" name="cscIdRoot" value="<?php echo $cscIdRoot ?>">
<input type="hidden" name="cscIdActual" value="<?php echo $cscIdActual ?>">
<input type="hidden" name="orderClauseDefault" value="<?php echo $orderClauseDefault ?>">
<input type="hidden" name="f_id" value="">
<input type="hidden" name="f_st_id_remove" value="">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<?php echo htmlDivLineSpacer("20px"); ?>
<?php echo defineButtonType08(getLngt("Suchen"), "action_search", "javascript:document.forms[0].f_act.value='search';document.forms[0].submit();", "180", "left", "3"); ?>
<?php echo defineButtonType08(getLngt("Felder zurücksetzen"), "action_clear", "javascript:clearFields();", "180"); ?>
<?php echo htmlDivLineSpacer("5px"); ?>
<div>
<table class="f8np1" border="0" cellpadding="0">
<tr>
<td><input type="text" name="f_street" value="<?php echo $f_street ?>" size="25" placeholder="<?php echo getLngt("Straße") ?>"></td>
<td><input type="text" name="f_zipcode" value="<?php echo $f_zipcode ?>" size="5" placeholder="<?php echo getLngt("PLZ") ?>"></td>
<td><input type="text" name="f_city" value="<?php echo $f_city ?>" size="20" placeholder="<?php echo getLngt("Ort") ?>"></td>
<td><input type="text" name="f_country" value="<?php echo $f_country ?>" size="3" placeholder="<?php echo getLngt("Land") ?>"></td>
<!-- <td><input type="text" name="f_district" value="<?php echo mcIsSet($f_district) ?>" size="20"></td> -->
<td><?php // echo getLngt("Bearbeiten") ?></td>
</tr>
<?php if (false) : ?>
<tr>
<td><a href="javascript:document.forms[0].orderClauseDefault.value='street';document.forms[0].f_act.value='search';document.forms[0].submit();"><?php echo getLngt("Straße") ?></a></td>
<td><a href="javascript:document.forms[0].orderClauseDefault.value='zipcode';document.forms[0].f_act.value='search';document.forms[0].submit();"><?php echo getLngt("PLZ") ?></a></td>
<td><a href="javascript:document.forms[0].orderClauseDefault.value='city';document.forms[0].f_act.value='search';document.forms[0].submit();"><?php echo getLngt("Ort") ?></a></td>
<td><a href="javascript:document.forms[0].orderClauseDefault.value='country';document.forms[0].f_act.value='search';document.forms[0].submit();"><?php echo getLngt("Land") ?></a></td>
<!-- <td><a href="javascript:document.forms[0].orderClauseDefault.value='district';document.forms[0].f_act.value='search';document.forms[0].submit();"><?php echo getLngt("Ortsteil") ?></a></td> -->
<td>&nbsp;</td>
</tr>
<?php endif; ?>
<tr>
<td colspan="5" height="10px"></td>
</tr>
<?php echo $out ?>
</table>
</div>
<?php echo htmlDivLineSpacer("15px"); ?>
<div>
<?php echo getLngt("Anzahl Einträge:") ?> <?php echo $numOfRows ?><?php if ($numOfRows == "0" && $f_act == "search" && $statusMessage == "") : echo " (Keine Einträge gefunden.)"; endif; ?>
</div>
<?php echo htmlDivLineSpacer("50px"); ?>
<?php echo defineButtonType08(getLngt("Änderung speichern"), "action_store", "javascript:document.forms[0].f_act.value='update';document.forms[0].submit();", "180", "left", "3"); ?>
<?php echo defineButtonType08(getLngt("Für Validierung hinzufügen"), "action_validated", "javascript:document.forms[0].f_act.value='validated';document.forms[0].submit();", "180"); ?>
<?php echo htmlDivLineSpacer("15px"); ?>
<div>
<table border="0">
<tr>
<td>
<table class="f8np1" border="0" cellpadding="0">
<tr>
<td><input type="text" name="f_street_new" value="" size="25" placeholder="<?php echo getLngt("Straße") ?>"></td>
<td><input type="text" name="f_zipcode_new" value="" size="5" placeholder="<?php echo getLngt("PLZ") ?>"></td>
<td><input type="text" name="f_city_new" value="" size="20" placeholder="<?php echo getLngt("Ort") ?>"></td>
<td><input type="text" name="f_country_new" value="" size="3" placeholder="<?php echo getLngt("Land") ?>"></td>
<!-- <td><input type="text" name="f_district_new" value="" size="20"></td> -->
<!-- <td>&nbsp;</td> -->
</tr>
</table>
</td>
</tr>
<?php
if ($out2 != "") :
?>
<tr>
<td>
<br><br><br>
<span class="f8np1_blue"><?php echo getLngt("Bestehende Adressen für Validierungprüfung:") ?></span>
<br><br>
<table class="f8np1" border="0" cellpadding="0">
<?php echo $out2 ?>
</table>
</td>
</tr>
<?php
endif;
?>
</table>
</div>
<?php echo htmlDivLineSpacer("15px"); ?>
<div>
<?php echo getLngt("Anzahl Einträge:") ?> <?php echo $numOfRows2 ?><?php if ($numOfRows2 == "0" && $f_act == "search" && $statusMessage == "") : echo " " . getLngt("(Keine Einträge gefunden.)"); endif; ?>
</div>
<?php echo htmlDivLineSpacer("40px"); ?>
</form>
</div>
</body>
</html>

410
html/admin/ad_list.php Normal file
View File

@@ -0,0 +1,410 @@
<?php
/*=======================================================================
*
* ad_list.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
include_once ("../geo/geocode.inc.php");
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act", "customerId", "cscIdRoot", "cscIdActual",
"f_street", "f_hsno", "f_zipcode", "f_city", "f_country",
"orderClauseDefault", "statusMessage", "tourno", "deactivateMenu"));
getLanguage(__FILE__);
$deactivateMenuStatic = "1";
$pageTitel = getLngt("ADRESSENLISTE");
include_once ("../admin/menu.php");
include_once ("../include/html.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);
$numOfRows = 0;
mcTrim($f_street); mcTrim($f_zipcode); mcTrim($f_city);
$searchValues = $f_street . $f_zipcode . $f_city; // if called e.g. by the first time with empty search-fields
mcIsSet($f_district);
// if any search-field has content then take default-city of the headquarter
$hqAddress = getAddress($hq_id, "hq");
if ($searchValues == "") :
$f_city = mcArrTrim($hqAddress, "city");
// $searchValues = $f_street . $f_zipcode . $f_city; // define again if no address is associated to headquarter
endif;
// Initialize output
mcIsSet($tourno);
$out = "";
// Generate search-resultset
if ($f_act == "search" && $searchValues != "") :
if (strlen($f_street) > 4 || (strlen($f_street) > 1 && (strlen($f_zipcode) > 1 || strlen($f_city) > 1))) :
// *********************************************************************
// * Selection of the costcenters of the current customer for the list *
// *********************************************************************
// This part only for headquarter employees
if ($userTypeName == "hq") :
$whereClause = "";
if ($f_street != "") : $whereClause .= "ad_street LIKE '" . $f_street . "%'"; endif;
if ($whereClause != "" && $f_zipcode != "") : $whereClause .= " AND "; endif;
if ($f_zipcode != "") : $whereClause .= "ad_zipcode LIKE '" . $f_zipcode . "%'"; endif;
if ($whereClause != "" && $f_city != "") : $whereClause .= " AND "; endif;
if ($f_city != "") : $whereClause .= "ad_city LIKE '" . $f_city . "%'"; endif;
if ($whereClause != "" && $f_country != "") : $whereClause .= " AND "; endif;
if ($f_country != "") : $whereClause .= "ad_country LIKE '" . $f_country . "%'"; endif;
// if ($whereClause != "") : $whereClause = " AND " . $whereClause; endif;
if ($orderClauseDefault == "") :
$orderClause = "ad_street, ad_zipcode";
else :
$orderClause = "ad_" . $orderClauseDefault;
endif;
// *****************************************************************************************************
// * TABLE "serviceplzareaaddress" Selection of the costcenter based on a search by companyname-prefix *
// *****************************************************************************************************
$sqlquery = "SELECT CONCAT('BEREICH: ',srvpa.srvpa_name,' (',srvpa.srvpa_longname,')') AS ad_district,"
. " ad.ad_street, ad.ad_zipcode, ad.ad_city, ad.ad_country,"
. " CONCAT(srvpaa.srvpaa_hsno_from,'-',srvpaa.srvpaa_hsno_to) AS srvpaa_hsno,"
. " srvpaa_mode"
. " FROM serviceplzareaaddress AS srvpaa, address AS ad, serviceplzarea AS srvpa"
. " WHERE ad.ad_id = srvpaa.ad_id AND"
. " srvpaa.srvpa_id = srvpa.srvpa_id"
. ($whereClause != "" ? " AND " : "") . $whereClause
. " ORDER BY " . $orderClause;
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
$lineToggler = 0;
while ($row = $result->fetch_assoc()):
$numOfRows++;
if ($lineToggler == 0) : $lineToggler = 1; else : $lineToggler = 0; endif;
$cellColor = getListColor($numOfRows, $lineToggler);
$v_ad_district = $row["ad_district"];
$v_ad_street = $row["ad_street"];
$v_ad_zipcode = $row["ad_zipcode"];
$v_ad_city = $row["ad_city"];
$v_ad_country = $row["ad_country"];
$v_srvpaa_hsno = $row["srvpaa_hsno"];
$v_srvpaa_mode = "";
if ($row["srvpaa_mode"] == "1") : $v_srvpaa_mode = ", " . getLngt("nur ungerade"); endif;
if ($row["srvpaa_mode"] == "2") : $v_srvpaa_mode = ", " . getLngt("nur gerade"); endif;
$out .= "<tr class=\"f10bp1\">";
$out .= "<td bgcolor=\"" . $cellColor ."\">&nbsp;" . "<a href=\"javascript:finishPage('".my_str_check_js($v_ad_district)."','".my_str_check_js($v_ad_street)."','".my_str_check_js($v_ad_zipcode)."','".my_str_check_js($v_ad_city)."','".my_str_check_js($v_ad_country)."','".$tourno."',0);\">"
. $v_ad_street . " (" . $v_srvpaa_hsno . $v_srvpaa_mode . ")</a>" . "&nbsp;</td>";
$out .= "<td bgcolor=\"" . $cellColor ."\"> $v_ad_zipcode &nbsp;</td> ";
$out .= "<td bgcolor=\"" . $cellColor ."\"> $v_ad_city &nbsp;</td> ";
$out .= "<td bgcolor=\"" . $cellColor ."\"> $v_ad_country &nbsp;</td> ";
$out .= "<td class=\"f8np1_blue\" bgcolor=\"" . $cellColor ."\"> $v_ad_district &nbsp;</td> ";
$out .= "</tr>\n";
endwhile;
$result->free();
// Empty line if $out is not empty
if ($out != "") :
$out .= "<tr><td colspan=\"5\">&nbsp;</td></tr>";
endif;
endif;
// **************************************************************************************
// * TABLE "street" Selection of the costcenter based on a search by companyname-prefix *
// **************************************************************************************
$whereClause = "";
if ($f_street != "") : $whereClause .= "st_street LIKE '" . $f_street . "%'"; endif;
if ($whereClause != "" && $f_zipcode != "") : $whereClause .= " AND "; endif;
if ($f_zipcode != "") : $whereClause .= "st_zipcode LIKE '" . $f_zipcode . "%'"; endif;
if ($whereClause != "" && $f_city != "") : $whereClause .= " AND "; endif;
if ($f_city != "") : $whereClause .= "st_city LIKE '" . $f_city . "%'"; endif;
if ($whereClause != "" && $f_country != "") : $whereClause .= " AND "; endif;
if ($f_country != "") : $whereClause .= "st_country LIKE '" . $f_country . "%'"; endif;
// if ($whereClause != "") : $whereClause = " AND " . $whereClause; endif;
if ($orderClauseDefault == "") :
$orderClause = "st_street, st_no_from, st_no_to, st_zipcode";
else :
$orderClause = "st_" . $orderClauseDefault;
endif;
if ($orderClause == "st_street")
$orderClause .= ", st_no_from, st_no_to";
$sqlquery = "SELECT st_district, st_street, st_zipcode, st_city, st_country, st_no_from, st_no_to"
. " FROM phoenix_special.street"
. " WHERE " . $whereClause
. " ORDER BY " . $orderClause;
// Straßen in den Rg.-PLZ-Bereichen nur aus der der Post-Tabelle holen
$use_street_post_1 = ($hq_id == 3 && strpos($_SERVER["HTTP_REFERER"], "job_tour.php") !== false);
if ($use_street_post_1) {
$sqlquery = "
SELECT DISTINCT srvp1.srvp_plz AS srvp1_plz, srvp2.srvp_plz AS srvp2_plz, srvsam.srvsam_name, srvsam.srva2_id
FROM servicesubareamapping AS srvsam, serviceplz AS srvp1, serviceplz AS srvp2
WHERE srvsam.srva_id = srvp1.srvp_id AND srvsam.srva2_id = srvp2.srvp_id AND LEFT(srvp1.srvp_plz, 1) = '1'
ORDER BY srvp1_plz, srvsam_sort";
$rg_plzs = array();
$res = $db->query($sqlquery);
if (DB::isError($res)) die ("$PHP_SELF: '$sqlquery'" . $res->getMessage());
$srvsam_srvp_plz_sql = "";
while ($row = $res->fetch_assoc()) {
$srvsam_srvp_plz_sql .= $row["srvp1_plz"] . "','";
$rg_plzs[$row["srvp1_plz"]][] = array($row["srvp2_plz"], $row["srvsam_name"], $row["srva2_id"]);
}
$res->free();
$srvsam_srvp_plz_sql = substr($srvsam_srvp_plz_sql, 0, -3);
$sqlquery = "(SELECT st_district, st_street, st_zipcode, st_city, st_country, st_no_from, st_no_to"
. " FROM phoenix_special.street"
. " WHERE " . $whereClause . " AND st_zipcode NOT IN ('" . $srvsam_srvp_plz_sql . "')"
. ") UNION "
. "(SELECT st_district, st_street, st_zipcode, st_city, '' AS st_country, '' AS st_no_from, '' AS st_no_to"
. " FROM phoenix_special.street_post_1"
. " WHERE " . $whereClause . " AND st_zipcode IN ('" . $srvsam_srvp_plz_sql . "')"
. ") ORDER BY " . $orderClause;
}
//echo $sqlquery;
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
$numOfRows = 0;
$lineToggler = 0;
while ($row = $result->fetch_assoc()):
// Straßen in den Rg.-PLZ-Bereichen ggfs. die Rg.-PLZ zuordnen
$mediation_area_id = 0;
if ($use_street_post_1 && in_array($row["st_zipcode"], array_keys($rg_plzs))) {
for ($i = count($rg_plzs[$row["st_zipcode"]]) - 1; $i >= 0; $i--) {
//echo $i.", ".$row["st_street"].", ".$row["st_district"].", ".$rg_plzs[$row["st_zipcode"]][$i][1] . "\n";
if (strpos($row["st_district"], $rg_plzs[$row["st_zipcode"]][$i][1]) !== false) {
//echo "found\n";
$mediation_area_id = $rg_plzs[$row["st_zipcode"]][$i][2];
if (trim($row["st_city"]) != trim($row["st_district"]))
$row["st_city"] .= " - " . $row["st_district"];
$row["st_district"] .= " (Rg.-PLZ " . $rg_plzs[$row["st_zipcode"]][$i][0] . ")";
break;
}
}
if ($mediation_area_id == 0) {
for ($i = count($rg_plzs[$row["st_zipcode"]]) - 1; $i > 0; $i--) {
if (strpos($row["st_city"], $rg_plzs[$row["st_zipcode"]][$i][1]) !== false) {
$mediation_area_id = $rg_plzs[$row["st_zipcode"]][$i][2];
if (trim($row["st_city"]) != trim($row["st_district"]) && trim($row["st_district"]) != "")
$row["st_city"] .= " - " . $row["st_district"];
$row["st_district"] .= " (Rg.-PLZ " . $rg_plzs[$row["st_zipcode"]][$i][0] . ")";
break;
}
}
}
}
$numOfRows++;
if ($lineToggler == 0) : $lineToggler = 1; else : $lineToggler = 0; endif;
$cellColor = getListColor($numOfRows, $lineToggler);
$v_ad_district = $row["st_district"];
$v_ad_street = $row["st_street"];
$v_ad_no = $row["st_no_from"] . "-" . $row["st_no_to"];
$v_ad_zipcode = $row["st_zipcode"];
$v_ad_city = $row["st_city"];
$v_ad_country = $row["st_country"];
$out .= "<tr class=\"f10bp1\">";
// $out .= "<td class=\"f10bp1_red\" bgcolor=\"" . $cellColor ."\"> $v_csc_name </td> ";
$out .= "<td bgcolor=\"" . $cellColor ."\">&nbsp;" . "<a href=\"javascript:finishPage('".my_str_check_js($v_ad_district)."','".my_str_check_js($v_ad_street)."','".my_str_check_js($v_ad_zipcode)."','".my_str_check_js($v_ad_city)."','".my_str_check_js($v_ad_country)."','".$tourno."',".$mediation_area_id.");\">"
. $v_ad_street . "</a>" . " " . $v_ad_no . "&nbsp;</td>";
$out .= "<td bgcolor=\"" . $cellColor ."\"> $v_ad_zipcode &nbsp;</td> ";
$out .= "<td bgcolor=\"" . $cellColor ."\"> $v_ad_city &nbsp;</td> ";
$out .= "<td bgcolor=\"" . $cellColor ."\"> $v_ad_country &nbsp;</td> ";
$out .= "<td bgcolor=\"" . $cellColor ."\"> $v_ad_district &nbsp;</td> ";
$out .= "</tr>\n";
endwhile;
$result->free();
else :
$statusMessage = getLngt("Eingabe entw. mind. 5 Zeichen bei Straße oder mind. 2 Zeichen bei Straße in Verbindung mit mind. 2 Zeichen bei Ort oder PLZ!");
endif;
endif;
?>
<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 type="text/javascript">
<!--
// NAVIGATION
<?php echo $jsMenuOut; ?>
var tourNo = "<?php echo $tourno ?>";
var v_district = '';
var v_street = '';
var v_zipcode = '';
var v_city = '';
var v_country = '';
function finishPage(district,street,zipcode,city,country,tourno,mediation_area_id) {
//alert(district + ' ' + street + ' ' + zipcode + ' ' + city + ' ' + country + ' ' + tourno + ' ' + mediation_area_id);
switch (tourno)
{
case "price_query1":
opener.document.forms[0].zipcode1.value = zipcode;
opener.document.forms[0].zipcode1.focus();
opener.updatePrice();
break;
case "price_query2":
opener.document.forms[0].zipcode2.value = zipcode;
opener.document.forms[0].zipcode2.focus();
opener.updatePrice();
break;
case "price_query3":
opener.document.forms[0].zipcode3.value = zipcode;
opener.document.forms[0].zipcode3.focus();
opener.updatePrice();
break;
case "price_query4":
opener.document.forms[0].zipcode4.value = zipcode;
opener.document.forms[0].zipcode4.focus();
opener.updatePrice();
break;
case "price_query5":
opener.document.forms[0].zipcode5.value = zipcode;
opener.document.forms[0].zipcode5.focus();
opener.updatePrice();
break;
case "price_query6":
opener.document.forms[0].zipcode6.value = zipcode;
opener.document.forms[0].zipcode6.focus();
opener.updatePrice();
break;
default:
if (tourno == "") {
// opener.document.forms[0].f_ad_district.value = district;
opener.document.forms[0].f_ad_street.value = street;
opener.document.forms[0].f_ad_zipcode.value = zipcode;
opener.document.forms[0].f_ad_city.value = city;
// opener.document.forms[0].f_ad_country.value = country;
} else {
opener.setJobList(tourno, opener.jl_ad_street, street);
opener.setJobList(tourno, opener.jl_ad_zipcode, zipcode);
opener.setJobList(tourno, opener.jl_ad_city, city);
opener.setJobList(tourno, opener.jl_tr_mediationarea_id, mediation_area_id);
opener.refreshFormFields();
//opener.setCurTourNo(tourNo);
//opener.parent.frames[1].document.forms[1].elements[0].focus();
opener.checkSendTour();
}
break;
}
self.close();
};
function clearFields() {
document.forms[0].f_street.value = '';
document.forms[0].f_zipcode.value = '';
document.forms[0].f_city.value = '<?php echo mcArrTrim($hqAddress, "city"); ?>';
document.forms[0].f_country.value = '';
document.forms[0].f_district.value = '';
};
-->
</script>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>displayStatusMessage();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="maincontent" name="maincontent" id="maincontent">
<form action="ad_list.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="customerId" value="<?php echo $customerId ?>">
<input type="hidden" name="cscIdRoot" value="<?php echo $cscIdRoot ?>">
<input type="hidden" name="cscIdActual" value="<?php echo $cscIdActual ?>">
<input type="hidden" name="orderClauseDefault" value="<?php echo $orderClauseDefault ?>">
<input type="hidden" name="tourno" value="<?php echo $tourno ?>">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<?php echo htmlDivLineSpacer("20px"); ?>
<div>
<div class="f12bp1_blue"><?php echo getLngt("Adressen") ?></div>
</div>
<?php echo htmlDivLineSpacer("20px"); ?>
<div>
<a href="javascript:document.forms[0].f_act.value='search';document.forms[0].submit();"><?php echo getLngt("Suchen") ?></a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="javascript:clearFields();"><?php echo getLngt("Felder zurücksetzen") ?></a>
</div>
<?php echo htmlDivLineSpacer("15px"); ?>
<div>
<!--
<?php echo "'" . $_SERVER["HTTP_REFERER"] . "', " . mcIsSet($use_street_post_1); ?>
-->
<table class="f8np1" border="0" cellpadding="0">
<tr>
<td><input type="text" name="f_street" value="<?php echo $f_street ?>" size="25"></td>
<td><input type="text" name="f_zipcode" value="<?php echo $f_zipcode ?>" size="5"></td>
<td><input type="text" name="f_city" value="<?php echo $f_city ?>" size="20"></td>
<td><input type="text" name="f_country" value="<?php echo $f_country ?>" size="3"></td>
<td><input type="text" name="f_district" value="<?php echo $f_district ?>" size="20"></td>
</tr>
<tr>
<td><a href="javascript:document.forms[0].orderClauseDefault.value='street';document.forms[0].f_act.value='search';document.forms[0].submit();"><?php echo getLngt("Straße") ?></a></td>
<td><a href="javascript:document.forms[0].orderClauseDefault.value='zipcode';document.forms[0].f_act.value='search';document.forms[0].submit();"><?php echo getLngt("PLZ") ?></a></td>
<td><a href="javascript:document.forms[0].orderClauseDefault.value='city';document.forms[0].f_act.value='search';document.forms[0].submit();"><?php echo getLngt("Ort") ?></a></td>
<td><a href="javascript:document.forms[0].orderClauseDefault.value='country';document.forms[0].f_act.value='search';document.forms[0].submit();"><?php echo getLngt("Land") ?></a></td>
<td><a href="javascript:document.forms[0].orderClauseDefault.value='district';document.forms[0].f_act.value='search';document.forms[0].submit();"><?php echo getLngt("Ortsteil") ?></a></td>
</tr>
<?php echo $out ?>
</table>
</div>
<?php echo htmlDivLineSpacer("15px"); ?>
<div>
<?php echo getLngt("Anzahl Einträge:") ?> <?php echo $numOfRows ?><?php if ($numOfRows == "0" && $f_act == "search" && $statusMessage == "") : echo " " . getLngt("(Keine Einträge gefunden.)"); endif; ?>
</div>
</form>
</div>
</body>
</html>

187
html/admin/chgpwd.php Normal file
View File

@@ -0,0 +1,187 @@
<?php
include_once("../include/global.inc.php");
getLanguage(__FILE__);
$pageTitel = getLngt("PASSWORT-ÄNDERUNG");
$usr_id = -1;
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
getCurrentScript(__FILE__);
$title = getLngt("Passwort-Änderung");
session_start();
$usr_id = $_SESSION["usr_id"];
$tries = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = 'usr' AND gdc_obj_id = " . $usr_id . " AND gdc_gen_fieldname = 'set_new_pwd'" );
if ($tries == ""):
header("Location: ../admin/start.php");
endif;
list($f_submit, $f_chk_password, $f_chg_password, $f_chg_password1, $pwd_changed) =
getHttpVars(array('f_submit', 'f_chk_password', 'f_chg_password', 'f_chg_password1', 'pwd_changed'));
$f_chk_password = trim($f_chk_password);
$f_chg_password = trim($f_chg_password);
$f_chg_password1 = trim($f_chg_password1);
$passwordfields = true;
$statusMessage = "";
if ($f_submit == "Ändern"):
//echo getFieldValueFromId("user","usr_id",$usr_id,"usr_password") . " == " . $db->getOne("SELECT PASSWORD('". $f_chg_password . "')") . "?";
if ($usr_id != $db->getOne("SELECT usr_id FROM user WHERE usr_id = " . $usr_id . " AND usr_password = PASSWORD('$f_chk_password')")):
$statusMessage = "Das alte Passwort ist nicht korrekt.";
elseif ($f_chg_password == "" && $f_chg_password1 == ""):
$statusMessage = "Bitte das neue Passwort eingeben und zur Sicherheit wiederholen!";
elseif (!checkPasswordValidation($f_chg_password, $f_chg_password1)):
elseif (getFieldValueFromId("user", "usr_id", $usr_id, "usr_password") == $db->getOne("SELECT PASSWORD('". $f_chg_password . "')")):
$statusMessage = "Das neue Passwort muss sich vom alten unterscheiden!";
else:
$currentTime = getDateTime("0");
$db->query("UPDATE user SET usr_password = PASSWORD('" . $f_chg_password . "'), usr_password_modify = '" . $currentTime . "' WHERE usr_id = " . $usr_id);
// deleteStmt("genericdatacontainer","gdc_obj_type = 'usr' AND gdc_gen_fieldname = 'set_new_pwd' AND gdc_obj_id = " . $usr_id);
//echo date("Y-m-d H:i:s") . "|" . $tries;
updateStmt("genericdatacontainer", "gdc_obj_id", $usr_id, array("gdc_content", "", "gdc_context", date("Y-m-d H:i:s") . "|" . $tries), "gdc_obj_type = 'usr' AND gdc_gen_fieldname = 'set_new_pwd'");
$statusMessage = "Sie haben Ihr Passwort geändert!";
$passwordfields = false;
endif;
endif;
if ($f_submit == getLngt("Weiter")):
if ($pwd_changed == "false")
updateStmt("genericdatacontainer", "gdc_obj_id", $usr_id, array("gdc_content", ($tries - 1)), "gdc_obj_type = 'usr' AND gdc_gen_fieldname = 'set_new_pwd'");
$_SESSION['chgpwd'] = '0';
header("Location: ../admin/start.php");
endif;
if ($f_submit == getLngt("Abmelden")):
header("Location: ../admin/logout.php");
endif;
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="description" content="votian"> <meta name="keywords" content="votian">
<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 type="text/javascript">
<!--
<?php echo $jsMenuOut; ?>
function initForm()
{
myhide('sprache');
document.forms[0].f_chk_password.focus();
}
function content_loaded() {
setTimeout(function(){ document.forms[0].f_chk_password.value = ""; document.forms[0].f_chg_password.value = ""; document.forms[0].f_chg_password1.value = "";}, 20);
}
document.addEventListener("DOMContentLoaded", content_loaded, false);
-->
</script>
<script src="../include/lib_global.js" type="text/javascript">
</script>
<noscript>
<center>
<b><br>JavaScript ist nicht verf&uuml;gbar. Bitte aktivieren Sie JavaScript<br><br>
in Ihrem Browser, damit diese Seite ordnungsgem&auml;&szlig; funktioniert!</b><br><br>
</center>
</noscript>
</head>
<body leftmargin="1" topmargin="1" marginwidth="0" marginheight="0" link="#990000" vlink="#990000" alink="#990000" onLoad="<?php echo $phpCurrentNavigationOnLoad ?>initForm();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="maincontent" name="maincontent" id="maincontent">
<?php echo htmlDivLineSpacer("30px"); ?>
<div class="f12bp1_blue">
<?php echo $title ?>
</div>
<?php echo htmlDivLineSpacer("25px"); ?>
<?php if (!$passwordfields) echo "<!--"; ?>
<div>
<?php echo getLngt("Bitte ändern Sie Ihr Passwort (mindestens 8 Zeichen, eine Zahl und ein Buchstabe):") ?>
</div>
<?php if (!$passwordfields) echo "-->"; ?>
<?php echo htmlDivLineSpacer("25px"); ?>
<form action="chgpwd.php" method="POST">
<?php if (!$passwordfields) echo "<!--"; ?>
<div>
<div <?php echo setStyleHtmlDiv("150px","left"); ?>><?php echo getLngt("Altes Passwort:") ?></div>
<div>
<input type="password" name="f_chk_password" value="" size="20" maxlength="20" autocomplete="off">
</div>
</div>
<?php echo htmlDivLineSpacer("20px"); ?>
<div>
<div <?php echo setStyleHtmlDiv("150px","left"); ?>><?php echo getLngt("Neues Passwort:") ?></div>
<div>
<input type="password" name="f_chg_password" value="" size="20" maxlength="20">
</div>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<div>
<div <?php echo setStyleHtmlDiv("150px","left"); ?>><?php echo getLngt("Wiederholung:") ?></div>
<div>
<input type="password" name="f_chg_password1" value="" size="20" maxlength="20">
</div>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<?php if (!$passwordfields) echo "-->"; ?>
<div class="f10bp1_red">
<?php echo $statusMessage; ?>
</div>
<?php if ($statusMessage != "") echo htmlDivLineSpacer("10px"); ?>
<?php if (!$passwordfields) echo "<!--"; ?>
<?php echo defineButton(getLngt("Ändern"), "f_submit", "", "", "", "", "", "", "", "", "", "", "", "", "", getLngt("Ändern") . " ALT+n", "n", true); ?>
<?php echo htmlDivLineSpacer("25px"); ?>
<div>
<?php if ($tries > 0) echo getLngt("Sie können Ihr Passwort auch zu einem späteren Zeitpunkt ändern und sich noch <b>" . $tries .
"</b> mal wieder anmelden, bis Sie Ihr Passwort ändern müssen (klicken Sie auf \"Weiter\").") ?>
</div>
<?php if ($tries > 0) echo htmlDivLineSpacer("10px"); ?>
<?php if (!$passwordfields) echo "-->"; ?>
<input type="hidden" name="pwd_changed" value="<?php if (!$passwordfields) echo 'true'; else echo 'false'; ?>">
<?php if ($tries > 0 || !$passwordfields) echo defineButton(getLngt("Weiter"), "f_submit", "", "", "", "", "", "", "", "", "", "", "", "", "", getLngt("Weiter") . " ALT+w", "w", true); ?>
<?php if ($passwordfields) echo htmlDivLineSpacer("25px"); ?>
<div>
<?php if ($passwordfields) echo getLngt("Melden Sie sich oben im Menü ab, wenn Sie jetzt noch keine Entscheidung treffen möchten.") ?>
</div>
</form>
<?php /*echo "($dbhost, \$f_submit = '$f_submit', \$usr_id = $usr_id, \$f_chg_password = '$f_chg_password', \$f_chg_password1 = '$f_chg_password1', \$tries = $tries, \$_SESSION['chgpwd'] = " . $_SESSION['chgpwd']*/?>
</div>
</body>
</html>
<script type="text/javascript">
<!--
checkBrowser();
-->
</script>

View File

@@ -0,0 +1,399 @@
<?php
/*=======================================================================
*
* courier_customer.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
// include_once ("../include/html.inc.php");
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
authCheckEmployeeRights($emp_id, "1", "1");
// Check for right to access amount fields
$crvhRgtRule01 = false;
if (authCheckEmployeeRights($emp_id, "39")) : $crvhRgtRule01 = true; endif;
$httpVarsArray = array("f_act", "courierId", "orderClause", "statusMessage", "f_cr_id",
"f_relationStatus", "f_del_customer_id", "g_cs_id", "f_cscr_description_new", "deactivateMenu");
if ($crvhRgtRule01) :
$httpVisualVarsRgtRule01 = array("f_cscr_prov", );
$httpVarsArray = array_merge($httpVarsArray, $httpVisualVarsRgtRule01);
endif;
getSecHttpVars("1", $httpVarsArray);
getLanguage(__FILE__);
$deactivateMenuStatic = "1";
$pageTitel = getLngt("BEZIEHUNG TRANSPORTEUR-KUNDE");
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
getCurrentScript(__FILE__);
// Initializations
if ($f_relationStatus == "") : $f_relationStatus = "0"; endif; // 0 = bad relation between cs and cr (blocked), 1 = good relation (favoured)
$f_cscr_description_new = trim($f_cscr_description_new); // Description related to an association between customer and courier
if ($f_cscr_prov == "") : $f_cscr_prov = "0"; endif; // Commission rate for good relations (favoured couriers only)
$currentTime = getDateTime("0");
// Only for output
$htmlClass01 = "class=\"smaller\""; // input,select
$html_td_01 = "valign=\"top\" align=\"left\""; // input
$html_td_02 = "valign=\"top\" align=\"right\""; // input
// **************************************
// * Operations for the couriercustomer *
// **************************************
// Insert new couriercustomer
if ($f_act == "newCourierCustomer" && $courierId != "" && $g_cs_id != "") :
if (!existsEntry("customercourier",array("cs_id",$g_cs_id,"cr_id",$courierId))) :
TA("B");
// Get max sort value of favoured couriers and increment
$maxSortValue = 0;
if ($f_relationStatus == "1") :
$maxSortValue = getMaxOfField("customercourier", "cscr_sort", "cs_id = '" . $g_cs_id . "' AND cscr_relation = '1' ");
if ($maxSortValue != "" && is_numeric($maxSortValue)) :
$maxSortValue++;
else :
$maxSortValue = 1;
endif;
endif;
// Insert couriervehicle
$defaultFields = array("cs_id",$g_cs_id,"cr_id",$courierId,"cscr_relation",$f_relationStatus,"cscr_sort",$maxSortValue,"cscr_description",$f_cscr_description_new);
if ($crvhRgtRule01) :
$f_cscr_prov = str_replace (",", ".", $f_cscr_prov);
$crvhRgtRule01Fields = array("cscr_prov", $f_cscr_prov);
$defaultFields = array_merge($defaultFields, $crvhRgtRule01Fields);
endif;
insertStmt("customercourier", $defaultFields);
writeToLogDB("181",$hq_id,"0",$usr_id,$courierId,"",$g_cs_id,"CR_ID=" . $courierId . "|CS_ID=" . $g_cs_id . "|CSCR_RELATION=" . $f_relationStatus,"0","0",$emp_id);
TA("C");
TA("E");
else :
$statusMessage = getLngt("Es existiert schon eine Beziehung zwischen dem Kurier und diesem Kunden!");
endif;
endif;
// Remove couriercustomer
if ($f_act == "removeCourierCustomer" && $courierId != "") :
TA("B");
// Entries to be deleted?
$fieldsLength = count($f_del_customer_id);
if ($fieldsLength > 0 && $f_del_customer_id[0] != "") :
// Remove all associations according to the zipcode nested in array $f_del_zipcode_id
for ($i = 0; $i < $fieldsLength; $i++) :
deleteStmt("customercourier","cr_id = " . $courierId . " AND cs_id = " . $f_del_customer_id[$i]);
writeToLogDB("182",$hq_id,"0",$usr_id,$courierId,"",$f_del_customer_id[$i],"CR_ID=" . $courierId . "|CS_ID=" . $f_del_customer_id[$i],"0","0",$emp_id);
// Resort the sort value of the favoured couriers of the customer
$sqlquery = "SELECT cs_id, cr_id FROM customercourier WHERE cs_id = " . $f_del_customer_id[$i] . " AND cscr_relation = '1' ORDER BY cscr_sort";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
$sortCounter = 1;
while ($row = $result->fetch_assoc()):
$csId = $row["cs_id"];
$crId = $row["cr_id"];
updateStmt("customercourier", "cs_id", $csId, array("cscr_sort", $sortCounter),"cr_id = '" . $crId . "' AND cscr_relation = '1'");
$sortCounter++;
endwhile;
$result->free();
endfor;
else :
$statusMessage = getLngt("Bitte markieren Sie zu löschende Beziehungen durch anklicken der jeweiligen Checkbox hinter dem Eintrag!");
endif;
TA("C");
TA("E");
endif;
// ***************************************************************************
// * Get the courier-customer relations of a specified courier for selection *
// ***************************************************************************
$f_cmp_comp = array(); $f_cmp_comp2 = array(); $f_cs_id = array(); $f_cs_eid = array(); $f_cscr_relation = array(); $f_cscr_prov = array(); $f_cscr_description = array();
$count = 0;
if ($courierId != "") :
$sqlquery = "SELECT cmp.cmp_comp, cmp.cmp_comp2, cs.cs_id, cs.cs_eid, cscr.cscr_relation, cscr.cscr_prov, cscr.cscr_description"
. " FROM customercourier AS cscr, courier AS cr, customer AS cs, "
. " company AS cmp"
. " WHERE cscr.cr_id = $courierId AND"
. " cr.cr_id = cscr.cr_id AND"
. " cr.hq_id = $hq_id AND"
. " cs.cs_id = cscr.cs_id AND"
. " cs.hq_id = $hq_id AND"
. " cmp.cmp_id = cs.cmp_id";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
while ($row = $result->fetch_assoc()):
$f_cmp_comp[$count] = $row["cmp_comp"];
$f_cmp_comp2[$count] = $row["cmp_comp2"];
$f_cs_id[$count] = $row["cs_id"];
$f_cs_eid[$count] = $row["cs_eid"];
$f_cscr_relation[$count] = $row["cscr_relation"];
$f_cscr_prov[$count] = $row["cscr_prov"];
$f_cscr_description[$count] = $row["cscr_description"];
$count++;
endwhile;
$result->free();
endif;
// Only for output
// $tmp_usr_id = getFieldValueFromId("courier", "cr_id", $courierId, "usr_id");
$tmpFields2 = getFieldsValueFromId("courier", "cr_id", $courierId, array("usr_id","cr_eid","cr_sid"));
$tmp_usr_id = $tmpFields2[0];
$tmp_cr_eid = $tmpFields2[1];
$tmp_cr_sid = $tmpFields2[2];
$tmpFields = getFieldsValueFromId("user","usr_id",$tmp_usr_id,array("usr_name","usr_firstname"));
$tmp_usr_name = $tmpFields[0];
$tmp_usr_firstname = $tmpFields[1];
$title = getLngt("Kundenbeziehungen von:") . "<br>" . $tmp_usr_firstname . " " . $tmp_usr_name . "&nbsp;&nbsp;";
if ($tmp_cr_eid != "" || $tmp_cr_sid != "") : $title .= "(" . getLngt("EID:") . " " . $tmp_cr_eid . " / " . getLngt("Akt. SID:") . " " . $tmp_cr_sid . ")"; endif;
// Output of the existing relations of the current selected area
$customerOutput = "";
for ($j = 0; $j < $count; $j++) :
$customerOutput .= $f_cmp_comp[$j] . "<br>";
if ($f_cmp_comp2[$j] != "") : $customerOutput .= $f_cmp_comp2[$j] . "<br>"; endif;
$customerOutput .= $f_cs_eid[$j] . "&nbsp;&nbsp;";
$imgName = "circle_red.jpg";
if ($f_cscr_relation[$j] == "1") : $imgName = "circle_green.jpg"; endif;
$customerOutput .= "<img src=\"../images/" . $imgName . "\" border=\"0\" height=\"10\" width=\"25\">&nbsp;&nbsp;";
$customerOutput .= "<input type=\"checkbox\" name=\"f_del_customer_id[]\" value=\"" . $f_cs_id[$j] . "\">&nbsp;&nbsp;&nbsp;&nbsp;";
if ($f_cscr_relation[$j] == "1") :
$f_cscr_prov[$j] = str_replace (".", ",", $f_cscr_prov[$j]);
if ($crvhRgtRule01) :
$customerOutput .= "<input type=\"text\" class=\"f8bp1\" name=\"f_cscr_prov_" . $f_cs_id[$j] . "\" value=\"" . $f_cscr_prov[$j] . "\" onChange=\"setProvWasChanged('" . $f_cs_id[$j] . "', '" . $f_cscr_prov[$j] . "', $(this).val());\" size=\"6\" maxlength=\"6\"> [%]";
else :
$customerOutput .= "[" . $f_cscr_prov[$j] . " %]";
endif;
endif;
$customerOutput .= "</br>";
$customerOutput .= $f_cscr_description[$j] . "</br>";
$customerOutput .= "</br></br>\n";
endfor;
// Button to remove associations between courier and customer(s). Only show if at least one customer is associated to the current area.
if ($count > 0) :
$customerOutput .= "<br>\n";
$customerOutput .= defineButtonType10(getLngt("Markierte&nbsp;Verknüpfungen&nbsp;entfernen"), "action_remove", "finishPage('removeCourierCustomer');", "240");
$customerOutput .= "<br><br>\n";
endif;
if ($customerOutput == "") :
$customerOutput = getLngt("Zur Zeit sind keine Beziehungen eingetragen!");
endif;
?>
<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 finishPage(mode) {
var ok = true;
if (mode == 'newCourierCustomer') {
if (document.forms[0].g_cs_id.value != '') {
document.forms[0].f_act.value = mode;
document.forms[0].submit();
} else {
alert('<?php echo getLngt("Wählen Sie bitte einen Kunden aus!") ?>');
}
}
if (mode == 'removeCourierCustomer') {
if (confirm('<?php echo getLngt("Möchten Sie die bestehende(n) Beziehung(en) wirklich löschen?") ?>')) {
document.forms[0].f_act.value = mode;
document.forms[0].submit();
}
}
};
function searchCsCsc() {
var f_act = 'search';
var widthPopupWin = 950;
var heightPopupWin = 600;
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
var popupWin;
popupWin = window.open("../admin/cs_csc_list.php?f_act=" + f_act + "&generic=100111111000",
"","dependent=yes,width=" + widthPopupWin + ",height=" +
heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin +
",scrollbars=yes");
};
// Set commissionv alue to relation between courier and customer
function setProvWasChanged (csId, provValueOld, provValueNew) {
// var su = '#' + 'f_su_chkbx_' + serialno;
var crId = '<?php echo $courierId ?>';
var crEid = '<?php echo getFieldValueFromId("courier", "cr_id", $courierId, "cr_eid") ?>';
provValueOld = provValueOld.replace(',', '.');
provValueNew = provValueNew.replace(',', '.');
// alert(crId + ' ' + csId + ' ' + provValueOld + ' ' + provValueNew);
if (csId != '' && crId != '' && provValueNew != '' && provValueOld != provValueNew) {
if (checkIsNaN(provValueNew, '<?php echo getLngt("Bitte geben Sie eine Zahl ein!") ?>')) {
if (provValueNew != provValueOld) {
if (confirm('<?php echo getLngt("Möchten Sie den neuen Wert speichern?!") ?>')) {
// "customercourier"
ajaxRequestGet('../include/ajaxReqLib.php', 'mode=100&db_table=customercourier&db_id_field=cr_id&search_value=' + crId + '&db_op_field=cscr_prov&new_content=' + provValueNew + '&clause=cs_id=' + csId + ' AND cscr_relation=1');
// "servicepricehistory"
ajaxRequestGet('../include/ajaxReqLib.php', 'mode=200&db_table=servicepricehistory&db_op_field=srvprch_obj_type---cr---srvprch_obj_id---' + crId + '---srvprch_obj_eid---' + crEid + '---srvprch_fieldname---cscr_prov---srvprch_context---' + csId + '---srvprch_price---' + provValueNew + '---srvprch_validfrom---<?php echo $currentTime ?>');
// "log"
ajaxRequestGet('../include/ajaxReqLib.php', 'mode=300&db_id_field=180&db_op_field=cr&search_value=' + crId + '&id_01=CS_ID&value_01=' + csId + '&id_02=CSCR_PROV_OLD&value_02=' + provValueOld + '&id_03=CSCR_PROV_NEW&value_03=' + provValueNew + '&id_04=VALID_FROM&value_04=<?php echo $currentTime ?>');
}
}
}
}
}
-->
</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="../admin/courier_customer.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="courierId" value="<?php echo ec($courierId) ?>">
<input type="hidden" name="g_cs_id" value="">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<?php echo htmlDivLineSpacer("10px"); ?>
<div class="f12bp1_blue">
<?php echo $title ?>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<div class="f10bp1">
<?php echo getLngt("Kunden:") ?>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<div class="f10bp1">
<?php echo $customerOutput; ?>
</div>
<?php echo htmlDivLineSpacer("15px"); ?>
<?php echo defineButtonType10(getLngt("Kunde&nbsp;suchen"), "action_search", "searchCsCsc();", "100"); ?>
<?php echo htmlDivLineSpacer("15px"); ?>
<div>
<div <?php echo setStyleHtmlDiv("100px","left"); ?>><?php echo getLngt("Firma:") ?></div>
<div>
<input type="text" name="g_cscad_comp" value="" size="36" disabled >
</div>
</div>
<?php echo htmlDivLineSpacer("5px"); ?>
<div>
<div <?php echo setStyleHtmlDiv("100px","left"); ?>>&nbsp;</div>
<div>
<input type="text" name="g_cscad_comp2" value="" size="36" disabled >
</div>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<div>
<div <?php echo setStyleHtmlDiv("100px","left"); ?>><?php echo getLngt("Adresse:") ?></div>
<div>
<input type="text" name="g_ad_street" value="" size="30" disabled >&nbsp;
<input type="text" name="g_cscad_hsno" value="" size="5" disabled >
</div>
</div>
<?php echo htmlDivLineSpacer("5px"); ?>
<div>
<div <?php echo setStyleHtmlDiv("100px","left"); ?>>&nbsp;</div>
<div>
<input type="text" name="g_ad_zipcode" value="" size="5" disabled >&nbsp;
<input type="text" name="g_ad_city" value="" size="30" disabled >
</div>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<div>
<div <?php echo setStyleHtmlDiv("100px","left"); ?>><?php echo getLngt("Bemerkung:") ?></div>
<div>
<input type="text" name="f_cscr_description_new" value="" size="50" maxlength="255">
</div>
</div>
<?php echo htmlDivLineSpacer("15px"); ?>
<div>
<div>
<input type="radio" <?php echo $htmlClass01 ?> name="f_relationStatus" value="0" checked> <?php echo getLngt("Sperren") ?><br>
<input type="radio" <?php echo $htmlClass01 ?> name="f_relationStatus" value="1"> <?php echo getLngt("Besonders erwünscht") ?><br>
<br>
</div>
<?php echo defineButtonType10(getLngt("Kunde&nbsp;dem&nbsp;Transporteur&nbsp;zuordnen"), "action_assoc", "finishPage('newCourierCustomer');", "230"); ?>
<?php echo htmlDivLineSpacer("50px"); ?>
<?php echo defineButtonType10(getLngt("Schließen"), "action_close", "window.close();", "80", "left", "3"); ?>
</div>
</form>
</div>
</body>
</html>

1113
html/admin/courier_list.php Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,86 @@
<?php
/*=======================================================================
*
* courier_msggroup_list.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
include_once ('../include/email/htmlMimeMail.php');
$triggerOut = "";
if ($hq_id != "" && is_numeric($hq_id)) :
$sqlquery = "SELECT msggrp.msggrp_name, cr.cr_eid, usr.usr_name, usr.usr_firstname, cmp.cmp_id"
. " FROM messagegroup AS msggrp, courier AS cr, user AS usr, company AS cmp"
. " WHERE msggrp.hq_id = '" . $hq_id . "' AND"
. " cr.cr_msggrp LIKE CONCAT('%,',msggrp.msggrp_id,',%') AND"
. " cr.hq_id = '" . $hq_id . "' AND"
. " cr.usr_id = usr.usr_id AND"
. " cr.cmp_id = cmp.cmp_id AND"
. " cmp.cmp_authenticated = '1' AND"
. " cmp.cmp_visible = '1'"
. " ORDER BY msggrp.msggrp_name, cr.cr_eid";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
$rowColor = "AAAAAA";
$tableRows = "";
while ($row = $result->fetch_assoc()):
$tableRows .= "<tr>\n";
$tableRows .= "<td style=\"text-align:center; background-color: #" . $rowColor . ";\">" . $row["msggrp_name"] . "</td>\n";
$tableRows .= "<td style=\"text-align:center; background-color: #" . $rowColor . ";\"><a href=\"../admin/courier_special.php?companyId=" . $row["cmp_id"] . "\" target=\"_blank\">" . $row["cr_eid"] . "</a>&nbsp;&nbsp;&nbsp;</td>\n";
$tableRows .= "<td style=\"text-align:center; background-color: #" . $rowColor . ";\">" . $row["usr_name"] . "</td>\n";
$tableRows .= "<td style=\"text-align:center; background-color: #" . $rowColor . ";\">" . $row["usr_firstname"] . "</td>\n";
$tableRows .= "</tr>\n";
endwhile;
$result->free();
$triggerOut .= "<table>\n";
$triggerOut .= "<tr>\n";
$triggerOut .= "<td class=\"f12bp1_blue\">" . getLngt("ÜBERSICHT ZUORDNUNGEN TRANSPORTEURE <=> NACHRICHTENGRUPPEN") . "</td>";
$triggerOut .= "</tr>\n";
$triggerOut .= "</table>\n";
$triggerOut .= "<br><br>";
$triggerOut .= "<table>\n";
$triggerOut .= "<tr>\n";
$triggerOut .= "<td style=\"text-align:center;\">" . getLngt("Nachrichtengruppe") . "&nbsp;&nbsp;&nbsp;</td>\n";
$triggerOut .= "<td style=\"text-align:center;\">" . getLngt("EID") . "&nbsp;&nbsp;&nbsp;</td>\n";
$triggerOut .= "<td style=\"text-align:center;\">" . getLngt("Nachname") . "&nbsp;&nbsp;&nbsp;</td>\n";
$triggerOut .= "<td style=\"text-align:center;\">" . getLngt("Vorname") . "&nbsp;&nbsp;&nbsp;</td>\n";
$triggerOut .= "</tr>\n";
$triggerOut .= $tableRows;
$triggerOut .= "</table>\n";
endif;
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="../css/phoenix.css">
</head>
<body class="menu_bgcol" >
<center>
<br><br><br>
<b><?php echo $triggerOut ?></b>
</center>
</body>
</html>

View File

@@ -0,0 +1,179 @@
<?php
/*=======================================================================
*
* courier_msggrp.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
// include_once ("../include/html.inc.php");
include_once ("../include/inc_filters.inc.php");
$httpVarsArray = array("f_act", "courierId", "orderClause", "statusMessage", "f_msggrp", "deactivateMenu");
getSecHttpVars("1", $httpVarsArray);
getLanguage(__FILE__);
$deactivateMenuStatic = "1";
$pageTitel = getLngt("NACHRICHTENGRUPPEN");
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
getCurrentScript(__FILE__);
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
authCheckEmployeeRights($emp_id, "1", "1");
// Only for output
$htmlClass01 = "class=\"smaller\""; // input,select
$html_td_01 = "valign=\"top\" align=\"left\""; // input
$html_td_02 = "valign=\"top\" align=\"right\""; // input
// Implode courier message groups
$f_msggrp2 = getImplodedFilterstring($f_msggrp);
// Set message group(s) of the courier
if ($f_act == "setCourierMsgGrp" && $courierId != "") :
TA("B");
// Update message groups
updateStmt("courier","cr_id",$courierId,array("cr_msggrp", $f_msggrp2));
// Write logdata into log database
writeToLogDB("66",$hq_id,"",$usr_id,$courierId,"","","MESSAGEGROUPS=".$f_msggrp2);
TA("C");
TA("E");
endif;
// ***************************************
// * Selection of the message group data *
// ***************************************
/*
$sqlquery = "SELECT msggrp.msggrp_id, msggrp.hq_id, msggrp.msggrp_name"
. " FROM messagegroup AS msggrp"
. " WHERE msggrp.hq_id = $hq_id"
. " ORDER BY msggrp.msggrp_id";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
while ($row = $result->fetch_assoc()):
$f_msggrp_id_array[] = $row["msggrp_id"];
endwhile;
$result->free();
*/
// Courier message groups
$f_msggrp = getFieldValueFromId("courier", "cr_id", "$courierId", "cr_msggrp");
$f_msggrp = substr($f_msggrp, 1, (strlen($f_msggrp) - 2) );
$f_msggrp = spliti(",",$f_msggrp);
$output = addCheckboxesFromTable ("f_msggrp", "messagegroup", "msggrp_id", "msggrp_name", "msggrp_id", "hq_id =" . $hq_id, $f_msggrp, "<br><br>");
// Only for output
$tmp_usr_id = getFieldValueFromId("courier", "cr_id", "$courierId", "usr_id");
$tmpFields = getFieldsValueFromId("user","usr_id",$tmp_usr_id,array("usr_name","usr_firstname"));
$tmp_usr_name = $tmpFields[0];
$tmp_usr_firstname = $tmpFields[1];
$title = getLngt("Nachrichtengruppen für") . " " . $tmp_usr_firstname . " " . $tmp_usr_name;
?>
<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 finishPage(mode) {
var ok = true;
if (mode == 'save') {
// if (!NaN(document.forms[0].f_crvh_prov.value, '<?php echo getLngt("Bitte tragen Sie eine Zahl bei Provision ein!") ?>')) {ok = false;};
if (ok) {
document.forms[0].f_act.value='setCourierMsgGrp';
document.forms[0].submit();
};
}
if (mode == 'reset') {
document.location.href = "courier_msggrp.php?courierId=<?php echo ec($courierId) ?>";
}
};
-->
</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="../admin/courier_msggrp.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="courierId" value="<?php echo ec($courierId) ?>">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<?php echo htmlDivLineSpacer("10px"); ?>
<div class="f12bp1_blue">
<?php echo $title ?>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<!-- Message groups -->
<div>
<table>
<tr>
<td>
<?php echo $output ?>
</td>
</tr>
</table>
</div>
<?php echo htmlDivLineSpacer("15px"); ?>
<div>
<?php echo defineButtonType10(getLngt("Speichern"), "action_save", "finishPage('save');", "100", "left", "3"); ?>
<?php echo defineButtonType10(getLngt("Zurücksetzen"), "action_close", "finishPage('reset');", "100", "left", "3"); ?>
<?php echo defineButtonType10(getLngt("Schließen"), "action_close", "window.close();", "100", "left", "3"); ?>
</div>
</form>
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

885
html/admin/cs_csc_list.php Normal file
View File

@@ -0,0 +1,885 @@
<?php
/*=======================================================================
*
* cs_csc_list.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
// Get the rights of the employee logged in and check the accessibility
if (!(authCheckEmployeeRights($emp_id, "0") || authCheckEmployeeRights($emp_id, "7"))) : die ("$PHP_SELF: Access denied!"); endif;
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act", "generic", "genNum", "genJsParName", "f_mode", "companyId", "orderClause", "statusMessage", "f_cmp_authenticated", "f_searchmode", "f_cmp_match",
"f_cmp_comp", "f_cmp_comp2", "f_cs_eid", "f_usr_name", "f_usr_phone", "f_usr_email", "f_csc_name", "f_csc_is_extern",
"f_street", "f_hsno", "f_zipcode", "f_city", "f_country", "f_remark", "f_person", "f_phone", "tourno", "csc_id", "f_show_invisible",
"cscIdRoot", "customerId", "cscIdActual", "f_hq_id", "callOpenerFunction", "deactivateMenu", "allowAllCustomerTypes", "job_hq_id"));
// Execution-Time for script
set_time_limit(120);
// Select user-type for mode of security check
$userType = getFieldValueFromId("user","usr_id",$usr_id,"usr_type");
// $userTypeName = getUserTypeName($userType);
// Check authentication verifying emmployee an his/her costcenter- and customer-association
if ( !( ($userType == "1") || authCheck($hq_id,$usr_id,$emp_id,$cscIdRoot,$customerId,$cscIdActual) ) ) :
die ("$PHP_SELF: Access denied!");
endif;
getLanguage(__FILE__);
$deactivateMenuStatic = "1";
$pageTitel = getLngt("KUNDENKOSTENSTELLEN");
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
getCurrentScript(__FILE__);
$numOfRows = 0;
$htmlClass01 = "class=\"smaller\""; // input,select
$tableOfRows = "";
if ($job_hq_id != "")
$hq_id = $job_hq_id;
$hqId = 0;
// Mandator filter
if ($f_hq_id == "") : $f_hq_id = array(); endif;
if (count($f_hq_id) == 0) : array_push($f_hq_id, $hq_id); endif;
if ($f_searchmode == "") : $f_searchmode = "1"; endif;
if ($f_csc_is_extern == "") : $f_csc_is_extern = "0"; endif;
if ($genNum == "") : $genNum = ""; endif; // "Generic number" to use more javascript parameters ("g_", "g2_" <=> genNum = "2", "g3_" <=> genNum = "3")
if ($genJsParName == "") : $genJsParName = ""; endif; // Name of a special JS parameter name of the caller page, the value will be associated
mcTrim($f_cmp_comp); mcTrim($f_cmp_comp2);
mcTrim($f_cmp_iln); mcTrim($f_cmp_tax_idno); mcTrim($f_cmp_bank); mcTrim($f_cmp_bankno); mcTrim($f_cmp_bankacc);
// Parameter for displayed column SEQUENCE
$displayedListCols = getParameterValue($emp_id, "MASK_CSCSC_LIST_COLS");
if ($displayedListCols == "") :
$displayedListCols = getParameterValue("0", "MASK_CSCSC_LIST_COLS", $hqId);
if ($displayedListCols == "") :
// Default settings
$displayedListCols = "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";
endif;
endif;
$displayedListColsArray = spliti(",",$displayedListCols);
$displayedListColsArrayLen = count($displayedListColsArray);
// Parameter for displayed column LENGTH
$displayedListLenCols = getParameterValue($emp_id, "MASK_CSCSC_LIST_LEN_COLS");
if ($displayedListLenCols == "") :
$displayedListLenCols = getParameterValue("0", "MASK_CSCSC_LIST_LEN_COLS", $hqId);
if ($displayedListLenCols == "") :
// Default settings
$displayedListLenCols = "30,15,11,20,30,5,20,5,5,20,20,20,15";
endif;
endif;
$displayedListLenColsArray = spliti(",",$displayedListLenCols);
// Get constants for fields to be searched in
$constSearchCscsclistCmpcompCmpmatch = SEARCH_CSCSCLIST_CMPCOMP_CMPMATCH;
$constSearchCscsclistCmpcompCseid = SEARCH_CSCSCLIST_CMPCOMP_CSEID;
$constSearchCscsclistCmpcompCscadphone = SEARCH_CSCSCLIST_CMPCOMP_CSCADPHONE;
// Check consistence of used fields per JavaScript
$tableHeaderSearchFieldsExtra = ""; // Defines the extra hidden fields to be integrated for search
$j = array_search("cmp_match",$displayedListColsArray);
if ($j === FALSE) : $tableHeaderSearchFieldsExtra .= "<input type=\"hidden\" name=\"f_cmp_match\" value=\"\">"; endif;
$j = array_search("cs_eid",$displayedListColsArray);
if ($j === FALSE) : $tableHeaderSearchFieldsExtra .= "<input type=\"hidden\" name=\"f_cs_eid\" value=\"\">"; endif;
$j = array_search("cscad_phone",$displayedListColsArray);
if ($j === FALSE) : $tableHeaderSearchFieldsExtra .= "<input type=\"hidden\" name=\"f_phone\" value=\"\">"; endif;
$f_cmp_match = trim($f_cmp_match);
if ($constSearchCscsclistCmpcompCmpmatch == "1" && $f_cmp_match == "") : $f_cmp_match = trim($f_cmp_comp); endif;
$f_cs_eid = trim($f_cs_eid);
if ($constSearchCscsclistCmpcompCseid == "1" && $f_cs_eid == "") : $f_cs_eid = trim($f_cmp_comp); endif;
$f_phone = trim($f_phone);
if ($constSearchCscsclistCmpcompCscadphone == "1" && $f_phone == "") : $f_phone = trim($f_cmp_comp); endif;
$f_csc_name = trim($f_csc_name);
$f_usr_name = trim($f_usr_name);
$f_usr_phone = trim($f_usr_phone);
$f_usr_email = trim($f_usr_email);
$f_street = trim($f_street);
$f_hsno = trim($f_hsno);
$f_zipcode = trim($f_zipcode);
$f_city = trim($f_city);
$f_country = trim($f_country);
$f_remark = trim($f_remark);
$f_person = trim($f_person);
$f_phone = trim($f_phone);
// Flag for "show invisible customers"
if ($f_show_invisible == "" || count($f_show_invisible) == 0) :
$f_show_invisible = "0";
else:
$f_show_invisible = "1";
endif;
// Check for displaying prospects. First check for option "permanently"
$displayedProspectsPermanently = getParameterValue("0", "MASK_CSCSC_LIST_SHOW_PROSPECTS_PERMANENTLY", $hqId);
if ($displayedProspectsPermanently == "1") :
$allowAllCustomerTypes = "1";
else :
if ($allowAllCustomerTypes == "" || (is_array($allowAllCustomerTypes) && count($allowAllCustomerTypes) == 0)) :
$allowAllCustomerTypes = "0";
else:
$allowAllCustomerTypes = "1";
endif;
endif;
// Check for displaying prospects. First check for option "permanently"
$activateCscLinkForProspects = getParameterValue("0", "MASK_CSCSC_LIST_ACTIVATE_PROSPECT_LINKS_FOR_JOBS", $hqId);
$numOfHq = getCountOfTable("headquarters", "hq_disabled = 0");
$filterMandators = "<div style=\"float:left;\">&nbsp;" . getLngt("Niederlassungen:") . "&nbsp;&nbsp;" . addCheckboxesFromTable("f_hq_id","headquarters","hq_id","hq_mnemonic","hq_mnemonic","hq_disabled = 0",$f_hq_id, "&nbsp;&nbsp;&nbsp;","") . "</div\n>";
$filterMandators .= defineButtonType08("Alle", "f_hq_check_all", "hqCheckAll(" . $numOfHq . ");", "50px", "left", "3");
$filterMandators .= defineButtonType08("Keine", "f_hq_uncheck_all", "hqUncheckAll(" . $numOfHq . ");", "50px", "left");
// OUTPUT: Page header option fields
$pageHeaderOptionFields = "";
if (TRUE) :
$pageHeaderOptionFields .= "<a href=\"javascript:document.forms[0].f_act.value='search';document.forms[0].submit();\">&nbsp;" . getLngt("Suchen") . "&nbsp;</a>\n";
$pageHeaderOptionFields .= "&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;\n";
$pageHeaderOptionFields .= "<a href=\"javascript:clearFields();\">" . getLngt("Felder&nbsp;zurücksetzen") . "</a>\n";
$pageHeaderOptionFields .= "&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;\n";
$pageHeaderOptionFields .= "Option:&nbsp;&nbsp;\n";
$pageHeaderOptionFields .= "<input type=\"radio\" name=\"f_searchmode\" value=\"0\" " . ($f_searchmode == "0" ? "checked" : "") . ">&nbsp;" . getLngt("Präfix") . "\n";
$pageHeaderOptionFields .= "<input type=\"radio\" name=\"f_searchmode\" value=\"1\" " . ($f_searchmode == "1" ? "checked" : "") . ">&nbsp;" . getLngt("Teilwort") . "\n";
$pageHeaderOptionFields .= "&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;\n";
// $pageHeaderOptionFields .= getLngt("Kostenstellen:") . "&nbsp;&nbsp;\n";
// $pageHeaderOptionFields .= "<input type=\"radio\" name=\"f_csc_is_extern\" value=\"0\" " . ($f_csc_is_extern == "0" ? "checked" : "") . ">&nbsp;" . getLngt("Nur&nbsp;interne") . "&nbsp;\n";
// $pageHeaderOptionFields .= "<input type=\"radio\" name=\"f_csc_is_extern\" value=\"1\" " . ($f_csc_is_extern == "1" ? "checked" : "") . ">&nbsp;" . getLngt("Nur&nbsp;externe") . "&nbsp;\n";
// $pageHeaderOptionFields .= "<input type=\"radio\" name=\"f_csc_is_extern\" value=\"2\" " . ($f_csc_is_extern == "2" ? "checked" : "") . ">&nbsp;" . getLngt("Alle") . "&nbsp;\n";
$pageHeaderOptionFields .= getLngt("Ausgeblendete") . "&nbsp;" . getLngt("anzeigen") . "&nbsp;\n";
$pageHeaderOptionFields .= "<input type=\"checkbox\" name=\"f_show_invisible[]\" value=\"1\" " . ($f_show_invisible == "1" ? "checked" : "") . ">&nbsp;&nbsp;&nbsp;\n";
$pageHeaderOptionFields .= getLngt("Mit Interessenten") . "&nbsp;\n";
$pageHeaderOptionFields .= "<input type=\"checkbox\" name=\"allowAllCustomerTypes[]\" value=\"1\" " . ($allowAllCustomerTypes == "1" ? "checked" : "") . ">\n";
$pageHeaderOptionFields .= $filterMandators;
endif;
// OUTPUT: Table header search fields
$tableHeaderSearchFields = "";
if (TRUE) :
$dspColHeaderSearchFieldArray["cmp_comp"] = "<input type=\"text\" " . $htmlClass01 . " name=\"f_cmp_comp\" value=\"" . $f_cmp_comp . "\" onBlur=\"javascript:checkSearchParameters('cmp_comp');\" _SIZE_MACRO_>";
$dspColHeaderSearchFieldArray["cmp_comp2"] = "<input type=\"text\" " . $htmlClass01 . " name=\"f_cmp_comp2\" value=\"" . $f_cmp_comp2 . "\" _SIZE_MACRO_>";
$dspColHeaderSearchFieldArray["cs_eid"] = "<input type=\"text\" " . $htmlClass01 . " name=\"f_cs_eid\" value=\"" . $f_cs_eid . "\" _SIZE_MACRO_>";
$dspColHeaderSearchFieldArray["csc_name"] = "<input type=\"text\" " . $htmlClass01 . " name=\"f_csc_name\" value=\"" . $f_csc_name . "\" _SIZE_MACRO_>";
$dspColHeaderSearchFieldArray["cmp_match"] = "<input type=\"text\" " . $htmlClass01 . " name=\"f_cmp_match\" value=\"" . $f_cmp_match . "\" _SIZE_MACRO_>";
$dspColHeaderSearchFieldArray["cmp_authenticated_img"] = "<a href=\"javascript:document.forms[0].f_act.value='search';document.forms[0].submit();\">&nbsp;" . getLngt("Suchen") . "&nbsp;</a>";
$dspColHeaderSearchFieldArray["usr_name"] = "<input type=\"text\" " . $htmlClass01 . " name=\"f_usr_name\" value=\"" . $f_usr_name . "\" _SIZE_MACRO_>";
$dspColHeaderSearchFieldArray["usr_phone"] = "<input type=\"text\" " . $htmlClass01 . " name=\"f_usr_phone\" value=\"" . $f_usr_phone . "\" _SIZE_MACRO_>";
$dspColHeaderSearchFieldArray["usr_email"] = "<input type=\"text\" " . $htmlClass01 . " name=\"f_usr_email\" value=\"" . $f_usr_email . "\" _SIZE_MACRO_>";
$dspColHeaderSearchFieldArray["ad_street"] = "<input type=\"text\" " . $htmlClass01 . " name=\"f_street\" value=\"" . $f_street . "\" _SIZE_MACRO_>";
$dspColHeaderSearchFieldArray["cscad_hsno"] = "<input type=\"text\" " . $htmlClass01 . " name=\"f_hsno\" value=\"" . $f_hsno . "\" _SIZE_MACRO_>";
$dspColHeaderSearchFieldArray["ad_zipcode"] = "<input type=\"text\" " . $htmlClass01 . " name=\"f_zipcode\" value=\"" . $f_zipcode . "\" _SIZE_MACRO_>";
$dspColHeaderSearchFieldArray["ad_city"] = "<input type=\"text\" " . $htmlClass01 . " name=\"f_city\" value=\"" . $f_city . "\" _SIZE_MACRO_>";
$dspColHeaderSearchFieldArray["cscad_remark"] = "<input type=\"text\" " . $htmlClass01 . " name=\"f_remark\" value=\"" . $f_remark . "\" _SIZE_MACRO_>";
$dspColHeaderSearchFieldArray["cscad_person"] = "<input type=\"text\" " . $htmlClass01 . " name=\"f_person\" value=\"" . $f_person . "\" _SIZE_MACRO_>";
$dspColHeaderSearchFieldArray["cscad_phone"] = "<input type=\"text\" " . $htmlClass01 . " name=\"f_phone\" value=\"" . $f_phone . "\" _SIZE_MACRO_>";
$dspColHeaderSearchFieldArray["statistic"] = "<a href=\"javascript:document.forms[0].f_act.value='search';document.forms[0].submit();\">&nbsp;" . getLngt("Suchen") . "&nbsp;</a>";
$dspColHeaderSearchFieldArray["cs_report"] = "<a href=\"javascript:document.forms[0].f_act.value='search';document.forms[0].submit();\">&nbsp;" . getLngt("Suchen") . "&nbsp;</a>";
$tmpKeys = array_keys($dspColHeaderSearchFieldArray);
for ($i = 0; $i < $displayedListColsArrayLen; $i++) {
// Search for the value "$displayedListColsArray" in "$dspColArray" and get the key (index)
$j = array_search($displayedListColsArray[$i], $tmpKeys);
if (!($j === FALSE)) :
// Define length (html attribute "size") of the field and substitute macro
mcArrIsSet($displayedListLenColsArray, $i);
if ($displayedListLenColsArray[$i] == "" || $displayedListLenColsArray[$i] == "0") :
$dspColHeaderSearchFieldArray[$tmpKeys[$j]] = str_replace("_SIZE_MACRO_", "", $dspColHeaderSearchFieldArray[$tmpKeys[$j]]);
else :
$dspColHeaderSearchFieldArray[$tmpKeys[$j]] = str_replace("_SIZE_MACRO_", " size=\"" . $displayedListLenColsArray[$i] . "\" ", $dspColHeaderSearchFieldArray[$tmpKeys[$j]]);
endif;
$cellColor = getListColor(1, 1);
$tableHeaderSearchFields .= "<td bgcolor=\"" . $cellColor . "\">" . $dspColHeaderSearchFieldArray[$tmpKeys[$j]] . "</td>";
endif;
}
endif;
// OUTPUT: Table header column links
$tableHeaderLinks = "";
if (TRUE) :
$dspColHeaderLinksArray = array();
$dspColHeaderLinksArray["cmp_comp"] = "<a href=\"javascript:submitPage('cmp.cmp_comp');\">&nbsp;" . getLngt("Firma") . "&nbsp;</a>";
$dspColHeaderLinksArray["cmp_comp2"] = "<a href=\"javascript:submitPage('cmp.cmp_comp2');\">&nbsp;" . getLngt("Firma2") . "&nbsp;</a>";
$dspColHeaderLinksArray["cs_eid"] = "<a href=\"javascript:submitPage('cs.cs_eid');\">&nbsp;" . getLngt("ExtID") . "&nbsp;</a>";
$dspColHeaderLinksArray["csc_name"] = "<a href=\"javascript:submitPage('csc.csc_name');\">&nbsp;" . getLngt("Kostenstelle") . "&nbsp;</a>";
$dspColHeaderLinksArray["cmp_match"] = "<a href=\"javascript:submitPage('cmp.cmp_match');\">&nbsp;" . getLngt("Freitext") . "&nbsp;</a>";
$dspColHeaderLinksArray["cmp_authenticated_img"] = "&nbsp;" . getLngt("Freigabe") . "&nbsp;";
$dspColHeaderLinksArray["usr_name"] = "<a href=\"javascript:submitPage('usr.usr_name');\">&nbsp;" . getLngt("Admin-Name") . "</a>";
$dspColHeaderLinksArray["usr_phone"] = "<a href=\"javascript:submitPage('usr.usr_phone');\">&nbsp;" . getLngt("Admin-Telefon") . "</a>";
$dspColHeaderLinksArray["usr_email"] = "<a href=\"javascript:submitPage('usr.usr_email');\">&nbsp;" . getLngt("Admin-Email") . "</a>";
$dspColHeaderLinksArray["ad_street"] = "<a href=\"javascript:submitPage('ad.ad_street');\">&nbsp;" . getLngt("Straße") . "</a>";
$dspColHeaderLinksArray["cscad_hsno"] = "<a href=\"javascript:submitPage('cscad.cscad_hsno');\">&nbsp;" . getLngt("Hausnr.") . "</a>";
$dspColHeaderLinksArray["ad_zipcode"] = "<a href=\"javascript:submitPage('ad.ad_zipcode');\">&nbsp;" . getLngt("PLZ") . "</a>";
$dspColHeaderLinksArray["ad_city"] = "<a href=\"javascript:submitPage('ad.ad_city');\">&nbsp;" . getLngt("Ort") . "</a>";
$dspColHeaderLinksArray["cscad_remark"] = "<a href=\"javascript:submitPage('cscad.cscad_remark');\">&nbsp;" . getLngt("Bemerkung") . "</a>";
$dspColHeaderLinksArray["cscad_person"] = "<a href=\"javascript:submitPage('cscad.cscad_person');\">&nbsp;" . getLngt("Person") . "</a>";
$dspColHeaderLinksArray["cscad_phone"] = "<a href=\"javascript:submitPage('cscad.cscad_phone');\">&nbsp;" . getLngt("Telefon") . "</a>";
$dspColHeaderLinksArray["statistic"] = "&nbsp;" . getLngt("Statistik") . "&nbsp;";
$dspColHeaderLinksArray["cs_report"] = "&nbsp;" . getLngt("Berichte") . "&nbsp;";
$tmpKeys = array_keys($dspColHeaderLinksArray);
for ($i = 0; $i < $displayedListColsArrayLen; $i++) {
// Search for the value "$displayedListColsArray" in "$dspColArray" and get the key (index)
$j = array_search($displayedListColsArray[$i], $tmpKeys);
if (!($j === FALSE)) :
$cellColor = getListColor(0, 0);
$tableHeaderLinks .= "<td bgcolor=\"" . $cellColor . "\">" . $dspColHeaderLinksArray[$tmpKeys[$j]] . "</td>";
endif;
}
endif;
// if called e.g. by the first time with empty search-fields
$searchValues = $f_cmp_comp . $f_cmp_comp2 . $f_cmp_match . $f_cs_eid . $f_csc_name . $f_street . $f_hsno . $f_zipcode . $f_city . $f_country . $f_remark . $f_person . $f_phone;
// $searchValues .= $f_usr_name . $f_usr_phone . $f_usr_email;
// Generate search-resultset
if ($f_act == "search" && $searchValues != "") :
if (strlen($f_cmp_comp) > 2 || strlen($f_cmp_comp2) > 2 || strlen($f_cmp_match) > 2 || strlen($f_cs_eid) > 2 || strlen($f_csc_name) > 0 ||
strlen($f_street) > 2 || strlen($f_hsno) > 0 || strlen($f_zipcode) > 2 || strlen($f_city) > 2 ||
strlen($f_remark) > 2 || strlen($f_person) > 2 || strlen($f_phone) > 2) :
// *******************************************
// * Selection of the customers for the list *
// *******************************************
if ($f_searchmode == "1") : $prefix = "%"; else : $prefix = ""; endif;
$whereClause = "";
// Check for search value in cmp.cmp_comp OR cmp.cmp_match
if ($f_cmp_comp != "") :
$whereClause .= "cmp.cmp_comp LIKE '" . $prefix . $f_cmp_comp . "%'";
if (($constSearchCscsclistCmpcompCmpmatch == "1" && $f_cmp_match != "") ||
($constSearchCscsclistCmpcompCseid == "1" && $f_cs_eid != "") ||
($constSearchCscsclistCmpcompCscadphone == "1" && $f_phone != "")) :
$whereClause = " (" . $whereClause;
if ($constSearchCscsclistCmpcompCmpmatch == "1" && $f_cmp_match != "") :
$whereClause .= " OR cmp.cmp_match LIKE '" . $prefix . $f_cmp_match . "%'";
endif;
if ($constSearchCscsclistCmpcompCseid == "1" && $f_cs_eid != "") :
$whereClause .= " OR cs.cs_eid LIKE '" . $prefix . $f_cs_eid . "%'";
endif;
if ($constSearchCscsclistCmpcompCscadphone == "1" && $f_phone != "") :
$whereClause .= " OR cscad.cscad_phone LIKE '" . $prefix . $f_phone . "%'";
endif;
$whereClause .= ") ";
endif;
endif;
if ($whereClause != "" && $f_cmp_comp2 != "") : $whereClause .= " AND "; endif;
if ($f_cmp_comp2 != "") : $whereClause .= "cmp.cmp_comp2 LIKE '" . $prefix . $f_cmp_comp2 . "%'"; endif;
// Check for search value in cmp.cmp_comp OR cmp.cmp_match
if ($constSearchCscsclistCmpcompCmpmatch != "1") :
if ($whereClause != "" && $f_cmp_match != "") : $whereClause .= " AND "; endif;
if ($f_cmp_match != "") : $whereClause .= "cmp.cmp_match LIKE '" . $prefix . $f_cmp_match . "%'"; endif;
endif;
// Check for search value in cmp.cmp_comp OR cs.cs_eid
if ($constSearchCscsclistCmpcompCseid != "1") :
if ($whereClause != "" && $f_cs_eid != "") : $whereClause .= " AND "; endif;
if ($f_cs_eid != "") : $whereClause .= "cs.cs_eid LIKE '" . $prefix . $f_cs_eid . "%'"; endif;
endif;
// Check for search value in cmp.cmp_comp OR cscad.cscad_phone
if ($constSearchCscsclistCmpcompCscadphone != "1") :
if ($whereClause != "" && $f_phone != "") : $whereClause .= " AND "; endif;
if ($f_phone != "") : $whereClause .= "cscad.cscad_phone LIKE '" . $prefix . $f_phone . "%'"; endif;
endif;
if ($whereClause != "" && $f_csc_name != "") : $whereClause .= " AND "; endif;
if ($f_csc_name != "") : $whereClause .= "csc.csc_name LIKE '" . $prefix . $f_csc_name . "%'"; endif;
// if ($whereClause != "" && $f_usr_name != "") : $whereClause .= " AND "; endif;
// if ($f_usr_name != "") : $whereClause .= "usr.usr_name LIKE '" . $prefix . $f_usr_name . "%'"; endif;
// if ($whereClause != "" && $f_usr_phone != "") : $whereClause .= " AND "; endif;
// if ($f_usr_phone != "") : $whereClause .= "usr.usr_phone LIKE '" . $prefix . $f_usr_phone . "%'"; endif;
// if ($whereClause != "" && $f_usr_email != "") : $whereClause .= " AND "; endif;
// if ($f_usr_email != "") : $whereClause .= "usr.usr_email LIKE '" . $prefix . $f_usr_email . "%'"; endif;
if ($whereClause != "" && $f_cmp_iln != "") : $whereClause .= " AND "; endif;
if ($f_cmp_iln != "") : $whereClause .= "cmp.cmp_iln LIKE '" . $prefix . $f_cmp_iln . "%'"; endif;
if ($whereClause != "" && $f_cmp_tax_idno != "") : $whereClause .= " AND "; endif;
if ($f_cmp_tax_idno != "") : $whereClause .= "cmp.cmp_tax_idno LIKE '" . $prefix . $f_cmp_tax_idno . "%'"; endif;
if ($whereClause != "" && $f_cmp_bank != "") : $whereClause .= " AND "; endif;
if ($f_cmp_bank != "") : $whereClause .= "cmp.cmp_bank LIKE '" . $prefix . $f_cmp_bank . "%'"; endif;
if ($whereClause != "" && $f_cmp_bankno != "") : $whereClause .= " AND "; endif;
if ($f_cmp_bankno != "") : $whereClause .= "cmp.cmp_bankno LIKE '" . $prefix . $f_cmp_bankno . "%'"; endif;
if ($whereClause != "" && $f_cmp_bankacc != "") : $whereClause .= " AND "; endif;
if ($f_cmp_bankacc != "") : $whereClause .= "cmp.cmp_bankacc LIKE '" . $prefix . $f_cmp_bankacc . "%'"; endif;
if ($whereClause != "" && $f_street != "") : $whereClause .= " AND "; endif;
if ($f_street != "") : $whereClause .= "ad.ad_street LIKE '" . $f_street . "%'"; endif;
if ($whereClause != "" && $f_hsno != "") : $whereClause .= " AND "; endif;
if ($f_hsno != "") : $whereClause .= "cscad.cscad_hsno LIKE '" . $f_hsno . "%'"; endif;
if ($whereClause != "" && $f_zipcode != "") : $whereClause .= " AND "; endif;
if ($f_zipcode != "") : $whereClause .= "ad.ad_zipcode LIKE '" . $f_zipcode . "%'"; endif;
if ($whereClause != "" && $f_city != "") : $whereClause .= " AND "; endif;
if ($f_city != "") : $whereClause .= "ad.ad_city LIKE '" . $f_city . "%'"; endif;
if ($whereClause != "" && $f_country != "") : $whereClause .= " AND "; endif;
if ($f_country != "") : $whereClause .= "ad.ad_country LIKE '" . $f_country . "%'"; endif;
if ($whereClause != "" && $f_remark != "") : $whereClause .= " AND "; endif;
if ($f_remark != "") : $whereClause .= "cscad.cscad_remark LIKE '" . $f_remark . "%'"; endif;
if ($whereClause != "" && $f_person != "") : $whereClause .= " AND "; endif;
if ($f_person != "") : $whereClause .= "cscad.cscad_person LIKE '" . $f_person . "%'"; endif;
// Check authentication
// Enable again 4 cashMode (... damit die "eigentliche" Funktion des Sperrens wieder aufgenommen werden kann !!!!!!!!!!!!!!!!!!)
// if ($whereClause != "" && $f_cmp_authenticated == "1") : $whereClause .= " AND "; endif;
// if ($f_cmp_authenticated == "1") : $whereClause .= "cmp.cmp_authenticated LIKE '" . $f_cmp_authenticated . "%'"; endif;
// Show "invisible" customers
$whereClauseCscVisible = "";
if ($f_show_invisible != "1") :
if ($whereClause != "") : $whereClause .= " AND "; endif;
$whereClause .= " cmp.cmp_visible = '1'";
$whereClauseCscVisible = " csc.csc_visible = '1' AND ";
endif;
if ($whereClause != "") : $whereClause .= " AND "; endif;
// if (!(strpos($displayedListCols, "cmp_comp,") === FALSE)) :
$constCscscListOrderBy = getParameterValue("0", "MASK_CSCSC_LIST_ORDER_BY", $hqId);
if ($orderClause == "") :
$orderClause = "cmp.cmp_comp";
if ($constCscscListOrderBy == "1") :
if (!(strpos($displayedListCols, "csc_name,") === FALSE)) :
$orderClause .= ", csc.csc_name";
endif;
endif;
endif;
// endif;
$whereClause2 = "";
// Internal/External/All costcenters
if ($f_csc_is_extern == "0") : $whereClause2 .= " AND csc.csc_is_extern = '0' "; endif;
if ($f_csc_is_extern == "1") : $whereClause2 .= " AND csc.csc_is_extern = '1' "; endif;
// filter csc_id_payer == CSC_ID_PAYER_CASH (real payer is cash payer)
// if ($tourno == -1) : $whereClause2 .= " AND cs.csc_id_payer != '" . CSC_ID_PAYER_CASH . "' "; endif;
// Filter according to the customer type
$whereClauseCustomerType = " cmp.cmp_type = '0' AND";
if ($allowAllCustomerTypes == "1") :
$whereClauseCustomerType = "";
endif;
$sqlquery = "SELECT csc.csc_id, csc.csc_name, csc.csc_is_extern, cs.cs_id, cs.cs_eid, cs.cs_eid AS cs_report, cs.csc_id_payer, cs.cs_id_parent, cs.cs_commission_no, cs.cs_jobbatch, cs.cs_discount, cs.cs_filter, cs.cs_fixprice_discount, "
. " cs.cs_prov, cs.cs_jb_jam_waittime, cs.cs_tracking, cs.cs_invmode, cmp.cmp_id, cmp.cmp_type, cmp.cmp_comp, cmp.cmp_comp2, cmp.cmp_authenticated, cmp.cmp_remark, cmp.cmp_match, cmp.cmp_cashmode, cmp.cmp_stax_idno,"
. " cmp.tx_id, cscad.ad_id, cscad.cscad_comp, cscad.cscad_comp2, cscad.cscad_hsno,"
. " cscad.cscad_remark, cscad.cscad_person, cscad.cscad_phone,"
. " ad.ad_street, ad.ad_zipcode, ad.ad_city, ad.ad_country, cmp2.cmp_comp AS payer_comp, cmp2.cmp_stax_idno AS payer_cmp_stax_idno, cs2.cs_commission_no AS payer_cs_commission_no, cs.cs_eid AS statistic"
. " FROM company AS cmp, costcenter AS csc, customer AS cs"
. " LEFT JOIN costcenter AS csc2 ON csc2.csc_id = cs.csc_id_payer"
. " LEFT JOIN customer AS cs2 ON cs2.cs_id = csc2.cs_id"
. " LEFT JOIN company AS cmp2 ON cmp2.cmp_id = cs2.cmp_id,"
. " costcenteraddress AS cscad, address AS ad"
. " WHERE " .$whereClause
. " cs.hq_id IN " . getSQLMandatorArray($f_hq_id) . " AND"
. " cmp.cmp_id = cs.cmp_id AND"
. " cmp.cmp_archived = '0' AND"
. " " . $whereClauseCustomerType
. " cs.cs_id = csc.cs_id "
. " " . $whereClause2 . " AND"
. " " . $whereClauseCscVisible
. " csc.csc_id = cscad.csc_id AND"
. " cscad.adt_id = '4' AND"
. " cscad.ad_id = ad.ad_id"
. " ORDER BY " . $orderClause;
// echo $sqlquery . "<br>";
getDb2Connection(); // Try to connect request server because of performance
// $result = $db2->query($sqlquery);
// if (DB::isError($result)) die ("$PHP_SELF: '$sqlquery': " . $result->getMessage());
$result = $db2->dbQ($sqlquery);
// Table with header
$rowCounter = 0;
$lineToggler = 0;
while ($row = $result->fetch_assoc()):
$numOfRows++;
$dspColArray = array();
$tableOfRows .= "<tr>";
$dspColArray["cmp_comp"] = "<td__BGCOL__>&nbsp;__START__" . $row["cmp_comp"] . "__END__</td>";
$dspColArray["cmp_comp2"] = "<td__BGCOL__>&nbsp;__START__" . $row["cmp_comp2"] . "__END__</td>";
if ($allowAllCustomerTypes == "1" && $row["cmp_type"] != "0") :
$dspColArray["cs_eid"] = "<td__BGCOL__>&nbsp;<a href=\"javascript:openCustomerSpecial('" . ec($row["cmp_id"]) . "');\">" . $row["cs_eid"] . "</a>" . "</td>";
else :
$dspColArray["cs_eid"] = "<td__BGCOL__>&nbsp;__START__" . $row["cs_eid"] . "__END__</td>";
endif;
$payer_comp = "";
$payer_cmp_stax_idno = "";
$payer_cs_commission_no = 0;
if ($row["csc_id_payer"] != "" && $row["csc_id_payer"] != 0):
// $payer_comp = $db->getOne("SELECT cmp_comp FROM company, customer, costcenter WHERE company.cmp_id = customer.cmp_id AND customer.cs_id = costcenter.cs_id AND costcenter.csc_id = " . $row["csc_id_payer"]);
$payer_comp = $row["payer_comp"];
$payer_cmp_stax_idno = $row["payer_cmp_stax_idno"];
$payer_cs_commission_no = $row["payer_cs_commission_no"];
endif;
if (trim($row["cscad_comp"] == ""))
$row["cscad_comp"] = $row["cmp_comp"];
$cs_comm_prefix = $db->getOne("SELECT par_value FROM parameter WHERE par_key = 'MASK_COMM_PREFIX_" . $row["cs_id"] . "'");
$cs_jb_jam_waittime = $row["cs_jb_jam_waittime"];
if ($cs_jb_jam_waittime > 0) {
$cs_jb_jam_waittime = $db->getOne("SELECT cs_jb_jam_waittime_minutes from customer WHERE cs_id = " . $row["cs_id"]);
if ($cs_jb_jam_waittime == 0) {
$cs_jb_jam_waittime = getParameterValue("0", "CS_JB_JAM_WAITTIME_AD_HOC_DEFAULT", "0");
}
}
$cs_invmail = $db->getOne("SELECT usr_inv_email from customer, employee, user WHERE cs_id = " . $row["cs_id"] . " AND customer.cs_admin = employee.emp_id AND employee.usr_id = user.usr_id");
$cs_jb_incomplete = $db->getOne("SELECT par_value FROM parameter WHERE par_key = 'CUSTOMER_MASK_JB_INCOMPLETE_" . $row["cs_id"] . "'");
// No Link for entries where csc_id_payer (i.e. real payer) is cash-payer (only when selection for payer only ($tourno == -1))
// if ($tourno == -1 && $row["csc_id_payer"] == CSC_ID_PAYER_CASH) {
if (($tourno == -1 && $row["cmp_authenticated"] != "1") || ($allowAllCustomerTypes == "1" && $row["cmp_type"] != "0" && $activateCscLinkForProspects != "1")) {
$dspColArray["csc_name"] = "<td__BGCOL__>&nbsp;__START__" . my_str_check_html($row["csc_name"]) . "__END__</a></td>";
} else {
$dspColArray["csc_name"] = "<td__BGCOL__>&nbsp;<a href=\"javascript:finishPage('" . $row["cs_id"] . "','" . $row["csc_id"] . "','" . my_str_check_js($row["csc_name"]) . "','" . my_str_check_js($row["cscad_comp"]) . "','" . my_str_check_js($row["cscad_comp2"]) . "','" . my_str_check_js($row["ad_street"]) . "','" . $row["cscad_hsno"] . "','" . $row["ad_zipcode"] . "','" . my_str_check_js($row["ad_city"]) . "','" . my_str_check_js($row["ad_country"]) . "','" . my_str_check_js($row["cscad_remark"]) . "','" . my_str_check_js($row["cscad_person"]) . "','" . $tourno . "','" . my_str_check_js($row["csc_id_payer"]) . "','" . my_str_check_js($payer_comp) . "','" . $row["tx_id"] . "','" . $row["cs_eid"] . "','" . $row["cs_commission_no"] . "','" . $row["cmp_authenticated"] . "','" . my_str_check_js($row["cmp_remark"]) . "','" . $row["cs_jobbatch"] . "','" . $row["cs_discount"] . "','" . $row["cs_filter"] . "','" . my_str_check_js($row["cmp_comp"]) . "','" . my_str_check_js($row["cmp_comp2"]) . "','" . $row["cs_id_parent"] . "'," . ($row["csc_is_extern"] == 0 && $row["cmp_type"] == 0 ? "0" : "1") . "," . $row["cs_fixprice_discount"] . "," . $row["cs_prov"] . ",'" . my_str_check_js($row["cmp_stax_idno"]) . "','" . my_str_check_js($payer_cmp_stax_idno) . "'," . $payer_cs_commission_no . ",'" . $cs_comm_prefix . "'," . $cs_jb_jam_waittime . "," . $row["cs_tracking"] . ",'" . $cs_invmail . "', '" . $cs_jb_incomplete . "', " . $row["cs_invmode"] . ");\">__START__" . my_str_check_html($row["csc_name"]) . "__END__</a></td>";
}
$dspColArray["cmp_match"] = "<td__BGCOL__>&nbsp;__START__" . $row["cmp_match"] . "__END__</td>";
$authImgName = "circle_red.png";
if ($row["cmp_authenticated"] == "1") : $authImgName = "circle_green.png"; endif;
if ($allowAllCustomerTypes == "1") :
if ($row["cmp_type"] == "1") : $authImgName = "circle_lightblue.png"; endif;
if ($row["cmp_type"] == "2") : $authImgName = "circle_lightblue.png"; endif;
if ($row["cmp_type"] == "3") : $authImgName = "circle_lightblue.png"; endif;
endif;
$dspColArray["cmp_authenticated_img"] = "<td align=\"center\"__BGCOL__><img src=\"../images/" . $authImgName . "\" border=\"0\" height=\"10\" width=\"25\"></td>";
$cashmodeImgName = "circle_green.png";
if ($row["cmp_cashmode"] == "1") : $cashmodeImgName = "circle_red.png"; endif;
// Enable 4 cashMode
// $dspColArray["usr_name"] = "<td align=\"center\"__BGCOL__><img src=\"../images/" . $cashmodeImgName . "\" border=\"0\" height=\"10\" width=\"25\"></td>";
// $dspColArray["usr_name"] = "<td__BGCOL__>&nbsp;__START__" . $row["usr_name"] . "__END__</td>";
// $dspColArray["usr_phone"] = "<td__BGCOL__>&nbsp;__START__" . $row["usr_phone"] . "__END__</td>";
// $dspColArray["usr_email"] = "<td__BGCOL__>&nbsp;__START__" . $row["usr_email"] . "__END__</td>";
$dspColArray["ad_street"] = "<td__BGCOL__>&nbsp;__START__" . $row["ad_street"] . "__END__</td>";
$dspColArray["cscad_hsno"] = "<td__BGCOL__>&nbsp;__START__" . $row["cscad_hsno"] . "__END__</td>";
$dspColArray["ad_zipcode"] = "<td__BGCOL__>&nbsp;__START__" . $row["ad_zipcode"] . "__END__</td>";
$dspColArray["ad_city"] = "<td__BGCOL__>&nbsp;__START__" . $row["ad_city"] . "__END__</td>";
$dspColArray["cscad_remark"] = "<td__BGCOL__>&nbsp;__START__" . $row["cscad_remark"] . "__END__</td>";
$dspColArray["cscad_person"] = "<td__BGCOL__>&nbsp;__START__" . $row["cscad_person"] . "__END__</td>";
$dspColArray["cscad_phone"] = "<td__BGCOL__>&nbsp;__START__" . $row["cscad_phone"] . "__END__</td>";
// $dspColArray["statistic"] = "<td__BGCOL__>&nbsp;<a href=\"javascript:openCustomerStatistics('" . $row["statistic"] . "');\">" . getLngt("Statistik") . "</a></td>";
// $dspColArray["cs_report"] = "<td__BGCOL__>&nbsp;<a href=\"javascript:openCustomerReports('" . $row["cs_eid"] . "');\">" . getLngt("Berichte") . "</a></td>";
$dspColArray["statistic"] = "<td__BGCOL__>&nbsp;<a href=\"javascript:openCustomerStatistics('" . $row["statistic"] . "');\"><img src=\"../images/arrow_right.png\" border=\"0\" height=\"10\" width=\"25\"></a></td>";
$dspColArray["cs_report"] = "<td__BGCOL__>&nbsp;<a href=\"javascript:openCustomerReports('" . $row["cs_eid"] . "');\"><img src=\"../images/arrow_right.png\" border=\"0\" height=\"10\" width=\"25\"></a></td>";
// Generate list
$rowCounter++;
$tmpKeys = array_keys($dspColArray);
for ($i = 0; $i < $displayedListColsArrayLen; $i++) {
// Search for the value "$displayedListColsArray" in "$dspColArray" and get the key (index)
$j = array_search($displayedListColsArray[$i], $tmpKeys);
if (!($j === FALSE)) :
// Define length (html attribute "size") of the field and substitute macro
if ($displayedListLenColsArray[$i] == "" || $displayedListLenColsArray[$i] == "0") :
$dspColArray[$tmpKeys[$j]] = str_replace("__START__", "", $dspColArray[$tmpKeys[$j]]);
$dspColArray[$tmpKeys[$j]] = str_replace("__END__", "", $dspColArray[$tmpKeys[$j]]);
else :
// content of db-fields
$tagBegin = "__START__";
$tagEnd = "__END__";
if (!(strpos($dspColArray[$tmpKeys[$j]], $tagBegin) === FALSE) && !(strpos($dspColArray[$tmpKeys[$j]], $tagEnd) === FALSE)) :
$pos0 = strpos($dspColArray[$tmpKeys[$j]], $tagBegin); // begin of tagBegin (first occurrence)
$pos1 = strpos($dspColArray[$tmpKeys[$j]], $tagBegin) + strlen($tagBegin); // end of tagBegin (first occurrence)
$pos2 = strpos($dspColArray[$tmpKeys[$j]], $tagEnd); // begin of tagEnd (first occurrence)
$pos3 = strpos($dspColArray[$tmpKeys[$j]], $tagEnd) + strlen($tagEnd); // end of tagEnd (first occurrence)
if ($pos2 - $pos1 > 0) :
// first get the content of the tag
$fieldContent = substr($dspColArray[$tmpKeys[$j]], $pos1, $pos2 - $pos1);
$fieldContent = substr($fieldContent, 0, $displayedListLenColsArray[$i]);
// replace original content with string-content
$dspColArray[$tmpKeys[$j]] = substr_replace($dspColArray[$tmpKeys[$j]], $fieldContent, $pos0, $pos3 - $pos0);
endif;
endif;
endif;
if ($lineToggler == 0) : $lineToggler = 1; else : $lineToggler = 0; endif;
$cellColor = getListColor($rowCounter, $lineToggler);
$dspColArray[$tmpKeys[$j]] = str_replace("__START__", "", $dspColArray[$tmpKeys[$j]]);
$dspColArray[$tmpKeys[$j]] = str_replace("__END__", "", $dspColArray[$tmpKeys[$j]]);
$dspColArray[$tmpKeys[$j]] = str_replace("__BGCOL__", " bgcolor=\"" . $cellColor ."\"", $dspColArray[$tmpKeys[$j]]);
$tableOfRows .= $dspColArray[$tmpKeys[$j]] . "\n";
endif;
}
if ($lineToggler == 0) : $lineToggler = 1; else : $lineToggler = 0; endif;
$tableOfRows .= "</tr>\n";
endwhile;
$result->free();
else :
$statusMessage = getLngt("Bei Eingabe weniger als 3 Zeichen in mindestens einem Feld erfolgt keine Suche! Mind. ein Zeichen bei Kostenstelle reicht aus!");
endif;
endif;
?>
<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 type="text/javascript">
<!--
// NAVIGATION
<?php echo $jsMenuOut; ?>
<?php if ($generic == "") : ?>
function finishPage(cs_id,csc_id,name,comp,comp2,street,hsno,zipcode,city,country,remark,person,tourno,csc_id_payer,payer_comp,tx_id,cs_eid,cs_commission_no,cmp_authenticated,cmp_remark,cs_jobbatch,cs_discount,cs_filter,cmp_comp,cmp_comp2,cs_id_parent,is_extern,cs_fixprice_discount,cs_prov,cmp_stax_idno,payer_cmp_stax_idno,payer_cs_commission_no,cs_comm_prefix,cs_jb_jam_waittime,cs_tracking,cs_invmail,cs_jb_incomplete,cs_invmode) {
if (tourno > -1)
{
opener.setJobList(tourno, opener.jl_csc_id, csc_id);
opener.setJobList(tourno, opener.jl_tr_comp, comp);
opener.setJobList(tourno, opener.jl_tr_person, person);
opener.setJobList(tourno, opener.jl_ad_street, street);
opener.setJobList(tourno, opener.jl_tr_hsno, hsno);
opener.setJobList(tourno, opener.jl_ad_zipcode, zipcode);
opener.setJobList(tourno, opener.jl_ad_city, city);
opener.setJobList(tourno, opener.jl_ad_country, country);
opener.setJobList(tourno, opener.jl_tr_remark, remark);
opener.setJobList(tourno, opener.jl_csc_id_payer, "false");
opener.setJobList(tourno, opener.jl_hide_tr_remark, "true");
if (csc_id_payer != "" && csc_id_payer != 0)
{
opener.setCsc_id_payer(csc_id_payer, payer_comp);
// opener.parent.job_options.document.tourOptions.payer_is_default.value = "true";
if (csc_id != csc_id_payer)
opener.add_cs_eid(csc_id_payer, "", payer_cs_commission_no, payer_comp, "", "", "", "", "", "", "", "", "", "", "", payer_cmp_stax_idno, cs_comm_prefix, cs_jb_jam_waittime, cs_tracking, cs_invmail, cs_jb_incomplete, cs_invmode);
}
} else {
opener.setCsc_id_payer(csc_id, comp);
if (cs_tracking == 1) {
opener.parent.job_tour.document.getElementById('tr_tracking_row').style.visibility = 'visible';
if (opener.getCurTourNo() > 0) {
opener.parent.job_tour.document.getElementById('tr_tracking_von').style.visibility = 'visible';
} else {
opener.parent.job_tour.document.getElementById('tr_tracking_von').style.visibility = 'collapse';
}
opener.parent.job_tour.document.getElementById('tr_tracking_nach').style.visibility = 'visible';
} else {
opener.parent.job_tour.document.getElementById('tr_tracking_row').style.visibility = 'collapse';
opener.parent.job_tour.document.getElementById('tr_tracking_nach').style.visibility = 'collapse';
opener.parent.job_tour.document.getElementById('tr_tracking_von').style.visibility = 'collapse';
}
<?php if (getParameterValue("0", "MASK_COPY_REMARK_OF PAYER_2_TR_REMARK", $hqId) == "1") : ?>
// 26.10.2019: Die Drittzahlerbemerkung soll angehängt werden
var cur_tr_remark = opener.getJobList(0, opener.jl_tr_remark);
if (cur_tr_remark != "" && cur_tr_remark.substring(cur_tr_remark.length - 1) != "\n") {
cur_tr_remark = cur_tr_remark + "\n";
}
var remString = "*** BEMERKUNG ZAHLER ***\n";
var pos_remString = cur_tr_remark.indexOf(remString);
if (pos_remString > -1) {
cur_tr_remark = cur_tr_remark.substring(0, pos_remString);
}
opener.setJobList(0, opener.jl_tr_remark, cur_tr_remark + (remark != "" && cur_tr_remark != remark ? remString : "") + (cur_tr_remark != remark ? remark : ""));
<?php endif; ?>
if (tx_id != "" && tx_id != 0)
{
opener.checkJb_sales_tax_rate_sign(tx_id);
opener.checkCs_filter(cs_filter, cs_jb_incomplete);
}
opener.parent.job_options.jb_markup_overwrite = 1;
<?php if (MASK_CASH_PAYER_SELECT == "1") : ?>
opener.parent.job_tour.document.tourForm.jb_costsplit.checked = true;
opener.checkCostsplit(true);
<?php endif; ?>
}
if (cs_eid != "" && cs_eid != 0)
{
opener.add_cs_eid(csc_id, cs_eid, cs_commission_no, comp, cmp_authenticated, cmp_remark, cs_jobbatch, cs_discount, cs_filter, tx_id, name, is_extern, cs_id, cs_fixprice_discount, cs_prov, cmp_stax_idno, cs_comm_prefix, cs_jb_jam_waittime, cs_tracking, cs_invmail, cs_jb_incomplete, cs_invmode);
opener.checkFixprice(0);
}
self.setTimeout("opener.refreshFormFields()", 100);
self.setTimeout("opener.resetSignificantPriceValues()", 150);
// opener.refreshFormFields();
self.setTimeout("opener.writeJob()", 200);
// opener.checkSendTour();
self.setTimeout("self.close()", 300);
// self.close();
};
<?php else : ?>
// GENERIC function
<?php if ($genJsParName == "") : ?>
function finishPage(cs_id,csc_id,name,comp,comp2,street,hsno,zipcode,city,country,remark,person,tourno,csc_id_payer,payer_comp,tx_id,cs_eid,cs_commission_no,cmp_authenticated,cmp_remark,cs_jobbatch,cs_discount,cs_filter,cmp_comp,cmp_comp2,cs_id_parent,is_extern,cs_fixprice_discount,cs_prov,cmp_stax_idno,payer_cmp_stax_idno,payer_cs_commission_no) {
<?php if (substr($generic, 0,1) == "1") : ?> opener.document.forms[0].g<?php echo $genNum; ?>_cs_id.value = cs_id; <?php endif; ?>
<?php if (substr($generic, 1,1) == "1") : ?> opener.document.forms[0].g<?php echo $genNum; ?>_csc_id.value = csc_id; <?php endif; ?>
<?php if (substr($generic, 2,1) == "1") : ?> opener.document.forms[0].g<?php echo $genNum; ?>_csc_name.value = name; <?php endif; ?>
<?php if (substr($generic, 3,1) == "1") : ?> opener.document.forms[0].g<?php echo $genNum; ?>_cscad_comp.value = comp; <?php endif; ?>
<?php if (substr($generic, 4,1) == "1") : ?> opener.document.forms[0].g<?php echo $genNum; ?>_cscad_comp2.value = comp2; <?php endif; ?>
<?php if (substr($generic, 5,1) == "1") : ?> opener.document.forms[0].g<?php echo $genNum; ?>_ad_street.value = street; <?php endif; ?>
<?php if (substr($generic, 6,1) == "1") : ?> opener.document.forms[0].g<?php echo $genNum; ?>_cscad_hsno.value = hsno; <?php endif; ?>
<?php if (substr($generic, 7,1) == "1") : ?> opener.document.forms[0].g<?php echo $genNum; ?>_ad_zipcode.value = zipcode; <?php endif; ?>
<?php if (substr($generic, 8,1) == "1") : ?> opener.document.forms[0].g<?php echo $genNum; ?>_ad_city.value = city; <?php endif; ?>
<?php if (substr($generic, 9,1) == "1") : ?> opener.document.forms[0].g<?php echo $genNum; ?>_ad_country.value = country; <?php endif; ?>
<?php if (substr($generic,10,1) == "1") : ?> opener.document.forms[0].g<?php echo $genNum; ?>_cscad_remark.value = remark; <?php endif; ?>
<?php if (substr($generic,11,1) == "1") : ?> opener.document.forms[0].g<?php echo $genNum; ?>_cscad_person.value = person; <?php endif; ?>
<?php if (substr($generic,12,1) == "1") : ?> opener.document.forms[0].g<?php echo $genNum; ?>_cs_eid.value = cs_eid; <?php endif; ?>
<?php if (substr($generic,13,1) == "1") : ?> opener.document.forms[0].g<?php echo $genNum; ?>_cmp_comp.value = cmp_comp; <?php endif; ?>
<?php if (substr($generic,14,1) == "1") : ?> opener.document.forms[0].g<?php echo $genNum; ?>_cmp_comp2.value = cmp_comp2; <?php endif; ?>
<?php if (substr($generic,15,1) == "1") : ?> opener.document.forms[0].g<?php echo $genNum; ?>_cs_id_parent.value = cs_id_parent; <?php endif; ?>
<?php if (substr($generic,16,1) == "1") : ?> opener.document.forms[0].g<?php echo $genNum; ?>_cs_discount.value = cs_discount; <?php endif; ?>
// Call opener function
<?php if ($callOpenerFunction != "") : ?> opener.<?php echo $callOpenerFunction; ?>; <?php endif; ?>
self.close();
};
<?php else : ?>
// Function ONLY if a special JS parameter name of the caller page is defined in $genJsParName
function finishPage(cs_id,csc_id,name,comp,comp2,street,hsno,zipcode,city,country,remark,person,tourno,csc_id_payer,payer_comp,tx_id,cs_eid,cs_commission_no,cmp_authenticated,cmp_remark,cs_jobbatch,cs_discount,cs_filter,cmp_comp,cmp_comp2,cs_id_parent,is_extern,cs_fixprice_discount,cs_prov,cmp_stax_idno,payer_cmp_stax_idno,payer_cs_commission_no) {
<?php if (substr($generic, 0,1) == "1") : ?> opener.document.forms[0].<?php echo $genJsParName; ?>.value = cs_id; <?php endif; ?>
<?php if (substr($generic, 1,1) == "1") : ?> opener.document.forms[0].<?php echo $genJsParName; ?>.value = csc_id; <?php endif; ?>
<?php if (substr($generic, 2,1) == "1") : ?> opener.document.forms[0].<?php echo $genJsParName; ?>.value = name; <?php endif; ?>
<?php if (substr($generic, 3,1) == "1") : ?> opener.document.forms[0].<?php echo $genJsParName; ?>.value = comp; <?php endif; ?>
<?php if (substr($generic, 4,1) == "1") : ?> opener.document.forms[0].<?php echo $genJsParName; ?>.value = comp2; <?php endif; ?>
<?php if (substr($generic, 5,1) == "1") : ?> opener.document.forms[0].<?php echo $genJsParName; ?>.value = street; <?php endif; ?>
<?php if (substr($generic, 6,1) == "1") : ?> opener.document.forms[0].<?php echo $genJsParName; ?>.value = hsno; <?php endif; ?>
<?php if (substr($generic, 7,1) == "1") : ?> opener.document.forms[0].<?php echo $genJsParName; ?>.value = zipcode; <?php endif; ?>
<?php if (substr($generic, 8,1) == "1") : ?> opener.document.forms[0].<?php echo $genJsParName; ?>.value = city; <?php endif; ?>
<?php if (substr($generic, 9,1) == "1") : ?> opener.document.forms[0].<?php echo $genJsParName; ?>.value = country; <?php endif; ?>
<?php if (substr($generic,10,1) == "1") : ?> opener.document.forms[0].<?php echo $genJsParName; ?>.value = remark; <?php endif; ?>
<?php if (substr($generic,11,1) == "1") : ?> opener.document.forms[0].<?php echo $genJsParName; ?>.value = person; <?php endif; ?>
<?php if (substr($generic,12,1) == "1") : ?> opener.document.forms[0].<?php echo $genJsParName; ?>.value = cs_eid; <?php endif; ?>
<?php if (substr($generic,13,1) == "1") : ?> opener.document.forms[0].<?php echo $genJsParName; ?>.value = cmp_comp; <?php endif; ?>
<?php if (substr($generic,14,1) == "1") : ?> opener.document.forms[0].<?php echo $genJsParName; ?>.value = cmp_comp2; <?php endif; ?>
<?php if (substr($generic,15,1) == "1") : ?> opener.document.forms[0].<?php echo $genJsParName; ?>.value = cs_id_parent; <?php endif; ?>
<?php if (substr($generic,16,1) == "1") : ?> opener.document.forms[0].<?php echo $genJsParName; ?>.value = cs_discount; <?php endif; ?>
// Call opener function
<?php if ($callOpenerFunction != "") : ?> opener.<?php echo $callOpenerFunction; ?>; <?php endif; ?>
self.close();
};
<?php endif; ?>
<?php endif; ?>
function clearFields() {
document.forms[0].f_cmp_comp.value = '';
if (document.forms[0].f_cmp_comp2) {document.forms[0].f_cmp_comp2.value = ''};
if (document.forms[0].f_cmp_match) {document.forms[0].f_cmp_match.value = ''};
if (document.forms[0].f_cs_eid) {document.forms[0].f_cs_eid.value = ''};
if (document.forms[0].f_csc_name) {document.forms[0].f_csc_name.value = ''};
if (document.forms[0].f_street) {document.forms[0].f_street.value = ''};
if (document.forms[0].f_hsno) {document.forms[0].f_hsno.value = ''};
if (document.forms[0].f_zipcode) {document.forms[0].f_zipcode.value = ''};
if (document.forms[0].f_city) {document.forms[0].f_city.value = ''};
if (document.forms[0].f_remark) {document.forms[0].f_remark.value = ''};
if (document.forms[0].f_person) {document.forms[0].f_person.value = ''};
if (document.forms[0].f_phone) {document.forms[0].f_phone.value = ''};
};
function checkSearchParameters(field_from) {
if (field_from == 'cmp_comp') {
// Check for search value in cmp_name to be also searched in cmp_match
if (<?php echo $constSearchCscsclistCmpcompCmpmatch ?> == 1) {
document.forms[0].f_cmp_match.value = document.forms[0].f_cmp_comp.value;
}
if (<?php echo $constSearchCscsclistCmpcompCseid ?> == 1) {
document.forms[0].f_cs_eid.value = document.forms[0].f_cmp_comp.value;
}
if (<?php echo $constSearchCscsclistCmpcompCscadphone ?> == 1) {
document.forms[0].f_phone.value = document.forms[0].f_cmp_comp.value;
}
}
};
function submitPage(orderClause) {
document.forms[0].orderClause.value = orderClause;
document.forms[0].f_act.value='search';
document.forms[0].submit();
};
function openCustomerStatistics(csEid) {
var widthPopupWin = 900;
var heightPopupWin = 700;
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
var popupWin;
popupWin = window.open("../statistic/statistic.php?f_act=calculate&f_category=3&f_statistic=61&g_cs_eid="+csEid+"&noStatisticMenu=1&deactivateMenu=1&outputColumnMode=0&outputTitle=Monatsübersicht&specialAligns=l,l,l,l,r&day_from=01&month_from=01&year_from=<?php echo getDateTime('lastyear'); ?>&day_to=<?php echo getDateTime('day'); ?>&month_to=<?php echo getDateTime('month'); ?>&year_to=<?php echo getDateTime('year'); ?>","","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
};
function openCustomerReports(csEid) {
var widthPopupWin = 1200;
var heightPopupWin = 800;
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
var popupWin;
popupWin = window.open("../groupware/report.php?rpObjType=cs&g_cs_eid=" + csEid,"","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
};
function openCustomerSpecial(cmpId) {
var widthPopupWin = 1200;
var heightPopupWin = 800;
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
var popupWin;
popupWin = window.open("../admin/customer_special.php?companyId=" + cmpId ,"","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
};
-->
</script>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>displayStatusMessage();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="maincontent" name="maincontent" id="maincontent">
<form action="../admin/cs_csc_list.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="orderClause" value="<?php echo $orderClause ?>">
<input type="hidden" name="tourno" value="<?php echo $tourno ?>">
<input type="hidden" name="generic" value="<?php echo $generic ?>">
<input type="hidden" name="genNum" value="<?php echo $genNum ?>">
<input type="hidden" name="genJsParName" value="<?php echo $genJsParName ?>">
<input type="hidden" name="callOpenerFunction" value="<?php echo $callOpenerFunction ?>">
<input type="hidden" name="f_cmp_authenticated" value="<?php echo $f_cmp_authenticated ?>">
<input type="hidden" name="job_hq_id" value="<?php echo $job_hq_id ?>">
<?php echo $tableHeaderSearchFieldsExtra ?>
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<?php echo htmlDivLineSpacer("10px"); ?>
<div class="f10bp1_blue">
<?php echo $pageTitel ?>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<!-- Headquarters checkboxes -->
<?php
if (authCheckEmployeeRights($emp_id, "10")) :
$parMaskCscListHqDisabled = getParameterValue("0", "MASK_CSC_LIST_HQ_SELECTION_DISABLED", $hq_id);
if ($parMaskCscListHqDisabled == "") : $parMaskCscListHqDisabled = getParameterValue("0", "MASK_CSC_LIST_HQ_SELECTION_DISABLED", "0"); endif;
if ($parMaskCscListHqDisabled != "1") :
echo getHeadquartersCheckboxes($f_hq_id);
echo htmlDivLineSpacer("10px", "", "left");
endif;
endif;
?>
<?php echo htmlDivLineSpacer("10px"); ?>
<div>
<?php echo $pageHeaderOptionFields ?>
</div>
<?php echo htmlDivLineSpacer("15px"); ?>
<div>
<table border="0">
<tr>
<td>
<table border="0">
<tr>
<td>
<table class="f8np1" border="0" cellpadding="0">
<tr>
<?php echo $tableHeaderSearchFields ?>
</tr>
<tr>
<?php echo $tableHeaderLinks ?>
</tr>
<?php echo $tableOfRows ?>
</table>
<br><br>
<?php echo getLngt("Anzahl Einträge:") ?> <?php echo $numOfRows ?><?php if ($numOfRows == "0" && $f_act == "search" && $statusMessage == "") : echo " " . getLngt("(Keine Einträge gefunden.)"); endif; ?>
</td>
</tr>
</table>
</td>
</table>
<?php
// Nur wenn eine csc_id übergeben und wenn ansonsten keine Einträge gefunden
if ($csc_id != "" && $numOfRows == "0" && $f_act == "search" && $statusMessage == "") {
$sqlquery = "SELECT jb_tourname, tr_sort, tr_comp, tr_person, tour.csc_id, ad_street, tr_hsno, ad_country, ad_zipcode, ad_city, tr_remark" .
" FROM job, tour, address WHERE (csc_id_payer = " . $csc_id . " AND csc_id_payer_cash = '0') AND LENGTH(jb_tourname) > 0" .
" AND job.jb_id = tour.jb_id AND tour.ad_id = address.ad_id ORDER BY jb_tourname, tr_sort" ;
$res = $db2->query($sqlquery);
// if ($res->numRows() > 0) {
if ($db2->dbNumRows($res) > 0) {
echo htmlDivLineSpacer("10px");
echo htmlDivLineSpacer("10px");
echo "<div class=\"f10bp1_blue\">" . "Adressen aus gespeicherten Touren" . "</div>";
echo htmlDivLineSpacer("10px");
$bgCol = getListColor(0, 0);
echo "<table border=\"0\"><tr><td><table border=\"0\"><tr><td>";
echo "<table border=\"0\"><tr><td bgcolor=\"" . $bgCol . "\">&nbsp;Name&nbsp;</td><td bgcolor=\"" . $bgCol . "\">&nbsp;Station&nbsp;</td><td bgcolor=\"" . $bgCol .
"\">&nbsp;</td><td bgcolor=\"" . $bgCol .
"\">&nbsp;Firma&nbsp;</td><td bgcolor=\"" . $bgCol . "\">&nbsp;Person&nbsp;</td><td bgcolor=\"" . $bgCol . "\">&nbsp;Straße&nbsp;</td><td bgcolor=\"" . $bgCol .
"\">&nbsp;Nr.&nbsp;</td><td bgcolor=\"" . $bgCol . "\">&nbsp;PLZ&nbsp;</td><td bgcolor=\"" . $bgCol . "\">&nbsp;Ort&nbsp;</td><td bgcolor=\"" . $bgCol .
"\">&nbsp;Bemerkung&nbsp;</td></tr>";
}
if (DB::isError($res)) die ("$PHP_SELF: '$sqlquery': " . $res->getMessage());
$lineToggler = 0;
while ($row = $res->fetch_assoc()):
if ($lineToggler == 0) : $lineToggler = 1; else : $lineToggler = 0; endif;
$bgCol = getListColor($lineToggler, $lineToggler);
echo "<tr><td bgcolor=\"" . $bgCol . "\">&nbsp;" . $row["jb_tourname"] . "</td><td bgcolor=\"" . $bgCol . "\">&nbsp;" . $row["tr_sort"] . "</td><td bgcolor=\"" . $bgCol . "\">" .
"<a href=\"javascript:finishPage('','" . $row["csc_id"] . "','','" . my_str_check_js($row["tr_comp"]) . "','','" . my_str_check_js($row["ad_street"]) . "','" . $row["tr_hsno"] . "','" .
$row["ad_zipcode"] . "','" . my_str_check_js($row["ad_city"]) . "','" . my_str_check_js($row["ad_country"]) . "','" . my_str_check_js($row["tr_remark"]) . "','" .
my_str_check_js($row["tr_person"]) . "','" . $tourno . "','','','','','','','','','','','','','',1,0,0,'','',0);\">" .
"<img src=\"../images/arrow_right.png\" border=\"0\" height=\"10\" width=\"25\">" . "</a>" . "</td><td bgcolor=\"" . $bgCol .
"\">&nbsp;" . $row["tr_comp"] . "</td><td bgcolor=\"" . $bgCol . "\">&nbsp;" . $row["tr_person"] . "</td><td bgcolor=\"" . $bgCol .
"\">&nbsp;" . $row["ad_street"] . "</td><td bgcolor=\"" . $bgCol . "\">&nbsp;" . $row["tr_hsno"] . "</td><td bgcolor=\"" . $bgCol .
"\">&nbsp;" . $row["ad_zipcode"] . "</td><td bgcolor=\"" . $bgCol . "\">&nbsp;" . $row["ad_city"] . "</td><td bgcolor=\"" . $bgCol .
"\">&nbsp;" . $row["tr_remark"] . "</td></tr>";
endwhile;
// if ($res->numRows() > 0)
if ($db2->dbNumRows($res) > 0)
echo "</td></td></tr>";
echo "</tr></td></table></tr></td></table>";
$res->free();
}
?>
</div>
</form>
</div>
</body>
</html>

View File

@@ -0,0 +1,328 @@
<?php
/*=======================================================================
*
* customer_courier.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
// include_once ("../include/html.inc.php");
$httpVarsArray = array("f_act", "customerId", "orderClause", "statusMessage",
"f_relationStatus", "f_del_courier_id", "g_cr_id", "f_cscr_description_new", "deactivateMenu");
getSecHttpVars("1", $httpVarsArray);
getLanguage(__FILE__);
$deactivateMenuStatic = "1";
$pageTitel = getLngt("BEZIEHUNG KUNDE-TRANSPORTEUR");
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
getCurrentScript(__FILE__);
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
authCheckEmployeeRights($emp_id, "1", "1");
// Initializations
mcIsSet($f_relationStatus, "0");
mcIsSet($f_actText);
mcTrim($f_cscr_description_new); // Description related to an association between customer and courier
// Only for output
$htmlClass01 = "class=\"smaller\""; // input,select
$html_td_01 = "valign=\"top\" align=\"left\""; // input
$html_td_02 = "valign=\"top\" align=\"right\""; // input
// **************************************
// * Operations for the couriercustomer *
// **************************************
// Insert new couriercustomer
if ($f_act == "newCustomerCourier" && $customerId != "" && $g_cr_id != "" && $g_cr_id != "0") :
if (!existsEntry("customercourier",array("cs_id",$customerId,"cr_id",$g_cr_id))) :
TA("B");
// Get max sort value of favoured couriers and increment
$maxSortValue = 0;
if ($f_relationStatus == "1") :
$maxSortValue = getMaxOfField("customercourier", "cscr_sort", "cs_id = '" . $customerId . "' AND cscr_relation = '1' ");
if ($maxSortValue != "" && is_numeric($maxSortValue)) :
$maxSortValue++;
else :
$maxSortValue = 1;
endif;
endif;
// Insert customercourier
insertStmt("customercourier", array("cs_id",$customerId,"cr_id",$g_cr_id,"cscr_relation",$f_relationStatus,"cscr_sort",$maxSortValue,"cscr_description",$f_cscr_description_new));
writeToLogDB("181",$hq_id,"0",$usr_id,$g_cr_id,"",$customerId,"CR_ID=" . $g_cr_id . "|CS_ID=" . $customerId . "|CSCR_RELATION=" . $f_relationStatus,"0","0",$emp_id);
TA("C");
TA("E");
else :
$statusMessage = getLngt("Es existiert schon eine Beziehung zwischen dem Kurier und diesem Kunden!");
endif;
endif;
// Remove couriercustomer
if ($f_act == "removeCustomerCourier" && $customerId != "") :
TA("B");
// Entries to be deleted?
$fieldsLength = count($f_del_courier_id);
if ($fieldsLength > 0 && $f_del_courier_id[0] != "") :
// Remove all associations
for ($i = 0; $i < $fieldsLength; $i++) :
deleteStmt("customercourier","cs_id = " . $customerId . " AND cr_id = " . $f_del_courier_id[$i]);
writeToLogDB("182",$hq_id,"0",$usr_id,$f_del_courier_id[$i],"",$customerId,"CR_ID=" . $f_del_courier_id[$i] . "|CS_ID=" . $customerId,"0","0",$emp_id);
endfor;
// Resort the sort value of the favoured couriers of the customer
$sqlquery = "SELECT cs_id, cr_id FROM customercourier WHERE cs_id = " . $customerId . " AND cscr_relation = '1' ORDER BY cscr_sort";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
$sortCounter = 1;
while ($row = $result->fetch_assoc()):
$csId = $row["cs_id"];
$crId = $row["cr_id"];
updateStmt("customercourier", "cs_id", $csId, array("cscr_sort", $sortCounter),"cr_id = '" . $crId . "' AND cscr_relation = '1'");
$sortCounter++;
endwhile;
$result->free();
else :
$statusMessage = getLngt("Bitte markieren Sie zu löschende Beziehungen durch anklicken der jeweiligen Checkbox hinter dem Eintrag!");
endif;
TA("C");
TA("E");
endif;
// ****************************************************************************
// * Get the courier-customer relations of a specified customer for selection *
// ****************************************************************************
$count = 0;
if ($customerId != "") :
$sqlquery = "SELECT usr.usr_firstname, usr.usr_name, usr.usr_phone, usr.usr_email, cr.cr_id, cr.cr_eid, cr.cr_sid, cscr.cscr_relation, cscr.cscr_description"
. " FROM customercourier AS cscr, courier AS cr, customer AS cs, "
. " user AS usr"
. " WHERE cscr.cs_id = $customerId AND"
. " cr.cr_id = cscr.cr_id AND"
. " cr.hq_id = $hq_id AND"
. " cs.cs_id = cscr.cs_id AND"
. " cs.hq_id = $hq_id AND"
. " usr.usr_id = cr.usr_id"
. " ORDER BY cr.cr_sid";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
while ($row = $result->fetch_assoc()):
$f_usr_firstname[$count] = $row["usr_firstname"];
$f_usr_name[$count] = $row["usr_name"];
$f_usr_phone[$count] = $row["usr_phone"];
$f_usr_email[$count] = $row["usr_email"];
$f_cr_id[$count] = $row["cr_id"];
$f_cr_eid[$count] = $row["cr_eid"];
$f_cr_sid[$count] = $row["cr_sid"];
$f_cscr_relation[$count] = $row["cscr_relation"];
$f_cscr_description[$count] = $row["cscr_description"];
$count++;
endwhile;
$result->free();
endif;
// Only for output
$tmp_cmp_id = getFieldValueFromId("customer", "cs_id", "$customerId", "cmp_id");
$tmpFields = getFieldsValueFromId("company","cmp_id",$tmp_cmp_id,array("cmp_comp","cmp_comp2"));
$pageHeadline = getLngt("Transporteursbeziehungen von:") . " " . $tmpFields[0] . " " . $tmpFields[1];
// Output of the existing relations of the current selected area
$courierOutput = "";
for ($j = 0; $j < $count; $j++) :
$courierOutput .= $f_usr_firstname[$j] . " " . $f_usr_name[$j] . "<br>";
$courierOutput .= getLngt("EID:") . " " . $f_cr_eid[$j] . " / " . getLngt("Akt. SID:") . " " . $f_cr_sid[$j] . "&nbsp;&nbsp;";
$imgName = "circle_red.jpg";
if ($f_cscr_relation[$j] == "1") : $imgName = "circle_green.jpg"; endif;
$courierOutput .= "<img src=\"../images/" . $imgName . "\" border=\"0\" height=\"10\" width=\"25\">&nbsp;&nbsp;";
$courierOutput .= "<input type=\"checkbox\" name=\"f_del_courier_id[]\" value=\"" . $f_cr_id[$j] . "\"><br>";
$courierOutput .= $f_cscr_description[$j];
$courierOutput .= "<br><br>\n";
endfor;
// Button to remove associations between courier and customer(s). Only show if at least one customer is associated to the current area.
if ($count > 0) :
$courierOutput .= "<br>\n";
$courierOutput .= defineButtonType10(getLngt("Markierte&nbsp;Verknüpfungen&nbsp;entfernen"), "action_remove", "finishPage('removeCustomerCourier');", "240");
$courierOutput .= "<br><br>\n";
endif;
if ($courierOutput == "") :
$courierOutput = getLngt("Zur Zeit sind keine Beziehungen eingetragen!");
endif;
?>
<html>
<head>
<title><?php echo $pageTitel ?></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 src="../include/searchLists.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
// NAVIGATION
<?php echo $jsMenuOut; ?>
function finishPage(mode) {
var ok = true;
if (mode == 'newCustomerCourier') {
if (document.forms[0].g_cr_id.value != '') {
document.forms[0].f_act.value = mode;
document.forms[0].submit();
} else {
alert('<?php echo getLngt("Wählen Sie bitte einen Transporteur aus!") ?>');
}
}
if (mode == 'removeCustomerCourier') {
if (confirm('<?php echo getLngt("Möchten Sie die bestehende(n) Beziehung(en) wirklich löschen?") ?>')) {
document.forms[0].f_act.value = mode;
document.forms[0].submit();
}
}
};
function searchCsCsc() {
var f_act = 'search';
var widthPopupWin = 950;
var heightPopupWin = 600;
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
var popupWin;
popupWin = window.open("../admin/cs_csc_list.php?f_act=" + f_act + "&generic=100111111000",
"","dependent=yes,width=" + widthPopupWin + ",height=" +
heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin +
",scrollbars=yes");
};
-->
</script>
</head>
<body class="menu_bgcol" onLoad="<?php echo $phpCurrentNavigationOnLoad ?>displayStatusMessage();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="mc_page-header">
<?php echo $pageHeadline ?>
</div>
<div class="maincontent mc_elem" name="maincontent" id="maincontent">
<form action="../admin/customer_courier.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="customerId" value="<?php echo ec($customerId) ?>">
<input type="hidden" name="g_cr_id" value="">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<?php echo htmlDivLineSpacer("10px"); ?>
<div class="f10bp1">
Transporteure:
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<div class="f10bp1">
<?php echo $courierOutput; ?>
</div>
<?php echo htmlDivLineSpacer("15px"); ?>
<?php echo defineButtonType10(getLngt("Transporteur&nbsp;suchen"), "action_search", "searchCourier('2');", "140"); ?>
<?php echo htmlDivLineSpacer("15px"); ?>
<div>
<div <?php echo setStyleHtmlDiv("250px","left"); ?>><?php echo getLngt("Name:") ?></div>
<div><input type="text" name="g_usr_firstname" value="" size="20" disabled ></div>
</div>
<div>
<div <?php echo setStyleHtmlDiv("250px","left"); ?>><?php echo getLngt("Vorname:") ?></div>
<div><input type="text" name="g_usr_name" value="" size="20" disabled ></div>
</div>
<div>
<div <?php echo setStyleHtmlDiv("250px","left"); ?>><?php echo getLngt("EID:") ?></div>
<div><input type="text" name="g_cr_eid" value="" size="10" disabled ></div>
</div>
<div>
<div <?php echo setStyleHtmlDiv("250px","left"); ?>><?php echo getLngt("SID:") ?></div>
<div><input type="text" name="g_cr_sid" value="" size="10" disabled ></div>
</div>
<div>
<div <?php echo setStyleHtmlDiv("250px","left"); ?>><?php echo getLngt("Telefon:") ?></div>
<div><input type="text" name="g_usr_phone" value="" size="20" disabled ></div>
</div>
<div>
<div <?php echo setStyleHtmlDiv("250px","left"); ?>><?php echo getLngt("E-Mail:") ?></div>
<div><input type="text" name="g_usr_email" value="" size="20" disabled ></div>
</div>
<div>
<div <?php echo setStyleHtmlDiv("250px","left"); ?>><?php echo getLngt("Beschreibung:") ?></div>
<div><input type="text" name="f_cscr_description_new" value="" size="50" maxlength="255"></div>
</div>
<?php echo htmlDivLineSpacer("15px"); ?>
<div>
<div>
<input type="radio" <?php echo $htmlClass01 ?> name="f_relationStatus" value="0" checked> <?php echo getLngt("Sperren") ?><br>
<input type="radio" <?php echo $htmlClass01 ?> name="f_relationStatus" value="1"> <?php echo getLngt("Besonders erwünscht") ?><br>
<br>
</div>
<?php echo defineButtonType10(getLngt("Transporteur&nbsp;dem&nbsp;Kunden&nbsp;zuordnen"), "action_assoc", "document.forms[0].f_act.value='" . ec($f_actText) . "';finishPage('newCustomerCourier');", "240"); ?>
<?php echo htmlDivLineSpacer("50px"); ?>
<?php echo defineButtonType10(getLngt("Schließen"), "action_close", "window.close();", "80", "left", "3"); ?>
</div>
</form>
</div>
</body>
</html>

1249
html/admin/customer_list.php Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,301 @@
<?php
/*=======================================================================
*
* customer_service_acceptance_protocol.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act", "customerId", "cscIdRoot", "cscIdActual",
"f_service", "objId", "objType", "f_question_new", "f_mail_new", "f_text", "deactivateMenu"));
// Get number of all services
$metatypeInstallationPhrase = " AND mt_sort != '1' ";
$numOfAllServices = getCountOfTable("metatype", "mt_type = 'service' AND mt_objtype = '' AND mt_objid = '0'" . $metatypeInstallationPhrase); // Number of ALL services
// Check HTTP-Parameters for the questions
$f_question_array = array();
$f_mail_array = array();
for ($i = 0; $i <= 20; $i++) :
// Question
list($tmpQuestion) = getSecHttpVars("1",array("f_question_" . pad($i,2)));
if ($tmpQuestion != "") :
$f_question_array[$i] = $tmpQuestion;
list($tmpMail) = getSecHttpVars("1",array("f_mail_" . pad($i,2)));
$f_mail_array[$i] = $tmpMail;
endif;
endfor;
if ($f_question_new != "") :
array_push($f_question_array, $f_question_new);
endif;
if ($f_mail_new != "") :
array_push($f_mail_array, $f_mail_new);
endif;
getLanguage(__FILE__);
$deactivateMenuStatic = "1";
$pageTitel = getLngt("ABNAHMEPROTOKOLL - Fragen und Text");
include_once ("../admin/menu.php");
include_once ("../include/html.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);
// Get global definitions of the services
$output = getLngt("Services") . ":&nbsp;";
$output .= "<select class=\"f8np1\" name=\"f_service\" id=\"f_service\" onChange=\"serviceFinishPage('');\">";
$output .= " <option value=\"\" " . ($f_service == "" ? "selected" : "") . ">" . getLngt("Keine Auswahl") . "</option>";
$output .= addOptionsFromTable("metatype", "mt_sort", "mt_value", "mt_sort", "mt_type = 'service' AND mt_objtype = '' AND mt_objid = '0'" . $metatypeInstallationPhrase, $f_service , "");
$output .= "</select>";
// Display questions of the service acceptance protocol
$outputQuestions = "";
$outputText = "";
if ($f_service != "" && $objType != "" && $objId != "") :
// Set special database fieldname regarding the generic data container structure
$specialDbFieldNameQuestions = "service_acceptance_protocol_questions";
$specialDbFieldNameMailState = "service_acceptance_protocol_mail_state_question";
$specialDbFieldNameText = "service_acceptance_protocol_text";
// Save questions
if ($f_act == "saveCustomerServicesAcceptanceProtocol") :
// **** Questions ****
// Load current questions of the customer
$gdcContentQuestions = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = '" . $objType . "' AND gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = '" . $specialDbFieldNameQuestions . "'");
$currArray = getKeyValueArrayFromString($gdcContentQuestions); // Convert key-value-string to array
$currArray[$f_service] = implode(",", $f_question_array); // Implode new questions of the selected service and store to current structure
// Get new string of ALL services to store into the database
$newContentArray = array();
for ($i = 0; $i < $numOfAllServices; $i++) :
if ($currArray[$i] != "") :
$newContentArray[] = $i . "=" . $currArray[$i];
endif;
endfor;
$gdcContentQuestions = implode("|", $newContentArray);
// Update or insert questions
if (existsEntry("genericdatacontainer",array("gdc_obj_type",$objType,"gdc_obj_id",$objId,"gdc_gen_fieldname",$specialDbFieldNameQuestions))) :
updateStmt("genericdatacontainer","gdc_obj_type",$objType,array("gdc_content", $gdcContentQuestions),"gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = '" . $specialDbFieldNameQuestions . "'");
else :
insertStmt("genericdatacontainer", array("gdc_obj_type", $objType, "gdc_obj_id", $objId, "gdc_gen_fieldname", $specialDbFieldNameQuestions, "gdc_content", $gdcContentQuestions));
endif;
// **** Mail state for questions ****
// Load current mail states of the customer
$gdcContentMails = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = '" . $objType . "' AND gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = '" . $specialDbFieldNameMailState . "'");
$currArray = getKeyValueArrayFromString($gdcContentMails); // Convert key-value-string to array
$currArray[$f_service] = implode(",", $f_mail_array); // Implode new questions of the selected service and store to current structure
// Get new string of ALL services to store into the database
$newContentArray = array();
for ($i = 0; $i < $numOfAllServices; $i++) :
if ($currArray[$i] != "") :
$newContentArray[] = $i . "=" . $currArray[$i];
endif;
endfor;
$gdcContentQuestions = implode("|", $newContentArray);
// Update or insert questions
if (existsEntry("genericdatacontainer",array("gdc_obj_type",$objType,"gdc_obj_id",$objId,"gdc_gen_fieldname",$specialDbFieldNameMailState))) :
updateStmt("genericdatacontainer","gdc_obj_type",$objType,array("gdc_content", $gdcContentQuestions),"gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = '" . $specialDbFieldNameMailState . "'");
else :
insertStmt("genericdatacontainer", array("gdc_obj_type", $objType, "gdc_obj_id", $objId, "gdc_gen_fieldname", $specialDbFieldNameMailState, "gdc_content", $gdcContentQuestions));
endif;
// **** Text ****
$gdcContentTexts = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = '" . $objType . "' AND gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = '" . $specialDbFieldNameText . "'");
$currArray = getKeyValueArrayFromString($gdcContentTexts); // Convert key-value-string to array
$currArray[$f_service] = $f_text; // Implode new text of the selected service and store to current structure
// Get new string of ALL services to store into the database
$newContentArray = array();
for ($i = 0; $i < $numOfAllServices; $i++) :
if ($currArray[$i] != "") :
$newContentArray[] = $i . "=" . $currArray[$i];
endif;
endfor;
$gdcContentTexts = implode("|", $newContentArray);
// Update or insert text
if (existsEntry("genericdatacontainer",array("gdc_obj_type",$objType,"gdc_obj_id",$objId,"gdc_gen_fieldname",$specialDbFieldNameText))) :
updateStmt("genericdatacontainer","gdc_obj_type",$objType,array("gdc_content", $gdcContentTexts),"gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = '" . $specialDbFieldNameText . "'");
else :
insertStmt("genericdatacontainer", array("gdc_obj_type", $objType, "gdc_obj_id", $objId, "gdc_gen_fieldname", $specialDbFieldNameText, "gdc_content", $gdcContentTexts));
endif;
endif;
// **** Prepare output questions ****
// (Re-)Load current questions and mail states of the customer
$gdcContentQuestions = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = '" . $objType . "' AND gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = '" . $specialDbFieldNameQuestions . "'");
$gdcContentMails = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = '" . $objType . "' AND gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = '" . $specialDbFieldNameMailState . "'");
$i = ""; // Init
$outputQuestions .= "<table>\n";
if ($gdcContentQuestions != "") :
// Split content to get the questions of the current selected service
// E.g.: "0=Q1,Q2,Q3|1=Q1,Q2,Q3,Q4,Q5|2=Q1..." => x(0) = Q1,Q2,Q3, x(1) = Q1,Q2,Q3,Q4,Q5, ...
// [=> 0=Q1,Q2,Q3 => Service "0" (= Lieferung) is mapped to the questions]
$f_question_array = getKeyValueArrayFromString($gdcContentQuestions);
$f_question_string = $f_question_array[$f_service]; // Take the questions (array) of the current service
$f_mail_array = getKeyValueArrayFromString($gdcContentMails);
$f_mail_string = $f_mail_array[$f_service]; // Take the mail states (array) of the questions of the current service
if ($f_question_string != "") :
$f_question_array = spliti(",", $f_question_string);
$f_question_array_len = count($f_question_array);
$f_mail_array = spliti(",", $f_mail_string);
$f_f_mail_array_len = count($f_mail_array);
if ($f_question_array_len > 0) :
for ($i = 0; $i < $f_question_array_len; $i++) :
$outputQuestions .= "<tr>\n";
$outputQuestions .= "<td>" . ($i + 1) . ".&nbsp;</td>";
$outputQuestions .= "<td>";
$outputQuestions .= "<input class=\"f10np1\" type=\"text\" name=\"f_question_" . pad($i,2) . "\" value=\"" . $f_question_array[$i] . "\" size=\"100\">";
$outputQuestions .= "</td>";
$outputQuestions .= "<td>";
$outputQuestions .= "<select class=\"f8np1\" name=\"f_mail_" . pad($i,2) . "\">";
$outputQuestions .= " <option value=\"\" " . ($f_mail_array[$i] == "" ? "selected" : "") . ">" . getLngt("Keine Mail") . "</option>";
$outputQuestions .= " <option value=\"1\" " . ($f_mail_array[$i] == "1" ? "selected" : "") . ">" . getLngt("Mail bei JA") . "</option>";
$outputQuestions .= " <option value=\"2\" " . ($f_mail_array[$i] == "2" ? "selected" : "") . ">" . getLngt("Mail bei NEIN") . "</option>";
$outputQuestions .= "</select>";
$outputQuestions .= "</td>";
$outputQuestions .= "</tr>\n";
endfor;
endif;
endif;
endif;
if ($i == "") : $i = 1; else : $i++; endif;
$outputQuestions .= "<tr>\n";
$outputQuestions .= "<td>" . $i . ".&nbsp;</td>\n";
$outputQuestions .= "<td>\n";
$outputQuestions .= "<input class=\"f10np1\" type=\"text\" name=\"f_question_new\" value=\"\" size=\"100\">";
$outputQuestions .= "</td>\n";
$outputQuestions .= "<td>";
$outputQuestions .= "<select class=\"f8np1\" name=\"f_mail_new\">";
$outputQuestions .= " <option value=\"\" selected>" . getLngt("Keine Mail") . "</option>";
$outputQuestions .= " <option value=\"1\">" . getLngt("Mail bei JA") . "</option>";
$outputQuestions .= " <option value=\"2\">" . getLngt("Mail bei NEIN") . "</option>";
$outputQuestions .= "</select>";
$outputQuestions .= "</tr>\n";
$outputQuestions .= "</table>\n";
// **** Prepare output text ****
// (Re-)Load current text of the customer
$gdcContentText = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = '" . $objType . "' AND gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = '" . $specialDbFieldNameText . "'");
$f_text_array = getKeyValueArrayFromString($gdcContentText);
$f_text = $f_text_array[$f_service]; // Take the text of the current service
$outputText .= "<table>";
$outputText .= " <tr>";
$outputText .= " <td>";
$outputText .= " <textarea name=\"f_text\" cols=\"100\" rows=\"10\">" . $f_text . "</textarea>";
$outputText .= " </td>";
$outputText .= " </tr>";
$outputText .= "</table>";
endif;
// Only for output
if ($objId != "" && ($objType == "cs" || $objType == "cr")) :
$cmpId = getFieldValueFromId("customer", "cs_id", $objId, "cmp_id");
$tmpFields = getFieldsValueFromId("company","cmp_id",$cmpId,array("cmp_comp","cmp_comp2"));
$title = $tmpFields[0] . " " . $tmpFields[1];
endif;
?>
<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 type="text/javascript">
<!--
// NAVIGATION
<?php echo $jsMenuOut; ?>
function serviceFinishPage(f_act) {
document.forms[0].f_act.value = f_act;
document.forms[0].submit();
};
-->
</script>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>displayStatusMessage();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="maincontent" name="maincontent" id="maincontent">
<form action="customer_service_acceptance_protocol.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="customerId" value="<?php echo $customerId ?>">
<input type="hidden" name="cscIdRoot" value="<?php echo $cscIdRoot ?>">
<input type="hidden" name="cscIdActual" value="<?php echo $cscIdActual ?>">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<input type="hidden" name="objType" value="<?php echo $objType ?>">
<input type="hidden" name="objId" value="<?php echo $objId ?>">
<?php echo htmlDivLineSpacer("20px"); ?>
<?php if ($title != "") : ?>
<div class="f12bp1_blue">
<?php echo $title ?>
</div>
<?php echo htmlDivLineSpacer("30px"); ?>
<?php endif; ?>
<div>
<div class="f12bp1_blue"><?php echo $pageTitel ?></div>
</div>
<?php echo htmlDivLineSpacer("20px"); ?>
<div>
<div class="f10np1"><?php echo $output ?></div>
</div>
<?php echo htmlDivLineSpacer("20px"); ?>
<div>
<div class="f10np1"><?php echo $outputQuestions ?></div>
</div>
<?php echo htmlDivLineSpacer("30px"); ?>
<?php if ($f_service != "") : ?>
<div>
<div class="f10np1"><?php echo $outputText ?></div>
</div>
<?php echo htmlDivLineSpacer("30px"); ?>
<?php endif; ?>
<?php if ($f_service != "") : ?>
<div>
<?php echo defineButtonType10(getLngt("Speichern"), "action_save", "serviceFinishPage('saveCustomerServicesAcceptanceProtocol');", "150", "left", "3"); ?>
<?php echo defineButtonType10(getLngt("Schließen"), "action_close", "window.close();", "150", "left", "3"); ?>
</div>
<?php echo htmlDivLineSpacer("5px", "", "left"); ?>
<?php endif; ?>
</form>
</div>
</body>
</html>

View File

@@ -0,0 +1,336 @@
<?php
/*=======================================================================
*
* customer_service_delivery_reasons.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
include_once ("../include/html.inc.php");
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act", "customerId", "cscIdRoot", "cscIdActual",
"f_service", "objId", "objType", "f_code_new", "f_reason_new", "f_mail_new", "f_text", "deactivateMenu"));
// Set number of delivery reasons lists
$numOfLists = 4; // Insert parameter to expand....
$numOfReasonsPerList = 20; // Insert parameter to expand....
if ($f_service == "") : $f_service = "0"; endif;
// Check HTTP-Parameters for the reasons
$f_reason_array = array();
$f_mail_array = array();
for ($i = 0; $i <= $numOfReasonsPerList; $i++) :
// Reason code and text
list($tmpCode) = getSecHttpVars("1",array("f_code_" . pad($i,2)));
list($tmpReason) = getSecHttpVars("1",array("f_reason_" . pad($i,2)));
if ($tmpReason != "") :
$f_reason_array[$i] = $tmpCode . "$" . $tmpReason;
endif;
/*
if ($tmpCode != "" && $tmpReason != "") :
list($tmpMail) = getSecHttpVars("1",array("f_mail_" . pad($i,2)));
$f_mail_array[$i] = $tmpMail;
endif;
*/
endfor;
if ($f_reason_new != "") :
array_push($f_reason_array, $f_code_new . "$" . $f_reason_new);
endif;
/*
if ($f_mail_new != "") :
array_push($f_mail_array, $f_mail_new);
endif;
*/
getLanguage(__FILE__);
$deactivateMenuStatic = "1";
$pageTitel = getLngt("ABLIEFERGRÜNDE AUF DEM ENDGERÄT");
include_once ("../admin/menu.php");
include_once ("../include/html.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);
// Get global definitions of the services
$output = getLngt("Listen") . ":&nbsp;";
$output .= "<select class=\"f8np1\" name=\"f_service\" id=\"f_service\" onChange=\"serviceFinishPage('');\">";
// $output .= " <option value=\"\" " . ($f_service == "" ? "selected" : "") . ">" . getLngt("Keine Auswahl") . "</option>";
for ($i = 0; $i < $numOfLists; $i++) :
$output .= " <option value=\"" . $i . "\" " . ($f_service == $i ? "selected" : "") . ">" . getLngt("Liste") . ": " . ($i + 1) . "</option>";
endfor;
$output .= "</select>";
// Display delivery reasons
$outputReasons = "";
$outputText = "";
if ($f_service != "" && $objType != "" && $objId != "") :
// Set special database fieldname regarding the generic data container structure
$specialDbFieldNameReasons = "service_delivery_reasons";
$specialDbFieldNameMailState = "service_delivery_reasons_mail_state";
$specialDbFieldNameText = "service_delivery_reasons_text";
// Save reasons
if ($f_act == "saveCustomerServicesDeliveryReasons") :
// **** Reasons ****
// Load current reasons of the customer
$gdcContentReasons = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = '" . $objType . "' AND gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = '" . $specialDbFieldNameReasons . "'");
$currArray = getKeyValueArrayFromString($gdcContentReasons); // Convert key-value-string to array
$currArray[$f_service] = implode("§", $f_reason_array); // Implode new reasons of the selected service and store to current structure
// Get new string of ALL services to store into the database
$newContentArray = array();
for ($i = 0; $i < $numOfLists; $i++) :
if ($currArray[$i] != "") :
$newContentArray[] = $i . "=" . $currArray[$i];
endif;
endfor;
$gdcContentReasons = implode("|", $newContentArray);
// Update or insert reasons
if (existsEntry("genericdatacontainer",array("gdc_obj_type",$objType,"gdc_obj_id",$objId,"gdc_gen_fieldname",$specialDbFieldNameReasons))) :
updateStmt("genericdatacontainer","gdc_obj_type",$objType,array("gdc_content", $gdcContentReasons),"gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = '" . $specialDbFieldNameReasons . "'");
else :
insertStmt("genericdatacontainer", array("gdc_obj_type", $objType, "gdc_obj_id", $objId, "gdc_gen_fieldname", $specialDbFieldNameReasons, "gdc_content", $gdcContentReasons));
endif;
// **** Mail state for reasons ****
/*
// Load current mail states of the customer
$gdcContentMails = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = '" . $objType . "' AND gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = '" . $specialDbFieldNameMailState . "'");
$currArray = getKeyValueArrayFromString($gdcContentMails); // Convert key-value-string to array
$currArray[$f_service] = implode("§", $f_mail_array); // Implode new reasons of the selected service and store to current structure
// Get new string of ALL services to store into the database
$newContentArray = array();
for ($i = 0; $i < $numOfLists; $i++) :
if ($currArray[$i] != "") :
$newContentArray[] = $i . "=" . $currArray[$i];
endif;
endfor;
$gdcContentReasons = implode("|", $newContentArray);
// Update or insert reasons
if (existsEntry("genericdatacontainer",array("gdc_obj_type",$objType,"gdc_obj_id",$objId,"gdc_gen_fieldname",$specialDbFieldNameMailState))) :
updateStmt("genericdatacontainer","gdc_obj_type",$objType,array("gdc_content", $gdcContentReasons),"gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = '" . $specialDbFieldNameMailState . "'");
else :
insertStmt("genericdatacontainer", array("gdc_obj_type", $objType, "gdc_obj_id", $objId, "gdc_gen_fieldname", $specialDbFieldNameMailState, "gdc_content", $gdcContentReasons));
endif;
*/
// **** Text ****
/*
$gdcContentTexts = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = '" . $objType . "' AND gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = '" . $specialDbFieldNameText . "'");
$currArray = getKeyValueArrayFromString($gdcContentTexts); // Convert key-value-string to array
$currArray[$f_service] = $f_text; // Implode new text of the selected service and store to current structure
// Get new string of ALL services to store into the database
$newContentArray = array();
for ($i = 0; $i < $numOfLists; $i++) :
if ($currArray[$i] != "") :
$newContentArray[] = $i . "=" . $currArray[$i];
endif;
endfor;
$gdcContentTexts = implode("|", $newContentArray);
// Update or insert text
if (existsEntry("genericdatacontainer",array("gdc_obj_type",$objType,"gdc_obj_id",$objId,"gdc_gen_fieldname",$specialDbFieldNameText))) :
updateStmt("genericdatacontainer","gdc_obj_type",$objType,array("gdc_content", $gdcContentTexts),"gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = '" . $specialDbFieldNameText . "'");
else :
insertStmt("genericdatacontainer", array("gdc_obj_type", $objType, "gdc_obj_id", $objId, "gdc_gen_fieldname", $specialDbFieldNameText, "gdc_content", $gdcContentTexts));
endif;
*/
endif;
// **** Prepare output reasons ****
// (Re-)Load current reasons and mail states of the customer
$gdcContentReasons = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = '" . $objType . "' AND gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = '" . $specialDbFieldNameReasons . "'");
$gdcContentMails = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = '" . $objType . "' AND gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = '" . $specialDbFieldNameMailState . "'");
$i = ""; // Init
$outputReasons .= "<table>\n";
$outputReasons .= "<tr>\n";
$outputReasons .= "<td>" . getLngt("Lfd.") . "&nbsp;</td>";
$outputReasons .= "<td>" . getLngt("Code") . "&nbsp;</td>";
$outputReasons .= "<td>" . getLngt("Text") . "&nbsp;</td>";
// $outputReasons .= "<td>" . getLngt("Mail-Status") . "</td>";
$outputReasons .= "</tr>\n";
if ($gdcContentReasons != "") :
// Split content to get the reasons of the current selected service
// E.g.: "1=R1§R2§R3|2=R1§R2§R3§R4§R5|3=R1..." => x(0) = R1§R2§R3, x(1) = R1,R2,R3,R4,R5, ...
// [=> 1=R1,R2,R3 => List "1" is mapped to the reasons]
$f_reason_array = getKeyValueArrayFromString($gdcContentReasons);
$f_reason_string = $f_reason_array[$f_service]; // Take the reasons (array) of the current service
// $f_mail_array = getKeyValueArrayFromString($gdcContentMails);
// $f_mail_string = $f_mail_array[$f_service]; // Take the mail states (array) of the reasons of the current service
if ($f_reason_string != "") :
$f_reason_array = explode("§", $f_reason_string);
$f_reason_array_len = count($f_reason_array);
// $f_mail_array = explode("§", $f_mail_string);
// $f_f_mail_array_len = count($f_mail_array);
if ($f_reason_array_len > 0) :
for ($i = 0; $i < $f_reason_array_len; $i++) :
$tmpVal = explode("$", $f_reason_array[$i]);
$reasonCode = $tmpVal[0];
$reasonText = $tmpVal[1];
$outputReasons .= "<tr>\n";
$outputReasons .= "<td>" . ($i + 1) . ".&nbsp;</td>";
$outputReasons .= "<td>";
$outputReasons .= "<input class=\"f10np1\" type=\"text\" name=\"f_code_" . pad($i,2) . "\" value=\"" . $reasonCode . "\" size=\"5\">";
$outputReasons .= "</td>";
$outputReasons .= "<td>";
$outputReasons .= "<input class=\"f10np1\" type=\"text\" name=\"f_reason_" . pad($i,2) . "\" value=\"" . $reasonText . "\" size=\"100\">";
$outputReasons .= "</td>";
/*
$outputReasons .= "<td>";
$outputReasons .= "<select class=\"f8np1\" name=\"f_mail_" . pad($i,2) . "\">";
$outputReasons .= " <option value=\"\" " . ($f_mail_array[$i] == "" ? "selected" : "") . ">" . getLngt("Keine Mail") . "</option>";
$outputReasons .= " <option value=\"1\" " . ($f_mail_array[$i] == "1" ? "selected" : "") . ">" . getLngt("Mail bei JA") . "</option>";
$outputReasons .= " <option value=\"2\" " . ($f_mail_array[$i] == "2" ? "selected" : "") . ">" . getLngt("Mail bei NEIN") . "</option>";
$outputReasons .= "</select>";
$outputReasons .= "</td>";
*/
$outputReasons .= "</tr>\n";
endfor;
endif;
endif;
endif;
if ($i == "") : $i = 1; else : $i++; endif;
$outputReasons .= "<tr>\n";
$outputReasons .= "<td>" . $i . ".&nbsp;</td>\n";
$outputReasons .= "<td>\n";
$outputReasons .= "<input class=\"f10np1\" type=\"text\" name=\"f_code_new\" value=\"\" size=\"5\">";
$outputReasons .= "</td>\n";
$outputReasons .= "<td>\n";
$outputReasons .= "<input class=\"f10np1\" type=\"text\" name=\"f_reason_new\" value=\"\" size=\"100\">";
$outputReasons .= "</td>\n";
/*
$outputReasons .= "<td>";
$outputReasons .= "<select class=\"f8np1\" name=\"f_mail_new\">";
$outputReasons .= " <option value=\"\" selected>" . getLngt("Keine Mail") . "</option>";
$outputReasons .= " <option value=\"1\">" . getLngt("Mail bei JA") . "</option>";
$outputReasons .= " <option value=\"2\">" . getLngt("Mail bei NEIN") . "</option>";
$outputReasons .= "</select>";
*/
$outputReasons .= "</tr>\n";
$outputReasons .= "</table>\n";
// **** Prepare output text ****
// (Re-)Load current text of the customer
$gdcContentText = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = '" . $objType . "' AND gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = '" . $specialDbFieldNameText . "'");
$f_text_array = getKeyValueArrayFromString($gdcContentText);
$f_text = $f_text_array[$f_service]; // Take the text of the current service
$outputText .= "<table>";
$outputText .= " <tr>";
$outputText .= " <td>";
$outputText .= " <textarea name=\"f_text\" cols=\"100\" rows=\"10\">" . $f_text . "</textarea>";
$outputText .= " </td>";
$outputText .= " </tr>";
$outputText .= "</table>";
endif;
// Only for output
if ($objId != "" && ($objType == "cs" || $objType == "cr")) :
$cmpId = getFieldValueFromId("customer", "cs_id", $objId, "cmp_id");
$tmpFields = getFieldsValueFromId("company","cmp_id",$cmpId,array("cmp_comp","cmp_comp2"));
$title = $tmpFields[0] . " " . $tmpFields[1];
endif;
?>
<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 type="text/javascript">
<!--
// NAVIGATION
<?php echo $jsMenuOut; ?>
function serviceFinishPage(f_act) {
document.forms[0].f_act.value = f_act;
document.forms[0].submit();
};
-->
</script>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>displayStatusMessage();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="maincontent" name="maincontent" id="maincontent">
<form action="customer_service_delivery_reasons.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="customerId" value="<?php echo $customerId ?>">
<input type="hidden" name="cscIdRoot" value="<?php echo $cscIdRoot ?>">
<input type="hidden" name="cscIdActual" value="<?php echo $cscIdActual ?>">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<input type="hidden" name="objType" value="<?php echo $objType ?>">
<input type="hidden" name="objId" value="<?php echo $objId ?>">
<?php echo htmlDivLineSpacer("20px"); ?>
<?php if ($title != "") : ?>
<div class="f12bp1_blue">
<?php echo $title ?>
</div>
<?php echo htmlDivLineSpacer("30px"); ?>
<?php endif; ?>
<div>
<div class="f12bp1_blue"><?php echo $pageTitel ?></div>
</div>
<?php echo htmlDivLineSpacer("20px"); ?>
<div>
<div class="f10np1"><?php echo $output ?></div>
</div>
<?php echo htmlDivLineSpacer("20px"); ?>
<div>
<div class="f10np1"><?php echo $outputReasons ?></div>
</div>
<?php echo htmlDivLineSpacer("30px"); ?>
<?php if (false && $f_service != "") : ?>
<div>
<div class="f10np1"><?php echo $outputText ?></div>
</div>
<?php echo htmlDivLineSpacer("30px"); ?>
<?php endif; ?>
<?php if ($f_service != "") : ?>
<div>
<?php echo defineButtonType10(getLngt("Speichern"), "action_save", "serviceFinishPage('saveCustomerServicesDeliveryReasons');", "150", "left", "3"); ?>
<?php echo defineButtonType10(getLngt("Schließen"), "action_close", "window.close();", "150", "left", "3"); ?>
</div>
<?php echo htmlDivLineSpacer("5px", "", "left"); ?>
<?php endif; ?>
</form>
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff

456
html/admin/dashb_cs.php Normal file
View File

@@ -0,0 +1,456 @@
<?php
/*=======================================================================
*
* dashb_cs.php
*
=======================================================================*/
include_once("../include/dbconnect.inc.php");
include_once("../include/mcglobal.inc.php");
include_once("../include/auth.inc.php");
include_once("../include/inc_user.inc.php");
include_once("../include/grid.inc.php");
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act", "objType", "objId", "xxxx"));
// Id of the actual employee and the costcenter (individual root-node) logged in
if ($cscIdRoot == ""): $cscIdRoot = getFieldValueFromId("employee","emp_id",$emp_id,"csc_id"); endif;
if ($customerId == ""): $customerId = getFieldValueFromId("costcenter","csc_id",$cscIdRoot,"cs_id"); endif;
if ($cscIdActual == ""): $cscIdActual = $cscIdRoot; endif;
getLanguage(__FILE__);
$pageTitel = getLngt("DASHBOARD");
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
getCurrentScript(__FILE__);
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
authCheckEmployeeRights($emp_id, "0", "1"); // Customer
authCheckEmployeeRights($emp_id, "11", "1"); // Sales
// Get2 the emp_id of the root admin, e.g. setting new passwords of employees
$empIdRootAdmin = getEmpIdOfRootAdmin("hq");
// Init
if ($objType == "") : $objType = "cs"; endif;
if ($objId == "") : $objId = ""; endif;
if ($objId != "" && is_numeric($objId)) :
$objId = getFieldValueFromId("customer","cmp_id",$objId,"cs_id");
endif;
$currentTime = getDateTime("0");
// DIRECT SEARCH
// border-style:solid; border-width:1px; border-color:#0080FF;
// background-image: url('../images/loupe.png'); background-repeat:no-repeat; background-position: 2px 2px; background-size: auto; padding-left: 40px;
$ctSearchCss = "
.ct_search {width:100%; padding:0px; margin:0px; border-spacing:0px; border-collapse:collapsed; background-color:#97bcFF;}
.ct_search_hl {padding:0px; margin:0px; background-color:#4e45ec; color:white;}
.ct_search_hl_td {padding:5px; margin:0px; font-size:10pt; font-family:Helvetica,Arial; font-style:normal; font-weight:normal;}
.ct_search_bd {padding:0px; margin:0px; background-color:#97bcFF; color:white; vertical-align:top;}
.ct_search_bd_td {height:1px; padding:5px; margin:0px;}
input[type=text] {width:200px; height:25px; background-image: url('../images/loupe.png'); background-repeat:no-repeat; background-position: 4px 4px; background-size: 12px 12px; padding-left: 25px;}
.buttonIcon {width:25px; height:25px; vertical-align:top;}
";
$ctSearchHtml = "
<table class=\"ct_search\" id=\"ct_search\">
<tr class=\"ct_search_hl\" id=\"ct_search_hl\">
<td class=\"ct_search_hl_td\" colspan=\"4\"><input type=\"text\" id=\"metaSearch\" name=\"metaSearch\" value=\"\">&nbsp;&nbsp;&nbsp;<button type=\"button\" class=\"buttonIcon\" onClick=\"metasearchStart('cs');\">&nbsp;</button></td>
</tr>
<tr class=\"ct_search_bd\" id=\"ct_search_bd\">
<td class=\"ct_search_bd_td\" id=\"metaSearchResult_01\"></td>
<td class=\"ct_search_bd_td\" id=\"metaSearchResult_02\"></td>
<td class=\"ct_search_bd_td\" id=\"metaSearchResult_03\"></td>
<td class=\"ct_search_bd_td\" id=\"metaSearchResult_04\"></td>
</tr>
</table>
";
// GRID
$gridParArr = array();
// border-style:solid; border-width:1px; border-color:#0080FF;
$gridParArr["output_css"] = "
.grid_ct {float:left; padding:0px; margin:0px; min-width:250px;
font-size:10pt; font-family:Helvetica,Arial; font-style:normal; font-weight:normal;}
.grid_ct_hl {min-height:22px; padding:5px; background-color:#4e45ec; color:white;}
.grid_ct_bd {min-height:250px; padding:5px; background-color:#97bcFF; color:white;}
";
// $gridParArr = array();
$grid = new Grid("400px", array(2,5), $gridParArr);
$gridJsOut = "";
$grid->resetContainerPageCounter();
// Include ouput function
include_once("../include/getDashboardData.php");
/*
$passphrase = getPwd("34a78d91s83g");
echo "passphrase = " . $passphrase . "</br>";
// STB909307 bito :: Storno MIT Kosten => In Statistik mitgezählt?
// STB970299 STB :: Hat (Test-)Berichte 2017
*/
// Wrapper for function "getDashData()"
function gdd ($tag, $headline, $structureType = "", $brArr = array(), $linkArr = array(), $styleArr = array(), $id = "", $type = "", $dateformat = "") {
global $objType, $objId;
$retVal = "";
if ($tag != "") :
if ($type == "") : $type = $objType; endif;
if ($id == "") : $id = $objId; endif;
if ($structureType == "") : $structureType = "table"; endif;
$retVal = getDashData($type, $tag, $id, $brArr, $styleArr, $dateformat, $structureType, $headline, $linkArr);
endif;
return $retVal;
}
if ($userTypeName == "hq") :
// Get data
$outCt = "";
// $outCt = "<div style=\"display:inline-block; width:100%;\">";
if ($objType != "" && $objId != "") :
// "FIRMENDATEN"
$outCt .= gdd("id", getLngt("DEBITOR"), "line", array(), array("cs", "cmp_id"));
$outCt .= gdd("company", getLngt("FIRMIERUNG"), "table", array(0,1), array("cs", "cmp_id"));
$outCt .= gdd("address", getLngt("ADRESSE"), "table", array(0), array("cs", "cmp_id"));
$outCt .= gdd(array("usr_email", "usr_phone", "usr_phone2", "usr_fax"), array(getLngt("MAIL"),getLngt("FON"), getLngt("MOB"), getLngt("FAX")), "line", array(), array("cs", "cmp_id"));
$outCt .= gdd("bank", getLngt("BANKVERBINDUNG"), "table", array(0,1,2,3,4), array("cs", "cmp_id"));
$gridMatrix = $grid->getNextContainerPageCounter();
// $gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("width", "300px"), "");
// $gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "#0080FF"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], getLngt("FIRMENDATEN"), "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("color", "black", "font-size", "10pt", "font-weight", "normal"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], strWrapJs($outCt), "bd");
/*
function gdd ($tag, $headline, $structureType = "", $brArr = array(), $styleArr = array(), $id = "", $type = "", $dateformat = "") {
....
$retVal = getDashData($type, $tag, $id, $brArr, $styleArr, $dateformat, $structureType, $headline);
*/
// "VORGÄNGE"
$outCt = "";
$outCt .= gdd("reports_num_since_last_login:" . date("z") . ",0," . $emp_id, getLngt("ANZAHL BERICHTE SEIT LETZTEM LOGIN"), "line");
$outCt .= gdd("reports_data_since_last_login:" . date("z") . ",0," . $emp_id, getLngt("BERICHTE SEIT LETZTEM LOGIN"), "table", array(1), array("rp", "rp_id"));
$outCt .= gdd("reports_num_since_last_login:" . date("z") . ",0", getLngt("ANZAHL BERICHTE") . " " . getDateTime("year"), "line");
$outCt .= gdd("reports_data_since_last_login:" . date("z") . ",0", getLngt("BERICHTE") . " " . getDateTime("year"), "table", array(1), array("rp", "rp_id"));
$outCt .= gdd("appointments_num_since_last_login:" . date("z") . ",0," . $emp_id, getLngt("ANZAHL TERMINE SEIT LETZTEM LOGIN"), "line");
$outCt .= gdd("appointments_data_since_last_login:" . date("z") . ",0," . $emp_id, getLngt("TERMINE SEIT LETZTEM LOGIN"), "table", array(0), array("ap", "ap_id"));
$gridMatrix = $grid->getNextContainerPageCounter();
// $gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("width", "300px"), "");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "#4e45ec"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], getLngt("VORGÄNGE"), "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("color", "black", "font-size", "10pt", "font-weight", "normal"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], strWrapJs($outCt), "bd");
// "STATISTIK"
$outCt = "";
$outCt .= gdd(array("stat_year_curr", "stat_year_last", "stat_year_1_before_last"), array(getDateTime("year"),getDateTime("lastyear"), date("Y",mktime(0, 0, 0, date("m"),date("d"),date("Y")-2))), "line", array());
$outCt .= gdd("user_since", getLngt("KUNDE SEIT"), "line");
$outCt .= gdd("last_order", getLngt("LETZTER AUFTRAG"), "line", array(), array("jb", "cs_last_job"));
$gridMatrix = $grid->getNextContainerPageCounter();
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "#4e45ec"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], getLngt("STATISTIK"), "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("color", "black", "font-size", "10pt", "font-weight", "normal"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], strWrapJs($outCt), "bd");
// gdd ($tag, $headline, $structureType = "", $brArr = array(), $styleArr = array(), $id = "", $type = "", $dateformat = "")
// "FAHRER"
$outCt = "";
$outCt .= gdd("cr_fav", getLngt("BEVORZUGTE FAHRER"), "table", array(1,3,5,7), array("cr", "cmp_id"));
$outCt .= gdd("cr_block", getLngt("GESPERRTE FAHRER"), "table", array(1,3,5,7), array("cr", "cmp_id"));
$gridMatrix = $grid->getNextContainerPageCounter();
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "#4e45ec"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], getLngt("FAHRER"), "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("color", "black", "font-size", "10pt", "font-weight", "normal"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], strWrapJs($outCt), "bd");
// "KOSTENSTELLENADRESSEN"
/*
$outCt = "";
$outCt .= gdd("costcenteraddresses", getLngt("KOSTENSTELLEN"), "table", array(1,2,4), array("csc", "csc_id"));
// $outCt .= getDashData($objType, "usr.usr_account", $objId);
$gridMatrix = $grid->getNextContainerPageCounter();
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "#4e45ec"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], getLngt("KOSTENSTELLEN"), "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("color", "black", "font-size", "10pt", "font-weight", "normal"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], strWrapJs($outCt), "bd");
*/
// "KOSTENSTELLEN"
$outCt = "";
$outCt .= gdd("costcenters", getLngt("KOSTENSTELLEN"), "table", array(0), array("csc", "csc_id"));
$gridMatrix = $grid->getNextContainerPageCounter();
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "#4e45ec"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], getLngt("KOSTENSTELLEN"), "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("color", "black", "font-size", "10pt", "font-weight", "normal"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], strWrapJs($outCt), "bd");
// "CHART: ANZAHL AUFTRÄGE"
$outCt = base64_encode(gdd("stat_chart_jobs:2", "", "table", array(), array()));
$gridMatrix = $grid->getNextContainerPageCounter();
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "#4e45ec"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], getLngt("ANZAHL AUFTRÄGE"), "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("color", "black", "font-size", "10pt", "font-weight", "normal"), "bd");
$gridJsOut .= $grid->gridSetContent($gridMatrix[0], $gridMatrix[1], "atob(\"" . $outCt . "\")", "bd", "html", ""); // Usage of "gridSetContent" instead of "gridSetHtml" (!!!!)
// "CHART: UMSÄTZE"
$outCt = base64_encode(gdd("stat_chart_sales:2", "", "table", array(), array()));
$gridMatrix = $grid->getNextContainerPageCounter();
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "#4e45ec"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], getLngt("UMSÄTZE"), "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("color", "black", "font-size", "10pt", "font-weight", "normal"), "bd");
$gridJsOut .= $grid->gridSetContent($gridMatrix[0], $gridMatrix[1], "atob(\"" . $outCt . "\")", "bd", "html", ""); // Usage of "gridSetContent" instead of "gridSetHtml" (!!!!)
endif;
// $outCt = "</div>";
// Current container page counter
/*
$tmpArr = $grid->getCurrentContainerPageCounter("0", "1");
echo "getCurrentContainerPageCounter.grid: " . $tmpArr[0] . " " . $tmpArr[1] . "<br>";
$tmpVal = $grid->getCurrentContainerPageCounter("1", "1");
echo "getCurrentContainerPageCounter.counter: " . $tmpVal . "<br><br>";
// $grid->addGridContainer($tmpArr[0], $tmpArr[1]);
*/
endif;
// Hide remaining containers without content
$gridJsOut .= $grid->gridHideRemaining();
?>
<html>
<head>
<title><?php echo $pageTitel ?></title>
<script>
/*
window.onerror=fnErrorTrap;
function fnErrorTrap(sMsg,sUrl,sLine){
var tmp_jb_id = "";
if(typeof(jb_id)!='undefined')
tmp_jb_id = jb_id;
var out = '';
iframe = document.createElement("IFRAME");
iframe.setAttribute("src", "../include/ajaxJsError.php?url="+escape(sUrl) + "&line=" + escape(sLine) + "&message=" + escape(sMsg) + "&user_agent=" + escape(navigator.userAgent) + "&jb_id=" + tmp_jb_id + "&out=" + escape(out));
iframe.width = 1;
iframe.height = 1;
iframe.style.display = 'none';
setTimeout(function(){
document.body.appendChild(iframe);
},10);
return false;
}
*/
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="description" content="votian"> <meta name="keywords" content="votian">
<link rel="stylesheet" type="text/css" href="../css/phoenix.css">
<style type="text/css">
<?php include_once ("../css/navigation.css.php"); ?>
</style>
<style type="text/css">
<?php echo $ctSearchCss ?>
<?php echo $grid->getGridItemParameter("output_css") ?>
</style>
<?php include_once ("../include/js_framework.inc.php"); ?>
<link rel="stylesheet" type="text/css" href="../css/Chart.min.css">
<script src="../js/moment.js"></script>
<script src="../js/Chart.js"></script>
<style>
canvas{
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
}
.chartjs-tooltip {
opacity: 1;
position: absolute;
background: rgba(0, 0, 0, .7);
color: white;
border-radius: 3px;
-webkit-transition: all .1s ease;
transition: all .1s ease;
pointer-events: none;
-webkit-transform: translate(-50%, 0);
transform: translate(-50%, 0);
padding: 4px;
}
.chartjs-tooltip-key {
display: inline-block;
width: 10px;
height: 10px;
}
</style>
<script src="../include/checkFormTags.js" type="text/javascript"></script>
<script language="JavaScript">
<!--
function metasearchStart (objType = '') {
metasearch(objType);
<?php
if ($userTypeName == "hq") :
// echo "$('#metaSearch').focus();";
endif;
?>
}
function storeCsGlobalInfo (elem) {
var content = $('#' + elem).val();
ajaxRequestGet('../include/ajaxReqLib.php', 'mode=500&wrap_html=1&value_01=hq2cs&value_02=<?php echo ec($hq_id) ?>&value_03=' + elem + '&value_04=' + encodeURI(escape(content)) + '&value_05=');
}
function openPopup (url,title,config) {
var widthPopupWin = screen.width - 80;
var heightPopupWin = screen.height - 180;
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2);
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2);
var popup;
popup = window.open(url,title, "dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
}
function openLinkByObject (objType, objValue) {
// alert(objType + ' ' + objValue);
// redirectLocation('../admin/dashb.php?objType=' + objType + '&objId=' + objValue);
$('#objType').val(objType);
$('#objId').val(objValue);
document.forms[0].submit();
}
function openLinkByContentObject (objType, objValue) {
// alert(objType + ' ' + objValue);
if (objType == 'jb') {
openPopup('../admin/jb_detail.php?job_id=' + objValue,'','');
}
if (objType == 'cs') {
openPopup('../admin/customer_special.php?companyId=' + objValue,'','');
}
if (objType == 'csc') {
if (objValue != '') {
// Get cs_id from csc_id (objValue)
ajaxRequestGet('../include/ajaxReqLib.php', 'mode=0&db_table=costcenter&db_id_field=csc_id&search_value=' + objValue + '&db_return_field=cs_id');
if (retValue != '') {
csId = retValue; // cs_id
// Open costcenter page
if (csId != '') {
openPopup('../customer/costcenter.php?customerId=' + csId + '&cscIdActual=' + objValue,'','');
}
}
}
}
if (objType == 'cr') {
openPopup('../admin/courier_special.php?companyId=' + objValue,'','');
}
if (objType == 'crvh') {
openPopup('../admin/courier_vehicle.php?courierId=' + objValue,'','');
}
if (objType == 'rp') {
if (objValue != '') {
// Get rp_createtime from rp_id (objValue)
ajaxRequestGet('../include/ajaxReqLib.php', 'mode=0&db_table=phoenix_group.report_process&db_id_field=rp_id&search_value=' + objValue + '&db_return_field=rp_createtime');
if (retValue != '') {
rpCreatetime = retValue; // rp_createtime
// Get rp_objid (customer) from rp_id (objValue)
ajaxRequestGet('../include/ajaxReqLib.php', 'mode=0&db_table=phoenix_group.report_process&db_id_field=rp_id&search_value=' + objValue + '&db_return_field=rp_objid');
if (retValue != '') {
rpObjid = retValue; // cs_id
// Get cs_eid
ajaxRequestGet('../include/ajaxReqLib.php', 'mode=0&db_table=customer&db_id_field=cs_id&search_value=' + rpObjid + '&db_return_field=cs_eid');
if (retValue != '') {
csEid = retValue; // cs_eid
}
}
// Open report page
if (rpCreatetime != '' && rpObjid != "" && csEid != '') {
openPopup('../groupware/report.php?rpObjType=cs&g_cs_eid=' + csEid + '&day_from=' + rpCreatetime.substring(8,10) + '&month_from=' + rpCreatetime.substring(5,7) + '&year_from=' + rpCreatetime.substring(0,4) + '&day_to=' + rpCreatetime.substring(8,10) + '&month_to=' + rpCreatetime.substring(5,7) + '&year_to=' + rpCreatetime.substring(0,4),'','');
}
}
}
}
}
function execBodyOnLoad() {
<?php echo $gridJsOut ?>
// checkStartTickerOut();
<?php
if ($userTypeName == "hq") :
echo "$('#maincontent').css('margin-left','0px');";
echo "$('#metaSearch').focus();";
endif;
?>
}
$(document).keypress(function(e) {
if (e.keyCode === 13 && e.target.nodeName == 'INPUT') {
e.preventDefault(); //prevent default if it is INPUT
var focused = $(':focus');
if ($(focused).attr('id') == "metaSearch") {
metasearchStart('<?php echo $objType ?>');
};
}
});
// -->
</script>
<noscript>
<center>
<b><br>JavaScript ist nicht verf&uuml;gbar. Bitte aktivieren Sie JavaScript<br><br>
in Ihrem Browser, damit diese Seite ordnungsgem&auml;&szlig; funktioniert!</b><br><br>
</center>
</noscript>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>execBodyOnLoad();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="maincontent" name="maincontent" id="maincontent">
<form id="dashboard" name="dashboard" action="../admin/dashb_cs.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" id="objType" name="objType" value="<?php echo ec($objType) ?>">
<input type="hidden" id="objId" name="objId" value="<?php echo ec($objId) ?>">
<div>
<?php echo $ctSearchHtml ?>
<?php echo $grid->getGridItemParameter("output_html") ?>
</div>
</form>
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff

2102
html/admin/employee.php Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,202 @@
<?php
/*=======================================================================
*
* employee_csc_rights.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act", "customerId", "cscIdRoot", "cscIdActual", "statusMessage", "deactivateMenu",
"emp_id_act", "emp_csc_access", "tableSort", "deactivateMenu", "f_hq_id"));
// Id of the actual employee and the costcenter (individual root-node) logged in
if ($cscIdRoot == ""): $cscIdRoot = getFieldValueFromId("employee","emp_id",$emp_id,"csc_id"); endif;
if ($customerId == ""): $customerId = getFieldValueFromId("costcenter","csc_id",$cscIdRoot,"cs_id"); endif;
if ($cscIdActual == ""): $cscIdActual = $cscIdRoot; endif;
getLanguage(__FILE__);
$deactivateMenuStatic = "1";
$pageTitel = getLngt("MITARBEITERRECHTE");
include_once ("../admin/menu.php");
include_once ("../include/html.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);
// Get the right of the employee logged in and check the access
$empHasNoAccessToEmployees = TRUE;
if (($userTypeName == "hq") && authCheckEmployeeRights($emp_id, "1") && authCheckEmployeeRights($emp_id, "3")) :
$empHasNoAccessToEmployees = FALSE;
endif;
if (($userTypeName == "cs") && authCheckEmployeeRights($emp_id, "10") && authCheckEmployeeRights($emp_id, "12") && $emp_id_act != "" && is_numeric($emp_id_act) && $emp_id_act != $emp_id) :
$empHasNoAccessToEmployees = FALSE;
endif;
// 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 !!!!
$usrIdAct = getFieldValueFromId("employee", "emp_id", $emp_id_act, "usr_id");
$hqIdAct = getFieldValueFromId("user", "usr_id", $usrIdAct, "hq_id");
$empIdActMdId = getFieldValueFromId("mandatorheadquarters", "hq_id", $hqIdAct, "md_id");
if ($empHasNoAccessToEmployees) :
if ($md_id == "" || !is_numeric($md_id) || $md_id != $empIdActMdId) :
$empHasNoAccessToEmployees = FALSE;
endif;
endif;
if ($empHasNoAccessToEmployees) : gotoReferer("1"); endif;
// Get the emp_id of the root admin because he/she is allowed to change a password of an employee
$empIdRootAdmin = getEmpIdOfRootAdmin($userTypeName);
$usrNameAct = getFieldValueFromId("user", "usr_id", $usrIdAct, "usr_name");
$usrFirstNameAct = getFieldValueFromId("user", "usr_id", $usrIdAct, "usr_firstname");
$usrAccountAct = getFieldValueFromId("user", "usr_id", $usrIdAct, "usr_account");
// Set rights
if ($f_act == "setCscAccess") :
if ($emp_id_act != "") :
TA("B");
// Remove current rights of the employee
$res = deleteStmt("employeecostcenter","emp_id = '" . $emp_id_act . "'");
if ($db->affected_rows > 0) :
$rightsLogString .= "DELETED_RIGHTS=YES";
else :
$rightsLogString .= "DELETED_RIGHTS=NO";
endif;
// Insert new rigths
if (is_array($emp_csc_access)) :
$emp_csc_access_len = count($emp_csc_access);
if ($emp_csc_access_len > 0) :
for ($i = 0; $i < $emp_csc_access_len; $i++) :
$res = insertStmt("employeecostcenter", array("emp_id", $emp_id_act, "csc_id", $emp_csc_access[$i]));
if ($db->affected_rows > 0) :
$rightsLogString .= "|" . $emp_id_act . "_" . $emp_csc_access[$i];
endif;
endfor;
endif;
endif;
TA("C");
TA("E");
// Write logdata into log database
// writeToLogDB("115",$hq_id,"",$usr_id,"","","",$rightsLogString,"","",$emp_id_act);
$statusMessage = getLngt("Die Rechte wurden gesetzt!");
endif;
endif;
// Get associative array of all costcenters of the customer except root costcenter ($retArray[$row[csc_id]]= csc_name)
$cscVector = getColVectorFromDB2ArrayByClause("costcenter AS csc", "csc.csc_name", "csc.cs_id = '" . $customerId . "' AND (NOT ISNULL(csc.csc_pre_id)) AND csc.csc_pre_id != ''", "csc.csc_id", "csc.csc_name", "");
$cscVectorKeys = array_keys($cscVector);
$cscVectorKeysLen = count($cscVectorKeys);
// Get associative array of costcenters of the current employee LOGGED IN having access to
$empCscVector = getColVectorFromDB2ArrayByClause("employeecostcenter AS empcsc", "empcsc.csc_id", "empcsc.emp_id = '" . $emp_id . "'", "", "", "");
// Get associative array of costcenters of the current employee TO BE MODIFIED having access to
$empActCscVector = getColVectorFromDB2ArrayByClause("employeecostcenter AS empcsc", "empcsc.csc_id", "empcsc.emp_id = '" . $emp_id_act . "'", "", "", "");
// Create csc-vector
$output = "<table>";
$output .= "<tr>";
$output .= "<td align=\"left\">" . defineButtonType10(getLngt("Zuweisen"), "action_set_csc_access", "finishPage('setCscAccess');", "100", "left") . "</td>"; // Left top corner
$output .= "</tr>";
for ($j = 0; $j < $cscVectorKeysLen; $j++) :
$cscId = $cscVectorKeys[$j];
$cscName = $cscVector[$cscId];
$output .= "<tr>";
$output .= "<td width=\"150\"><b>" . getLngt($cscName) . "</b></td>";
$output .= "<td align=\"center\">";
$tmpChecked = "";
if (in_array($cscId, $empActCscVector)) : $tmpChecked = "checked"; endif;
$tmpDisabled = "disabled";
if ($emp_id == $empIdRootAdmin || in_array($cscId, $empCscVector)) : $tmpDisabled = ""; endif;
$output .= "<input type=\"checkbox\" name=\"emp_csc_access[]\" value=\"" . $cscId . "\" " . $tmpChecked . " " . $tmpDisabled . ">";
$output .= "</td>";
$output .= "</tr>";
endfor;
$output .= "</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 type="text/javascript">
<!--
// NAVIGATION
<?php echo $jsMenuOut; ?>
function finishPage(f_act) {
document.forms[0].f_act.value = f_act;
document.forms[0].submit();
};
-->
</script>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>displayStatusMessage();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="maincontent" name="maincontent" id="maincontent">
<form action="../admin/employee_csc_rights.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) ?>">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<input type="hidden" name="emp_id_act" value="<?php echo ec($emp_id_act) ?>">
<?php echo htmlDivLineSpacer("10px"); ?>
<div class="f12bp1_blue">
<?php echo $usrFirstNameAct . " " . $usrNameAct . " [" . $usrAccountAct . "]"; ?>
</div>
<?php echo htmlDivLineSpacer("20px"); ?>
<div class="f10np1">
<?php
if ($userTypeName == "hq" || $userTypeName == "cs") :
if (!$empHasNoAccessToEmployees) :
echo $output;
endif;
endif;
?>
</div>
</form>
</div>
</body>
</html>

View File

@@ -0,0 +1,404 @@
<?php
/*=======================================================================
*
* employee_list.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
// Get the rights of the employee logged in and check the accessibility
// authCheckEmployeeRights($emp_id, "3", "1");
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act", "customerId", "cscIdRoot", "cscIdActual", "statusMessage",
"emp_id_act", "treeMode", "tableSort", "deactivateMenu", "f_hq_id"));
getLanguage(__FILE__);
$pageTitel = getLngt("MITARBEITER");
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
getCurrentScript(__FILE__);
// Select user-type for mode of security check
$userType = getFieldValueFromId("user","usr_id",$usr_id,"usr_type");
$userTypeName = getUserTypeName($userType);
// Get the rights of the employee logged in and check the accessibility
$empHasNoAccessToEmployees = false;
if ($userTypeName == "hq") :
if (!authCheckEmployeeRights($emp_id, "3")) : $empHasNoAccessToEmployees = true; endif;
elseif ($userTypeName == "cs") :
if (!authCheckEmployeeRights($emp_id, "2")) : $empHasNoAccessToEmployees = true; endif;
// else :
// gotoReferer("1"); // REMARKED, because employee list will be restricted; emp. only can see himself !!!
endif;
// Check authentication verifying emmployee an his/her costcenter- and customer-association
if ( !( authCheckHQ($hq_id,$usr_id,$emp_id) || authCheck($hq_id,$usr_id,$emp_id,$cscIdRoot,$customerId,$cscIdActual) ) || $userTypeName == "" ) :
die ("$PHP_SELF: Access denied!");
endif;
if ($empHasNoAccessToEmployees) :
header("Location: ../admin/employee.php?currentNavigationItem=zentralenmitarbeiter&emp_id_act=" . ec($emp_id) . "&customerId=" . ec($customerId) . "&cscIdRoot=" . ec($cscIdRoot) . "&cscIdActual=" . ec($cscIdActual));
endif;
// Get the emp_id of the root admin because he/she is allowed to change a password of an employee
$empIdRootAdmin = getEmpIdOfRootAdmin($userTypeName);
$empHasNoAccessToEmployeeHistory = false;
if ($userTypeName == "hq") :
if ($emp_id == $empIdRootAdmin || authCheckEmployeeRights($emp_id, "32")) : $empHasNoAccessToEmployeeHistory = true; endif;
endif;
// Get ALL administrator IDs
$empIdRootArr = getColVectorFromDB2ArrayByClause("headquarters", "hq_admin", "", "", "hq_admin", "");
// Mandator filter
if ($f_hq_id == "") : $f_hq_id = array(); endif;
if (count($f_hq_id) == 0) : array_push($f_hq_id, $hq_id); endif;
// Get the rights of the employee logged in
$empRights = getRights($emp_id);
// Secure-check of the association between customer and the ACTUAL(!) costcenter
// Is it the same customer like for the "root"-costcenter?
$tmpFields = array("cs_id",$customerId,"csc_id",$cscIdActual);
if ($userTypeName == "hq" || existsEntry("costcenter",$tmpFields)) :
// $treeMode decides to show the employees only of the current costcenter or all
// employees of all sub-costcenters inclusive the actual one
if ($treeMode != "") : $treeMode = TRUE; else : $treeMode = FALSE; endif;
if ($tableSort == "") : $tableSort = "usr_name"; endif;
$cscNameActual = getFieldValueFromId("costcenter","csc_id",$cscIdActual,"csc_name");
// Get the user_id of the current employee in $emp_id_act
$usrId = getFieldValueFromId("employee", "emp_id", $emp_id_act, "usr_id");
// Remove employee
if ($f_act == "removeEmployee" && $emp_id_act != "") :
if ( ($userTypeName == "hq" && !existsEntry("headquarters",array("hq_admin",$emp_id_act))) || ($userTypeName == "cs" && !existsEntry("customer",array("cs_admin",$emp_id_act))) ) :
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_firstname");
$tmpUsrPassword = getFieldValueFromId("user", "usr_id", $usrId, "usr_password");
$tmpEmpRigths = getFieldValueFromId("employee", "emp_id", $emp_id_act, "emp_rights");
$logString = makeLogString(array($tmpUsrName,$tmpUsrFirstName,$tmpUsrAccount,$tmpEmpRigths,$tmpUsrPassword,$tmpEmpRigths), ";", "0");
deleteStmt("employee","emp_id = ".$emp_id_act);
deleteStmt("user","usr_id = ".$usrId);
// Write logdata into log database
writeToLogDB("75",$hq_id,"",$usr_id,"","","","STATUS_DELETED=" . $logString,"","",$emp_id_act);
TA("C");
TA("E");
// 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)) :
// Get database instance connection data of metaobject
$constExtDbInst = getExternalMetaDbInst();
$db_conn = getDbConnectionSpecial($constExtDbInst, $dbname, $dblogin, $dbpassword);
$tmpSqlQuery = "DELETE FROM meta_object.metaobject WHERE mo_id_ref_db = '" . $constGlobalDbInstNo . "' AND mo_obj_type = 'usr' AND mo_obj_id = '" . $usrId . "'";
$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;
else :
$statusMessage = getLngt("Datenfehler! Löschen Sie bitte den Mitarbeiter und legen Sie ihn neu an! :-(");
endif;
else :
$statusMessage = getLngt("Der Administratoreintrag kann nicht entfernt werden! ;-)");
endif;
endif;
// **********************************************************************************************
// * Selection of all employees of the actual costcenter (customer) or headquarter for the list *
// **********************************************************************************************
// Check if employee has NO access to other employees
$whereClause = "";
if ($empHasNoAccessToEmployees) :
$whereClause = " AND emp.emp_id = '" . $emp_id . "'";
endif;
if ($userTypeName == "hq") :
$sqlquery = "SELECT emp.emp_id, usr.usr_name, usr.usr_firstname, usr.usr_email, usr.usr_phone,"
. " usr.usr_phone2, usr.usr_account, hq.hq_mnemonic"
. " FROM user AS usr, employee AS emp, headquarters AS hq"
. " WHERE usr.usr_type = '1' AND emp.usr_id = usr.usr_id AND emp.csc_id = '0' AND usr.hq_id = hq.hq_id AND hq.hq_id IN " . getSQLMandatorArray($f_hq_id) . " " . $whereClause
. " ORDER BY $tableSort";
endif;
if ($userTypeName == "cs") :
if ($treeMode) :
$sqlquery = "SELECT emp.emp_id, usr.usr_name, usr.usr_firstname, usr.usr_email, usr.usr_phone,"
. " usr.usr_phone2, usr.usr_account, csc.csc_name"
. " FROM user AS usr, employee AS emp, costcenter AS csc"
. " WHERE emp.usr_id = usr.usr_id AND emp.csc_id = csc.csc_id AND csc.cs_id = '$customerId' AND"
. " (csc.csc_path LIKE '%//$cscNameActual//%' OR csc.csc_id = '$cscIdActual')" . $whereClause
. " ORDER BY $tableSort";
else :
$sqlquery = "SELECT emp.emp_id, usr.usr_name, usr.usr_firstname, usr.usr_email,"
. " usr.usr_phone, usr.usr_phone2, usr.usr_account"
. " FROM user AS usr, employee AS emp"
. " WHERE emp.usr_id = usr.usr_id AND csc_id = '$cscIdActual'" . $whereClause
. " ORDER BY $tableSort";
endif;
endif;
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
// Only for output
$treeModeOut = "";
$treeModeOut2 = "";
if ($userTypeName == "hq") :
$treeModeLinkText = "";
else :
$treeModeLinkText = getLngt("Mitarbeiter der aktuellen Kostenstelle");
if ($treeMode) :
$treeModeOut2 = "&treeMode=true";
else :
$treeModeOut = "&treeMode=true";
$treeModeLinkText = getLngt("Mitarbeiter aller Unterkostenstellen");
endif;
endif;
// Maintable with header
$numOfUser = 0;
$tableOfEmployees = "<table border=\"0\" cellpadding=\"5\">";
$tableOfEmployees .= "<tr class=\"f8bp1\">";
if ($userTypeName == "hq" && authCheckEmployeeRights($emp_id, "10")) :
$tableOfEmployees .= "<td>&nbsp;<a href=\"javascript:document.forms[0].tableSort.value='usr_name';document.forms[0].submit();\">" . getLngt("Name") . "</a></td>";
$tableOfEmployees .= "<td>&nbsp;<a href=\"javascript:document.forms[0].tableSort.value='usr_firstname';document.forms[0].submit();\">" . getLngt("Vorname") . "</a></td>";
$tableOfEmployees .= "<td>&nbsp;<a href=\"javascript:document.forms[0].tableSort.value='hq_mnemonic';document.forms[0].submit();\">" . getLngt("Niederlassung") . "</a></td>";
$tableOfEmployees .= "<td>&nbsp;<a href=\"javascript:document.forms[0].tableSort.value='usr_email';document.forms[0].submit();\">" . getLngt("E-Mail") . "</a></td>";
$tableOfEmployees .= "<td>&nbsp;<a href=\"javascript:document.forms[0].tableSort.value='usr_phone';document.forms[0].submit();\">" . getLngt("Telefon") . "</a></td>";
$tableOfEmployees .= "<td>&nbsp;<a href=\"javascript:document.forms[0].tableSort.value='usr_account';document.forms[0].submit();\">" . getLngt("Anmeldename") . "</a></td>";
$tableOfEmployees .= "<td>&nbsp;" . getLngt("Löschen") . "</td>";
if ($empHasNoAccessToEmployeeHistory) :
$tableOfEmployees .= "<td>&nbsp;" . getLngt("Historie") . "</td>";
endif;
$tableOfEmployees .= "<td>&nbsp;" . getLngt("Bearbeiten") . "</td>";
else :
$tableOfEmployees .= "<td>&nbsp;<a href=\"../admin/employee_list.php?customerId=" . ec($customerId) . "&cscIdRoot=" . ec($cscIdRoot) . "&cscIdActual=" . ec($cscIdActual) . $treeModeOut2 . "&currentNavigationItem=zentralenmitarbeiter&tableSort=usr_name\">" . getLngt("Name") . "</a></td>";
$tableOfEmployees .= "<td>&nbsp;<a href=\"../admin/employee_list.php?customerId=" . ec($customerId) . "&cscIdRoot=" . ec($cscIdRoot) . "&cscIdActual=" . ec($cscIdActual) . $treeModeOut2 . "&currentNavigationItem=zentralenmitarbeiter&tableSort=usr_firstname\">" . getLngt("Vorname") . "</a></td>";
$tableOfEmployees .= "<td>&nbsp;<a href=\"../admin/employee_list.php?customerId=" . ec($customerId) . "&cscIdRoot=" . ec($cscIdRoot) . "&cscIdActual=" . ec($cscIdActual) . $treeModeOut2 . "&currentNavigationItem=zentralenmitarbeiter&tableSort=usr_email\">" . getLngt("E-Mail") . "</a></td>";
$tableOfEmployees .= "<td>&nbsp;<a href=\"../admin/employee_list.php?customerId=" . ec($customerId) . "&cscIdRoot=" . ec($cscIdRoot) . "&cscIdActual=" . ec($cscIdActual) . $treeModeOut2 . "&currentNavigationItem=zentralenmitarbeiter&tableSort=usr_phone\">" . getLngt("Telefon") . "</a></td>";
$tableOfEmployees .= "<td>&nbsp;<a href=\"../admin/employee_list.php?customerId=" . ec($customerId) . "&cscIdRoot=" . ec($cscIdRoot) . "&cscIdActual=" . ec($cscIdActual) . $treeModeOut2 . "&currentNavigationItem=zentralenmitarbeiter&tableSort=usr_account\">" . getLngt("Anmeldename") . "</a></td>";
if ($treeMode) : $tableOfEmployees .= "<td>" . getLngt("Kostenstelle") . "</td>"; endif;
$tableOfEmployees .= "<td>&nbsp;" . getLngt("Löschen") . "</td>";
$tableOfEmployees .= "<td>&nbsp;" . getLngt("Bearbeiten") . "</td>";
endif;
$tableOfEmployees .= "</tr>";
$rowCounter = 0;
$lineToggler = 0;
while ($row = $result->fetch_assoc()):
$numOfUser++;
$cellColor = getListColor($numOfUser, $lineToggler);
$tableOfEmployees .= "<tr>";
$tableOfEmployees .= "<td bgcolor=\"" . $cellColor ."\">&nbsp;" . "<a href=\"employee.php?emp_id_act=" . ec($row["emp_id"])
. "&customerId=" . ec($customerId)
. "&cscIdRoot=" . ec($cscIdRoot)
. "&cscIdActual=" . ec($cscIdActual)
. "&deactivateMenu=" . ec(1)
. "\" target=\"_blank\">" . $row["usr_name"]
. "</a>" . "</td>";
$tableOfEmployees .= "<td bgcolor=\"" . $cellColor ."\">&nbsp;" . $row["usr_firstname"] . "</td>";
if ($userTypeName == "hq" && authCheckEmployeeRights($emp_id, "10")) :
$tableOfEmployees .= "<td bgcolor=\"" . $cellColor ."\">&nbsp;" . $row["hq_mnemonic"] . "</td>";
endif;
$tableOfEmployees .= "<td bgcolor=\"" . $cellColor ."\">&nbsp;" . $row["usr_email"] . "</td>";
$tableOfEmployees .= "<td bgcolor=\"" . $cellColor ."\">&nbsp;" . $row["usr_phone"] . "</td>";
$tableOfEmployees .= "<td bgcolor=\"" . $cellColor ."\">&nbsp;" . $row["usr_account"] . "</td>";
if ($treeMode) : $tableOfEmployees .= "<td bgcolor=\"" . $cellColor ."\">&nbsp;" . $row["csc_name"] . "</td>"; endif;
$tableOfEmployees .= "<td align=\"center\" bgcolor=\"" . $cellColor ."\"><a href=\"javascript:removeEmployee('".ec("removeEmployee")."','".ec($row["emp_id"])."','".$row["usr_account"]."','".ec($customerId)."','".ec($cscIdRoot)."','".ec($cscIdActual)."');\">"
. "<img src=\"../images/trash.jpg\" border=\"0\" height=\"13\" width=\"8\">"
. "</a>" . "</td>";
if ($empHasNoAccessToEmployeeHistory) :
$tableOfEmployees .= "<td align=\"center\" bgcolor=\"" . $cellColor ."\">";
if ($emp_id == $empIdRootAdmin || !in_array($row["emp_id"], $empIdRootArr)) :
$tableOfEmployees .= "<a href=\"history.php?history_mode=" . ec(4) . "&empIdHist=" . ec($row["emp_id"]) . "&customerId=" . ec($customerId)
. "&cscIdRoot=" . ec($cscIdRoot) . "&cscIdActual=" . ec($cscIdActual) . "&deactivateMenu=" . ec(1)
. "\" target=\"_blank\">"
. "<img src=\"../images/arrow_right.png\" border=\"0\" height=\"10\" width=\"25\">"
. "</a>";
endif;
$tableOfEmployees .= "</td>";
endif;
$tableOfEmployees .= "<td align=\"center\" bgcolor=\"" . $cellColor ."\"><a href=\"employee.php?emp_id_act=" . ec($row["emp_id"])
. "&customerId=" . ec($customerId)
. "&cscIdRoot=" . ec($cscIdRoot)
. "&cscIdActual=" . ec($cscIdActual)
. "&deactivateMenu=" . ec(1)
. "\" target=\"_blank\">"
. "<img src=\"../images/arrow_right.png\" border=\"0\" height=\"10\" width=\"25\">"
. "</a>" . "</td>";
$tableOfEmployees .= "</tr>";
$usrName = $row["usr_name"];
$usrFirstname = $row["usr_firstname"];
endwhile;
$tableOfEmployees .= "</table>";
$result->free();
endif;
?>
<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 type="text/javascript">
<!--
// NAVIGATION
<?php echo $jsMenuOut; ?>
function removeEmployee(f_act,emp_id_act,emp_act_account,cs_id,csc_id_root,csc_id_actual) {
if (confirm('Benutzer ' + emp_act_account + ' entfernen?')) {
document.location.href = "employee_list.php?f_act="+f_act+"&emp_id_act="+emp_id_act+"&customerId="+cs_id+"&cscIdRoot="+csc_id_root+"&cscIdActual="+csc_id_actual+"&currentNavigationItem=zentralenmitarbeiter";
};
};
function finishPage() {
document.forms[0].submit();
}
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 employeeHistory(empId) {
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/history.php?history_mode=<?php echo ec(4) ?>&empIdHist=" + empId + "&op=0","","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
}
-->
</script>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>displayStatusMessage();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="maincontent" name="maincontent" id="maincontent">
<form action="../admin/employee_list.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) ?>">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<input type="hidden" name="tableSort" value="<?php echo $tableSort ?>">
<?php echo htmlDivLineSpacer("10px"); ?>
<!-- Headquarters checkboxes -->
<?php if ($userTypeName == "hq" && authCheckEmployeeRights($emp_id, "10")) : ?>
<?php echo getHeadquartersCheckboxes($f_hq_id); ?>
<?php echo htmlDivLineSpacer("10px", "", "left"); ?>
<?php endif; ?>
<div class="f12bp1_blue">
<div>
<?php
if ($userTypeName == "hq") :
if (!$empHasNoAccessToEmployees) :
if (authCheckEmployeeRights($emp_id, "10")) :
$titleText = getLngt("Mitarbeiter der Niederlassungen");
else :
$titleText = getLngt("Mitarbeiter der Niederlassung");
endif;
else :
$titleText = $usrFirstname . " " . $usrName;
endif;
else :
if (!$empHasNoAccessToEmployees) :
if ($treeMode) :
$titleText = getLngt("Mitarbeiter aller Unterkostenstellen von") . " " . $cscNameActual;
else :
$titleText = getLngt("Mitarbeiter der Kostenstelle") . " " . $cscNameActual;
endif;
else :
$titleText = $usrFirstname . " " . $usrName;
endif;
endif;
?>
</div>
<?php if ($userTypeName == "hq" && authCheckEmployeeRights($emp_id, "10")) : ?>
<div>
<div <?php echo setStyleHtmlDiv("400px","left"); ?>><?php echo $titleText ?></div>
<?php echo defineButtonType10(getLngt("Aktualisieren"), "action_reload", "document.forms[0].submit();", "100", "left", "3"); ?>
</div>
<?php endif; ?>
</div>
<?php echo htmlDivLineSpacer("20px", "", "left"); ?>
<?php echo defineButtonType10(getLngt("Neuer&nbsp;Mitarbeiter"), "action_new", "newEmployee();", "140", "left", "50") ?>
<?php // echo defineButtonType10(getLngt("Mitarbeiterhistorie"), "action_history", "employeeHistory(" . ec(0) . ");", "140", "left") ?>
<?php echo htmlDivLineSpacer("20px", "", "left"); ?>
<div>
<table border="0">
<tr>
<td class="f10np1">
<?php echo $tableOfEmployees ?>
<br><br>
<?php
if (!$empHasNoAccessToEmployees) :
echo getLngt("Anzahl Benutzer:") . " " . $numOfUser;
endif;
?>
<br><br><br>
<?php if (!$empHasNoAccessToEmployees) : ?>
<a href="../admin/employee_list.php?customerId=<?php echo ec($customerId) ?>&cscIdRoot=<?php echo ec($cscIdRoot) ?>&cscIdActual=<?php echo ec($cscIdActual) ?><?php echo $treeModeOut ?>"><?php echo $treeModeLinkText ?></a>
<?php endif; ?>
</td>
</tr>
</table>
</div>
</form>
</div>
</body>
</html>

View File

@@ -0,0 +1,267 @@
<?php
/*=======================================================================
*
* employee_rights.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
// Get the rights of the employee logged in and check the accessibility
// authCheckEmployeeRights($emp_id, "3", "1");
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act", "statusMessage", "emp_id_act", "emp_rights", "tableSort", "deactivateMenu", "f_hq_id"));
getLanguage(__FILE__);
$pageTitel = getLngt("MITARBEITERRECHTE");
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
getCurrentScript(__FILE__);
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1");
// Get the right of the employee logged in and check the access
$empHasNoAccessToEmployees = TRUE;
if ($userTypeName == "hq" && authCheckEmployeeRights($emp_id, "3") && $emp_id_act != "" && is_numeric($emp_id_act) && $emp_id_act != $emp_id) :
$empHasNoAccessToEmployees = FALSE;
endif;
// 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 !!!!
$usrIdAct = getFieldValueFromId("employee", "emp_id", $emp_id_act, "usr_id");
$hqIdAct = getFieldValueFromId("user", "usr_id", $usrIdAct, "hq_id");
$empIdActMdId = getFieldValueFromId("mandatorheadquarters", "hq_id", $hqIdAct, "md_id");
if ($empHasNoAccessToEmployees) :
if ($md_id == "" || !is_numeric($md_id) || $md_id != $empIdActMdId) :
$empHasNoAccessToEmployees = FALSE;
endif;
endif;
if ($empHasNoAccessToEmployees) : gotoReferer("1"); endif;
// Get the emp_id of the root admin because he/she is allowed to change a password of an employee
$empIdRootAdmin = getEmpIdOfRootAdmin($userTypeName);
$usrNameAct = getFieldValueFromId("user", "usr_id", $usrIdAct, "usr_name");
$usrFirstNameAct = getFieldValueFromId("user", "usr_id", $usrIdAct, "usr_firstname");
$usrAccountAct = getFieldValueFromId("user", "usr_id", $usrIdAct, "usr_account");
// For access restriction regarding to edit another employee, get headquarters the employee logged in has access to
$empIdAccessToHq = "";
$whereClauseHqRestriction = "";
if ($empIdRootAdmin != $emp_id) :
$empIdAccessToHq = getFieldValueFromId("employee", "emp_id", $emp_id, "emp_headquarters");
if ($empIdAccessToHq != "") :
$whereClauseHqRestriction = " AND mdhq.hq_id IN (" . $empIdAccessToHq . ")";
endif;
endif;
// Get ALL headquarters to be displayed of the current mandator RESTRICTED by headquarters of the employee logged in
$hqVector = getColVectorFromDB2ArrayByClause("headquarters AS hq, mandatorheadquarters AS mdhq", "hq.hq_mnemonic", "mdhq.md_id = '" . $md_id . "' AND hq.hq_id = mdhq.hq_id" . $whereClauseHqRestriction, "hq.hq_id", "hq.hq_id", ""); // Returns associative array ($retArray[$row[hq_id]]= hq_mnemonic)
$hqArrayKeys = array_keys($hqVector);
$hqArrayKeysLen = count($hqArrayKeys);
$rgtVector = getColVectorFromDB2ArrayByClause("rights", "rgt_name", "", "rgt_id", "rgt_id", ""); // Returns associative array ($retArray[$row[rgt_id]]= rgt_name)
$rgtArrayKeys = array_keys($rgtVector);
$rgtArrayKeysLen = count($rgtArrayKeys);
$empIdHqRgtVector = getEmpHqRights($emp_id); // Rights (hq-rgt-matrix) of the user logged in
$empIdActHqRgtVector = getEmpHqRights($emp_id_act); // Rigths (hq-rgt-matrix) of the current user
// Set rights
if ($f_act == "setRights") :
if ($emp_id_act != "") :
$rightsLogString = "";
TA("B");
// Remove current rights of the employee
if ($empIdRootAdmin == $emp_id) :
$res = deleteStmt("employeerights","emp_id = '" . $emp_id_act . "'");
else :
$res = deleteStmt("employeerights","emp_id = '" . $emp_id_act . "' AND hq_id IN (" . $empIdAccessToHq . ")");
endif;
if ($db->affected_rows > 0) :
$rightsLogString .= "DELETED_RIGHTS=YES";
else :
$rightsLogString .= "DELETED_RIGHTS=NO";
endif;
// Insert new rigths
$emp_rights_len = count($emp_rights);
for ($i = 0; $i < $emp_rights_len; $i++) :
// Get hq_id and rgt_id from the element values of the array (e.g. an element could be "102_7" corresponding with "HTG-HH"_"Export")
$tmpArray = split("_", $emp_rights[$i]);
$specialHqId = $tmpArray[0];
$specialRgtId = $tmpArray[1];
if ($specialHqId != "" && is_numeric($specialHqId) && $specialRgtId != "" && is_numeric($specialRgtId)) :
$res = insertStmt("employeerights", array("emp_id", $emp_id_act, "hq_id", $specialHqId, "rgt_id", $specialRgtId));
if ($db->affected_rows > 0) :
$rightsLogString .= "|" . $specialHqId . "_" . $specialRgtId;
endif;
endif;
endfor;
TA("C");
TA("E");
// Write logdata into log database
writeToLogDB("115",$hq_id,"",$usr_id,"","","",$rightsLogString,"","",$emp_id_act);
// Get rights again after changing
$empIdHqRgtVector = getEmpHqRights($emp_id); // Rights of the user logged in
$empIdActHqRgtVector = getEmpHqRights($emp_id_act); // Rigths of the current user
$statusMessage = getLngt("Die Rechte wurden gesetzt!");
endif;
endif;
// Create hq-rgt-matrix
$output = "<table>";
$output .= "<tr>";
$output .= "<td align=\"left\">" . defineButtonType10(getLngt("Rechte&nbsp;zuweisen"), "action_set_rights", "finishPage('setRights');", "140", "left") . "</td>"; // Left top corner
// Column headlines
for ($i = 0; $i < $hqArrayKeysLen; $i++) :
// $output .= "<td align=\"center\" width=\"50\"><b>" . $hqVector[$hqArrayKeys[$i]] . "</b></td>";
$output .= "<td align=\"center\" width=\"50\">";
$output .= "<b>" . $hqVector[$hqArrayKeys[$i]] . "</b><br>";
$output .= "<span class=\"toggle_cell\"><input type=\"checkbox\" class=\"toggle_chkbx\" onclick=\"toggleColumn(" . $i . ", this)\"></span>\n";
$output .= "</td>";
endfor;
$output .= "</tr>";
for ($j = 0; $j < $rgtArrayKeysLen; $j++) :
$output .= "<tr>";
$output .= "<td width=\"150\"><b>" . getLngt($rgtVector[$rgtArrayKeys[$j]]) . "</b></td>";
for ($i = 0; $i < $hqArrayKeysLen; $i++) :
$output .= "<td align=\"center\">";
$tmpChecked = "";
mcArrIsSet($rgtArrayKeys, $j);
mcArrIsSet($hqArrayKeys, $i);
$empIdActHqRgtVector[$hqArrayKeys[$i]][$rgtArrayKeys[$j]] = mcArrMultiDimIsSet($empIdActHqRgtVector[$hqArrayKeys[$i]], $rgtArrayKeys[$j]);
if ($empIdActHqRgtVector[$hqArrayKeys[$i]][$rgtArrayKeys[$j]] == "1") : $tmpChecked = "checked"; endif;
$tmpDisabled = "disabled";
if ($emp_id == $empIdRootAdmin || $empIdHqRgtVector[$hqArrayKeys[$i]][$rgtArrayKeys[$j]] == "1") : $tmpDisabled = ""; endif;
$output .= "<input type=\"checkbox\" class=\"row_" . $j . " col_" . $i . "\" name=\"emp_rights[]\" value=\"" . $hqArrayKeys[$i] . "_" . $rgtArrayKeys[$j] . "\" ".$tmpChecked." ".$tmpDisabled.">\n";
$output .= "</td>";
endfor;
$output .= "<td class=\"toggle_cell\" align=\"center\"><input type=\"checkbox\" class=\"toggle_chkbx\" onclick=\"toggleRow(" . $j . ", this)\">\n</td>";
$output .= "</tr>";
endfor;
$output .= "</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"); ?>
.toggle_cell
{ background-color: #e0e0e0;
border-bottom: 2px solid #bbb;
text-align: center; /* Zentriert den Inhalt (die Checkbox) */
padding: 5px; /* Etwas Luft */
}
.toggle_chkbx
{ accent-color: #555;
cursor: pointer;
}
</style>
<?php include_once ("../include/js_framework.inc.php"); ?>
<script type="text/javascript">
<!--
// NAVIGATION
<?php echo $jsMenuOut; ?>
function finishPage(f_act) {
document.forms[0].f_act.value = f_act;
document.forms[0].submit();
};
function toggleColumn(colIndex, source) {
// Sucht nach allen Elementen mit der Klasse .col_0, .col_1 usw.
const targets = document.querySelectorAll('.col_' + colIndex);
targets.forEach(checkbox => {
if (!checkbox.readOnly && !checkbox.disabled) {
checkbox.checked = source.checked;
}
});
}
function toggleRow(rowIndex, source) {
// Sucht nach allen Elementen mit der Klasse .row_0, .row_1 usw.
const targets = document.querySelectorAll('.row_' + rowIndex);
targets.forEach(checkbox => {
if (!checkbox.readOnly && !checkbox.disabled) {
checkbox.checked = source.checked;
}
});
}
-->
</script>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>displayStatusMessage();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="maincontent" name="maincontent" id="maincontent">
<form action="../admin/employee_rights.php" method="post">
<input type="hidden" name="f_act" value="">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<input type="hidden" name="emp_id_act" value="<?php echo ec($emp_id_act) ?>">
<?php echo htmlDivLineSpacer("10px"); ?>
<div class="f12bp1_blue">
<?php echo $usrFirstNameAct . " " . $usrNameAct . " [" . $usrAccountAct . "]"; ?>
</div>
<?php echo htmlDivLineSpacer("20px"); ?>
<div class="f10np1">
<?php
if ($userTypeName == "hq") :
if (!$empHasNoAccessToEmployees) :
echo $output;
endif;
endif;
?>
</div>
</form>
</div>
</body>
</html>

536
html/admin/filter.php Normal file
View File

@@ -0,0 +1,536 @@
<?php
/*=======================================================================
*
* filter.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
$httpVars = array("f_act", "actionMode", "filterType", "customerId", "courierId", "crfIdAction", "f_crvh_filter", "f_crvh_filter_str",
"f_crf_edit_enabled", "f_crf_modify_enabled", "f_crf_type", "f_crf_status", "f_crf_short", "f_crf_text", "f_crf_sort",
"f_crf_order_by", "orderClause", "statusMessage", "deactivateMenu", "openerParameter", "readonly", "crf_admin");
getSecHttpVars("1", $httpVars);
getLanguage(__FILE__);
if ($crf_admin == "" || $crf_admin != "100") :
$deactivateMenuStatic = "1";
endif;
$pageTitel = getLngt("AUFTRAGSFILTER");
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
include_once ("../include/inc_filters.inc.php");
getCurrentScript(__FILE__);
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
authCheckEmployeeRights($emp_id, "0", "1");
$outputJS = "";
$crfTextRightToEdit = "0";
if ($crf_admin == "100" && authCheckEmployeeRights($emp_id, "32")) :
$crfTextRightToEdit = "1";
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// if (true || $usr_id != "300001") : $crfTextRightToEdit = "0"; $f_crf_edit_enabled = "0"; $f_crf_modify_enabled = "0"; endif; // !!!!!!!!!!!
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
endif;
// Flag for displaying filter texts
if (mcIsSet($f_crf_edit_enabled) == "" || (is_array($f_crf_edit_enabled) && count($f_crf_edit_enabled) == 0)) :
$f_crf_edit_enabled = "0";
else:
$f_crf_edit_enabled = "1";
if ($crfTextRightToEdit != "1") :
$f_crf_edit_enabled = "0";
endif;
endif;
$f_crf_edit_enabled_0 = "";
if ($f_crf_edit_enabled == "1") : $f_crf_edit_enabled_0 = "checked"; endif;
// Flag for modifying filters
if ($f_crf_modify_enabled == "" || count($f_crf_modify_enabled) == 0) :
$f_crf_modify_enabled = "0";
else:
$f_crf_modify_enabled = "1";
if ($crfTextRightToEdit != "1") :
$f_crf_modify_enabled = "0";
endif;
endif;
$f_crf_modify_enabled_0 = "";
if ($f_crf_modify_enabled == "1") : $f_crf_modify_enabled_0 = "checked"; endif;
if ($actionMode == "") : $actionMode = "0"; endif; // ["0" = Returns filter string per JS (default) / "1" = Returns customer filters]
if ($openerParameter == "") : $openerParameter = "g_crvh_filter"; endif; // Name of the parameter of the opener
if ($filterType != "" && !is_numeric($filterType)) : $filterType = ""; endif; // Filter type [0 = crvh (default), 1 = cr, ....]
if ($f_crf_order_by == "" || !is_numeric($f_crf_order_by)) : $f_crf_order_by = "0"; endif;
if ($f_crvh_filter_str != "") :
if (substr($f_crvh_filter_str, 0, 1) != ",") : $f_crvh_filter_str = "," . $f_crvh_filter_str; endif;
if (substr($f_crvh_filter_str, -1) != ",") : $f_crvh_filter_str = $f_crvh_filter_str . ","; endif;
else :
// Implode checked courier filter fields to store in DB
$f_crvh_filter_str = getImplodedFilterstring($f_crvh_filter);
endif;
// Modify filter
$retFilters = 0;
if ($f_act == "modifyFilter") :
if ($actionMode == "0") :
// Return filter string
$f_crvh_filter_str = substr($f_crvh_filter_str, 1); // Remove first comma
$f_crvh_filter_str = substr($f_crvh_filter_str, 0, -1); // Remove last comma
$retFilters = 1;
endif;
if ($customerId != "") :
if ($actionMode == "1") :
// TA("B");
// Update customer filter
updateStmt("customer","cs_id",$customerId,array("cs_filter ", $f_crvh_filter_str));
// TA("C");
// TA("E");
endif;
endif;
if ($courierId != "") :
if ($actionMode == "1") :
// TA("B");
// Update courier filter
updateStmt("courier","cr_id",$courierId,array("cr_filter ", $f_crvh_filter_str));
// TA("C");
// TA("E");
endif;
endif;
endif;
// Insert filter
if ($f_act == "insertFilter") :
$f_crf_short = trim($f_crf_short);
$f_crf_text = trim($f_crf_text);
if ($f_crf_sort == "" || !is_numeric($f_crf_sort)) :
$f_crf_sort = "0";
endif;
if ($f_crf_short != "" && $f_crf_text != "") :
// Check lock regarding queue of filters to be removed
$doRemove = true;
$parCrfToBeRemoved = getParameterValue("0", "FILTER_TO_BE_DELETED", "0", "0");
if ($parCrfToBeRemoved != "") :
if (strpos($parCrfToBeRemoved, "," . $f_crf_short . ",") !== false) :
$doRemove = false;
endif;
endif;
if ($doRemove) :
insertStmt("courierfilter", array("crf_type", $f_crf_type, "crf_short", $f_crf_short, "crf_text", $f_crf_text, "crf_status", $f_crf_status, "vht_id", "0", "crf_sort", $f_crf_sort));
$crfIdNew = getLastInsertId();
// Write logdata into log database
writeToLogDB("168",$hq_id,"",$usr_id,"","","","crf_id=" . $crfIdNew . "|crf_type=" . $f_crf_type . "|crf_short=" . $f_crf_short . "|crf_text=" . $f_crf_text . "|crf_status=" . $f_crf_status . "|vht_id=" . "0" . "|crf_sort=" . $f_crf_sort);
$statusMessage = getLngt("Der Filter wurde hinzugefügt!");
else :
$statusMessage = getLngt("ACHTUNG! Der Filter wurde NICHT hinzugefügt. Das gewünschte Kürzel") . " " . $f_crf_short . " " . getLngt("wurde erst kürzlich gelöscht und transaktionell noch nicht vollständig verarbeitet, so z.B. die Entfernung aus allen relevanten Aufträgen, etc.") . " " . getLngt("Vermutlich können Sie den neuen Filter am morgigen Tag anlegen!");
endif;
endif;
endif;
// Remove filter
if ($f_act == "removeFilter") :
if ($crfIdAction != "" && is_numeric($crfIdAction)) :
// Get current values before removing
$crfFields = getFieldsValueFromId("courierfilter", "crf_id", $crfIdAction, array("crf_type","crf_short","crf_text","crf_status","vht_id","crf_sort","crf_longtext"));
$crfShort = $crfFields[1];
if ($crfShort != "") :
TA("B");
// * Table "courierfilter" *
deleteStmt("courierfilter","crf_id = ".$crfIdAction);
// * Table "job" *
$parCrfToBeRemoved = getParameterValue("0", "FILTER_TO_BE_DELETED", "0", "0");
if ($parCrfToBeRemoved == "") :
setParameterValue("FILTER_TO_BE_DELETED", "," . $crfShort . ",");
else :
setParameterValue("FILTER_TO_BE_DELETED", $parCrfToBeRemoved . $crfShort . ",");
endif;
// * Table "customer" *
$sqlquery = "UPDATE customer,
(SELECT cs.cs_id FROM customer AS cs, company AS cmp WHERE cs.cs_filter != '' AND cs.cmp_id = cmp.cmp_id AND cmp.cmp_archived = '0') AS cs_relevant
SET cs_filter = REPLACE(cs_filter, '," . $crfShort . ",', ','), cs_modify = cs_modify
WHERE customer.cs_id = cs_relevant.cs_id";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: <br>$sqlquery<br>" . $result->getMessage());
// Clean up
$sqlquery = "UPDATE customer,
(SELECT cs.cs_id FROM customer AS cs, company AS cmp WHERE cs.cs_filter = ',' AND cs.cmp_id = cmp.cmp_id AND cmp.cmp_archived = '0') AS cs_relevant
SET cs_filter = '', cs_modify = cs_modify
WHERE customer.cs_id = cs_relevant.cs_id";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: <br>$sqlquery<br>" . $result->getMessage());
// * Table "courier" *
$sqlquery = "UPDATE courier,
(SELECT cr.cr_id FROM courier AS cr, company AS cmp WHERE cr.cr_filter != '' AND cr.cmp_id = cmp.cmp_id AND cmp.cmp_archived = '0') AS cr_relevant
SET cr_filter = REPLACE(cr_filter, '," . $crfShort . ",', ','), cr_modify = cr_modify
WHERE courier.cr_id = cr_relevant.cr_id";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: <br>$sqlquery<br>" . $result->getMessage());
// Clean up
$sqlquery = "UPDATE courier,
(SELECT cr.cr_id FROM courier AS cr, company AS cmp WHERE cr.cr_filter = ',' AND cr.cmp_id = cmp.cmp_id AND cmp.cmp_archived = '0') AS cr_relevant
SET cr_filter = '', cr_modify = cr_modify
WHERE courier.cr_id = cr_relevant.cr_id";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: <br>$sqlquery<br>" . $result->getMessage());
// * Table "couriervehicle" *
$sqlquery = "UPDATE couriervehicle
SET crvh_filter = REPLACE(crvh_filter, '," . $crfShort . ",', ','), crvh_modify = crvh_modify";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: <br>$sqlquery<br>" . $result->getMessage());
// Clean up
$sqlquery = "UPDATE couriervehicle
SET crvh_filter = '', crvh_modify = crvh_modify
WHERE crvh_filter = ','";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: <br>$sqlquery<br>" . $result->getMessage());
// Write logdata into log database
writeToLogDB("169",$hq_id,"",$usr_id,"","","","crf_id=" . $crfIdAction . "|crf_type=" . $crfFields[0] . "|crf_short=" . $crfFields[1] . "|crf_text=" . $crfFields[2] . "|crf_status=" . $crfFields[3] . "|vht_id=" . $crfFields[4] . "|crf_sort=" . $crfFields[5] . "|crf_longtext=" . $crfFields[6]);
$statusMessage = getLngt("Der Filter wurde entfernt!");
TA("C");
TA("E");
endif;
endif;
endif;
// Only for output
$pageHeadline = getLngt("Filterauswahl");
if ($customerId != "") :
// Get filters from customer
$f_crvh_filter_str = getFieldValueFromId("customer","cs_id",$customerId,"cs_filter");
$cmpId = getFieldValueFromId("customer", "cs_id", $customerId, "cmp_id");
$tmpFields = getFieldsValueFromId("company","cmp_id",$cmpId,array("cmp_comp","cmp_comp2"));
$cmpComp = $tmpFields[0];
$cmpComp2 = $tmpFields[1];
$pageHeadline = $cmpComp . " " . $cmpComp2;
endif;
if ($courierId != "") :
// Get filters from customer
$f_crvh_filter_str = getFieldValueFromId("courier","cr_id",$courierId,"cr_filter");
$cmpId = getFieldValueFromId("courier", "cr_id", $courierId, "cmp_id");
$tmpFields = getFieldsValueFromId("company","cmp_id",$cmpId,array("cmp_comp","cmp_comp2"));
$cmpComp = $tmpFields[0];
$cmpComp2 = $tmpFields[1];
$pageHeadline = $cmpComp . " " . $cmpComp2;
endif;
// Selected filters
$output = getFilters($f_crvh_filter_str, $filterType, "", "100", "4", "1", "", $f_crf_edit_enabled, $f_crf_modify_enabled, $f_crf_order_by);
getCurrentScript(__FILE__);
?>
<html>
<head>
<title><?php echo $pageTitel ?></title>
<style type="text/css">
<?php include_once ("../css/phoenix.css.php"); ?>
</style>
<style type="text/css">
<?php include_once ("../css/navigation.css.php"); ?>
.class_crf_lt_edit { width:180px; height:50px; background-color:#AAAACC; border:grey 3px solid; box-shadow: 10px 20px 30px grey; display: none;}
.class_crf_lt_textarea { position: relative; width: 200px; height: 50px; }
</style>
<style type="text/css">
<?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 src="../include/searchLists.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
var retFilters = <?php echo $retFilters ?>;
if (retFilters == 1) {
opener.document.forms[0].<?php echo $openerParameter ?>.value = '<?php echo $f_crvh_filter_str ?>';
window.close();
}
// NAVIGATION
<?php echo $jsMenuOut; ?>
function openCourierfilterSort() {
var widthPopupWin = 800;
var heightPopupWin = 1024;
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
var popupWin;
popupWin = window.open("../admin/sort.php?deactivateMenu=1&objType=crf&objId=0&noMap=1","","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
};
function finishPage(mode) {
var doSubmit = true;
var msg = '';
if (mode == 'save') {
document.forms[0].f_act.value='modifyFilter';
document.forms[0].submit();
}
if (mode == 'insert') {
document.forms[0].f_act.value='insertFilter';
if ($('#f_crf_type').val() != 0 && $('#f_crf_type').val() != 1) {
doSubmit = false;
msg = '<?php echo getLngt("Bitte die Art des Filters bestimmen (Transporteursfilter oder Fahrzeugfilter)!") ?>';
}
if ($('#f_crf_status').val() != 1 && $('#f_crf_status').val() != 2) {
doSubmit = false;
msg = '<?php echo getLngt("Bitte den Typ des Filters bestimmen (Pflichtfilter oder optionaler Filter)!") ?>';
}
if ($('#f_crf_sort').val() == '' || isNaN($('#f_crf_sort').val()) ) {
// doSubmit = false;
msg = '<?php echo getLngt("Es wurde keine Sortierungsnummer erfasst. Diese wird vorerst auf 0 gesetzt!") ?>';
}
if (trim($('#f_crf_short').val()) == '') {
doSubmit = false;
msg = '<?php echo getLngt("Bitte das Kürzel festlegen!") ?>';
} else {
// Check existence of the new value in "crf.crf_short"
ajaxRequestGet('../include/ajaxReqLib.php', 'mode=0&db_table=courierfilter&db_id_field=crf_short&search_value=' + encodeURI(escape(trim($('#f_crf_short').val()))) + '&db_return_field=crf_id');
if (retValue != '' || isNaN(retValue)) {
doSubmit = false;
msg = '<?php echo getLngt("Das Kürzel existiert schon, bitte wählen Sie ein anderes!") ?>';
}
}
if (trim($('#f_crf_text').val()) == '') {
doSubmit = false;
msg = '<?php echo getLngt("Bitte die Bezeichnung festlegen!") ?>';
} else {
// Check existence of the new value in "crf.crf_text"
ajaxRequestGet('../include/ajaxReqLib.php', 'mode=0&db_table=courierfilter&db_id_field=crf_text&search_value=' + encodeURI(escape(trim($('#f_crf_text').val()))) + '&db_return_field=crf_id');
if (retValue != '' || isNaN(retValue)) {
doSubmit = false;
msg = '<?php echo getLngt("Die Bezeichnung existiert schon!") ?>';
}
}
if (doSubmit) {
if (!confirm('<?php echo getLngt("Soll der neue Filter angelegt werden?") ?>')) {
doSubmit = false;
msg = '<?php echo getLngt("Der Filter wurde nicht eingefügt!") ?>';
}
}
}
if (mode == 'remove') {
document.forms[0].f_act.value='removeFilter';
}
if (mode == 'sort') {
// document.forms[0].f_act.value='sortFilter';
openCourierfilterSort();
}
if (msg != '') {
alert(msg);
}
if (doSubmit) {
document.forms[0].submit();
} else {
document.forms[0].f_act.value='';
}
};
function containerAction (elemId, elemVisual = '', elemVal = '_noAction_') {
<?php if ($f_crf_edit_enabled == "1") : ?>
if (elemVal != '_noAction_') {
$('#' + elemId).val(elemVal);
}
if (elemVisual == 'hide') {
myhide(elemId);
} else if (elemVisual == 'show') {
myshow(elemId);
}
<?php endif; ?>
}
function saveCrfLongtext (crfId, elemId, partTextLen = 100) {
<?php if ($f_crf_edit_enabled == "1") : ?>
if (elemId) {
// alert('crfId = ' + crfId + ' :: elemId = ' + elemId.value);
if (confirm('<?php echo getLngt("Soll der neue Text gespeichert werden?") ?>')) {
elemVal = elemId.value;
elemVal = elemVal.replace(/'/g, '');
if (true) {
// Update new longtext value in courierfilter
ajaxRequestGet('../include/ajaxReqLib.php', 'mode=100&db_table=courierfilter&db_id_field=crf_id&db_op_field=crf_longtext&new_content=' + encodeURI(escape(elemVal)) + '&search_value=' + crfId);
// Insert into log
ajaxRequestGet('../include/ajaxReqLib.php', 'mode=300&db_id_field=170&db_op_field=crf&search_value=' + crfId + '&id_01=crf_id&value_01=' + crfId + '&id_02=crf_longtext&value_02=' + encodeURI(escape(elemVal)));
// Refresh main output field with the new value
var buttonStr = '&nbsp;&nbsp;<input type="button" style="width: 10px; height: 10px; vertical-align: middle;" id="crf_' + crfId + '" value="" onClick="containerAction(\'crf_lt_edit_' + crfId + '\', \'show\');">';
var dotStr = '';
if (elemVal.length > partTextLen) {
dotStr = '....';
}
$('#crf_lt_part_' + crfId).html(elemVal.substr(0, partTextLen) + dotStr + buttonStr);
containerAction('crf_lt_part_' + crfId, 'show');
// Rewrite ....
// ajaxRequestGet('../include/ajaxReqGeneric.php', 'incPath=include&incFile=caglobal.inc.php&fun=mk_jb_invtext_full&par_01=' + crfId + '&retIdx=0');
// Reload ....
// ajaxRequestGet('../include/ajaxReqLib.php', 'mode=0&db_table=job&db_id_field=jb_id&search_value=' + crfId + '&db_return_field=jb_invtext');
// if (retValue != '') {
// $('#f_jb_invtext_new').html(retValue);
// }
// } else {
// alert('<?php echo getLngt("....") ?>');
}
}
} else {
alert('<?php echo getLngt("Das hat leider nicht geklappt!") ?>');
}
<?php endif; ?>
}
function crfSortUpdate (crfId, crfSort) {
<?php if ($f_crf_modify_enabled == "1") : ?>
// alert('crfId = ' + crfId + ' :: crfSort = ' + crfSort);
if (true) {
// Update
ajaxRequestGet('../include/ajaxReqLib.php', 'mode=100&db_table=courierfilter&db_id_field=crf_id&db_op_field=crf_sort&new_content=' + crfSort + '&search_value=' + crfId);
// Insert into log
ajaxRequestGet('../include/ajaxReqLib.php', 'mode=300&db_id_field=171&db_op_field=crf&search_value=' + crfId + '&id_01=crf_id&value_01=' + crfId + '&id_02=crf_sort&value_02=' + crfSort);
}
<?php endif; ?>
}
function removeCrf (crfId, crfShort, crfText) {
<?php if ($f_crf_modify_enabled == "1") : ?>
if (confirm('<?php echo getLngt("Soll der Filter ' + crfShort + ' [' + crfText + '] wirklich gelöscht werden?") ?>')) {
document.forms[0].crfIdAction.value = crfId;
finishPage('remove');
}
<?php endif; ?>
}
-->
</script>
</head>
<body class="menu_bgcol" onLoad="<?php echo $phpCurrentNavigationOnLoad ?><?php echo $outputJS ?>displayStatusMessage();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="mc_page-header">
<?php echo $pageHeadline ?>
</div>
<?php if ($f_crf_modify_enabled != "1") : ?>
<div class="f10bp1_blue">
<?php
if ($readonly != "1") :
echo defineButtonType10(getLngt("Speichern"), "action_save", "finishPage('save');", "120", "left", "0");
endif;
?>
<?php
if ($deactivateMenuStatic == "1") :
echo defineButtonType10(getLngt("Schließen"), "action_close", "window.close();", "120", "left", "0");
endif;
?>
</div>
<?php endif; ?>
<div class="maincontent mc_elem" name="maincontent" id="maincontent">
<form action="../admin/filter.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="filterType" value="<?php echo ec($filterType) ?>">
<input type="hidden" name="actionMode" value="<?php echo ec($actionMode) ?>">
<input type="hidden" name="openerParameter" value="<?php echo ec($openerParameter) ?>">
<input type="hidden" name="customerId" value="<?php echo ec($customerId) ?>">
<input type="hidden" name="courierId" value="<?php echo ec($courierId) ?>">
<input type="hidden" name="crfIdAction" value="">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<input type="hidden" name="crf_admin" value="<?php echo ec($crf_admin) ?>">
<?php echo htmlDivLineSpacer("30px"); ?>
<?php
if ($crfTextRightToEdit == "1") :
echo '
<div style="float:left;">
' . getLngt("Sortierung nach") . '&nbsp;&nbsp;
<select class="f8np1" name="f_crf_order_by" onChange="document.forms[0].submit();">
<option value="0" ' . ($f_crf_order_by == "0" ? "selected" : "") . '>' . getLngt("Kürzel") . '</option>
<option value="1" ' . ($f_crf_order_by == "1" ? "selected" : "") . '>' . getLngt("Bezeichnung") . '</option>
<option value="2" ' . ($f_crf_order_by == "2" ? "selected" : "") . '>' . getLngt("Sortiernr.") . '</option>
</select>&nbsp;&nbsp;&nbsp;&nbsp;
' . getLngt("Weitere Filterelemente anzeigen") . '&nbsp;&nbsp;
<input type="checkbox" name="f_crf_edit_enabled[]" value="' . $row["crf_short"] . '" ' . $f_crf_edit_enabled_0 . ' onChange="document.forms[0].submit();">
&nbsp;&nbsp;&nbsp;&nbsp;
' . getLngt("Filter verwalten") . '&nbsp;&nbsp;
<input type="checkbox" name="f_crf_modify_enabled[]" value="' . $row["crf_short"] . '" ' . $f_crf_modify_enabled_0 . ' onChange="document.forms[0].submit();">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</div>
';
echo defineButtonType08(getLngt("Sortieren"), "action_sort", "finishPage('sort');", "80");
echo htmlDivLineSpacer("20px");
if ($f_crf_modify_enabled == "1") :
echo '
<div style="float:left;">
<select class="f8np1" id="f_crf_type" name="f_crf_type">
<option value="0" selected>' . getLngt("Fahrzeugfilter") . '</option>
<option value="1">' . getLngt("Transporteursfilter") . '</option>
</select>
<select class="f8np1" id="f_crf_status" name="f_crf_status">
<option value="1" selected>' . getLngt("Pflichtfilter") . '</option>
<option value="2">' . getLngt("Optionaler Filter") . '</option>
</select>
<input type="text" class="f8np1" id="f_crf_short" name="f_crf_short" value="" size="4" maxlength="4" placeholder="' . getLngt("Kürzel") . '">
<input type="text" class="f8np1" id="f_crf_text" name="f_crf_text" value="" size="30" maxlength="50" placeholder="' . getLngt("Bezeichnung") . '">
<input type="text" class="f8np1" id="f_crf_sort" name="f_crf_sort" value="" size="5" maxlength="7" placeholder="' . getLngt("Sort.") . '">
&nbsp;&nbsp;
</div>
';
echo defineButtonType08(getLngt("Anlegen"), "action_insert", "finishPage('insert');", "80", "left", "3");
echo htmlDivLineSpacer("30px");
endif;
else :
echo "<input type=\"hidden\" name=\"f_crf_edit_enabled\" value=\"0\">";
endif;
?>
<!-- Filter -->
<div>
<table>
<tr>
<td>
<?php echo $output ?>
</td>
</tr>
</table>
</div>
<?php // echo htmlDivLineSpacer("15px"); ?>
</form>
</div>
</body>
</html>

668
html/admin/group.php Normal file
View File

@@ -0,0 +1,668 @@
<?php
/*=======================================================================
*
* group.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act", "generic", "f_hq_id", "f_grp_id", "f_grp_name", "showGroupMembers", "f_hq_visibility", "deactivateMenu"));
getLanguage(__FILE__);
$pageTitel = "GRUPPEN";
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
include_once ("../include/inc_filters.inc.php");
include_once ("../include/inc_group.inc.php");
getCurrentScript(__FILE__);
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
authCheckEmployeeRights($emp_id, "8", "1");
authCheckEmployeeRights($emp_id, "25", "1");
// Mandator filter
if ($f_hq_id == "") : $f_hq_id = array(); endif;
if (count($f_hq_id) == 0) : array_push($f_hq_id, $hq_id); endif;
// Initialize value
$outputFormatField = defineOutputFormats();
mcIsSet($generic, "1111");
mcIsSet($showGroupMembers);
mcIsSet($listOfEntries);
mcTrim($f_grp_name);
$hqIdToBeStored = $hq_id;
if ($f_hq_visibility == "" || count($f_hq_visibility) == 0) :
$f_hq_visibility = "0";
else:
$f_hq_visibility = "1";
$hqIdToBeStored = "0";
endif;
// *** Actions ***
if ($md_id != "" && $md_id > 0) :
if ($f_act == "saveGroupNew") :
if ($f_grp_name != "") :
if (!existsEntry("groups",array("md_id",$md_id,"grp_name",$f_grp_name))) :
insertStmt("groups", array("md_id",$md_id,"hq_id",$hqIdToBeStored,"grp_name",$f_grp_name));
$f_grp_name = "";
else :
$statusMessage = getLngt("Die eingegebene Gruppe existiert schon, evtl. in einer anderen Niederlassung!");
endif;
else :
$statusMessage = getLngt("Geben Sie bitte eine Gruppenbezeichnung ein!");
endif;
endif;
if ($f_act == "saveGroupModified") :
if ($f_grp_id != "" && $f_grp_name != "") :
if (existsEntry("groups",array("md_id",$md_id,"grp_id",$f_grp_id))) :
if (!existsEntry("groups",array("md_id",$md_id,"hq_id",$hq_id,"grp_name",$f_grp_name))) :
updateStmt("groups","grp_id",$f_grp_id,array("md_id",$md_id,"hq_id",$hqIdToBeStored,"grp_name", $f_grp_name));
$f_grp_name = "";
else :
$statusMessage = getLngt("Der eingegebene Gruppenname existiert schon, evtl. in einer anderen Niederlassung!");
endif;
else :
$statusMessage = getLngt("Die eingegebene Gruppe existiert nicht!");
endif;
else :
$statusMessage = getLngt("Geben Sie bitte eine Gruppenbezeichnung ein!");
endif;
endif;
if ($f_act == "saveGroupRemove") :
if ($f_grp_id != "") :
if (existsEntry("groups",array("grp_id",$f_grp_id))) :
// Check group for state "readonly"
$grpReadonly = getFieldValueFromId("groups","grp_id",$f_grp_id,"grp_readonly");
if ($grpReadonly == "0") :
// Remove all customer relations
$rowArray = getGroupMembers(array($f_grp_id), "cs", $f_hq_id);
$rowArrayLen = count($rowArray);
if ($rowArrayLen > 0) :
for ($j = 0; $j < $rowArrayLen; $j++) :
$csGroup = getFieldValueFromId("customer","cs_id",$rowArray[$j]["cs_id"],"cs_group");
$csGroup = removeItemFromFilterstring($csGroup, $f_grp_id);
updateStmt("customer", "cs_id", $rowArray[$j]["cs_id"], array("cs_group", $csGroup));
endfor;
endif;
// Remove all carrier relations
$rowArray = getGroupMembers(array($f_grp_id), "cr", $f_hq_id);
$rowArrayLen = count($rowArray);
if ($rowArrayLen > 0) :
for ($j = 0; $j < $rowArrayLen; $j++) :
$crGroup = getFieldValueFromId("courier","cr_id",$rowArray[$j]["cr_id"],"cr_group");
$crGroup = removeItemFromFilterstring($crGroup, $f_grp_id);
updateStmt("courier", "cr_id", $rowArray[$j]["cr_id"], array("cr_group", $crGroup));
endfor;
endif;
// Remove all employee relations
$rowArray = getGroupMembers(array($f_grp_id), "emp", $f_hq_id);
$rowArrayLen = count($rowArray);
if ($rowArrayLen > 0) :
for ($j = 0; $j < $rowArrayLen; $j++) :
$empGroup = getFieldValueFromId("employee","usr_id",$rowArray[$j]["usr_id"],"emp_group");
$empGroup = removeItemFromFilterstring($empGroup, $f_grp_id);
updateStmt("employee", "usr_id", $rowArray[$j]["usr_id"], array("emp_group", $empGroup));
endfor;
endif;
// Remove all article relations
$rowArray = getGroupMembers(array($f_grp_id), "at", $f_hq_id);
$rowArrayLen = count($rowArray);
if ($rowArrayLen > 0) :
for ($j = 0; $j < $rowArrayLen; $j++) :
$atGroup = getFieldValueFromId("article","at_id",$rowArray[$j]["at_id"],"at_group");
$atGroup = removeItemFromFilterstring($atGroup, $f_grp_id);
updateStmt("article", "at_id", $rowArray[$j]["at_id"], array("at_group", $atGroup));
endfor;
endif;
// Remove all service relations
$rowArray = getGroupMembers(array($f_grp_id), "srv", $f_hq_id, "1");
$rowArrayLen = count($rowArray);
if ($rowArrayLen > 0) :
for ($j = 0; $j < $rowArrayLen; $j++) :
$srvGroup = getFieldValueFromId("service","srv_id",$rowArray[$j]["srv_id"],"srv_group");
$srvGroup = removeItemFromFilterstring($srvGroup, $f_grp_id);
updateStmt("service", "srv_id", $rowArray[$j]["srv_id"], array("srv_group", $srvGroup));
endfor;
endif;
// Remove all servicetype relations
$rowArray = getGroupMembers(array($f_grp_id), "srvt", $f_hq_id, "1");
$rowArrayLen = count($rowArray);
if ($rowArrayLen > 0) :
for ($j = 0; $j < $rowArrayLen; $j++) :
$srvtGroup = getFieldValueFromId("servicetype","srvt_id",$rowArray[$j]["srvt_id"],"srvt_group");
$srvtGroup = removeItemFromFilterstring($srvtGroup, $f_grp_id);
updateStmt("servicetype", "srvt_id", $rowArray[$j]["srvt_id"], array("srvt_group", $srvtGroup));
endfor;
endif;
// Remove all metafieldcategory relations
$rowArray = getGroupMembers(array($f_grp_id), "mtfc", $f_hq_id, "1");
$rowArrayLen = count($rowArray);
if ($rowArrayLen > 0) :
for ($j = 0; $j < $rowArrayLen; $j++) :
$mtfcGroup = getFieldValueFromId("metafieldcategory","mtfc_id",$rowArray[$j]["mtfc_id"],"mtfc_group");
$mtfcGroup = removeItemFromFilterstring($mtfcGroup, $f_grp_id);
updateStmt("metafieldcategory", "mtfc_id", $rowArray[$j]["mtfc_id"], array("mtfc_group", $mtfcGroup));
endfor;
endif;
// Remove all metafieldtemplate relations
$rowArray = getGroupMembers(array($f_grp_id), "mtft", $f_hq_id, "1");
$rowArrayLen = count($rowArray);
if ($rowArrayLen > 0) :
for ($j = 0; $j < $rowArrayLen; $j++) :
$mtftGroup = getFieldValueFromId("metafieldtemplate","mtft_id",$rowArray[$j]["mtft_id"],"mtft_group");
$mtftGroup = removeItemFromFilterstring($mtftGroup, $f_grp_id);
updateStmt("metafieldtemplate", "mtft_id", $rowArray[$j]["mtft_id"], array("mtft_group", $mtftGroup));
endfor;
endif;
// Remove group
deleteStmt("groups","grp_id = '" . $f_grp_id . "'");
$f_grp_id = "";
$f_grp_name = "";
else :
$statusMessage = getLngt("Die angegebene Gruppe darf nicht gelöscht werden!");
endif;
else :
$statusMessage = getLngt("Die eingegebene Gruppe existiert nicht!");
endif;
else :
$statusMessage = getLngt("Wählen Sie die zu löschende Gruppe über die Spalte Bearbeiten aus!");
endif;
endif;
endif;
// Statement for groups
$whereClauseHq = " (grp.hq_id = '" . $hq_id . "' OR grp.hq_id = '0') ";
if ($f_hq_id != "" && count($f_hq_id) >= 1) :
$whereClauseHq = " (grp.hq_id IN " . getSQLMandatorArray($f_hq_id) . " OR grp.hq_id = '0') ";
endif;
$sqlquery = "SELECT grp.grp_id, grp.grp_name, grp.grp_readonly, grp.hq_id, hq.hq_mnemonic"
. " FROM groups AS grp"
. " LEFT JOIN headquarters AS hq ON grp.hq_id = hq.hq_id"
. " WHERE grp.md_id = '" . $md_id . "' AND " . $whereClauseHq
. " ORDER BY grp.grp_name";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
// Table with header
$numOfRows = 1;
$lineToggler = 0;
$tableOfRows = "<tr><td align=\"center\">" . getLngt("Gruppe") . "&nbsp;&nbsp;&nbsp;</td>";
if ($f_hq_id != "" && count($f_hq_id) >= 1) :
$tableOfRows .= "<td align=\"center\">" . getLngt("Niederlassung") . "&nbsp;&nbsp;&nbsp;</td>";
endif;
$tableOfRows .= "<td align=\"center\">&nbsp;" . getLngt("Bearbeiten") . "&nbsp;</td>";
$tableOfRows .= "<td align=\"center\">&nbsp;" . getLngt("Mitglieder") . "&nbsp;</td></tr>";
while ($row = $result->fetch_assoc()):
$numOfRows++;
if ($lineToggler == 0) : $lineToggler = 1; else : $lineToggler = 0; endif;
$cellColor = getListColor($numOfRows, $lineToggler);
$tableOfRows .= "<tr>";
$tableOfRows .= "<td align=\"left\" bgcolor=\"" . $cellColor ."\">&nbsp;" . $row["grp_name"] . "&nbsp;&nbsp;&nbsp;</td>";
if ($row["hq_id"] == "0") :
$tableOfRows .= "<td align=\"left\" bgcolor=\"" . $cellColor ."\">&nbsp;" . getLngt("Alle") . "&nbsp;&nbsp;&nbsp;</td>";
elseif ($f_hq_id != "" && count($f_hq_id) >= 1) :
$tableOfRows .= "<td align=\"left\" bgcolor=\"" . $cellColor ."\">&nbsp;" . $row["hq_mnemonic"] . "&nbsp;&nbsp;&nbsp;</td>";
endif;
$tableOfRows .= "<td align=\"center\" bgcolor=\"" . $cellColor ."\">&nbsp;";
if ($row["grp_readonly"] == "0") :
$tableOfRows .= "<a href=\"javascript:editGrp('" . $row["grp_id"] . "','" . $row["grp_name"] . "','" . $row["hq_id"] . "');\"><img src=\"../images/arrow_right.png\" border=\"0\" height=\"10\" width=\"25\"></a>";
endif;
$tableOfRows .= "</td>";
$tableOfRows .= "<td align=\"center\" bgcolor=\"" . $cellColor ."\">&nbsp;<a href=\"javascript:grpMembers('" . $row["grp_id"] . "');\"><img src=\"../images/arrow_right.png\" border=\"0\" height=\"10\" width=\"25\"></a></td>";
// $tableOfRows .= "<td align=\"center\" bgcolor=\"" . $cellColor ."\">&nbsp;<a href=\"javascript:finishPage('" . $row["grp_id"] . "','" . $row["grp_name"] . "');\">" . $row["grp_name"] . "</a></td>";
$tableOfRows .= "</tr>";
endwhile;
$result->free();
// Show members of the group if requested
if ($showGroupMembers == "1") :
$grpName = getFieldValueFromId("groups","grp_id",$f_grp_id,"grp_name");
$listOfEntries .= "<br>";
$listOfEntries .= "<table class=\"f12bp1\" border=\"0\" cellpadding=\"0\">";
$listOfEntries .= "<tr><td colspan=\"2\">" . getLngt("Mitglieder der Gruppe:") . " " . $grpName . "</td></tr>\n";
$listOfEntries .= "</table>";
$listOfEntries .= "<br><br>";
// Groups
$rowArray = getGroupMembers(array($f_grp_id), "grp", $f_hq_id);
$rowArrayLen = count($rowArray);
if ($rowArrayLen > 0) :
$titleArray = array(getLngt("Name&nbsp;"));
$fieldArray = array("grp_name");
$aligns = "l";
$alignArray = spliti(",",$aligns);
$alignTitles = "left";
$widths = "255";
$widthArray = spliti(",",$widths);
$summationField = "";
$mode = "2"; // Output from ARRAY
$sortDBField = ""; // Used in following include-file for sorting per column;
include ("../include/inc_list_defineoutput.inc.php");
endif;
$listOfEntries .= "<table class=\"f10np1\" border=\"0\" cellpadding=\"0\">";
if ($rowArrayLen > 0) :
$listOfEntries .= "<tr><td colspan=\"2\">" . getLngt("GRUPPEN:") . "</td></tr>\n";
$listOfEntries .= $tableHeader . $tableBody;
else :
$listOfEntries .= "<tr><td colspan=\"2\">" . getLngt("GRUPPEN:") . " " . getLngt("-Keine-") . "</td></tr>\n";
endif;
$listOfEntries .= "</table>";
$listOfEntries .= "<br><br>";
// Customers
$rowArray = getGroupMembers(array($f_grp_id), "cs", $f_hq_id);
$rowArrayLen = count($rowArray);
if ($rowArrayLen > 0) :
$titleArray = array(getLngt("EID&nbsp;"), getLngt("Firma&nbsp;"), getLngt("Zusatz&nbsp;"));
$fieldArray = array("cs_eid", "cmp_comp", "cmp_comp2");
$aligns = "l,l,l";
$alignArray = spliti(",",$aligns);
$alignTitles = "left";
$widths = "50";
$widthArray = spliti(",",$widths);
$summationField = "";
$mode = "2"; // Output from ARRAY
$sortDBField = ""; // Used in following include-file for sorting per column;
include ("../include/inc_list_defineoutput.inc.php");
endif;
$listOfEntries .= "<table class=\"f10np1\" border=\"0\" cellpadding=\"0\">";
if ($rowArrayLen > 0) :
$listOfEntries .= "<tr><td colspan=\"2\">" . getLngt("KUNDEN:") . "</td></tr>\n";
$listOfEntries .= $tableHeader . $tableBody;
else :
$listOfEntries .= "<tr><td colspan=\"2\">" . getLngt("KUNDEN:") . " " . getLngt("-Keine-") . "</td></tr>\n";
endif;
$listOfEntries .= "</table>";
$listOfEntries .= "<br><br>";
// Couriers
$rowArray = getGroupMembers(array($f_grp_id), "cr", $f_hq_id);
$rowArrayLen = count($rowArray);
if ($rowArrayLen > 0) :
$titleArray = array(getLngt("EID&nbsp;"), getLngt("Name&nbsp;"), getLngt("Vorname&nbsp;"));
$fieldArray = array("cr_eid", "usr_name", "usr_firstname");
$aligns = "l,l,l";
$alignArray = spliti(",",$aligns);
$alignTitles = "left";
$widths = "50";
$widthArray = spliti(",",$widths);
$summationField = "";
$mode = "2"; // Output from ARRAY
$sortDBField = ""; // Used in following include-file for sorting per column;
include ("../include/inc_list_defineoutput.inc.php");
endif;
$listOfEntries .= "<table class=\"f10np1\" border=\"0\" cellpadding=\"0\">";
if ($rowArrayLen > 0) :
$listOfEntries .= "<tr><td colspan=\"2\">" . getLngt("TRANSPORTEURE:") . "</td></tr>\n";
$listOfEntries .= $tableHeader . $tableBody;
else :
$listOfEntries .= "<tr><td colspan=\"2\">" . getLngt("TRANSPORTEURE:") . " " . getLngt("-Keine-") . "</td></tr>\n";
endif;
$listOfEntries .= "</table>";
$listOfEntries .= "<br><br>";
// Employees
$rowArray = getGroupMembers(array($f_grp_id), "emp", $f_hq_id);
$rowArrayLen = count($rowArray);
if ($rowArrayLen > 0) :
$titleArray = array(getLngt("Name&nbsp;"), getLngt("Vorname&nbsp;"));
$fieldArray = array("usr_name", "usr_firstname");
$aligns = "l,l";
$alignArray = spliti(",",$aligns);
$alignTitles = "left";
$widths = "50";
$widthArray = spliti(",",$widths);
$summationField = "";
$mode = "2"; // Output from ARRAY
$sortDBField = ""; // Used in following include-file for sorting per column;
include ("../include/inc_list_defineoutput.inc.php");
endif;
$listOfEntries .= "<table class=\"f10np1\" border=\"0\" cellpadding=\"0\">";
if ($rowArrayLen > 0) :
$listOfEntries .= "<tr><td colspan=\"2\">" . getLngt("MITARBEITER:") . "</td></tr>\n";
$listOfEntries .= $tableHeader . $tableBody;
else :
$listOfEntries .= "<tr><td colspan=\"2\">" . getLngt("MITARBEITER:") . " " . getLngt("-Keine-") . "</td></tr>\n";
endif;
$listOfEntries .= "</table>";
$listOfEntries .= "<br><br>";
// Branches
$rowArray = getGroupMembers(array($f_grp_id), "br", $f_hq_id);
$rowArrayLen = count($rowArray);
if ($rowArrayLen > 0) :
$titleArray = array(getLngt("Schlüssel&nbsp;"), getLngt("Bezeichnung&nbsp;"));
$fieldArray = array("br_key", "br_name");
$aligns = "l,l";
$alignArray = spliti(",",$aligns);
$alignTitles = "left";
$widths = "50";
$widthArray = spliti(",",$widths);
$summationField = "";
$mode = "2"; // Output from ARRAY
$sortDBField = ""; // Used in following include-file for sorting per column;
include ("../include/inc_list_defineoutput.inc.php");
endif;
$listOfEntries .= "<table class=\"f10np1\" border=\"0\" cellpadding=\"0\">";
if ($rowArrayLen > 0) :
$listOfEntries .= "<tr><td colspan=\"2\">" . getLngt("BRANCHEN:") . "</td></tr>\n";
$listOfEntries .= $tableHeader . $tableBody;
else :
$listOfEntries .= "<tr><td colspan=\"2\">" . getLngt("BRANCHEN:") . " " . getLngt("-Keine-") . "</td></tr>\n";
endif;
$listOfEntries .= "</table>";
$listOfEntries .= "<br><br>";
// Articles
$rowArray = getGroupMembers(array($f_grp_id), "at", $f_hq_id);
$rowArrayLen = count($rowArray);
if ($rowArrayLen > 0) :
$titleArray = array(getLngt("EID&nbsp;"), getLngt("Name&nbsp;"));
$fieldArray = array("at_eid", "at_name");
$aligns = "l,l";
$alignArray = spliti(",",$aligns);
$alignTitles = "left";
$widths = "50";
$widthArray = spliti(",",$widths);
$summationField = "";
$mode = "2"; // Output from ARRAY
$sortDBField = ""; // Used in following include-file for sorting per column;
include ("../include/inc_list_defineoutput.inc.php");
endif;
$listOfEntries .= "<table class=\"f10np1\" border=\"0\" cellpadding=\"0\">";
if ($rowArrayLen > 0) :
$listOfEntries .= "<tr><td colspan=\"2\">" . getLngt("ARTIKEL:") . "</td></tr>\n";
$listOfEntries .= $tableHeader . $tableBody;
else :
$listOfEntries .= "<tr><td colspan=\"2\">" . getLngt("ARTIKEL:") . " " . getLngt("-Keine-") . "</td></tr>\n";
endif;
$listOfEntries .= "</table>";
$listOfEntries .= "<br><br>";
// Service
$rowArray = getGroupMembers(array($f_grp_id), "srv", $f_hq_id, "1");
$rowArrayLen = count($rowArray);
if ($rowArrayLen > 0) :
$titleArray = array(getLngt("Name&nbsp;"));
$fieldArray = array("srv_name");
$aligns = "l";
$alignArray = spliti(",",$aligns);
$alignTitles = "left";
$widths = "50";
$widthArray = spliti(",",$widths);
$summationField = "";
$mode = "2"; // Output from ARRAY
$sortDBField = ""; // Used in following include-file for sorting per column;
include ("../include/inc_list_defineoutput.inc.php");
endif;
$listOfEntries .= "<table class=\"f10np1\" border=\"0\" cellpadding=\"0\">";
if ($rowArrayLen > 0) :
$listOfEntries .= "<tr><td colspan=\"2\">" . getLngt("PREISTYPEN:") . "</td></tr>\n";
$listOfEntries .= $tableHeader . $tableBody;
else :
$listOfEntries .= "<tr><td colspan=\"2\">" . getLngt("PREISTYPEN:") . " " . getLngt("-Keine-") . "</td></tr>\n";
endif;
$listOfEntries .= "</table>";
$listOfEntries .= "<br><br>";
// Servicetypes
$rowArray = getGroupMembers(array($f_grp_id), "srvt", $f_hq_id, "1");
$rowArrayLen = count($rowArray);
if ($rowArrayLen > 0) :
$titleArray = array(getLngt("Name&nbsp;"));
$fieldArray = array("srvt_name");
$aligns = "l";
$alignArray = spliti(",",$aligns);
$alignTitles = "left";
$widths = "50";
$widthArray = spliti(",",$widths);
$summationField = "";
$mode = "2"; // Output from ARRAY
$sortDBField = ""; // Used in following include-file for sorting per column;
include ("../include/inc_list_defineoutput.inc.php");
endif;
$listOfEntries .= "<table class=\"f10np1\" border=\"0\" cellpadding=\"0\">";
if ($rowArrayLen > 0) :
$listOfEntries .= "<tr><td colspan=\"2\">" . getLngt("LEISTUNGSTYPEN:") . "</td></tr>\n";
$listOfEntries .= $tableHeader . $tableBody;
else :
$listOfEntries .= "<tr><td colspan=\"2\">" . getLngt("LEISTUNGSTYPEN:") . " " . getLngt("-Keine-") . "</td></tr>\n";
endif;
$listOfEntries .= "</table>";
$listOfEntries .= "<br><br>";
// Metafieldcategories
$rowArray = getGroupMembers(array($f_grp_id), "mtfc", $f_hq_id, "1");
$rowArrayLen = count($rowArray);
if ($rowArrayLen > 0) :
$titleArray = array(getLngt("Name&nbsp;"));
$fieldArray = array("mtfc_description");
$aligns = "l";
$alignArray = spliti(",",$aligns);
$alignTitles = "left";
$widths = "50";
$widthArray = spliti(",",$widths);
$summationField = "";
$mode = "2"; // Output from ARRAY
$sortDBField = ""; // Used in following include-file for sorting per column;
include ("../include/inc_list_defineoutput.inc.php");
endif;
$listOfEntries .= "<table class=\"f10np1\" border=\"0\" cellpadding=\"0\">";
if ($rowArrayLen > 0) :
$listOfEntries .= "<tr><td colspan=\"2\">" . getLngt("KATEGORIEN:") . "</td></tr>\n";
$listOfEntries .= $tableHeader . $tableBody;
else :
$listOfEntries .= "<tr><td colspan=\"2\">" . getLngt("KATEGORIEN:") . " " . getLngt("-Keine-") . "</td></tr>\n";
endif;
$listOfEntries .= "</table>";
$listOfEntries .= "<br><br>";
// Metafieldtemplates
$rowArray = getGroupMembers(array($f_grp_id), "mtft", $f_hq_id, "1");
$rowArrayLen = count($rowArray);
if ($rowArrayLen > 0) :
$titleArray = array(getLngt("Name&nbsp;"));
$fieldArray = array("mtft_name");
$aligns = "l";
$alignArray = spliti(",",$aligns);
$alignTitles = "left";
$widths = "50";
$widthArray = spliti(",",$widths);
$summationField = "";
$mode = "2"; // Output from ARRAY
$sortDBField = ""; // Used in following include-file for sorting per column;
include ("../include/inc_list_defineoutput.inc.php");
endif;
$listOfEntries .= "<table class=\"f10np1\" border=\"0\" cellpadding=\"0\">";
if ($rowArrayLen > 0) :
$listOfEntries .= "<tr><td colspan=\"2\">" . getLngt("TEMPLATES:") . "</td></tr>\n";
$listOfEntries .= $tableHeader . $tableBody;
else :
$listOfEntries .= "<tr><td colspan=\"2\">" . getLngt("TEMPLATES:") . " " . getLngt("-Keine-") . "</td></tr>\n";
endif;
$listOfEntries .= "</table>";
$listOfEntries .= "<br><br>";
$showGroupMembers = ""; // Init
endif;
?>
<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 type="text/javascript">
<!--
// NAVIGATION
<?php echo $jsMenuOut; ?>
// GENERIC function
function finishPage(grp_id,grp_name) {
<?php if (substr($generic, 0,1) == "1") : ?> opener.document.forms[0].g_grp_id.value = grp_id; <?php endif; ?>
<?php if (substr($generic, 2,1) == "1") : ?> opener.document.forms[0].g_grp_name.value = grp_name; <?php endif; ?>
self.close();
};
function finishPage2(f_act) {
document.forms[0].f_act.value = f_act;
document.forms[0].submit();
};
function finishPage3(f_act) {
if (confirm('<?php echo getLngt("Möchten Sie die selektierte Gruppe wirklich entfernen? Bei allen Mitgliedern würden ebenfalls die Beziehungen gelöscht!") ?>')) {
document.forms[0].f_act.value = f_act;
document.forms[0].submit();
};
};
function editGrp(grp_id, grp_name, hq_id) {
document.forms[0].f_grp_id.value = grp_id;
document.forms[0].f_grp_name.value = grp_name;
if (hq_id == '0') {
document.getElementsByName('f_hq_visibility[]')[0].checked = true;
} else {
document.getElementsByName('f_hq_visibility[]')[0].checked = false;
}
};
function grpMembers(grp_id) {
document.forms[0].f_grp_id.value = grp_id;
document.forms[0].f_grp_name.value = '';
document.forms[0].showGroupMembers.value = '1';
document.forms[0].submit();
};
function openGroups() {
var widthPopupWin = 800;
var heightPopupWin = 700;
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
var popupWin;
var groupId = document.forms[0].f_grp_id.value;
if (groupId != '') {
popupWin = window.open("../admin/groupmembers.php?itemType=grp&itemId=" + groupId,"","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
} else {
alert('<?php getLngt("Es wurde keine Gruppe ausgewählt!") ?>');
}
};
-->
</script>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>displayStatusMessage();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="maincontent2" name="maincontent" id="maincontent">
<form action="../admin/group.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="generic" value="<?php echo $generic ?>">
<input type="hidden" name="f_grp_id" value="<?php echo $f_grp_id ?>">
<input type="hidden" name="showGroupMembers" value="<?php echo $showGroupMembers ?>">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<?php echo htmlDivLineSpacer("10px"); ?>
<!-- Headquarters checkboxes -->
<?php if (authCheckEmployeeRights($emp_id, "10")) : ?>
<?php echo getHeadquartersCheckboxes($f_hq_id); ?>
<?php echo htmlDivLineSpacer("10px", "", "left"); ?>
<?php endif; ?>
<div>
<?php echo defineButtonType10(getLngt("Anzeigen"), "action_show", "finishPage2('');", "120", "left", "3"); ?>
</div>
<?php echo htmlDivLineSpacer("20px", "", "left"); ?>
<div>
<table class="f10np1" border="0" cellpadding="0">
<?php echo $tableOfRows ?>
</table>
</div>
<?php echo htmlDivLineSpacer("20px"); ?>
<div>
<?php echo getLngt("(Neue) Gruppe:") ?>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<div>
<div <?php echo setStyleHtmlDiv("150px","left"); ?>><?php echo getLngt("Bezeichnung:") ?></div>
<div>
<input type="text" name="f_grp_name" value="<?php echo $f_grp_name ?>" maxlength="100" size="30">
</div>
</div>
<?php echo htmlDivLineSpacer("5px"); ?>
<div>
<div <?php echo setStyleHtmlDiv("200px","left"); ?>><?php echo getLngt("Für alle Zentralen sichtbar:") ?></div>
<div>
<input type="checkbox" name="f_hq_visibility[]" value="1">
</div>
</div>
<?php echo htmlDivLineSpacer("20px", "", "left"); ?>
<div>
<?php echo defineButtonType10(getLngt("Hinzufügen"), "action_new", "finishPage2('saveGroupNew');", "120", "left", "3"); ?>
<?php echo defineButtonType10(getLngt("Umbenennen"), "action_rename", "finishPage2('saveGroupModified');", "120", "left", "3"); ?>
<?php echo defineButtonType10(getLngt("Löschen"), "action_remove", "finishPage3('saveGroupRemove');", "120", "left", "3"); ?>
<?php echo defineButtonType08(getLngt("Gruppen"), "action_grp", "openGroups();", "120", "left", "3");?>
<?php // echo defineButtonType10(getLngt("Schließen"), "action_close", "window.close();", "120", "left", "3"); ?>
</div>
<?php echo htmlDivLineSpacer("30px", "", "left"); ?>
<div>
<?php echo $listOfEntries ?>
</div>
<?php echo htmlDivLineSpacer("20px"); ?>
</form>
</div>
</body>
</html>

273
html/admin/groupmembers.php Normal file
View File

@@ -0,0 +1,273 @@
<?php
/*=======================================================================
*
* groupmembers.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
// include_once ("../include/html.inc.php");
include_once ("../include/inc_filters.inc.php");
$httpVarsArray = array("f_act", "itemId", "itemType", "orderClause", "statusMessage", "f_group", "deactivateMenu");
getSecHttpVars("1", $httpVarsArray);
getLanguage(__FILE__);
$deactivateMenuStatic = "1";
$pageTitel = getLngt("GRUPPENZUGEHÖRIGKEIT");
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
getCurrentScript(__FILE__);
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
authCheckEmployeeRights($emp_id, "1", "1");
// Only for output
$htmlClass01 = "class=\"smaller\""; // input,select
$html_td_01 = "valign=\"top\" align=\"left\""; // input
$html_td_02 = "valign=\"top\" align=\"right\""; // input
// Implode groups
$f_group2 = getImplodedFilterstring($f_group);
// Set group(s) of the item (courier, customer, article, prospect, vehicle, etc.)
if ($md_id != "" && $md_id > 0) :
if ($f_act == "setGroup" && $itemId != "") :
TA("B");
// Group (Groups can be associated to other groups)
if ($itemType == "grp") :
updateStmt("groups","grp_id",$itemId,array("grp_group", $f_group2));
writeToLogDB("83",$hq_id,"",$usr_id,"","","","GROUPS=".$f_group2);
endif;
// Courier
if ($itemType == "cr") :
updateStmt("courier","cr_id",$itemId,array("cr_group", $f_group2));
writeToLogDB("77",$hq_id,"",$usr_id,$itemId,"","","GROUPS=".$f_group2);
endif;
// Customer
if ($itemType == "cs") :
updateStmt("customer","cs_id",$itemId,array("cs_group", $f_group2));
writeToLogDB("78",$hq_id,"",$usr_id,"","",$itemId,"GROUPS=".$f_group2);
endif;
// Article
if ($itemType == "at") :
updateStmt("article","at_id",$itemId,array("at_group", $f_group2));
writeToLogDB("79",$hq_id,"",$usr_id,"","","","GROUPS=".$f_group2,$itemId);
endif;
// Branch
if ($itemType == "br") :
updateStmt("branch","br_id",$itemId,array("br_group", $f_group2));
writeToLogDB("80",$hq_id,"",$usr_id,"","","","GROUPS=".$f_group2,"",$itemId);
endif;
// Vehicle
if ($itemType == "crvh") :
updateStmt("couriervehicle","crvh_id",$itemId,array("crvh_group", $f_group2));
writeToLogDB("81",$hq_id,"",$usr_id,"","","","GROUPS=".$f_group2);
endif;
// Employee
if ($itemType == "emp") :
updateStmt("employee","emp_id",$itemId,array("emp_group", $f_group2));
writeToLogDB("82",$hq_id,"",$usr_id,"","","","GROUPS=".$f_group2,"","",$itemId);
endif;
// Service
if ($itemType == "srv") :
updateStmt("service","srv_id",$itemId,array("srv_group", $f_group2));
// writeToLogDB("83",$hq_id,"",$usr_id,"","","","GROUPS=".$f_group2,"","",$itemId);
endif;
// Servicetype
if ($itemType == "srvt") :
updateStmt("servicetype","srvt_id",$itemId,array("srvt_group", $f_group2));
// writeToLogDB("84",$hq_id,"",$usr_id,"","","","GROUPS=".$f_group2,"","",$itemId);
endif;
// Metafieldcategory
if ($itemType == "mtfc") :
updateStmt("metafieldcategory","mtfc_id",$itemId,array("mtfc_group", $f_group2));
// writeToLogDB("xx",$hq_id,"",$usr_id,"","","","GROUPS=".$f_group2,"","",$itemId);
endif;
// Metafieldtemplate
if ($itemType == "mtft") :
updateStmt("metafieldtemplate","mtft_id",$itemId,array("mtft_group", $f_group2));
// writeToLogDB("xx",$hq_id,"",$usr_id,"","","","GROUPS=".$f_group2,"","",$itemId);
endif;
TA("C");
TA("E");
endif;
endif;
// Get group membership of the current item
$f_group = "";
$title = "";
if ($itemType == "grp") :
$f_group = getFieldValueFromId("groups", "grp_id", $itemId, "grp_group");
$tmp_grp_name = getFieldValueFromId("groups", "grp_id", $itemId, "grp_name");
$title .= "<span class=\"f14bp1_blue\">" . getLngt("Gruppe") . "</span> &nbsp;&nbsp;" . $tmp_grp_name;
endif;
if ($itemType == "cr") :
$f_group = getFieldValueFromId("courier", "cr_id", $itemId, "cr_group");
$tmp_usr_id = getFieldValueFromId("courier", "cr_id", $itemId, "usr_id");
$tmpFields = getFieldsValueFromId("user","usr_id",$tmp_usr_id,array("usr_name","usr_firstname"));
$title .= "<span class=\"f14bp1_blue\">" . getLngt("Transporteur") . "</span> &nbsp;&nbsp;" . $tmpFields[1] . " " . $tmpFields[0];
endif;
if ($itemType == "cs") :
$f_group = getFieldValueFromId("customer", "cs_id", $itemId, "cs_group");
$tmp_cmp_id = getFieldValueFromId("customer", "cs_id", $itemId, "cmp_id");
$tmpFields = getFieldsValueFromId("company","cmp_id",$tmp_cmp_id,array("cmp_comp","cmp_comp2"));
$title .= "<span class=\"f14bp1_blue\">" . getLngt("Kunde") . "</span> &nbsp;&nbsp;" . $tmpFields[0] . " " . $tmpFields[1];
endif;
if ($itemType == "at") :
$f_group = getFieldValueFromId("article", "at_id", $itemId, "at_group");
$tmp_at_name = getFieldValueFromId("article", "at_id", $itemId, "at_name");
$title .= "<span class=\"f14bp1_blue\">" . getLngt("Artikel") . "</span> &nbsp;&nbsp;" . $tmp_at_name;
endif;
if ($itemType == "br") :
$f_group = getFieldValueFromId("branch", "br_id", $itemId, "br_group");
$tmpFields = getFieldsValueFromId("branch","br_id",$itemId,array("br_key","br_name"));
$title .= "<span class=\"f14bp1_blue\">" . getLngt("Branche") . "</span> &nbsp;&nbsp;" . $tmpFields[0] . " " . $tmpFields[1];
endif;
if ($itemType == "crvh") :
$f_group = getFieldValueFromId("couriervehicle", "crvh_id", $itemId, "crvh_group");
$tmp_crvh_sid = getFieldValueFromId("couriervehicle", "crvh_id", $itemId, "crvh_sid");
$title .= "<span class=\"f14bp1_blue\">" . getLngt("Fahrzeug") . "</span> &nbsp;&nbsp;" . $tmp_crvh_sid;
endif;
if ($itemType == "emp") :
$f_group = getFieldValueFromId("employee", "emp_id", $itemId, "emp_group");
$tmp_usr_id = getFieldValueFromId("employee", "emp_id", $itemId, "usr_id");
$tmpFields = getFieldsValueFromId("user","usr_id",$tmp_usr_id,array("usr_name","usr_firstname"));
$title .= "<span class=\"f14bp1_blue\">" . getLngt("Mitarbeiter") . "</span> &nbsp;&nbsp;" . $tmpFields[1] . " " . $tmpFields[0];
endif;
if ($itemType == "srv") :
$f_group = getFieldValueFromId("service", "srv_id", $itemId, "srv_group");
$tmp_srv_name = getFieldValueFromId("service", "srv_id", $itemId, "srv_name");
$title .= "<span class=\"f14bp1_blue\">" . getLngt("Preistyp") . "</span> &nbsp;&nbsp;" . $tmp_srv_name;
endif;
if ($itemType == "srvt") :
$f_group = getFieldValueFromId("servicetype", "srvt_id", $itemId, "srvt_group");
$tmp_srvt_name = getFieldValueFromId("servicetype", "srvt_id", $itemId, "srvt_name");
$title .= "<span class=\"f14bp1_blue\">" . getLngt("Leistungstyp") . "</span> &nbsp;&nbsp;" . $tmp_srvt_name;
endif;
if ($itemType == "mtfc") :
$f_group = getFieldValueFromId("metafieldcategory", "mtfc_id", $itemId, "mtfc_group");
$tmp_mtfc_name = getFieldValueFromId("metafieldcategory", "mtfc_id", $itemId, "mtfc_description");
$title .= "<span class=\"f14bp1_blue\">" . getLngt("Kategorie") . "</span> &nbsp;&nbsp;" . $tmp_mtfc_name;
endif;
if ($itemType == "mtft") :
$f_group = getFieldValueFromId("metafieldtemplate", "mtft_id", $itemId, "mtft_group");
$tmp_mtft_name = getFieldValueFromId("metafieldtemplate", "mtft_id", $itemId, "mtft_name");
$title .= "<span class=\"f14bp1_blue\">" . getLngt("Template") . "</span> &nbsp;&nbsp;" . $tmp_mtft_name;
endif;
$f_group = substr($f_group, 1, (strlen($f_group) - 2) );
$f_group = spliti(",",$f_group);
$output = addCheckboxesFromTable("f_group", "groups", "grp_id", "grp_name", "grp_name", "md_id = '" . $md_id . "' AND (hq_id = '" . $hq_id . "' OR hq_id = '0')", $f_group, "<br><br>");
$pageHeadline = "<span class=\"f14bp1_blue\">" . strtoupper($pageTitel) . "</span>" . " &nbsp;&nbsp;&nbsp;&nbsp;" . $title;
?>
<html>
<head>
<title><?php echo $pageTitel ?></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 src="../include/searchLists.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
// NAVIGATION
<?php echo $jsMenuOut; ?>
function finishPage(mode) {
var ok = true;
if (mode == 'save') {
if (ok) {
document.forms[0].f_act.value='setGroup';
document.forms[0].submit();
};
}
if (mode == 'reset') {
document.location.href = "groupmembers.php?itemType=<?php echo ec($itemType) ?>&itemId=<?php echo ec($itemId) ?>";
}
};
-->
</script>
</head>
<body class="menu_bgcol" onLoad="<?php echo $phpCurrentNavigationOnLoad ?>displayStatusMessage();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="mc_page-header">
<?php echo $pageHeadline ?>
</div>
<?php // echo htmlDivLineSpacer("5px", "", "left"); ?>
<div>
<?php echo defineButtonType10(getLngt("Speichern"), "action_save", "finishPage('save');", "120", "left", "20"); ?>
<?php echo defineButtonType10(getLngt("Zurücksetzen"), "action_close", "finishPage('reset');", "120", "left", "0"); ?>
<?php echo defineButtonType10(getLngt("Schließen"), "action_close", "window.close();", "120", "left", "0"); ?>
</div>
<div class="maincontent mc_elem" name="maincontent" id="maincontent">
<form action="../admin/groupmembers.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="itemId" value="<?php echo ec($itemId) ?>">
<input type="hidden" name="itemType" value="<?php echo ec($itemType) ?>">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<?php echo htmlDivLineSpacer("20px"); ?>
<!-- Groups -->
<div>
<table>
<tr>
<td>
<?php echo $output ?>
</td>
</tr>
</table>
</div>
</form>
</div>
</body>
</html>

654
html/admin/history.php Normal file
View File

@@ -0,0 +1,654 @@
<?php
/*=======================================================================
*
* history.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
include_once ("../include/inc_job.inc.php");
include_once ("../include/inc_history.inc.php");
// Check HTTP-Parameters
getSecHttpVars("1",array("history_mode", "f_act", "customerId", "cscIdRoot", "cscIdActual", "empIdMaster", "cs_id", "cr_id", "job_id", "at_id", "empIdHist", "op",
"day_from", "month_from", "year_from", "day_to", "month_to", "year_to", "dbhistory", "deactivateMenu", "logoselection", "displayselection"));
getLanguage(__FILE__);
if (!isset($op) || $op == "") : $op = "0"; endif;
if (!isset($logoselection) || $logoselection == "") : $logoselection = "0"; endif;
// Potential employee restrictions regarding rights
$historyEmpRightArr = array_fill(0, 100, true);
if (!authCheckEmployeeRights($emp_id, "40")) : $historyEmpRightArr[40] = false; endif;
if (!authCheckEmployeeRights($emp_id, "41")) : $historyEmpRightArr[41] = false; endif;
// $history_mode:
// "0" : Customer
// "1" : Courier
// "2" : Job
// "3" : Article
// "4" : Employee
$typeArray = array();
if ($history_mode == "0") :
$typeArray["mode"] = "cs";
$typeArray["id"] = $cs_id;
$typeArray["auth"] = "0";
$typeArray["pagetitle"] = getLngt("KUNDENHISTORIE");
$typeArray["dateselection"] = "1";
$typeArray["logomapping"] = array("1" => "36", "2" => "48");
$typeArray["logoselection"] = "
<select class=\"f8np1\" id=\"logoselection\" name=\"logoselection\" onChange=\"setDisplaySelection();\">
<option value=\"0\">" . getLngt("FILTER") . "</option>
<option value=\"1\" " . ($logoselection == "1" ? "selected" : "") . ">" . getLngt("Kundenänderungen") . "</option>
<option value=\"2\" " . ($logoselection == "2" ? "selected" : "") . ">" . getLngt("Kostenstellenanschriften") . "</option>
</select>&nbsp;&nbsp;&nbsp;&nbsp;
<select class=\"f8np1\" id=\"displayselection\" name=\"displayselection\" onChange=\"checkLogoSelection();\">
<option value=\"0\" " . ($displayselection == "0" ? "selected" : "") . ">" . getLngt("Alle Felder") . "</option>
<option value=\"1\" " . ($displayselection == "1" ? "selected" : "") . ">" . getLngt("Nur geänderte") . "</option>
</select>
";
elseif ($history_mode == "1") :
$typeArray["mode"] = "cr";
$typeArray["id"] = $cr_id;
$typeArray["auth"] = "1";
$typeArray["pagetitle"] = getLngt("TRANSPORTEURSHISTORIE");
if ($logoselection == "2") :
$typeArray["pagetitle"] = getLngt("FAHRZEUGHISTORIE DES TRANSPORTEURS");
endif;
$typeArray["dateselection"] = "1";
$typeArray["logomapping"] = array("1" => "37", "2" => "86");
$typeArray["logoselection"] = "
<select class=\"f8np1\" id=\"logoselection\" name=\"logoselection\" onChange=\"setDisplaySelection();\">
<option value=\"0\">" . getLngt("FILTER") . "</option>
<option value=\"1\" " . ($logoselection == "1" ? "selected" : "") . ">" . getLngt("Transporteursänderungen") . "</option>
<option value=\"2\" " . ($logoselection == "2" ? "selected" : "") . ">" . getLngt("Fahrzeugänderungen") . "</option>
</select>&nbsp;&nbsp;&nbsp;&nbsp;
<select class=\"f8np1\" id=\"displayselection\" name=\"displayselection\" onChange=\"checkLogoSelection();\">
<option value=\"0\" " . ($displayselection == "0" ? "selected" : "") . ">" . getLngt("Alle Felder") . "</option>
<option value=\"1\" " . ($displayselection == "1" ? "selected" : "") . ">" . getLngt("Nur geänderte") . "</option>
</select>
";
elseif ($history_mode == "2") :
$typeArray["mode"] = "jb";
$typeArray["id"] = $job_id;
$typeArray["auth"] = "4";
$typeArray["pagetitle"] = getLngt("AUFTRAGSHISTORIE");
$typeArray["dateselection"] = "0";
$typeArray["logomapping"] = array();
$typeArray["logoselection"] = "";
elseif ($history_mode == "3") :
$typeArray["mode"] = "at";
$typeArray["id"] = $at_id;
$typeArray["auth"] = "14";
$typeArray["pagetitle"] = getLngt("ARTIKELHISTORIE");
$typeArray["dateselection"] = "1";
$typeArray["logomapping"] = array();
$typeArray["logoselection"] = "";
elseif ($history_mode == "4") :
$typeArray["mode"] = "emp";
$typeArray["id"] = $empIdHist;
$typeArray["auth"] = "32";
$typeArray["pagetitle"] = getLngt("MITARBEITERHISTORIE");
$typeArray["dateselection"] = "1";
$typeArray["logomapping"] = array();
$typeArray["logoselection"] = "";
endif;
$deactivateMenuStatic = "1";
$pageTitel = $typeArray["pagetitle"];
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
getCurrentScript(__FILE__);
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
if (!authCheckEmployeeRights($emp_id, $typeArray["auth"])) : gotoReferer("1"); endif;
// Get the emp_id of the root admin because he/she is allowed to change a password of an employee
$empIdRootAdmin = getEmpIdOfRootAdmin($userTypeName);
// For limitation of the rows displayed
$limitOfRowsDisplayed = "2500";
// Get the array for formatting the database-values for the output according to the defined type
$outputFormatField = defineOutputFormats();
if ($op != "0") :
$day_from = "01"; $month_from = "01"; $year_from = "2020";
$day_to = getDateTime("day"); $month_to = getDateTime("month"); $year_to = getDateTime("year");
endif;
// Check range of date. All fields have to be set
if ($day_from == "" || $month_from == "" || $year_from == "" ||
$day_to == "" || $month_to == "" || $year_to == "") :
// Initialize date-ranges to the current date
$fromDateRange = getDateTime("3") . " 00:00:00";
$toDateRange = getDateTime("3") . " 23:59:59";
$day_from = getDateTime("day");
$month_from = getDateTime("month");
$year_from = getDateTime("year");
$day_to = getDateTime("day");
$month_to = getDateTime("month");
$year_to = getDateTime("year");
else :
$fromDateRange = $year_from . "-" . pad($month_from,2) . "-" . pad($day_from,2) . " 00:00:00";
$toDateRange = $year_to . "-" . pad($month_to,2) . "-" . pad($day_to,2) . " 23:59:59";
endif;
// Get the year of the begin of history data
$dbhistory = getDBNames($dbhistory, $year_from);
/*
echo "op = " . $op . "<br>";
echo "logoselection = " . $logoselection . "<br>";
echo "displayselection = " . $displayselection . "<br>";
echo "fromDateRange = " . $fromDateRange . "<br>";
echo "toDateRange = " . $toDateRange . "<br>";
*/
// --- CUSTOMER HISTORY ------------------
if ($typeArray["mode"] == "cs") :
// From table "log"
$fieldClause = getDBFields("logoperation") . "," . getDBFields("log") . "," . getDBFields("user") . " ";
$fromClause = "phoenix_log.logoperation AS logo, phoenix_log." . $dbh_log . " AS log " .
"LEFT JOIN phoenix.user AS usr ON log.usr_id = usr.usr_id ";
// Pre-Statement to get the last modification entry to compare with the first of selectet date range
$fromDateRangeSql = $fromDateRange;
$toDateRangeSql = $toDateRange;
$tmpMaxLogCreatetime = "";
if ($logoselection > "0" && count($typeArray["logomapping"]) > 0) :
$whereClausePre = "log.cs_id = '" . $cs_id . "' AND "
. " log.logo_id = '" . $typeArray["logomapping"][$logoselection] . "' AND "
. " log.logo_id = logo.logo_id AND "
. " log.log_createtime < '" . $fromDateRange . "'";
$tmpMaxLogCreatetime = getMaxOfField("phoenix_log.logoperation AS logo, phoenix_log.log AS log", "log.log_createtime", $whereClausePre);
if ($tmpMaxLogCreatetime != "") :
$fromDateRangeSql = $tmpMaxLogCreatetime;
endif;
endif;
$whereClause = "log.cs_id = '" . $cs_id . "' AND "
. ($logoselection > "0" && count($typeArray["logomapping"]) > 0 ? "log.logo_id = '" . $typeArray["logomapping"][$logoselection] . "' AND " : "")
. " log.logo_id = logo.logo_id AND"
. " log.log_createtime >= '" . $fromDateRangeSql . "' AND"
. " log.log_createtime <= '" . $toDateRangeSql . "'";
// $orderByClause = "log.log_createtime LIMIT 0," . $limitOfRowsDisplayed;
$orderByClause = ($logoselection > "0" && count($typeArray["logomapping"]) > 0 ? "log.logo_id, " : "")
. ($logoselection == "2" && count($typeArray["logomapping"]) > 0 ? "CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(logo_description, '|ADT_ID=', -1),'|', 1) AS UNSIGNED), " : "")
. "log.log_id LIMIT 0," . $limitOfRowsDisplayed;
$sqlquery = generateStatement($fieldClause,$fromClause,$whereClause,$orderByClause);
// echo $sqlquery . "<br><br>";
// Send request to database
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
// Generate list with header
$titleArray = array(getLngt("Vorgang") . "&nbsp;&nbsp;",getLngt("Zeitpunkt") . "&nbsp;&nbsp;",getLngt("Name") . "&nbsp;&nbsp;",getLngt("Vorname") . "&nbsp;&nbsp;",getLngt("Telefon") . "&nbsp;&nbsp;",getLngt("Details"));
$fieldArray = array("logo_op_shortname","log_createtime","usr_name","usr_firstname","usr_phone","logo_description");
$aligns = "l,c,l,l,l,l";
$alignArray = spliti(",",$aligns);
$alignTitles = "center";
$widths = "180,130,150,150,80,350";
$widthArray = spliti(",",$widths);
$summationField = "";
$postParserField = "logo_description";
$mode = "1"; // Output from DB-RESULT
$sortDBField = ""; // Used in following include-file for sorting per column;
if ($logoselection > "0" && count($typeArray["logomapping"]) > 0) :
$noDisplayBoolCondition = array("log_createtime", ">=", $fromDateRange);
endif;
include ("../include/inc_list_defineoutput.inc.php");
$result->free();
// *** ONLY OUTPUT ***
// Customer
$cmpId = getFieldValueFromId("customer", "cs_id", $cs_id, "cmp_id");
$tmpFields = getFieldsValueFromId("company","cmp_id",$cmpId,array("cmp_comp","cmp_comp2"));
$csCmpComp = $tmpFields[0];
$csCmpComp2 = $tmpFields[1];
// Post parsing if necessary
if ($postParserField != "") :
$tableBody = postParseCsHistory($tableBody, ($logoselection > "0" ? true : false));
endif;
// Invert all occurrences of "<tr>"
$tableBody = reverseOuterTableRows($tableBody);
endif;
// --- COURIER HISTORY ------------------
if ($typeArray["mode"] == "cr") :
// From table "log"
$fieldClause = getDBFields("logoperation") . "," . getDBFields("log") . "," . getDBFields("user") . " ";
$fromClause = "phoenix_log.logoperation AS logo, phoenix_log." . $dbh_log . " AS log " .
"LEFT JOIN phoenix.user AS usr ON log.usr_id = usr.usr_id ";
// Pre-Statement to get the last modification entry to compare with the first of selectet date range
$fromDateRangeSql = $fromDateRange;
$toDateRangeSql = $toDateRange;
$tmpMaxLogCreatetime = "";
if ($logoselection > "0" && count($typeArray["logomapping"]) > 0) :
$whereClausePre = "log.cr_id = '" . $cr_id . "' AND "
. " log.logo_id = '" . $typeArray["logomapping"][$logoselection] . "' AND "
. " log.logo_id = logo.logo_id AND "
. " log.log_createtime < '" . $fromDateRange . "'";
$tmpMaxLogCreatetime = getMaxOfField("phoenix_log.logoperation AS logo, phoenix_log.log AS log", "log.log_createtime", $whereClausePre);
if ($tmpMaxLogCreatetime != "") :
$fromDateRangeSql = $tmpMaxLogCreatetime;
endif;
endif;
$whereClause = "log.cr_id = '" . $cr_id . "' AND "
. ($logoselection > "0" && count($typeArray["logomapping"]) > 0 ? "log.logo_id = '" . $typeArray["logomapping"][$logoselection] . "' AND " : "")
. " log.logo_id = logo.logo_id AND "
. " log.log_createtime >= '" . $fromDateRangeSql . "' AND"
. " log.log_createtime <= '" . $toDateRangeSql . "'";
// $orderByClause = "log.log_createtime LIMIT 0," . $limitOfRowsDisplayed;
$orderByClause = "log.log_id LIMIT 0," . $limitOfRowsDisplayed;
$sqlquery = generateStatement($fieldClause,$fromClause,$whereClause,$orderByClause);
// echo $sqlquery . "<br><br>";
// Send request to database
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
// Generate list with header
$titleArray = array(getLngt("Vorgang") . "&nbsp;&nbsp;",getLngt("Zeitpunkt") . "&nbsp;&nbsp;",getLngt("Auftrag") . "&nbsp;&nbsp;",getLngt("Fahrzeug") . "&nbsp;&nbsp;",getLngt("Name") . "&nbsp;&nbsp;",getLngt("Vorname") . "&nbsp;&nbsp;",getLngt("Telefon") . "&nbsp;&nbsp;",getLngt("Details"));
$fieldArray = array("logo_op_shortname","log_createtime","jb_id","cr_sid","usr_name","usr_firstname","usr_phone","logo_description");
$aligns = "l,c,c,c,l,l,l,l";
$alignArray = spliti(",",$aligns);
$alignTitles = "center";
$widths = "330,130,50,50,150,150,80,200";
$widthArray = spliti(",",$widths);
$summationField = "";
$postParserField = "logo_description";
$mode = "1"; // Output from DB-RESULT
$sortDBField = ""; // Used in following include-file for sorting per column;
if ($logoselection > "0" && count($typeArray["logomapping"]) > 0) :
$noDisplayBoolCondition = array("log_createtime", ">=", $fromDateRange);
endif;
// $checkDifferences = true;
include ("../include/inc_list_defineoutput.inc.php");
$result->free();
// *** ONLY OUTPUT ***
// Courier
$crSid = getFieldValueFromId("courier", "cr_id", $cr_id, "cr_sid");
$crUsrId = getFieldValueFromId("courier", "cr_id", $cr_id, "usr_id");
$tmpFields = getFieldsValueFromId("user","usr_id",$crUsrId,array("usr_firstname","usr_name"));
$crUsrFirstname = $tmpFields[0];
$crUsrName = $tmpFields[1];
// Post parsing if necessary
if ($postParserField != "") :
$tableBody = postParseCrHistory($tableBody, $crSid, ($logoselection > "0" ? true : false));
endif;
// Invert all occurrences of "<tr>"
$tableBody = reverseOuterTableRows($tableBody);
endif;
// --- JOB HISTORY ------------------
if ($typeArray["mode"] == "jb") :
// From table "log"
$fieldClause = getDBFields("logoperation") . "," . getDBFields("log") . "," . getDBFields("user") . " ";
$fromClause = "phoenix_log.logoperation AS logo, phoenix_log." . $dbh_log . " AS log " .
"LEFT JOIN phoenix.user AS usr ON log.usr_id = usr.usr_id ";
// $whereClause = "log.jb_id = '" . $job_id . "' AND log.hq_id = '" . $hq_id . "' AND log.logo_id = logo.logo_id";
$whereClause = "log.jb_id = '" . $job_id . "' AND log.logo_id = logo.logo_id";
// $orderByClause = "log.log_createtime";
$orderByClause = "log.log_id DESC";
$sqlquery = generateStatement($fieldClause,$fromClause,$whereClause,$orderByClause);
// Send request to database
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
// Generate list with header
$titleArray = array(getLngt("Vorgang") . "&nbsp;&nbsp;",getLngt("Zeitpunkt") . "&nbsp;&nbsp;",getLngt("Fahrzeug") . "&nbsp;&nbsp;",getLngt("Name") . "&nbsp;&nbsp;",getLngt("Vorname") . "&nbsp;&nbsp;",getLngt("Telefon") . "&nbsp;&nbsp;",getLngt("Details"));
$fieldArray = array("logo_op_shortname","log_createtime","cr_sid","usr_name","usr_firstname","usr_phone","logo_description");
$aligns = "l,c,c,l,l,l,l";
$alignArray = spliti(",",$aligns);
$alignTitles = "center";
$widths = "330,130,50,150,150,80,200";
$widthArray = spliti(",",$widths);
$summationField = "";
$postParserField = "logo_description";
$mode = "1"; // Output from DB-RESULT
$sortDBField = ""; // Used in following include-file for sorting per column;
include ("../include/inc_list_defineoutput.inc.php");
$historyentry = $tableHeader . $tableBody;
$result->free();
// *** ONLY OUTPUT ***
// Job
// $jbXXXX = getFieldValueFromId("job", "jb_id", $job_id, "jb_XXXX");
// Post parsing if necessary
if ($postParserField != "") :
$tableBody = postParseJbHistory($tableBody);
endif;
// Invert all occurrences of "<tr>"
$tableBody = reverseOuterTableRows($tableBody);
endif;
// --- ARTICLE HISTORY ------------------
if ($typeArray["mode"] == "at") :
// From table "log"
$fieldClause = getDBFields("logoperation") . "," . getDBFields("log") . "," . getDBFields("user") . " ";
$fromClause = "phoenix_log.logoperation AS logo, phoenix_log." . $dbh_log . " AS log " .
"LEFT JOIN phoenix.user AS usr ON log.usr_id = usr.usr_id ";
// $whereClause = "log.at_id = '" . $at_id . "' AND log.hq_id = '" . $hq_id . "' AND log.logo_id = logo.logo_id AND ";
$whereClause = "log.at_id = '" . $at_id . "' AND log.logo_id = logo.logo_id AND ";
$whereClause .= "log.log_createtime >= '$fromDateRange' AND log.log_createtime <= '$toDateRange'";
// $orderByClause = "log.log_createtime LIMIT 0," . $limitOfRowsDisplayed;
$orderByClause = "log.log_id LIMIT 0," . $limitOfRowsDisplayed;
$sqlquery = generateStatement($fieldClause,$fromClause,$whereClause,$orderByClause);
// Send request to database
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
// Generate list with header
$titleArray = array(getLngt("Vorgang") . "&nbsp;&nbsp;",getLngt("Zeitpunkt") . "&nbsp;&nbsp;",getLngt("Name") . "&nbsp;&nbsp;",getLngt("Vorname") . "&nbsp;&nbsp;",getLngt("Telefon") . "&nbsp;&nbsp;",getLngt("Details"));
$fieldArray = array("logo_op_shortname","log_createtime","usr_name","usr_firstname","usr_phone","logo_description");
$aligns = "l,c,l,l,l,l";
$alignArray = spliti(",",$aligns);
$alignTitles = "center";
$widths = "180,130,150,150,80,350";
$widthArray = spliti(",",$widths);
$summationField = "";
$postParserField = "logo_description";
$mode = "1"; // Output from DB-RESULT
$sortDBField = ""; // Used in following include-file for sorting per column;
include ("../include/inc_list_defineoutput.inc.php");
$result->free();
// *** ONLY OUTPUT ***
// Article
$tmpFields = getFieldsValueFromId("article","at_id",$at_id,array("at_name","at_eid"));
$atName = $tmpFields[0];
$atEid = $tmpFields[1];
// Post parsing if necessary
if ($postParserField != "") :
$tableBody = postParseAtHistory($tableBody);
endif;
// Invert all occurrences of "<tr>"
$tableBody = reverseOuterTableRows($tableBody);
endif;
// --- EMPLOYEE HISTORY ------------------
if ($typeArray["mode"] == "emp") :
// From table "log"
$fieldClause = getDBFields("logoperation") . "," . getDBFields("log") . "," . getDBFields("user") . " ";
$fromClause = "phoenix_log.logoperation AS logo, phoenix_log." . $dbh_log . " AS log "
. "LEFT JOIN phoenix.user AS usr ON log.usr_id = usr.usr_id ";
$whereClause = "";
if ($empIdHist != "0") :
$whereClause .= "log.emp_id = '" . $empIdHist . "' AND ";
endif;
$whereClause .= "log.logo_id = logo.logo_id AND log.log_createtime >= '$fromDateRange' AND log.log_createtime <= '$toDateRange' AND logo_op_category = 'emp' ";
// $orderByClause = "log.log_createtime LIMIT 0," . $limitOfRowsDisplayed;
$orderByClause = "log.log_id LIMIT 0," . $limitOfRowsDisplayed;
$sqlquery = generateStatement($fieldClause,$fromClause,$whereClause,$orderByClause);
// Send request to database
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
// Generate list with header
$titleArray = array(getLngt("Vorgang") . "&nbsp;&nbsp;",getLngt("Zeitpunkt") . "&nbsp;&nbsp;",getLngt("Name") . "&nbsp;&nbsp;",getLngt("Vorname") . "&nbsp;&nbsp;",getLngt("Telefon") . "&nbsp;&nbsp;",getLngt("Details"));
$fieldArray = array("logo_op_shortname","log_createtime","usr_name","usr_firstname","usr_phone","logo_description");
$aligns = "l,c,l,l,l,l";
$alignArray = spliti(",",$aligns);
$alignTitles = "center";
$widths = "330,130,150,150,80,300";
$widthArray = spliti(",",$widths);
$summationField = "";
$postParserField = "logo_description";
$mode = "1"; // Output from DB-RESULT
$sortDBField = ""; // Used in following include-file for sorting per column;
include ("../include/inc_list_defineoutput.inc.php");
$result->free();
// *** ONLY OUTPUT ***
// Employee
$usrIdHist = getFieldValueFromId("employee", "emp_id", $empIdHist, "usr_id");
$tmpFields = getFieldsValueFromId("user","usr_id",$usrIdHist,array("usr_firstname","usr_name"));
$empUsrFirstname = $tmpFields[0];
$empUsrName = $tmpFields[1];
// Post parsing if necessary
if ($postParserField != "") :
$tableBody = postParseEmpHistory($tableBody, $crSid);
endif;
// Invert all occurrences of "<tr>"
$tableBody = reverseOuterTableRows($tableBody);
endif;
// Define output table
$historyentry = $tableHeader . $tableBody;
$currentFrameName = ""; // Empty string for "main frame"
$filter_dateranges = "";
$js_date = "";
if ($op == "0" && $typeArray["dateselection"] == "1") :
// Date-ranges
$filter_dateranges .= "<td>" . getLngt("Von:") . "\n";
$filter_dateranges .= "<select name=\"day_from\" class=\"f8np1\" onchange=\"fillDateFields(0, '" . $currentFrameName . "', 'history', 'day_from', 'day_from', 'month_from', 'year_from', '', '', '')\"></select>\n";
$filter_dateranges .= "<select name=\"month_from\" class=\"f8np1\" onchange=\"fillDateFields(0, '" . $currentFrameName . "', 'history', 'month_from', 'day_from', 'month_from', 'year_from', '', '', '')\"></select>\n";
$filter_dateranges .= "<select name=\"year_from\" class=\"f8np1\" onchange=\"fillDateFields(0, '" . $currentFrameName . "', 'history', 'year_from', 'day_from', 'month_from', 'year_from', '', '', '')\"></select>\n";
$filter_dateranges .= "</td><td>&nbsp;&nbsp;" . getLngt("bis:") . "\n";
$filter_dateranges .= "<select name=\"day_to\" class=\"f8np1\" onchange=\"fillDateFields(0, '" . $currentFrameName . "', 'history', 'day_to', 'day_to', 'month_to', 'year_to', '', '', '')\"></select>\n";
$filter_dateranges .= "<select name=\"month_to\" class=\"f8np1\" onchange=\"fillDateFields(0, '" . $currentFrameName . "', 'history', 'month_to', 'day_to', 'month_to', 'year_to', '', '', '')\"></select>\n";
$filter_dateranges .= "<select name=\"year_to\" class=\"f8np1\" onchange=\"fillDateFields(0, '" . $currentFrameName . "', 'history', 'year_to', 'day_to', 'month_to', 'year_to', '', '', '')\"></select>\n";
$filter_dateranges .= "</td>";
// Javascript-function as template only for
$js_date .= "<script type=\"text/javascript\">\n";
$js_date .= "<!--\n";
$js_date .= "function initForm() {\n";
$js_date .= " fillDateFields(1,\"" . $currentFrameName . "\",\"history\",\"\",\"day_from\",\"month_from\",\"year_from\",\"\",\"\",\"\");\n";
$js_date .= " setDateTimeFields(\"" . $currentFrameName . "\",\"history\",".$day_from.",".$month_from.",".$year_from.", \"\", \"\", \"day_from\", \"month_from\", \"year_from\", \"\", \"\", \"\");\n";
$js_date .= " fillDateFields(1,\"" . $currentFrameName . "\",\"history\", \"\", \"day_to\", \"month_to\", \"year_to\", \"\", \"\", \"\");\n";
$js_date .= " setDateTimeFields(\"" . $currentFrameName . "\",\"history\",".$day_to.",".$month_to.",".$year_to.", \"\", \"\", \"day_to\", \"month_to\", \"year_to\", \"\", \"\", \"\");\n";
$js_date .= "}\n";
$js_date .= "-->\n";
$js_date .= "</script>\n";
endif;
// Output headline
$pageHeadline = $pageTitel . ":&nbsp;&nbsp;&nbsp;";
if ($typeArray["mode"] == "cs") :
$pageHeadline .= $csCmpComp . " " . $csCmpComp2;
elseif ($typeArray["mode"] == "cr") :
$pageHeadline .= $crUsrFirstname . " " . $crUsrName;
elseif ($typeArray["mode"] == "jb") :
$pageHeadline .= $job_id;
elseif ($typeArray["mode"] == "at") :
$pageHeadline .= $atName . " (" . $atEid . ")";
elseif ($typeArray["mode"] == "emp") :
$pageHeadline .= $empUsrFirstname . " " . $empUsrName;
endif;
?>
<html>
<head>
<title><?php echo $pageTitel ?> <?php if ($typeArray["mode"] == "cs") : echo $csCmpComp; elseif ($typeArray["mode"] == "cr") : echo $crUsrFirstname . " " . $crUsrName; elseif ($typeArray["mode"] == "jb") : echo $job_id; elseif ($typeArray["mode"] == "at") : echo $atEid; endif; ?></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/lib_global.js" type="text/javascript">
</script>
<script type="text/javascript">
<!--
// NAVIGATION
<?php echo $jsMenuOut; ?>
-->
function setDisplaySelection() {
var logoSelectionVal = $('#logoselection').val();
if (logoSelectionVal > 0) {
$('#displayselection').val('1');
} else {
$('#displayselection').val('0');
}
}
function checkLogoSelection() {
var logoSelectionVal = $('#logoselection').val();
var displaySelectionVal = $('#displayselection').val();
if (displaySelectionVal > 0) {
if (logoSelectionVal == 0) {
$('#displayselection').val('0');
alert('<?php echo getLngt("Sie müssen einen Filter selektieren, um nur die geänderten Werte anzuzeigen") ?>');
} else {
$(".state_not_changed").hide();
}
} else {
$(".state_not_changed").show();
}
}
</script>
<?php echo $js_date ?>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?><?php echo ($op == "0" ? "initForm();" : "") ?>setDisplaySelection();checkLogoSelection();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="mc_page-header" id="mc_page-header">
<?php echo $pageHeadline ?>
</div>
<div class="maincontent" name="maincontent" id="maincontent">
<form name="history" action="../admin/history.php" method="post">
<input type="hidden" name="history_mode" value="<?php echo ec($history_mode) ?>">
<input type="hidden" name="cs_id" value="<?php echo ec($cs_id) ?>">
<input type="hidden" name="cr_id" value="<?php echo ec($cr_id) ?>">
<input type="hidden" name="job_id" value="<?php echo ec($job_id) ?>">
<input type="hidden" name="at_id" value="<?php echo ec($at_id) ?>">
<input type="hidden" name="empIdHist" value="<?php echo ec($empIdHist) ?>">
<input type="hidden" name="op" value="<?php echo ec($op) ?>">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<?php echo htmlDivLineSpacer("10px"); ?>
<div>
<!- Date-ranges and filter -->
<div
<?php echo setStyleHtmlDiv("700px","left"); ?>><?php echo $filter_dateranges ?>
<?php
if ($op == "0" && $typeArray["logoselection"] != "") :
echo "&nbsp;&nbsp;&nbsp;&nbsp;" . $typeArray["logoselection"] . "&nbsp;&nbsp;";
else :
echo "<input type=\"hidden\" id=\"logoselection\" name=\"logoselection\" value=\"" . $logoselection . "\">";
echo "<input type=\"hidden\" id=\"displayselection\" name=\"displayselection\" value=\"" . $displayselection . "\">";
endif;
?>
</div>
<!- Actions -->
<div>
<?php if ($op == "0") : echo defineButton(getLngt("Aktualisieren"), "action_refresh", "submitPage();", "left", "5", "", "", "115px"); endif; ?>
<?php // echo defineButton(getLngt("Schließen"), "action_close", "window.close();", "left", "", "", "", "115px"); ?>
</div>
</div>
<?php echo htmlDivLineSpacer("30px", "", "left"); ?>
<div>
<?php if ($rowCounter >= $limitOfRowsDisplayed) : echo getLngt("Mehr als") . " " . $limitOfRowsDisplayed . " " . getLngt("Datensätze werden nicht dargestellt"); endif; ?>
<?php echo htmlDivLineSpacer("15px"); ?>
</div>
<!- History -->
<div>
<table cellspacing="0" cellpadding="0" vspace="0" hspace="0">
<?php echo $historyentry ?>
</table>
</div>
</form>
</div>
</body>
</html>

541
html/admin/hq_admin.php Normal file
View File

@@ -0,0 +1,541 @@
<?php
/*=======================================================================
*
* hq_admin.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", "f_hq_id", "statusMessage", "deactivateMenu", "configDisplayMode",
"par_locatingByPDA", "par_locatingFromHrs", "par_locatingFromMin", "par_locatingToHrs", "par_locatingToMin"));
getLanguage(__FILE__);
$pageTitel = getLngt("NIEDERLASSUNGEN");
$pageHeadline = getLngt("Globale Einstellungen");
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
include_once ("../include/inc_stock.inc.php");
getCurrentScript(__FILE__);
mcIsSet($customerId, "0");
mcIsSet($cscIdRoot, "0");
mcIsSet($cscIdActual, "0");
if ($configDisplayMode == "" || $configDisplayMode == "0") : $configDisplayMode = "1"; endif;
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
$usrAccessArray["cs"] = "0";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
// 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;
// Special rights
$empHasGeneralAccessToHeadquartersAdministration = authCheckEmployeeRights($emp_id, "47"); // General access to headquarters administration
$empHasAccessregardingHeadquartersManager = authCheckEmployeeRights($emp_id, "32"); // Headquarters manager
$empHasAccessToModifyPDALocatingState = authCheckEmployeeRights($emp_id, "9"); // VPA locating
$empHasAccessToHeadquarters = authCheckEmployeeRights($emp_id, "10"); // Access to all headquarters
$empHasAccessToEditBwvHotlineNumbers = authCheckEmployeeRights($emp_id, "45"); // BWV hotline
// Current timestamp
$currentTime = getDateTime("0");
// Get the emp_id of the root admin, e.g. setting new passwords of employees
$empIdRootAdmin = getEmpIdOfRootAdmin($userTypeName);
// For output only
$styleDivWidth01 = "190px"; // Container for parameterizing lists
if ($f_act != "") :
// Change GLOBAL parameters (for headquarter)
if ($f_act == "setGlobPar") :
if ($empHasGeneralAccessToHeadquartersAdministration) :
$tmpLogStr = "";
for ($f = 1; $f < $f_hq_id_ext_len; $f++) :
getSecHttpVars("1",array("hq_data_cmp_comp_" . $f_hq_id_ext[$f], "hq_data_cmp_comp2_" . $f_hq_id_ext[$f], "hq_data_cmp_comp3_" . $f_hq_id_ext[$f], "hq_data_cmp_comp4_" . $f_hq_id_ext[$f],
"hq_data_ad_street_" . $f_hq_id_ext[$f], "hq_data_cmp_hsno_" . $f_hq_id_ext[$f], "hq_data_ad_zipcode_" . $f_hq_id_ext[$f], "hq_data_ad_city_" . $f_hq_id_ext[$f]));
$cmpComp = trim(${("hq_data_cmp_comp_" . $f_hq_id_ext[$f])}); $cmpComp2 = trim(${("hq_data_cmp_comp2_" . $f_hq_id_ext[$f])});
$cmpComp3 = trim(${("hq_data_cmp_comp3_" . $f_hq_id_ext[$f])}); $cmpComp4 = trim(${("hq_data_cmp_comp4_" . $f_hq_id_ext[$f])});
$adStreet = trim(${("hq_data_ad_street_" . $f_hq_id_ext[$f])}); $cmpHsno = trim(${("hq_data_cmp_hsno_" . $f_hq_id_ext[$f])});
$adZipcode = trim(${("hq_data_ad_zipcode_" . $f_hq_id_ext[$f])}); $adCity = trim(${("hq_data_ad_city_" . $f_hq_id_ext[$f])});
$hqCmpId = getFieldValueFromId("headquarters","hq_id", $f_hq_id_ext[$f],"cmp_id");
if ($hqCmpId != "" && is_numeric($hqCmpId) && $hqCmpId > 0) :
updateStmt("company", "cmp_id", $hqCmpId, array("cmp_comp", $cmpComp, "cmp_comp2", $cmpComp2, "cmp_comp3", $cmpComp3, "cmp_comp4", $cmpComp4, "cmp_hsno", $cmpHsno));
$hqAdId = getFieldValueFromId("company","cmp_id", $hqCmpId,"ad_id");
if ($hqAdId != "" && is_numeric($hqAdId) && $hqAdId > 0) :
updateStmt("address", "ad_id", $hqAdId, array("ad_street", $adStreet, "ad_zipcode", $adZipcode, "ad_city", $adCity));
else :
insertStmt("address", array("ad_street", $adStreet, "ad_zipcode", $adZipcode, "ad_city", $adCity));
$adIdNew = getLastInsertID();
updateStmt("company", "cmp_id", $hqCmpId, array("ad_id", $adIdNew));
endif;
endif;
if ($tmpLogStr != "") : $tmpLogStr .= "|"; endif;
$tmpLogStr .= $f . "=" . $hqCmpId . ";" . $hqAdId . ";" . $cmpComp . ";" . $cmpComp2 . ";" . $cmpComp3 . ";" . $cmpComp4 . ";" . $adStreet . ";" . $cmpHsno . ";" . $adZipcode . ";" . $adCity;
endfor;
// Write logdata into log database
writeToLogDB("199",$hq_id,"",$usr_id,"","","","" . $tmpLogStr,"","","");
endif;
if ($empHasGeneralAccessToHeadquartersAdministration && $empHasAccessToModifyPDALocatingState) :
/*
// Store value to enable/disable the PDA locating
if (is_numeric($par_locatingByPDA)) :
if (existsEntry("parameter",array("par_key","LOCATING_PDA_ENABLED","emp_id","0","hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", "0", array("par_value", $par_locatingByPDA), " par_key = 'LOCATING_PDA_ENABLED' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "LOCATING_PDA_ENABLED", "emp_id", "0", "par_value", $par_locatingByPDA, "hq_id", $hq_id, "md_id", $md_id));
endif;
else :
$statusMessage = getLngt("Der Status konnte nicht geändert werden.");
endif;
// Store interval for the PDA locating
if ($par_locatingFromHrs == "" || !is_numeric($par_locatingFromHrs)) : $par_locatingFromHrs = "0"; endif;
if ($par_locatingFromMin == "" || !is_numeric($par_locatingFromMin)) : $par_locatingFromMin = "0"; endif;
if ($par_locatingToHrs == "" || !is_numeric($par_locatingToHrs)) : $par_locatingToHrs = "23"; endif;
if ($par_locatingToMin == "" || !is_numeric($par_locatingToMin)) : $par_locatingToMin = "59"; endif;
// Check for from-time <= to-time
if ($par_locatingToHrs < $par_locatingFromHrs || ($par_locatingToHrs == $par_locatingFromHrs && $par_locatingToMin < $par_locatingFromMin)) :
$statusMessage = getLngt("Die obere Intervallgrenze für die VPA-Ortung ist kleiner als die untere. Bitte neu eingeben!");
else :
if (existsEntry("parameter",array("par_key","LOCATING_PDA_INTERVAL","emp_id","0","hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", "0", array("par_value", $par_locatingFromHrs . "," . $par_locatingFromMin . "," . $par_locatingToHrs . "," . $par_locatingToMin), " par_key = 'LOCATING_PDA_INTERVAL' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "LOCATING_PDA_INTERVAL", "emp_id", "0", "par_value", $par_locatingFromHrs . "," . $par_locatingFromMin . "," . $par_locatingToHrs . "," . $par_locatingToMin, "hq_id", $hq_id, "md_id", $md_id));
endif;
endif;
// Write logdata into log database
writeToLogDB("194",$hq_id,"",$usr_id,"","","","LOC_GLOB_PAR_STATE=" . $par_locatingByPDA . "|LOC_GLOB_PAR_INTERVAL=" . $par_locatingFromHrs . "," . $par_locatingFromMin . "," . $par_locatingToHrs . "," . $par_locatingToMin,"","","");
*/
endif;
if ($empHasGeneralAccessToHeadquartersAdministration && $empHasAccessToEditBwvHotlineNumbers) :
$tmpLogStr = "";
for ($f = 0; $f < $f_hq_id_ext_len; $f++) :
// BWV-Hotline
getSecHttpVars("1",array("par_BWV_phone_" . $f_hq_id_ext[$f]));
$par_BWV_phone = ${("par_BWV_phone_" . $f_hq_id_ext[$f])};
if (existsEntry("parameter",array("par_key","BWV_PHONE_NO","emp_id","0","hq_id",$f_hq_id_ext[$f]))) :
updateStmt("parameter", "emp_id", "0", array("par_value", $par_BWV_phone), " par_key = 'BWV_PHONE_NO' AND hq_id = '" . $f_hq_id_ext[$f] . "'");
else:
insertStmt("parameter", array("par_key", "BWV_PHONE_NO", "emp_id", "0", "par_value", $par_BWV_phone, "hq_id", $f_hq_id_ext[$f], "md_id", $md_id));
endif;
if ($tmpLogStr != "") : $tmpLogStr .= "|"; endif;
$tmpLogStr .= $f . "=" . $par_BWV_phone;
// GLN
getSecHttpVars("1",array("par_GLN_" . $f_hq_id_ext[$f]));
$par_GLN = ${("par_GLN_" . $f_hq_id_ext[$f])};
if ($f == 0) :
if (existsEntry("parameter",array("par_key","GLN_HQ_ALL","emp_id","0","hq_id",$f_hq_id_ext[$f]))) :
updateStmt("parameter", "emp_id", "0", array("par_value", $par_GLN), " par_key = 'GLN_HQ_ALL' AND hq_id = '" . $f_hq_id_ext[$f] . "'");
else:
insertStmt("parameter", array("par_key", "GLN_HQ_ALL", "emp_id", "0", "par_value", $par_GLN, "hq_id", $f_hq_id_ext[$f], "md_id", $md_id));
endif;
else :
updateStmt("headquarters", "hq_id", $f_hq_id_ext[$f], array("hq_gln", $par_GLN), "");
endif;
if ($tmpLogStr != "") : $tmpLogStr .= "|"; endif;
$tmpLogStr .= "," . $par_GLN;
// DUNS
getSecHttpVars("1",array("par_DUNS_" . $f_hq_id_ext[$f]));
$par_DUNS = ${("par_DUNS_" . $f_hq_id_ext[$f])};
if ($f == 0) :
if (existsEntry("parameter",array("par_key","DUNS_HQ_ALL","emp_id","0","hq_id",$f_hq_id_ext[$f]))) :
updateStmt("parameter", "emp_id", "0", array("par_value", $par_DUNS), " par_key = 'DUNS_HQ_ALL' AND hq_id = '" . $f_hq_id_ext[$f] . "'");
else:
insertStmt("parameter", array("par_key", "DUNS_HQ_ALL", "emp_id", "0", "par_value", $par_DUNS, "hq_id", $f_hq_id_ext[$f], "md_id", $md_id));
endif;
else :
updateStmt("headquarters", "hq_id", $f_hq_id_ext[$f], array("hq_duns", $par_DUNS), "");
endif;
if ($tmpLogStr != "") : $tmpLogStr .= "|"; endif;
$tmpLogStr .= "," . $par_DUNS;
endfor;
// Write logdata into log database
writeToLogDB("196",$hq_id,"",$usr_id,"","","","" . $tmpLogStr,"","","");
endif;
endif;
endif;
// Button for setting GLOBAL PARAMETERS
$buttonGlobalSettings = defineButtonType10(getLngt("Speichern"), "action_save_globs", "finishPage('" . ec("setGlobPar") . "');", "140", "left");
$outHqAddress = "";
$outHotlineBWV = "";
$outGLN = "";
$outDUNS = "";
$outVHT = "";
$outLocatingVPA = "";
if ($userTypeName == "hq") :
// Headquarters master data (address, etc.)
if ($empHasGeneralAccessToHeadquartersAdministration || $empHasAccessToHeadquarters) :
$outHqAddress .= "";
for ($f = 1; $f < $f_hq_id_ext_len; $f++) :
$hqCmpId = getFieldValueFromId("headquarters","hq_id", $f_hq_id_ext[$f],"cmp_id");
$hqCmpFields = getFieldsValueFromId("company", "cmp_id", $hqCmpId, array("cmp_comp","cmp_comp2","cmp_comp3","cmp_comp4","ad_id","cmp_hsno"));
$cmpAdId = $hqCmpFields[4];
$hqAdFields = getFieldsValueFromId("address", "ad_id", $cmpAdId, array("ad_street","ad_zipcode","ad_city","ad_country"));
$outHqAddress .= "<div style=\"width:700px\"><b>" . getLngt("Niederlassung") . "&nbsp;" . $hqNameArr[$f_hq_id_ext[$f]] . "</b></br>";
if (($empHasGeneralAccessToHeadquartersAdministration || ($empIdRootAdmin != "" && $emp_id == $empIdRootAdmin))) :
$outHqAddress .= "<div>";
$outHqAddress .= "<input type=\"text\" name=\"hq_data_cmp_comp_" . $f_hq_id_ext[$f] . "\" value=\"" . $hqCmpFields[0] . "\" placeholder=\"" . getLngt("[1]") . "\" size=\"50\">" . "&nbsp;";
$outHqAddress .= "<input type=\"text\" name=\"hq_data_cmp_comp2_" . $f_hq_id_ext[$f] . "\" value=\"" . $hqCmpFields[1] . "\" placeholder=\"" . getLngt("[2]") . "\" size=\"50\">" . "";
$outHqAddress .= "</div><div>";
$outHqAddress .= "<input type=\"text\" name=\"hq_data_cmp_comp3_" . $f_hq_id_ext[$f] . "\" value=\"" . $hqCmpFields[2] . "\" placeholder=\"" . getLngt("[3]") . "\" size=\"50\">" . "&nbsp;";
$outHqAddress .= "<input type=\"text\" name=\"hq_data_cmp_comp4_" . $f_hq_id_ext[$f] . "\" value=\"" . $hqCmpFields[3] . "\" placeholder=\"" . getLngt("[4]") . "\" size=\"50\">" . "";
$outHqAddress .= "</div><div>";
$outHqAddress .= "<input type=\"text\" name=\"hq_data_ad_street_" . $f_hq_id_ext[$f] . "\" value=\"" . $hqAdFields[0] . "\" placeholder=\"" . getLngt("Strasse") . "\" size=\"50\">" . "&nbsp;";
$outHqAddress .= "<input type=\"text\" name=\"hq_data_cmp_hsno_" . $f_hq_id_ext[$f] . "\" value=\"" . $hqCmpFields[5] . "\" placeholder=\"" . getLngt("Hausnr.") . "\" size=\"10\">" . "";
$outHqAddress .= "</div><div>";
$outHqAddress .= "<input type=\"text\" name=\"hq_data_ad_zipcode_" . $f_hq_id_ext[$f] . "\" value=\"" . $hqAdFields[1] . "\" placeholder=\"" . getLngt("PLZ") . "\" size=\"10\">" . "&nbsp;";
$outHqAddress .= "<input type=\"text\" name=\"hq_data_ad_city_" . $f_hq_id_ext[$f] . "\" value=\"" . $hqAdFields[2] . "\" placeholder=\"" . getLngt("Ort") . "\" size=\"50\">" . "&nbsp;";
$outHqAddress .= "</div>";
else :
$outHqAddress .= "<div>";
$outHqAddress .= $hqCmpFields[0] . "&nbsp;" . $hqCmpFields[1];
$outHqAddress .= "</div><div>";
$outHqAddress .= $hqCmpFields[2] . "&nbsp;" . $hqCmpFields[3];
$outHqAddress .= "</div><div>";
$outHqAddress .= $hqAdFields[0] . "&nbsp;" . $hqCmpFields[5];
$outHqAddress .= "</div><div>";
$outHqAddress .= $hqAdFields[1] . "&nbsp;" . $hqAdFields[2];
$outHqAddress .= "</div>";
endif;
$outHqAddress .= "<br><br></div>\n";
endfor;
endif;
// VPA locating
if ($empHasAccessToModifyPDALocatingState) :
/*
// 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;
// for ($f = 0; $f < $f_hq_id_ext_len; $f++) :
$outLocatingVPA .= "<div style=\"float:left;width:80px\"><b>" . getLngt("VPA-Ortung:") . "</b></div>\n" .
"<div><select name=\"par_locatingByPDA\">" . addOptionsGenericText(array(getLngt("Aus"),getLngt("An")),$locatingByPDA,"") . "</select><br><br></div>\n";
$outLocatingVPA .= "<div style=\"float:left;width:80px\"><b>" . getLngt("Intervall bei<br>Aktivierung:") . "</b></div>\n" .
"<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>\n" .
"<div style=\"float:left;width:80px\">&nbsp;</div>\n" .
"<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";
*/
endif;
// BWV-Hotline, GLN, DUNS
if ($empHasAccessToEditBwvHotlineNumbers) :
$par_GLN_HQ_ALL = getParameterValue("0", "GLN_HQ_ALL", "0");
$par_DUNS_HQ_ALL = getParameterValue("0", "DUNS_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]);
$outHotlineBWV .= "<div style=\"width:300px\"><b>" . ($f_hq_id_ext[$f] == "0" ? getLngt("BWV-Hotline bundesweit:") : getLngt("BWV-Hotline") . "&nbsp;" . $hqNameArr[$f_hq_id_ext[$f]]) . "</b><br>";
if (($empHasGeneralAccessToHeadquartersAdministration || ($empIdRootAdmin != "" && $emp_id == $empIdRootAdmin)) && authCheckEmployeeRights($emp_id, "45")) :
$outHotlineBWV .= "<input type=\"text\" name=\"par_BWV_phone_" . $f_hq_id_ext[$f] . "\" value=\"" . $par_BWV_phone . "\">";
else :
$outHotlineBWV .= $par_BWV_phone;
endif;
$outHotlineBWV .= "<br><br></div>\n";
// GLN
$hq_gln = "";
if ($f > 0) :
$hq_gln = getFieldValueFromId("headquarters","hq_id", $f_hq_id_ext[$f],"hq_gln");
endif;
$outGLN .= "<div style=\"width:300px\"><b>" . ($f_hq_id_ext[$f] == "0" ? getLngt("GLN bundesweit:") : getLngt("GLN") . "&nbsp;" . $hqNameArr[$f_hq_id_ext[$f]]) . "</b><br>";
if (($empHasGeneralAccessToHeadquartersAdministration || ($empIdRootAdmin != "" && $emp_id == $empIdRootAdmin)) && authCheckEmployeeRights($emp_id, "45")) :
if ($f == 0) :
$outGLN .= "<input type=\"text\" name=\"par_GLN_0\" value=\"" . $par_GLN_HQ_ALL . "\">";
else :
$outGLN .= "<input type=\"text\" name=\"par_GLN_" . $f_hq_id_ext[$f] . "\" value=\"" . $hq_gln . "\">";
endif;
else :
if ($f == 0) :
$outGLN .= $par_GLN_HQ_ALL;
else :
$outGLN .= $hq_gln;
endif;
endif;
$outGLN .= "<br><br></div>\n";
// DUNS
$hq_duns = "";
if ($f > 0) :
$hq_duns = getFieldValueFromId("headquarters","hq_id", $f_hq_id_ext[$f],"hq_duns");
endif;
$outDUNS .= "<div style=\"width:300px\"><b>" . ($f_hq_id_ext[$f] == "0" ? getLngt("DUNS bundesweit:") : getLngt("DUNS") . "&nbsp;" . $hqNameArr[$f_hq_id_ext[$f]]) . "</b><br>";
if (($empHasGeneralAccessToHeadquartersAdministration || ($empIdRootAdmin != "" && $emp_id == $empIdRootAdmin)) && authCheckEmployeeRights($emp_id, "45")) :
if ($f == 0) :
$outDUNS .= "<input type=\"text\" name=\"par_DUNS_0\" value=\"" . $par_DUNS_HQ_ALL . "\">";
else :
$outDUNS .= "<input type=\"text\" name=\"par_DUNS_" . $f_hq_id_ext[$f] . "\" value=\"" . $hq_duns . "\">";
endif;
else :
if ($f == 0) :
$outDUNS .= $par_DUNS_HQ_ALL;
else :
$outDUNS .= $hq_duns;
endif;
endif;
$outDUNS .= "<br><br></div>\n";
endfor;
endif;
// Vehicle classes (output only)
if (true) :
$sqlquery = "SELECT hq.hq_mnemonic, cr.hq_id, crvh.vht_id, mt.mt_value, COUNT(*) AS num"
. " FROM couriervehicle AS crvh, courier AS cr, metatype AS mt, headquarters AS hq, mandatorheadquarters AS md"
. " WHERE crvh.cr_id = cr.cr_id AND cr.hq_id = hq.hq_id AND md.hq_id = hq.hq_id AND"
. " crvh.vht_id = mt.mt_sort AND mt.mt_type = 'vehicletype'"
. " GROUP BY cr.hq_id, crvh.vht_id"
. " ORDER BY hq.hq_mnemonic, crvh.vht_id";
// echo $sqlquery . "<br>";
$result = $db->dbQ($sqlquery);
$remHqId = 0;
while ($row = $result->fetch_assoc()):
$hqId = $row["hq_id"];
$hqMnemonic = $row["hq_mnemonic"];
$vhtName = $row["mt_value"];
$numOfVehiclesPerClass = $row["num"];
if ($remHqId == 0) :
$remHqId = $hqId;
$outVHT .= "<div style=\"width:700px\"><b>" . getLngt("Niederlassung") . "&nbsp;" . $hqMnemonic . "</b>";
endif;
if ($remHqId != $hqId) :
$remHqId = $hqId;
$outVHT .= "<br><br></div>\n";
$outVHT .= "<div style=\"width:700px\"><b>" . getLngt("Niederlassung") . "&nbsp;" . $hqMnemonic . "</b>";
endif;
$outVHT .= "<div><span style=\"display: inline-block; width: 70px\">" . getLngt($vhtName) . "</span>" . "&nbsp;" . "<span style=\"display: inline-block; width: 30px; text-align: right;\">" . $numOfVehiclesPerClass . "</span></div>";
endwhile;
$outVHT .= "<br><br></div>\n";
$result->free();
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"); ?>
.flex-container {
display: flex;
min-height: 100vh;
width: 100%;
flex-wrap: nowrap;
}
.divNav {
flex: 0 0 200px;
padding: 20px;
display: flex;
flex-direction: column;
}
.divContent1, .divContent2, .divContent3, .divContent4, .divContent5, .divContent6 {
flex: 1;
padding: 20px;
display: flex;
flex-direction: column;
}
</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 finishPage(f_act) {
document.forms[0].f_act.value = f_act;
document.forms[0].submit();
};
var configDisplayMode = '<?php echo $configDisplayMode; ?>';
function changeDisplay (configDisplayModeNew) {
if (configDisplayMode != configDisplayModeNew) {
myhide('divContent' + configDisplayMode);
myshow('divContent' + configDisplayModeNew);
configDisplayMode = configDisplayModeNew;
$('#configDisplayMode').val(configDisplayModeNew);
}
}
function initDisplay () {
myhide('divContent1');
myhide('divContent2');
myhide('divContent3');
myhide('divContent4');
myhide('divContent5');
myhide('divContent6');
myshow('divContent' + configDisplayMode);
}
-->
</script>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>initDisplay();changeDisplay('<?php echo $configDisplayMode; ?>');displayStatusMessage();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="mc_page-header" id="mc_page-header">
<?php echo $pageHeadline ?>
</div>
<?php // echo htmlDivLineSpacer("5px", "", "left"); ?>
<div>
<?php echo $buttonGlobalSettings ?>
</div>
<?php echo htmlDivLineSpacer("20px", "", "left"); ?>
<div class="maincontent2 mc_elem" name="maincontent" id="maincontent">
<form action="../admin/hq_admin.php" method="post">
<input type="hidden" name="f_act" value="">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<input type="hidden" id="configDisplayMode" name="configDisplayMode" value="<?php echo $configDisplayMode ?>">
<div class="flex-container">
<!-- 0. column -->
<div class="divNav" id="divNav">
<div>
<?php
echo defineButtonType10(getLngt("Standortadresse"), "action_change_1", "changeDisplay('1');", "160");
echo htmlDivLineSpacer("5px");
echo defineButtonType10(getLngt("BWV-Hotline"), "action_change_2", "changeDisplay('2');", "160");
echo htmlDivLineSpacer("5px");
echo defineButtonType10(getLngt("GLN"), "action_change_3", "changeDisplay('3');", "160");
echo htmlDivLineSpacer("5px");
echo defineButtonType10(getLngt("DUNS"), "action_change_4", "changeDisplay('4');", "160");
echo htmlDivLineSpacer("5px");
echo defineButtonType10(getLngt("Fahrzeugklassen"), "action_change_5", "changeDisplay('5');", "160");
echo htmlDivLineSpacer("5px");
// echo defineButtonType10(getLngt("VPA-Ortung"), "action_change_6", "changeDisplay('6');", "160");
// echo htmlDivLineSpacer("5px");
?>
</div>
</div>
<!-- 1. column -->
<div class="divContent1" id="divContent1">
<?php echo $outHqAddress ?>
</div>
<!-- 2. column -->
<div class="divContent2" id="divContent2">
<?php echo $outHotlineBWV ?>
</div>
<!-- 3. column -->
<div class="divContent3" id="divContent3">
<?php echo $outGLN ?>
</div>
<!-- 4. column -->
<div class="divContent4" id="divContent4">
<?php echo $outDUNS ?>
</div>
<!-- 5. column -->
<div class="divContent5" id="divContent5">
<?php echo $outVHT ?>
</div>
<!-- 6. column -->
<div class="divContent6" id="divContent6">
<?php // echo $outLocatingVPA ?>
</div>
</form>
</div>
</body>
</html>

59
html/admin/impressum.html Normal file
View File

@@ -0,0 +1,59 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="de">
<head>
<title>votian</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="description" content="votian"> <meta name="keywords" content="votian">
<meta http-equiv="expires" content="Sat, 01 Dec 2003 00:00:00 GMT">
<link rel="stylesheet" type="text/css" href="../css/phoenix.css">
</head>
<body bgcolor="#FFFFFA" leftmargin="1" topmargin="1" marginwidth="0" marginheight="0" link="#990000" vlink="#990000" alink="#990000">
<table border="0" height="100%" width="100%" align="center" cellspacing="0" cellpadding="0" vspace="0" hspace="0">
<tr>
<td width=5%><img src="../images/empty.gif" width="1" height="10" alt=" "></td>
<td width=90%><img src="../images/empty.gif" width="1" height="1" alt=" "></td>
<td width=5%><img src="../images/empty.gif" width="1" height="10" alt=" "></td>
</tr>
<tr>
<td colspan=3 align=center valign=top>
<div class=headline1><b>Impressum</b></div>
</tr>
<tr>
<td width=5%>&nbsp;</td>
<td width=90% align=center>
<table border="0" width=100% height=100% align=center cellspacing=0 cellpadding=0 vspace=0 hspace=0>
<tr>
<td colspan=10 align=center>
<form action="">
<font size=-1><b>Assecutor</b></font><br>
Data Service GmbH<img src="../images/empty.gif" width="1" height="15" alt=" "><br><br>
<br>Carsten Annacker<br>Gunnar Timm<br>Marc Vollmann<br>
<br>
Gerhart-Hauptmann-Weg 14<br>
21502 Geesthacht<br>
&nbsp;<br>
E-Mail: contact@assecutor.de<br>
Web: http://www.assecutor.de
<br><br>
</form>
</td>
</tr>
</table>
<br>
</td>
<td width=5%>&nbsp;</td>
</tr>
<tr>
<td width=5%><img src="../images/empty.gif" width="1" height="5" alt=" "></td>
<td width=90%><img src="../images/empty.gif" width="1" height="1" alt=" "></td>
<td width=5%><img src="../images/empty.gif" width="1" height="5" alt=" "></td>
</tr>
</table>
</body>
</html>

18
html/admin/index.html Normal file
View File

@@ -0,0 +1,18 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="de">
<head>
<title>votian</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="description" content="votian"> <meta name="keywords" content="votian">
<meta http-equiv="refresh" content="0; URL=../index.php">
<link rel="stylesheet" type="text/css" href="css/phoenix.css">
</head>
<body bgcolor="#FFFFFA" leftmargin="1" topmargin="1" marginwidth="0" marginheight="0" link="#990000" vlink="#990000" alink="#990000">
<a href="../index.php">Bitte hier klicken, wenn Sie nicht automatisch weitergeleitet werden...</a>
</body>
</html>

650
html/admin/info.php Normal file
View File

@@ -0,0 +1,650 @@
<?php
/*=======================================================================
*
* info.php
*
=======================================================================*/
include_once("../include/dbconnect.inc.php");
include_once("../include/caglobal.inc.php");
include_once("../include/auth.inc.php");
include_once("../include/inc_user.inc.php");
include_once("../include/grid.inc.php");
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act", "noResetUserStates"));
// Id of the actual employee and the costcenter (individual root-node) logged in
if ($cscIdRoot == ""): $cscIdRoot = getFieldValueFromId("employee","emp_id",$emp_id,"csc_id"); endif;
if ($customerId == ""): $customerId = getFieldValueFromId("costcenter","csc_id",$cscIdRoot,"cs_id"); endif;
if ($cscIdActual == ""): $cscIdActual = $cscIdRoot; endif;
// Reset user states data after login
// Has to be executed before including "menu.php" (!!!!)
if (!isset($noResetUserStates) || $noResetUserStates == "") :
resetUserStates();
$noResetUserStates = "1";
endif;
getLanguage(__FILE__);
$pageTitel = getLngt("STARTSEITE");
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
getCurrentScript(__FILE__);
// GRID
// 1. Parameter: Initial column width
// 2. Parameter: Number of rows and columns
$grid = new Grid("600px", array(3,2));
// All output has to match a special grid container
$gridJsOut = "";
// Grid container sequential number, read from left to right and then row by row from top to button
// E.g. array(3,2) has 6 = 3 x 2 containers ([0][0] = 1)
// Reset the counter (= 0)
$grid->resetContainerPageCounter();
// Returns container page counter values
// $mode: "0" or empty <=> returns the array(row, col) regarding current container ID
// "1" returns the page counter by itself
// "2" returns the ID of the container
// $gridMatrix = $grid->getNextContainerPageCounter();
// Current user data
$sqlquery = "SELECT usr.usr_name, usr.usr_firstname, usr.usr_type"
. " FROM user AS usr"
. " WHERE usr.usr_id = " . $usr_id . " AND usr.hq_id = " . $hq_id;
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
while ($row = $result->fetch_assoc()):
$v_usr_type = $row["usr_type"];
$v_usr_name = $row["usr_name"];
$v_usr_firstname = $row["usr_firstname"];
endwhile;
$result->free();
if ($v_usr_type == "1") :
if (authCheckEmployeeRights($emp_id, "0") && authCheckEmployeeRights($emp_id, "11")) :
include ("../groupware/calendar.php");
endif;
endif;
// Get the emp_id of the root admin, e.g. setting new passwords of employees
$empIdRootAdmin = getEmpIdOfRootAdmin("hq");
// Company-data
$sqlquery = "";
if ($v_usr_type == "3") :
// Courier
$sqlquery = "SELECT cmp.cmp_id, cmp.cmp_comp, cmp.cmp_comp2, cmp.cmp_logo, cmp.cmp_logo_width, cmp.cmp_logo_height"
. " FROM company AS cmp, courier AS cr"
. " WHERE cr.usr_id = " . $usr_id
. " AND cmp.cmp_id = cr.cmp_id";
elseif ($v_usr_type == "2") :
// Customer
$sqlquery = "SELECT cmp.cmp_id, cmp.cmp_comp, cmp.cmp_comp2, cmp.cmp_logo, cmp.cmp_logo_width, cmp.cmp_logo_height"
. " FROM company AS cmp, customer AS cs"
. " WHERE cs.cs_admin = " . $emp_id
. " AND cmp.cmp_id = cs.cmp_id";
elseif ($v_usr_type == "1") :
// Headquarter
$sqlquery = "SELECT cmp.cmp_id, cmp.cmp_comp, cmp.cmp_comp2, cmp.cmp_logo, cmp.cmp_logo_width, cmp.cmp_logo_height"
. " FROM company AS cmp, headquarters AS hq"
. " WHERE hq.hq_id = " . $hq_id
. " AND hq.cmp_id = cmp.cmp_id";
endif;
if ($sqlquery != "") :
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
while ($row = $result->fetch_assoc()):
$v_cmp_id = $row["cmp_id"];
$v_cmp_comp = $row["cmp_comp"];
$v_cmp_comp2 = $row["cmp_comp2"];
$v_cmp_logo = $row["cmp_logo"];
$v_cmp_logo_width = $row["cmp_logo_width"];
$v_cmp_logo_height = $row["cmp_logo_height"];
endwhile;
endif;
$result->free();
$companyLogo = "";
if (trim($v_cmp_logo) == "") :
$v_cmp_id = getFieldValueFromId("headquarters", "hq_id", $hq_id, "cmp_id");
list ($v_cmp_logo, $v_cmp_logo_width, $v_cmp_logo_height) = getFieldsValueFromId("company","cmp_id",$v_cmp_id,array("cmp_logo","cmp_logo_width","cmp_logo_height"));
endif;
if (trim($v_cmp_logo) != "") :
$companyLogo = "<img src=\"../images/external/" . $v_cmp_logo . "\" border=\"0\" height=\"" . $v_cmp_logo_height . "\" width=\"" . $v_cmp_logo_width . "\">";
endif;
// Container
$gridMatrix = $grid->getNextContainerPageCounter();
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "red"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], $v_cmp_comp . " " . $v_cmp_comp2, "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("font-size", "14pt", "font-weight", "bold"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], "<center>" . $companyLogo . "</br></br>" . getLngt("Hallo") . " " . $v_usr_firstname . " " . $v_usr_name . "</br></br></center>", "bd");
// **********************************************
// *** Birthdays, newsticker and appointments ***
// **********************************************
$currentTime = getDateTime("0");
$birthdateOut = "";
$newstickerOut = "";
$appointmentOut = "";
// FOR HEADQUARTERS ONLY
if ($v_usr_type == "1") :
// Birthday data
$sqlquery = "SELECT DISTINCT hq.hq_mnemonic, usr.usr_name, usr.usr_firstname, usr.usr_type"
. " FROM user AS usr, headquarters AS hq"
. " WHERE usr.hq_id = hq.hq_id AND RIGHT(usr.usr_birthdate, 5) = RIGHT(CURDATE(), 5)"
. " ORDER BY usr.usr_type, usr.usr_name";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
$tmpUsrTypeArray = array(0,0,0,0);
while ($row = $result->fetch_assoc()):
if ($tmpUsrTypeArray[$row["usr_type"]] == "0") :
$tmpUsrTypeArray[$row["usr_type"]] = "1";
if ($row["usr_type"] == "1") : $birthdateOut .= "<tr><td colspan=\"2\">" . getLngt("Mitarbeiter") . ":</td></tr>"; endif;
if ($row["usr_type"] == "2") : $birthdateOut .= "<tr><td colspan=\"2\">" . getLngt("Kunden") . ":</td></tr>"; endif;
if ($row["usr_type"] == "3") : $birthdateOut .= "<tr><td colspan=\"2\">" . getLngt("Transporteure") . ":</td></tr>"; endif;
endif;
$birthdateOut .= "<tr>";
$birthdateOut .= "<td>(" . $row["hq_mnemonic"] . ")&nbsp;&nbsp;</td>";
$birthdateOut .= "<td>" . $row["usr_firstname"] . "&nbsp;" . $row["usr_name"] . "</td>";
$birthdateOut .= "</tr>";
endwhile;
$result->free();
// Container birthdays
$gridMatrix = $grid->getNextContainerPageCounter();
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "green"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], getLngt("Wir gratulieren herzlich zum Geburtstag!"), "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("font-size", "14pt", "font-weight", "bold"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], "<center></br>" . "<table>" . $birthdateOut . "</table>" . "</br></center>", "bd");
// DIRECT SEARCH
$bdOut = "<div><center></br><b>" . getLngt("Auftrag, Kunde, Fahrer, Fahrzeug") . ":</b>&nbsp;&nbsp;"
. "<input type=\"text\" id=\"metaSearch\" name=\"metaSearch\" value=\"\" size=\"15\">&nbsp;&nbsp;"
. "<button type=\"button\" class=\"buttonIcon\" onClick=\"metasearch();\">" . "&nbsp;" . "</button></br></div>"
. "<div style=\"padding:10px\" id=\"metaSearchResult_01\"></div>"
. "<div style=\"padding:10px\" id=\"metaSearchResult_02\"></div>"
. "<div style=\"padding:10px\" id=\"metaSearchResult_03\"></div>"
. "<div style=\"padding:10px\" id=\"metaSearchResult_04\"></div>";
// Container meta search
$gridMatrix = $grid->getNextContainerPageCounter();
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "green"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], getLngt("DIREKTSUCHE"), "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("font-size", "12pt", "font-weight", "normal"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], $bdOut, "bd");
// SPECIAL RIGHTS FOR reports !!!!!!!!!!!!!!!!!!!!!!!!!!!!
$newCsReportsOut = "";
$newCrReportsOut = "";
$presetDays = 7;
if (authCheckEmployeeRights($emp_id, "0") && authCheckEmployeeRights($emp_id, "16")) :
$numOfNewCsReports = 0;
$listOfLoginsArray = getListOfLogEntries(array('52','53'), array(0,0,0,0,-($presetDays),0), array("log_createtime"), $emp_id, "log_createtime DESC");
$listOfLoginsArrayLen = count($listOfLoginsArray);
if ($listOfLoginsArrayLen > 0) :
$lastLoginTime = $listOfLoginsArray[1][0];
if ($lastLoginTime != "") :
$numOfNewCsReports = getCountOfTable("phoenix_group.report_process", "hq_id = '" . $hq_id . "' AND rp_objtype = 'cs' AND rp_createtime >= '" . $lastLoginTime . "'");
if ($numOfNewCsReports == -1) : $numOfNewCsReports = 0; endif;
$numOfNewCrReports = getCountOfTable("phoenix_group.report_process", "hq_id = '" . $hq_id . "' AND rp_objtype = 'cr' AND rp_createtime >= '" . $lastLoginTime . "'");
if ($numOfNewCsReports == -1) : $numOfNewCsReports = 0; endif;
endif;
endif;
$newCsReportsOut = "<a href=\"../groupware/report.php?currentNavigationItem=vertrieb&rpObjType=cs&day_from=". ec(substr($lastLoginTime,8,2)) . "&month_from=". ec(substr($lastLoginTime,5,2)) . "&year_from=". ec(substr($lastLoginTime,0,4)) . "&day_to=" . ec(getDateTime("day")) . "&month_to=". ec(getDateTime("month")) . "&year_to=". ec(getDateTime("year")) . "\" target=\"_blank\">" . getLngt("[Kundenberichte]") . "</a>";
$newCrReportsOut = "<a href=\"../groupware/report.php?currentNavigationItem=vertrieb&rpObjType=cr&day_from=". ec(substr($lastLoginTime,8,2)) . "&month_from=". ec(substr($lastLoginTime,5,2)) . "&year_from=". ec(substr($lastLoginTime,0,4)) . "&day_to=" . ec(getDateTime("day")) . "&month_to=". ec(getDateTime("month")) . "&year_to=". ec(getDateTime("year")) . "\" target=\"_blank\">" . getLngt("[Transporteursberichte]") . "</a>";
endif; // SPECIAL RIGHTS FOR reports !!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Number of reports
$reportOut = "";
$lastLoginTimestamp = substr($lastLoginTime,8,2) . "." . substr($lastLoginTime,5,2) . "." . substr($lastLoginTime,0,4). "&nbsp;&nbsp;" . substr($lastLoginTime,11,2) . "." . substr($lastLoginTime,14,2) . "." . substr($lastLoginTime,17,2);
if ($newCsReportsOut != "" || $newCrReportsOut != "") :
$reportOut .= "<div><table>";
$reportOut .= "<tr><td align=\"center\"><b>" . getLngt("BERICHTE seit letztem Login") . "&nbsp;[" . $lastLoginTimestamp . "]&nbsp;" . getLngt("(max. eine Woche)") . "<br><br></td></tr>";
if ($newCsReportsOut != "") :
$reportOut .= "<tr><td align=\"center\">" . $newCsReportsOut . "&nbsp;&nbsp;[" . getLngt("Anzahl") . "&nbsp;" . $numOfNewCsReports . "]<br><br></td></tr>";
endif;
if ($newCrReportsOut != "") :
$reportOut .= "<tr><td align=\"center\">" . $newCrReportsOut . "&nbsp;&nbsp;[" . getLngt("Anzahl") . "&nbsp;" . $numOfNewCrReports . "]<br><br></td></tr>";
endif;
$reportOut .= "</table></div>";
// Container reports
$gridMatrix = $grid->getNextContainerPageCounter();
// $gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "blue"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], getLngt("BERICHTE seit letztem Login") . "&nbsp;[" . $lastLoginTimestamp . "]&nbsp;" . getLngt("(max. eine Woche)"), "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("font-size", "10pt", "font-weight", "normal"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], "<center></br>" . $reportOut . "</center>", "bd");
endif;
// SPECIAL RIGHTS FOR calendar !!!!!!!!!!!!!!!!!!!!!!!!!!!!
if (authCheckEmployeeRights($emp_id, "0") && authCheckEmployeeRights($emp_id, "11")) :
// Appointment data
$f_hq_id = array($hq_id);
$f_selUsrId = $usr_id;
// Monitored appointments
$f_ap_cat_search_4 = "1"; // Get only appointments with activated "alarm"
$tmpApRangeStarttime = getDateTime("date_plus_offset", array(-1,0,0), "Ymd");
$tmpApRangeEndtime = getDateTime("date_plus_offset", array(0,7,0), "Ymd");
$apArray = getAppointmentsFromDB(substr($tmpApRangeStarttime,0,4), substr($tmpApRangeStarttime,4,2) , substr($tmpApRangeStarttime,6,2), substr($tmpApRangeEndtime,0,4), substr($tmpApRangeEndtime,4,2) , substr($tmpApRangeEndtime,6,2));
// Normal appointments
$f_ap_cat_search_4 = "0"; // Get normal appointments
$tmpApRangeStarttime = getDateTime("date_plus_offset", array(0,0,0), "Ymd");
$tmpApRangeEndtime = getDateTime("date_plus_offset", array(0,1,0), "Ymd");
$apArray2 = getAppointmentsFromDB(substr($tmpApRangeStarttime,0,4), substr($tmpApRangeStarttime,4,2) , substr($tmpApRangeStarttime,6,2), substr($tmpApRangeEndtime,0,4), substr($tmpApRangeEndtime,4,2) , substr($tmpApRangeEndtime,6,2));
// Merge arrays
$apArray = array_merge($apArray, $apArray2);
$lenApArray = count($apArray);
for ($j = 0; $j < $lenApArray; $j++) :
$tmpId = $apArray[$j][0];
$tmpText = $apArray[$j][1];
$tmpExecDateTime = $apArray[$j][2];
$tmpExecDate = substr($tmpExecDateTime,8,2) . "." . substr($tmpExecDateTime,5,2) . "." . substr($tmpExecDateTime,0,4);
$tmpExecTime = substr($tmpExecDateTime,11,5);
$tmpExecDateYear = substr($apArray[$j][2],0,4);
$tmpExecDateMonth = substr($apArray[$j][2],5,2);
$tmpExecDateDay = substr($apArray[$j][2],8,2);
$tmpCmpId = trim($apArray[$j][3]);
$tmpCmpComp = trim($apArray[$j][4]);
$tmpCmpComp2 = trim($apArray[$j][5]);
$tmpCsId = $apArray[$j][6];
$tmpCsEid = $apArray[$j][7];
$tmpEndDateTime = $apArray[$j][8];
$tmpEndDate = substr($tmpEndDateTime,8,2) . "." . substr($tmpEndDateTime,5,2) . "." . substr($tmpEndDateTime,0,4);
$tmpEndTime = substr($tmpEndDateTime,11,5);
$tmpUsrId = trim($apArray[$j][9]);
$tmpUsrFirstname = trim($apArray[$j][10]);
$tmpUsrName = trim($apArray[$j][11]);
$tmpParticipants = trim($apArray[$j][12]);
$tmpParticipants = substr($tmpParticipants,1,-1); // Remove commata from db-field
$tmpConfirmed = trim($apArray[$j][13]);
$tmpConfirmed = substr($tmpConfirmed,1,-1); // Remove commata from db-field
$tmpPtCmpComp = trim($apArray[$j][14]);
$tmpPtCmpComp2 = trim($apArray[$j][15]);
$tmpPtCsEid = $apArray[$j][16];
$tmpPtId = $apArray[$j][17];
$tmpApCat1 = $apArray[$j][18];
$tmpApCat2 = $apArray[$j][19];
$tmpApCat3 = $apArray[$j][20];
$tmpApCat4 = $apArray[$j][21];
$cellCol = "FFFFFF";
$apOut .= "<tr><td>" . getLngt("Beginn") . "</td><td>" . getLngt("Ende") . "</td><td>" . getLngt("Ersteller") . "</td><td>" . getLngt("Teilnehmer") . "</td><td>" . getLngt("Beschreibung") . "</td><td>" . getLngt("Kunde") . "</td><td>&nbsp;</td></tr>";
$apOut .= "<tr>";
// Dates (From, To)
$apOut .= "<td width=\"90\" align=\"center\" valign=\"center\" bgcolor=\"#" . $cellCol . "\"><b>" . $tmpExecDate . "<br>" . ($tmpApCat4 == "1" ? "<img src=\"../images/ap_clock.png\" width=\"15\" height=\"15\" style=\"border:none;\">" : "") . "<br>" . $tmpExecTime . "</b></td>";
if ($tmpEndTime != "00:00") :
$apOut .= "<td width=\"90\" align=\"center\" valign=\"center\" bgcolor=\"#" . $cellCol . "\"><b>" . $tmpEndDate . "<br><br>" . $tmpEndTime . "</b></td>";
else :
$apOut .= "<td width=\"90\" align=\"left\" valign=\"center\" bgcolor=\"#" . $cellCol . "\">&nbsp;</td>";
endif;
// User
if ($tmpUsrId != "") :
$apOut .= "<td width=\"150\" align=\"left\" valign=\"center\" bgcolor=\"#" . $cellCol . "\">" . $tmpUsrFirstname . "<br>" . $tmpUsrName . "</td>";
else :
$apOut .= "<td width=\"150\" align=\"left\" valign=\"center\" bgcolor=\"#" . $cellCol . "\">&nbsp;</td>";
endif;
// Participants
$apOut .= "<td width=\"150\" align=\"left\" valign=\"center\" bgcolor=\"#" . $cellCol . "\">";
if ($tmpParticipants != "") :
$tmpParticipants = spliti(",", $tmpParticipants); // It has to be an array
$tmpParticipantsLen = count($tmpParticipants);
// Needs array of users confirmed the appointment
$tmpConfirmed = spliti(",", $tmpConfirmed);
for ($k = 0; $k < $tmpParticipantsLen; $k++) :
$participantName = $db->getOne("SELECT CONCAT(usr_name,', ',usr_firstname) AS name FROM user WHERE usr_id = '" . $tmpParticipants[$k] . "'");
$participantConfirmed = "[?]";
$l = array_search($tmpParticipants[$k], $tmpConfirmed);
if (!($l === FALSE)) :
$participantConfirmed = getLngt("[OK]");
else :
if ($tmpParticipants[$k] == $tmpUsrId) :
$participantConfirmed = getLngt("[OK]");
elseif ($tmpParticipants[$k] == $usr_id) : // Only the user has a link to confirm his/her own entry
// $participantConfirmed = "<a href=\"javascript:confirmAppointmentFinishPage('" . $tmpId . "');\">" . getLngt("[Bestätigen]") . "</a>";
$participantConfirmed = getLngt("[Bestätigen]");
endif;
endif;
$apOut .= $participantName . "&nbsp;" . $participantConfirmed . "<br>";
endfor;
else :
$apOut .= "&nbsp;";
endif;
$apOut .= "</td>";
// Text
$apOut .= "<td align=\"left\" valign=\"center\" bgcolor=\"#" . $cellCol . "\">" . $tmpText . "</td>";
// Potential customer relation (Company name and EID)
if ($tmpCsId != "") :
$apOut .= "<td width=\"205\" align=\"left\" valign=\"center\" bgcolor=\"#" . $cellCol . "\">" . $tmpCmpComp . "<br>" . ($tmpCmpComp2 != "" ? $tmpCmpComp2 . "<br>" : "") . $tmpCsEid . "<br>";
// . "<input type=\"button\" name=\"action\" value=\"Details\" onClick=\"openCustomerSpecial('" . $tmpCmpId . "');\">"
// . "<input type=\"button\" name=\"action\" value=\"Berichte\" onClick=\"getCsHistory('" . $tmpCsEid . "');\">"
// . "<input type=\"button\" name=\"action\" value=\"Statistik\" onClick=\"openCustomerStatistics('" . $tmpCsEid . "');\">"
// . "</td>";
// elseif ($tmpPtId != "") :
// $apOut .= "<td width=\"205\" align=\"left\" valign=\"center\" bgcolor=\"#" . $cellCol . "\">" . $tmpPtCmpComp . "<br>" . ($tmpPtCmpComp2 != "" ? $tmpPtCmpComp2 . "<br>" : "") . $tmpPtCsEid . "<br>"
// . "<input type=\"button\" name=\"action\" value=\"Details\" onClick=\"openProspectSpecial('" . $tmpPtId . "');\">"
// . "<input type=\"button\" name=\"action\" value=\"Berichte\" onClick=\"getPtHistory('','" . $tmpPtCsEid . "');\">"
// . "</td>";
else :
$apOut .= "<td width=\"200\" align=\"left\" valign=\"center\" bgcolor=\"#" . $cellCol . "\">&nbsp;</td>";
endif;
$apOut .= "<td width=\"100\" align=\"left\" valign=\"center\" bgcolor=\"#" . $cellCol . "\">";
$apOut .= "&nbsp;&nbsp;<a href=\"../groupware/appointment.php?currentNavigationItem=vertrieb&f_selUsrId=" . ec($usr_id) . "&viewMode=" . ec(0) . "&selYear=" . ec($tmpExecDateYear) . "&selMonth=" . ec($tmpExecDateMonth) . "&selDay=" . ec($tmpExecDateDay) . "\">" . getLngt("[Zum Termin]") . "</a>";
$apOut .= "</td>";
// if ($j < $lenApArray - 1) : $apOut .= "</tr><tr>"; endif;
$apOut .= "</tr>";
endfor;
if (true || $lenApArray > 0) :
// Container appointments
$gridMatrix = $grid->getNextContainerPageCounter();
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "blue"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], getLngt("AKTUELLE TERMINE") . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button type=\"button\" class=\"buttonMenuUserInfo\" onClick=\"document.location.href = \'../groupware/appointment.php?currentNavigationItem=vertrieb&f_selUsrId=" . ec($usr_id) . "\';\">" . getLngt("Kalender") . "</button>", "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("font-size", "10pt", "font-weight", "normal"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], "<center></br>" . "<table>" . $apOut . "</table>" . "</center>", "bd");
endif;
endif; // SPECIAL RIGHTS FOR calendar !!!!!!!!!!!!!!!!!!!!!!!!!!!!
endif;
// A text, transmitted by ajax from client to server with "encodeURI(escape(content))" in javascript,
// stored - urldecoded in PHP - into the DB and read by PHP from the database again like here for (editable) output
function my_str_check_ajax($aStr, $nl2br_enabled = true)
{
while (strpos($aStr, "\\")) :
$aStr = str_replace("\\n", "\n", $aStr);
$aStr = str_replace("\\r", "\r", $aStr);
endwhile;
if ($nl2br_enabled) :
$aStr = str_replace("\n\r", "</br>", $aStr);
$aStr = str_replace("\r\n", "</br>", $aStr);
$aStr = str_replace("\n", "</br>", $aStr);
$aStr = str_replace("\r", "</br>", $aStr);
endif;
return $aStr;
}
// CUSTOMER NEWS, visible for headquarter and customers, editable by headquarters only regarding access rights
if ($v_usr_type == "1" || $v_usr_type == "2") :
$csGlobalInfoByHq = "";
if (existsEntry("genericdatacontainer",array("gdc_obj_type","hq2cs","gdc_obj_id",$hq_id,"gdc_gen_fieldname","global_cs_info"))) :
$csGlobalInfoByHq = getFieldValueFromClause("genericdatacontainer","gdc_content","gdc_obj_type = 'hq2cs' AND gdc_obj_id = '" . $hq_id . "' AND gdc_gen_fieldname = 'global_cs_info'");
endif;
// Check for access right to edit the text
if ($v_usr_type == "1") :
$outCsGlobalInfoByHqHeadline = getLngt("Aktuelle Infos für die Kunden");
else :
$outCsGlobalInfoByHqHeadline = getLngt("Aktuelle Informationen für Sie");
endif;
if ($v_usr_type == "1" && authCheckEmployeeRights($emp_id, "0") && authCheckEmployeeRights($emp_id, "35")) :
$outCsGlobalInfoByHqHeadline .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . "<button type=\"button\" class=\"buttonMenuUserInfo\" onClick=\"storeCsGlobalInfo(\'global_cs_info\');\">" . getLngt("Speichern") . "</button>";
$outCsGlobalInfoByHqBody = "<center><textarea id=\"global_cs_info\" name=\"global_cs_info\" cols=\"70\" rows=\"5\" style=\"resize:vertical;\">" . my_str_check_http($csGlobalInfoByHq) . "</textarea></center>";
else :
$outCsGlobalInfoByHqBody = my_str_check_ajax($csGlobalInfoByHq);
endif;
// Container customer news
$gridMatrix = $grid->getNextContainerPageCounter();
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "green"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], $outCsGlobalInfoByHqHeadline, "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("font-size", "10pt", "font-weight", "normal", "color", "black"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], "</br>" . $outCsGlobalInfoByHqBody, "bd");
endif;
// Hide remaining containers without content
$gridJsOut .= $grid->gridHideRemaining();
?>
<html>
<head>
<title><?php echo $pageTitel ?></title>
<script>
//Quelle: https://msdn.microsoft.com/en-us/library/cc197053%28v=vs.85%29.aspx
window.onerror=fnErrorTrap;
function fnErrorTrap(sMsg,sUrl,sLine){
//parent.job_tour.document.tourForm.
//parent.job_options.document.tourOptions.
var tmp_jb_id = "";
if(typeof(jb_id)!='undefined')
tmp_jb_id = jb_id;
var out = '';
// if(typeof(parent.job_options.document.tourOptions) != 'undefined') {
// for (var i = 0; i <= parent.job_options.document.tourOptions.elements.length; i++) {
//// out += i + ": " + parent.job_options.document.tourOptions.elements[i].name + " = " + parent.job_options.document.tourOptions.elements[i].value + "\n";
// out += parent.job_options.document.forms[0].elements[i].value + "\n";
// }
// }
iframe = document.createElement("IFRAME");
iframe.setAttribute("src", "../include/ajaxJsError.php?url="+escape(sUrl) + "&line=" + escape(sLine) + "&message=" + escape(sMsg) + "&user_agent=" + escape(navigator.userAgent) + "&jb_id=" + tmp_jb_id + "&out=" + escape(out));
iframe.width = 1;
iframe.height = 1;
iframe.style.display = 'none';
setTimeout(function(){
document.body.appendChild(iframe);
},10);
return false;
}
//alert('test');
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="description" content="votian"> <meta name="keywords" content="votian">
<link rel="stylesheet" type="text/css" href="../css/phoenix.css">
<style type="text/css">
<?php include_once ("../css/navigation.css.php"); ?>
</style>
<style type="text/css">
<?php echo $grid->getGridItemParameter("output_css") ?>
.bar1
{ width:100%; height:100px;
font-size:12pt; font-family:Helvetica,Arial; font-style:normal; font-weight:normal;
background:#1b12b9; color:white;
}
.bar2
{ width:100%; height:100px;
font-size:14pt; font-family:Helvetica,Arial; font-style:normal; font-weight:normal;
background:#4e45ec; color:white;
}
.bar3
{ width:100%;
font-size:10pt; font-family:Helvetica,Arial; font-style:normal; font-weight:normal;
background:#4e45ec; color:white;
}
</style>
<?php include_once ("../include/js_framework.inc.php"); ?>
<script src="../include/checkFormTags.js" type="text/javascript"></script>
<script language="JavaScript">
<!--
var searchResult = '';
function checkStartTickerOut () {
myhide('startTickerOut');
if (max > 0) {
tickerActive = true;
myshow('startTickerOut');
ticker('startTickerOut');
}
}
function metasearchSpecial (objType, containerNo = '1') {
var searchVal = $("#metaSearch").val();
var searchProcessOk = false;
var ctNum = padl(containerNo.toString(),2,'0');
if (!objType) {objType = ''};
searchVal = searchVal.trim();
searchValLen = searchVal.length;
if (objType != '' && searchVal != ''&& searchValLen >= 4) {
// alert('JS.objType = ' + objType);
ajaxRequestGet('../include/ajaxReqSearch.php', 'retMode=0&objType=' + objType + '&searchValue=' + encodeURI(escape(searchVal)));
searchProcessOk = true;
if (searchResult != '') {
$('#metaSearchResult_' + ctNum).html(searchResult);
}
} else {
$('#metaSearchResult_' + ctNum).html('<center><span style="color:red"><?php echo getLngt("Bitte mindestens 4 Zeichen eingeben!") ?></span></center>');
}
return searchProcessOk;
}
function metasearch () {
// Init container
$('#metaSearchResult_01').html('');
$('#metaSearchResult_02').html('');
$('#metaSearchResult_03').html('');
$('#metaSearchResult_04').html('');
// Search in categories
var searchProcessOk = true;
searchProcessOk = metasearchSpecial('jb',1);
if (searchProcessOk) {
searchProcessOk = metasearchSpecial('cs',2);
}
if (searchProcessOk) {
searchProcessOk = metasearchSpecial('cr',3);
}
if (searchProcessOk) {
searchProcessOk = metasearchSpecial('crvh',4);
}
<?php
if ($v_usr_type == "1") :
// echo "$('#metaSearch').focus();";
endif;
?>
}
function storeCsGlobalInfo (elem) {
var content = $('#' + elem).val();
ajaxRequestGet('../include/ajaxReqLib.php', 'mode=500&wrap_html=1&value_01=hq2cs&value_02=<?php echo ec($hq_id) ?>&value_03=' + elem + '&value_04=' + encodeURI(escape(content)) + '&value_05=');
}
// Opens a new (popup-)window with specified parameters
function popupSearch (url,title,config) {
var widthPopupWin = screen.width - 80;
var heightPopupWin = screen.height - 180;
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2);
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2);
var popup;
popup = window.open(url,title, "dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
}
function openLinkByObject (objType, objValue) {
// alert(objType + ' ' + objValue);
if (objType == 'jb') {
popupSearch('../admin/jb_detail.php?job_id=' + objValue,'','');
}
if (objType == 'cs') {
popupSearch('../admin/customer_special.php?companyId=' + objValue,'','');
}
if (objType == 'cr') {
popupSearch('../admin/courier_special.php?companyId=' + objValue,'','');
}
if (objType == 'crvh') {
popupSearch('../admin/courier_vehicle.php?courierId=' + objValue,'','');
}
}
function execBodyOnLoad() {
<?php echo $gridJsOut ?>
// checkStartTickerOut();
<?php
if ($v_usr_type == "1") :
echo "$('#metaSearch').focus();";
endif;
?>
}
$(document).keypress(function(e) {
if (e.keyCode === 13 && e.target.nodeName == 'INPUT') {
e.preventDefault(); //prevent default if it is INPUT
var focused = $(':focus');
if ($(focused).attr('id') == "metaSearch") {
metasearch();
};
}
});
// -->
</script>
<noscript>
<center>
<b><br>JavaScript ist nicht verf&uuml;gbar. Bitte aktivieren Sie JavaScript<br><br>
in Ihrem Browser, damit diese Seite ordnungsgem&auml;&szlig; funktioniert!</b><br><br>
</center>
</noscript>
</head>
<body leftmargin="1" topmargin="1" marginwidth="0" marginheight="0" link="#990000" vlink="#990000" alink="#990000" onLoad="<?php echo $phpCurrentNavigationOnLoad ?>execBodyOnLoad();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="maincontent" name="maincontent" id="maincontent">
<?php echo htmlDivLineSpacer("10px"); ?>
<form name="start" action="../admin/info.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="noResetUserStates" value="<?php echo ec($noResetUserStates) ?>">
<div>
<?php echo $grid->getGridItemParameter("output_html") ?>
</div>
</form>
</div>
</body>
</html>

2684
html/admin/jb_detail.php Normal file

File diff suppressed because it is too large Load Diff

1516
html/admin/jb_detail_.php Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,68 @@
<html>
<head>
<title><?php echo getLngt("AUFTRAGSDETAILS") ?></title>
<link rel="stylesheet" type="text/css" href="../css/phoenix.css">
<script src="../include/lib_courier.js" type="text/javascript">
</script>
<noscript>
<center>
<b><br>JavaScript ist nicht verf&uuml;gbar. Bitte aktivieren Sie JavaScript<br><br>
in Ihrem Browser, damit diese Seite ordnungsgem&auml;&szlig; funktioniert!</b><br><br>
</center>
</noscript>
</head>
<body onLoad="this.moveTo((screen.width * 0.5)-(document.body.offsetWidth * 0.5),(screen.height * 0.5)-(document.body.offsetHeight * 0.5));">
<form name="jb_detail" action="../admin/jb_detail.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="job_id" value="<?php echo ec($job_id) ?>">
<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="empIdMaster" value="<?php echo ec($empIdMaster) ?>">
<input type="hidden" name="dbhistory" value="<?php echo ec($dbhistory) ?>">
<table class="f8np1" cellspacing="0" cellpadding="0" vspace="0" hspace="0">
<tr>
<td valign="top">
<!-- JOB-DATA -->
<table cellspacing="0" cellpadding="0" vspace="0" hspace="0">
<tr><td><b><?php echo getLngt("AUFTRAG:") ?></b></td></tr>
<?php if ($automailer == "0") : echo $jobentry; endif; ?>
</table>
</td>
<td>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td>
<td valign="top">
<!-- COURIER-DATA -->
<table cellspacing="0" cellpadding="0" vspace="0" hspace="0">
<tr><td><b><?php echo getLngt("TRANSPORTEUR:") ?></b></td></tr>
<?php if ($automailer == "0") : echo $courierentry; endif; ?>
</table>
</td>
<tr>
</table>
<br><br>
<!-- TOUR-DATA -->
<table class="f8np1" cellspacing="0" cellpadding="0" vspace="0" hspace="0">
<tr><td><b> <?php echo getLngt("TOUR:") ?></b></td></tr>
<tr>
<?php if ($automailer == "0") : echo $tourentry; endif; ?>
</tr>
</table>
<br><br>
<table class="f8np1" cellspacing="0" cellpadding="0" vspace="0" hspace="0">
<tr><td colspan="4"><b><?php echo getLngt("KOSTEN:") ?></b></td></tr>
<?php if ($automailer == "0") : echo $jobcosts; endif; ?>
</table>
</form>
</body>
</html>

View File

@@ -0,0 +1,64 @@
<?php
/*=======================================================================
*
* jb_detail_sign.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/global.inc.php");
include_once ("../include/auth.inc.php");
include_once ("../include/image.inc.php");
ob_start();
include_once ("../include/inc_phpSniff.inc.php");
getSecHttpVars("1",array("jb_id", "tr_sort", "dbhistory"));
getLanguage(__FILE__);
// Decision to use the job archive or normal tables
getDBNames($dbhistory);
$trSign = "";
if ($jb_id != "" && $tr_sort != "") :
// Check current browser and version of the client
$phpSniff = new phpSniff();
$browser = $phpSniff->get_property("browser");
$browser_majver = $phpSniff->get_property("maj_ver");
ob_end_clean();
$sqlquery = "SELECT tr_sign FROM " . $dbh_tr . " WHERE jb_id = $jb_id AND tr_sort = $tr_sort";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
while ($row = $result->fetch_assoc()):
$trSign = trim($row["tr_sign"]);
endwhile;
$result->free();
// Output of the image
if ($trSign != "") :
if ($browser == "ie" && $browser_majver <= "5") :
header ("Content-type: image/jpeg");
$im = createSignImage(splitRawCoordinates ($trSign));
imagejpeg ($im);
else :
header ("Content-type: image/png");
$im = createSignImage(splitRawCoordinates ($trSign));
imagepng ($im);
endif;
else :
echo getLngt("Keine Unterschrift vorhanden!") . "<br>";
endif;
endif;
// $trSign = "A10,15;30,40;10,5;40,70A0,0;0,90;90,90;90,0;0,0";
?>

View File

@@ -0,0 +1,24 @@
<?php
/*=======================================================================
*
* jb_detail_sign2.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/global.inc.php");
// include_once ("../include/auth.inc.php");
include_once ("../include/image.inc.php");
getSecHttpVars("1",array("tr_sign"));
// Output of the image
if ($tr_sign != "") :
header ("Content-type: image/png");
$im = createSignImage(splitRawCoordinates ($tr_sign));
imagepng ($im);
endif;
?>

2367
html/admin/jb_list.php Normal file

File diff suppressed because it is too large Load Diff

2331
html/admin/jb_list_MC.php Normal file

File diff suppressed because it is too large Load Diff

80
html/admin/jb_list_fs.php Normal file
View File

@@ -0,0 +1,80 @@
<?php
/*=======================================================================
*
* jb_list_fs.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/global.inc.php");
include_once ("../include/auth.inc.php");
// Check HTTP-Parameters
getSecHttpVars("1",array("maskNumOfWins","setPercentValues"));
// Get default values to be displayed calling the joblists (1. frame = Autoranking, 2. frame = Open jobs, etc.)
// First try to get default values defined by the employees
$defaultListStatus = "";
$tmp = getParameterValue($emp_id, "MASK_JOBLIST_DEFAULTLIST");
if ($tmp != "") :
$defaultListStatus = explode(",",$tmp);
endif;
// If values do not exist take default system values
if ($defaultListStatus == "") :
$defaultListStatus = explode(",",MASK_JOBLIST_DEFAULTLIST);
endif;
if ($maskNumOfWins == "" || $maskNumOfWins == "0" || !is_numeric($maskNumOfWins)) : $maskNumOfWins = "2"; endif; // Number of frames = number of lists
// Initialize navigation-level
mcIsSet($navigationLevel, "1");
if ($navigationLevel == "" || ($navigationLevel != "1" && $navigationLevel != "2" && $navigationLevel != "3")) :
$navigationLevel = "1";
endif;
$frames = "";
$framesetScaleArray = array();
// Scaling factor for homogeneous scaling (no percent values set manually)
$scale = round(100 / $maskNumOfWins);
for ($j = 1; $j <= $maskNumOfWins; $j++) :
if ($setPercentValues == "") :
$framesetScaleArray[] = $scale . "%";
else :
// Get percent-value for scaling of the current frame
getSecHttpVars("1",array("percentScaleValueWin_" . $j));
$tmp = "percentScaleValueWin_" . $j;
$framesetScaleArray[] = ${$tmp};
endif;
$frames .= "<frame src=\"jb_list.php?defaultListStatus=" . ec($defaultListStatus[$j - 1]) . "&maskNumOfWin=" . ec($j) . "&maskNumOfWins=" . ec($maskNumOfWins) . ($j == "1" ? "&showScalingMenu=0" : "") . "\" name=\"content" . $j . "\" scrolling=\"auto\" marginwidth=\"0\" marginheight=\"0\">\n";
endfor;
// Normalize values to 100%
if ($setPercentValues != "") :
$sumValue = array_sum($framesetScaleArray);
for ($j = 0; $j < $maskNumOfWins; $j++) :
$framesetScaleArray[$j] = round($framesetScaleArray[$j] * (100 / $sumValue));
endfor;
endif;
$framesetScale = implode(",", $framesetScaleArray);
?>
<html>
<head>
<title><?php echo getLngt("AUFTRAGSLISTEN") ?></title>
</head>
<frameset rows="<?php echo $framesetScale ?>" id="jb_list_fs">
<?php echo $frames ?>
</frameset>
</html>

133
html/admin/language.php Normal file
View File

@@ -0,0 +1,133 @@
<?php
/*=======================================================================
*
* language.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act", "f_lng_num"));
if ($f_lng_num != "" && is_numeric($f_lng_num)) :
$languageSelected = $f_lng_num;
endif;
getLanguage(__FILE__);
$pageTitel = getLngt("SPRACHEN");
include_once ("../include/html.inc.php");
getCurrentScript(__FILE__);
// Select user-type for mode of security check
$userType = "";
if (isset($emp_id) && isset($hq_id) && isset($usr_id)) :
$userType = getFieldValueFromId("user","usr_id",$usr_id,"usr_type");
endif;
// Toggles list colors
function getTableColor($x, $y) {
$bgCol = "";
if ($x % 2 == 0 && $y == 0) : $bgCol = "#AAAAFF"; endif;
if ($x % 2 == 0 && $y == 1) : $bgCol = "#AAAAFF"; endif;
if ($x % 2 == 1 && $y == 0) : $bgCol = "#CCCCFF"; endif;
if ($x % 2 == 1 && $y == 1) : $bgCol = "#CCCCFF"; endif;
return $bgCol;
}
// *** Actions ***
if ($f_act == "saveLanguage") :
if ($userType != "") :
if (is_numeric($f_lng_num)) :
if (existsEntry("parameter",array("par_key","SYSTEM_LANGUAGE_DEFAULT","emp_id",$emp_id,"hq_id",$hq_id))) :
updateStmt("parameter", "emp_id", $emp_id, array("par_value", $f_lng_num), " par_key = 'SYSTEM_LANGUAGE_DEFAULT' AND hq_id = '" . $hq_id . "'");
else:
insertStmt("parameter", array("par_key", "SYSTEM_LANGUAGE_DEFAULT", "emp_id", $emp_id, "par_value", $f_lng_num, "hq_id", $hq_id));
endif;
$languageSelected = $f_lng_num;
endif;
endif;
endif;
// Statement for languages
$sqlquery = "SELECT lng.lng_num, lng.lng_text"
. " FROM phoenix_special.language AS lng"
. " ORDER BY lng.lng_num";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
// Table with header
$numOfRows = 1;
$lineToggler = 0;
$tableOfRows = "";
while ($row = $result->fetch_assoc()):
$numOfRows++;
if ($lineToggler == 0) : $lineToggler = 1; else : $lineToggler = 0; endif;
$cellColor = getTableColor($numOfRows, $lineToggler);
$tableOfRows .= "<tr>\n";
$tableOfRows .= "<td align=\"center\" bgcolor=\"" . $cellColor ."\">&nbsp;<a href=\"javascript:finishPage('" . ec($row["lng_num"]) . "');\">" . getLngt($row["lng_text"]) . "</a></td>\n";
$tableOfRows .= "</tr>\n";
endwhile;
$result->free();
?>
<html>
<head>
<title><?php echo $pageTitel ?></title>
<link rel="stylesheet" type="text/css" href="../css/phoenix.css">
<script type="text/javascript">
<!--
function initPage() {
opener.submit();
};
function finishPage(f_lng_num) {
document.forms[0].f_act.value = 'saveLanguage';
document.forms[0].f_lng_num.value = f_lng_num;
document.forms[0].submit();
};
-->
</script>
</head>
<body onLoad="initPage();">
<div>
<form action="../admin/language.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="f_lng_num" value="">
<br><br>
<table class="f12np1" border="0" cellpadding="0" width="100%">
<?php echo $tableOfRows ?>
</table>
<br><br>
<table border="0" cellpadding="0" width="100%">
<tr>
<td align="center">
<input type="button" value="<?php echo getLngt("Schließen"); ?>" onClick="self.close()">
</td>
</tr>
</table>
</form>
</div>
</body>
</html>

760
html/admin/login.php Normal file
View File

@@ -0,0 +1,760 @@
<?php
include_once("../include/dbconnect.inc.php");
include_once("../include/global.inc.php");
//include_once("../include/caglobal.inc.php");
include_once ("../include/email.inc.php");
session_start();
getLanguage(__FILE__);
$multipleAccounts = false;
$accountsList = null;
// $currentClientIP = trim($_SERVER['HTTP_X_FORWARDED_FOR']);
$currentClientIP = mcArrTrim($_SERVER, "HTTP_X_FORWARDED_FOR");
if ($currentClientIP == "") :
// $currentClientIP = trim($_SERVER['REMOTE_ADDR']);
$currentClientIP = mcArrTrim($_SERVER, "REMOTE_ADDR");
endif;
// Check for "forgot password"
$parLoginForgotPasswordEnabled = getParameterValue("0", "LOGIN_FORGOT_PASSWORD_ENABLED", "0", "0");
if ($parLoginForgotPasswordEnabled == "1") :
list($f_act, $f_chk_account) = getHttpVars(array('f_act', 'f_chk_account'));
if ($f_act == "pwdForgotten" && $f_chk_account != "") :
// Get email from user
$usrId = getFieldValueFromId("user","usr_account",$f_chk_account,"usr_id");
if ($usrId != "") :
$usrEmail = getFieldValueFromId("user","usr_id",$usrId,"usr_email");
if ($usrEmail != "") :
// Change password
$newPwd = chr(rand(65,90)) . chr(rand(97,122)) . chr(rand(65,90)) . chr(rand(97,122)) . rand(0,9) . rand(0,9) . rand(0,9) . rand(0,9);
$sqlStmtPwd = "UPDATE user SET usr_password = PASSWORD('" . $newPwd . "'), usr_password_modify = NOW(), usr_password_old = '' WHERE usr_id = '" . $usrId . "'";
$res = $db->exec($sqlStmtPwd);
if ($db->connect_errno) : die (); endif;
if ($db->affected_rows > 0) :
$usrName = getFieldValueFromId("user","usr_id",$usrId,"usr_name");
$usrFirstname = getFieldValueFromId("user","usr_id",$usrId,"usr_firstname");
$usrHqId = getFieldValueFromId("user","usr_id",$usrId,"hq_id");
$mailFrom = getParameterValue("0", "MAIL_SENDER_ADDRESS", $usrHqId);
$mailTo = $usrEmail;
$mailBcc = "support@assecutor.de";
$mailSubject = getParameterValue("0", "MAIL_SUBJECT_PREFIX", "0", "0") . "Passwort vergessen";
$mailMode = "html";
if ($mailMode == "html") :
$mailText = "Hallo <b>" . $usrFirstname . " " . $usrName . "</b></br></br>soeben wurde f<>r Ihr Konto <b>\"" . $f_chk_account
. "\"</b> auf https://" . $_SERVER['SERVER_NAME']
. " das folgende Einmalpasswort erzeugt:</br></br>"
. "<b>" . $newPwd . "</b>"
. "</br></br>Sollte diese Nachfrage nicht von Ihnen stammen, handelt es sich m<>glicherweise um eine nicht autorisierte Anfrage."
. "</br></br>Diese Nachricht wurde automatisch erzeugt und dient nur als Hinweis, bitte antworten Sie nicht darauf.";
else :
$mailText = "Hallo" . $usrFirstname . " " . $usrName . ",\n\nsoeben wurde f<>r Ihr Konto \"" . $f_chk_account
. "\" auf https://" . $_SERVER['SERVER_NAME']
. " das folgende Einmalpasswort erzeugt:\n\n"
. $newPwd
. "\n\nSollte diese Nachfrage nicht von Ihnen stammen, handelt es sich m<>glicherweise um eine nicht autorisierte Anfrage."
. "\n\nDiese Nachricht wurde automatisch erzeugt und dient nur als Hinweis, bitte antworten Sie nicht darauf.";
endif;
$mailLogContent = $currentClientIP . " | " . $mailMode . " | " . $mailSubject . " | " . $usrFirstname . " " . $usrName . " | " . $f_chk_account . " | " . $newPwd;
sendExternalMail($mailText, $mailSubject, $mailTo, $mailFrom, $mailCc, $mailBcc, $mailMode, $mailLogContent);
else :
$statusMessage = getLngt("Der Vorgang hat leider nicht geklappt! Bitte versuchen Sie es noch einmal oder wenden sich ggfs. an die zust<73>ndige Niederlassung!");
endif;
else :
$statusMessage = getLngt("Es wurde leider keine E-Mail-Adresse gefunden! Bitte wenden Sie sich ggfs. an die zust<73>ndige Niederlassung!");
endif;
else :
$statusMessage = getLngt("Der angegebene Benutzername wurde leider nicht gefunden! Bitte wenden Sie sich ggfs. an die zust<73>ndige Niederlassung!");
endif;
endif;
endif;
$pageTitel = getLngt("ANMELDUNG");
$usr_id = -1;
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
getCurrentScript(__FILE__);
$constMaxLoginTrials = getParameterValue("0", "MAXIMUM_LOGIN_TRIALS", "0", "0");
$loginTrials = checkClientLoginTrials();
if ($loginTrials == 20) :
$conf = prepareSendMailPear("smtp.1und1.com","admin@assecutor.de","a7=!wURsT","admin@assecutor.de","ALERT: CHECK FOR BOT-ATTACK !!!","Assecutor","admin@assecutor.de","ALERT: CHECK FOR BOT-ATTACK !!!) (IP=".$currentClientIP.", account=".$f_chk_account.")");
$mail_object =& Mail::factory("smtp", $conf[0]);
$mail_object->send($conf[1], $conf[2], $conf[3]);
endif;
if ($loginTrials == $constMaxLoginTrials) :
$conf = prepareSendMailPear("smtp.1und1.com","admin@assecutor.de","a7=!wURsT","admin@assecutor.de","ALERT: SYSTEM ACCESS DENIED - BOT-ATTACK !!! (IP=".$currentClientIP.", account=".$f_chk_account.")",
"Assecutor","admin@assecutor.de","ALERT: SYSTEM ACCESS DENIED - BOT-ATTACK !!!) ");
$mail_object =& Mail::factory("smtp", $conf[0]);
$mail_object->send($conf[1], $conf[2], $conf[3]);
endif;
if ($loginTrials > $constMaxLoginTrials) :
// Referer
header("Location: ../admin/accessdenied.php");
endif;
if (substr(phpversion(), 0, 1) >= "5") :
if (isset($_SESSION['state']) && !isset($_SESSION['sso_error']) && isset($_SESSION['sso']) && !isset($_SESSION['usr_id']) && !isset($_SESSION['hq_id'])):
$statusMessage = checkSSOLogin();
// Wenn login ok, dann gelangt das Script nicht an diese Stelle (exit in checkLogin())!
// list($f_chk_account) = getHttpVars(array('f_chk_account'));
elseif (isset($_SESSION['state']) && isset($_SESSION['sso_error'])) :
$statusMessage = getLngt($_SESSION['sso_error']);
unset($_SESSION['sso_error']);
elseif (!isset($_SESSION['usr_id']) && !isset($_SESSION['hq_id'])):
$statusMessage = checkLogin();
// Wenn login ok, dann gelangt das Script nicht an diese Stelle (exit in checkLogin())!
list($f_chk_account) = getHttpVars(array('f_chk_account'));
else:
if(isset($_SESSION['sso'])) {
header("Location: ../admin/start.php");
exit();
} else {
// $randomCryptionNumber = $HTTP_SESSION_VARS["randomCryptionNumber"];
$randomCryptionNumber = $_SESSION["randomCryptionNumber"];
// header("Location: ../admin/menu_fs.php?p=" . ec("1"));
$usrTotpSecretCurrent = getFieldValueFromId("user", "usr_id", $_SESSION['usr_id'], "usr_totp_secret");
$usrTotpActivated = getFieldValueFromId("user", "usr_id", $_SESSION['usr_id'], "usr_totp_activated");
if ($usrTotpSecretCurrent == "" || $usrTotpActivated != "1") :
// 2-FA has to be activated
header("Location: ../admin/start.php");
else :
// 2-FA is activated and codes have to be checked
header("Location: ../admin/GA_verification.php");
endif;
}
endif;
else :
if (!isset($HTTP_SESSION_VARS['usr_id']) && !isset($HTTP_SESSION_VARS['hq_id'])):
$statusMessage = checkLogin();
// Wenn login ok, dann gelangt das Script nicht an diese Stelle (exit in checkLogin())!
list($f_chk_account) = getHttpVars(array('f_chk_account'));
else:
if(isset($_SESSION['sso'])) {
header("Location: ../admin/start.php");
exit();
} else {
// $randomCryptionNumber = $HTTP_SESSION_VARS["randomCryptionNumber"];
$randomCryptionNumber = $HTTP_SESSION_VARS["randomCryptionNumber"];
// header("Location: ../admin/menu_fs.php?p=" . ec("1"));
$usrTotpSecretCurrent = getFieldValueFromId("user", "usr_id", $_SESSION['usr_id'], "usr_totp_secret");
if (isset($_SESSION['sso']) || $usrTotpSecretCurrent == "") :
// 2-FA has to be activated
header("Location: ../admin/start.php");
else :
// 2-FA is activated and codes have to be checked
header("Location: ../admin/GA_verification.php");
endif;
}
endif;
endif;
//function checkSSOLogin() {
// global $PHP_SELF, $HTTP_SESSION_VARS, $_SESSION, $hq_id, $usr_id, $emp_id, $db, $dbname, $multipleAccounts, $accountsList;
//
// // Wurde bereits ein Account ausgewählt?
//// if (isset($_POST['sso_selected_account'])) {
//// $_SESSION['selected_account'] = $_POST['sso_selected_account'];
//// }
//
// if (isset($_POST['sso_selected_account'])) {
// $_SESSION['selected_account'] = $_POST['sso_selected_account'];
// // WICHTIG: Nach dem Setzen der Session-Variable MUSS die Seite neu geladen werden,
// // um den Login-Prozess mit dem nun bekannten Account fortzusetzen.
// // Das Formular POST war erfolgreich, jetzt redirecten.
// header("Location: $PHP_SELF");
// exit();
// }
//
// $usr_email = $_SESSION['sso'];
//
// if ($usr_email != ''):
// $sqlquery = "
// SELECT usr.usr_id, usr.hq_id, usr.usr_account
// FROM user AS usr
// JOIN headquarters AS hq ON usr.hq_id = hq.hq_id
// WHERE usr.usr_email = '$usr_email'
// ";
//
// $result = $db->dbQ($sqlquery);
// if (DB::isError($result)) die("$PHP_SELF: [$sqlquery] " . $result->getMessage());
//
// $accounts = [];
// while ($row = $result->fetch_assoc()) {
// $accounts[] = $row;
// }
// $result->free();
//
// if (count($accounts) > 1 && !isset($_SESSION['selected_account'])) {
// $multipleAccounts = true;
// $accountsList = $accounts;
//// showAccountSelectionModal($accounts);
//// exit();
// }
//
// if (isset($_SESSION['selected_account'])) {
// foreach ($accounts as $acc) {
// if ($acc['usr_account'] == $_SESSION['selected_account']) {
// $usr_id = $acc["usr_id"];
// $hq_id = $acc["hq_id"];
// $usr_account = $acc["usr_account"];
// }
// }
// unset($_SESSION['selected_account']);
// }
//
// elseif (count($accounts) === 1) {
// $usr_id = $accounts[0]["usr_id"];
// $hq_id = $accounts[0]["hq_id"];
// $usr_account = $accounts[0]["usr_account"];
// }
// else {
// unset($_SESSION['sso']);
// return "Benutzer $usr_email im System nicht gefunden.";
// }
//
// $emp_id = getOneStmt(
// "SELECT emp.emp_id FROM employee AS emp, user AS usr
// WHERE emp.usr_id = $usr_id
// AND usr.usr_account = '$usr_account'
// AND usr.hq_id = $hq_id
// AND usr.usr_email = '$usr_email'",
// "emp_id"
// );
//
// $_SESSION['usr_id'] = $usr_id;
// $_SESSION['hq_id'] = $hq_id;
// $_SESSION['emp_id'] = $emp_id;
// $_SESSION['dbname'] = $dbname;
// $_SESSION["chgpwd"] = "1";
//
// unset($_SESSION['sso']);
//
// header("Location: $PHP_SELF");
// exit();
// endif;
//}
function checkSSOLogin() {
global $PHP_SELF, $HTTP_SESSION_VARS, $_SESSION, $hq_id, $usr_id, $emp_id, $db, $dbname, $multipleAccounts, $accountsList;
// 1. POST VERARBEITUNG
// Wenn ein Account ausgewählt wurde, speichern wir ihn und machen einen Reload (Redirect),
// damit die Seite sauber mit der Auswahl neu lädt.
if (isset($_POST['sso_selected_account'])) {
$_SESSION['selected_account'] = $_POST['sso_selected_account'];
// WICHTIG: Hier neu laden, damit wir aus dem POST-Modus rauskommen
header("Location: $PHP_SELF");
exit();
}
$usr_email = $_SESSION['sso'];
if ($usr_email != ''):
$sqlquery = "
SELECT usr.usr_id, usr.hq_id, usr.usr_account
FROM user AS usr
JOIN headquarters AS hq ON usr.hq_id = hq.hq_id
WHERE usr.usr_email = '$usr_email'
";
$result = $db->dbQ($sqlquery);
if (DB::isError($result)) die("$PHP_SELF: [$sqlquery] " . $result->getMessage());
$accounts = [];
while ($row = $result->fetch_assoc()) {
$accounts[] = $row;
}
$result->free();
// 2. PRÜFUNG: MUSS MODAL ANGEZEIGT WERDEN?
if (count($accounts) > 1 && !isset($_SESSION['selected_account'])) {
$multipleAccounts = true;
$accountsList = $accounts;
// WICHTIG: Hier abbrechen!
// Wir dürfen nicht weiterlaufen, da wir noch keine User-ID haben.
// Das Skript läuft nun weiter im HTML und zeigt das Modal an.
return;
}
// 3. ACCOUNT ZUWEISUNG (wenn Auswahl getroffen oder nur 1 Account)
if (isset($_SESSION['selected_account'])) {
foreach ($accounts as $acc) {
if ($acc['usr_account'] == $_SESSION['selected_account']) {
$usr_id = $acc["usr_id"];
$hq_id = $acc["hq_id"];
$usr_account = $acc["usr_account"];
}
}
// Auswahl wieder löschen, damit man beim nächsten Mal nicht festhängt
unset($_SESSION['selected_account']);
} elseif (count($accounts) === 1) {
$usr_id = $accounts[0]["usr_id"];
$hq_id = $accounts[0]["hq_id"];
$usr_account = $accounts[0]["usr_account"];
} else {
// Fallback: Session löschen wenn kein Account passt
unset($_SESSION['sso']);
return "Benutzer $usr_email im System nicht gefunden.";
}
// Ab hier haben wir sicher eine $usr_id
$emp_id = getOneStmt(
"SELECT emp.emp_id FROM employee AS emp, user AS usr
WHERE emp.usr_id = $usr_id
AND usr.usr_account = '$usr_account'
AND usr.hq_id = $hq_id
AND usr.usr_email = '$usr_email'",
"emp_id"
);
$_SESSION['usr_id'] = $usr_id;
$_SESSION['hq_id'] = $hq_id;
$_SESSION['emp_id'] = $emp_id;
$_SESSION['dbname'] = $dbname;
$_SESSION["chgpwd"] = "1";
// unset($_SESSION['sso']);
header("Location: $PHP_SELF");
exit();
endif;
}
function showAccountSelectionModal($accounts) {
echo '
<html>
<head>
<title>Account auswählen</title>
<style>
body { font-family: Arial; background:#f3f3f3; }
.modal {
width: 400px; margin: 100px auto; padding: 20px;
background: white; border-radius: 10px;
box-shadow: 0 0 15px rgba(0,0,0,0.2);
text-align:center;
}
select, button {
width: 90%; padding: 10px; margin-top: 15px;
font-size: 16px;
}
button {
background:#007bff; color:white; border:none;
border-radius:8px; cursor:pointer;
}
button:hover {
background:#0056b3;
}
</style>
</head>
<body>
<div class="modal">
<h2>Bitte Account ausw&auml;hlen</h2>
<form method="POST">
<select name="sso_selected_account">
';
foreach ($accounts as $acc) {
echo '<option value="'.$acc['usr_account'].'">'.$acc['usr_account'].'</option>';
}
echo '
</select>
<button type="submit">Weiter</button>
</form>
</div>
</body>
</html>
';
}
// Login-Formular
function checkLogin()
{
global $PHP_SELF, $HTTP_SESSION_VARS, $_SESSION, $hq_id, $usr_id, $emp_id, $db, $dbname, $currentClientIP;
list($f_submit, $f_chk_account, $f_chk_password, $statusMessage, $deviceIsKnown) =
getHttpVars(array('f_submit', 'f_chk_account', 'f_chk_password', 'statusMessage', 'deviceIsKnown'));
if ($f_submit == getLngt("Anmelden")):
$f_chk_account = str_replace("'", "\'", $f_chk_account);
$f_chk_password = str_replace("'", "\'", $f_chk_password);
$sessionVars = authenticate($f_chk_account, $f_chk_password, $statusMessage);
$usr_id = $sessionVars[0];
$hq_id = $sessionVars[1];
$emp_id = $sessionVars[2];
if ($usr_id != "" && is_numeric($usr_id) && $usr_id > "0") :
$randomCryptionNumber = ($usr_id + 1234);
else :
$randomCryptionNumber = rand(1,10000);
endif;
if ($usr_id != ''):
// Return-Wert ist ungleich '', name/pass ist g<>ltig
if (phpversion() < '4.1.0'):
// bis auschl. PHP 4.1.0.
session_register("usr_id","hq_id","emp_id");
$HTTP_SESSION_VARS["usr_id"] = $usr_id;
$HTTP_SESSION_VARS["hq_id"] = $hq_id;
$HTTP_SESSION_VARS["emp_id"] = $emp_id;
$HTTP_SESSION_VARS["dbname"] = $dbname;
$HTTP_SESSION_VARS["randomCryptionNumber"] = $randomCryptionNumber;
$HTTP_SESSION_VARS["chgpwd"] = "1";
else:
// ab einschl. PHP 4.1.0.
$_SESSION['usr_id'] = $usr_id;
$_SESSION['hq_id'] = $hq_id;
$_SESSION['emp_id'] = $emp_id;
$_SESSION['dbname'] = $dbname;
$_SESSION['randomCryptionNumber'] = $randomCryptionNumber;
$_SESSION["chgpwd"] = "1";
endif;
if ($deviceIsKnown != "1" && getParameterValue("0", "LOGIN_CHECK_DEVICE", "0", "0") == "1"):
$usrFreeDevice = getOneStmt("SELECT gdc_content FROM genericdatacontainer WHERE gdc_obj_type = 'usr' AND gdc_obj_id = " . $usr_id . " AND gdc_gen_fieldname = 'usr_free_device'", "gdc_content");
$usr_account = getOneStmt("SELECT usr_account FROM user AS usr WHERE usr_id = " . $usr_id, "usr_account");
if ($usrFreeDevice != "1"):
insertStmt("genericdatacontainer", array("gdc_obj_type", "usr", "gdc_obj_id", $usr_id, "gdc_gen_fieldname", "usr_free_device", "gdc_content", "1", "gdc_context", date("Y-m-d H:i:s")));
myWriteLog(
"usr_free_device = '1' was set:\n" .
"\$usr_id = " . $usr_id . ", \$usr_account = [" . $usr_account . "], \$_SERVER['HTTP_USER_AGENT'] = [" . $_SERVER['HTTP_USER_AGENT'] . "], \$_SERVER['REMOTE_ADDR'] = [" . $currentClientIP . "]"
);
else:
$usr_email = getOneStmt("SELECT usr_email FROM user AS usr WHERE usr_id = " . $usr_id, "usr_email");
// $browser = get_browser(null, true);
if ($usr_email != ""):
include_once("../include/email/htmlMimeMail.php");
$usr_firstname = getOneStmt("SELECT usr_firstname FROM user AS usr WHERE usr_id = " . $usr_id, "usr_firstname");
$usr_name = getOneStmt("SELECT usr_name FROM user AS usr WHERE usr_id = " . $usr_id, "usr_name");
$mailObj = new htmlMimeMail();
$mailObj->setFrom(getParameterValue("0", "MAIL_SENDER_ADDRESS", $hq_id));
$mailObj->setBcc("ca@assecutor.de");
$parMailSubjectPrefix = trim(getParameterValue("0", "MAIL_SUBJECT_PREFIX", "0", "0"));
$mailObj->setSubject($parMailSubjectPrefix . " Anmeldung von einem unbekannten Ger<65>t");
$mailObj->setText("Hallo " . $usr_firstname . ' ' . $usr_name . ",\n\n". 'soeben hat sich jemand mit Ihrem Konto "' . $usr_account .
'" auf https://' . $_SERVER['SERVER_NAME'] .
" von einem bisher unbekannten Ger<65>t angemeldet:\n\n" .
$_SERVER['HTTP_USER_AGENT'] .
// $browser["browser"] . " " . $browser["platform"] .
"\n\nSollte diese Anmeldung nicht von Ihnen stammen, handelt es sich m<>glicherweise um einen nicht autorisierten Login." .
"\n\nDiese Mail wurde automatisch erzeugt und dient nur als Hinweis, bitte antworten Sie nicht darauf."
);
$mailResult = $mailObj->send(array($usr_email), 'smtp');
// $mailResult = $mailObj->send(array("ca@assecutor.de"), 'smtp');
myWriteLog(
"Warningmail was sent from <" . getParameterValue("0", "MAIL_SENDER_ADDRESS", $hq_id) . "> to <" . $usr_email . ">:\n" .
"\$usr_id = " . $usr_id . ", \$usr_account = [" . $usr_account . "], \$_SERVER['HTTP_USER_AGENT'] = [" . $_SERVER['HTTP_USER_AGENT'] . "], \$_SERVER['REMOTE_ADDR'] = [" . $currentClientIP . "]"
);
else:
myWriteLog(
"Warningmail could not be sent because no mail-address available:\n" .
"\$usr_id = " . $usr_id . ", \$usr_account = [" . $usr_account . "], \$_SERVER['HTTP_USER_AGENT'] = [" . $_SERVER['HTTP_USER_AGENT'] . "], \$_SERVER['REMOTE_ADDR'] = [" . $currentClientIP . "]"
);
endif;
endif;
endif;
header("Location: $PHP_SELF");
exit();
endif;
elseif ($f_submit == 'Registrieren'):
header("Location: register.php");
endif;
return $statusMessage;
}
function myWriteLog($log_text) {
$log_file_name = "../log/login_" . date("Ym") . ".log";
$fileHandle = @fopen($log_file_name, 'a');
@fwrite($fileHandle, "[" . date("Y-m-d H:i:s") . "] " . $log_text . "\n");
@fclose($fileHandle);
}
// authenticate username/password against a database
// returns: 0 if username and password is incorrect
// emp_id if username and password are correct
function authenticate($f_chk_account, $f_chk_password, &$statusMessage)
{
global $db, $PHP_SELF, $currentClientIP;
$retArray = array("","","");
if ($f_chk_account == "" || $f_chk_password == "") :
$statusMessage = getLngt("Benutzername und/oder Passwort fehlt oder ist falsch.");
return "";
endif;
$sqlquery = "SELECT usr.usr_id, usr.hq_id, usr.usr_password FROM user AS usr, headquarters AS hq"
. " WHERE usr.usr_account = '$f_chk_account'"
. " AND (usr.usr_password_old = OLD_PASSWORD('" . $f_chk_password . "') OR usr.usr_password = PASSWORD('" . $f_chk_password . "'))"
. " AND usr.hq_id = hq.hq_id";
$result = $db->dbQ($sqlquery);
$usr_id = "";
$hq_id = "";
while ($row = $result->fetch_assoc()):
$usr_id = intval($row["usr_id"]);
$hq_id = intval($row["hq_id"]);
$usr_password = $row["usr_password"];
endwhile;
$result->free();
if ($db->connect_errno):
$statusMessage = '$PHP_SELF: authenticate: Fehler bei Abfrage von Datenbank.';
else:
// Get the IP of the current client calling the page
// $currentClientIP = trim($_SERVER['REMOTE_ADDR']); // Defined above, global import
if ($usr_id == '') :
$statusMessage = getLngt("Benutzername und/oder Passwort fehlt oder ist falsch.");
// Login-trial failed! Update table "ipsecurity"
updateClientLoginTrials();
// Write logdata into log database
writeToLogDB("52",$hq_id,"",$usr_id,"","","","ACCOUNT=" . $f_chk_account . "|MESS=Login failed|IP=" . $currentClientIP);
else :
if (substr($usr_password, 0, 1) != "*") {
$db->query("UPDATE user SET usr_password = PASSWORD('" . $f_chk_password . "') WHERE usr_id = " . $usr_id);
}
$retArray[0] = $usr_id;
$retArray[1] = $hq_id;
$retArray[2] = "";
$emp_id = getOneStmt(
"SELECT emp.emp_id FROM employee AS emp, user AS usr" .
" WHERE emp.usr_id = $usr_id AND usr.usr_account = '$f_chk_account' AND usr.hq_id = $hq_id"
. " AND usr.usr_password = PASSWORD('$f_chk_password')", "emp_id");
if ($db->connect_errno) :
$statusMessage = getLngt("$PHP_SELF: authenticate: Fehler bei Abfrage von Datenbank.");
else:
$retArray[2] = $emp_id;
endif;
// Write logdata into log database
writeToLogDB("52",$hq_id,"",$usr_id,"","",$emp_id,"ACCOUNT=" . $f_chk_account . "|MESS=Login ok|IP=" . $currentClientIP);
endif;
endif;
// Check status of authentication, if user is a customer
mcIsSet($emp_id);
if ($emp_id != "" && getFieldValueFromId("user","usr_id",$usr_id,"usr_type") == "2") :
$cmp_authenticated = getOneStmt(
"SELECT cmp.cmp_authenticated"
. " FROM company AS cmp, customer AS cs, costcenter AS csc, employee AS emp"
. " WHERE emp.emp_id = $emp_id AND"
. " emp.csc_id = csc.csc_id AND"
. " csc.cs_id = cs.cs_id AND"
. " cs.cmp_id = cmp.cmp_id", "cmp_authenticated");
if ($db->connect_errno) :
$statusMessage = getLngt("$PHP_SELF: authenticate: Fehler bei Abfrage von Datenbank.");
else:
if ($cmp_authenticated != "1") :
// Customer has no access
$retArray = array("","","");
$statusMessage = getLngt("Leider haben Sie keine Zugangsberechtigung.");
endif;
endif;
endif;
return $retArray;
}
$title = getLngt("Herzlich willkommen!");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="description" content="votian"> <meta name="keywords" content="votian">
<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 type="text/javascript">
<!--
<?php echo $jsMenuOut; ?>
function initForm()
{
myhide('abmelden');
myhide('sprache');
document.forms[0].f_chk_account.focus();
document.forms[0].deviceIsKnown.value = getCookie("deviceIsKnown");
//alert(document.forms[0].deviceIsKnown.value);
}
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(";");
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == " ") {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
// Forgot password
function forgot_password() {
var usrAccount = document.forms[0].f_chk_account.value;
if (usrAccount == '') {
alert('<?php echo getLngt("Bitte tragen Sie Ihren Benutzernamen ein und bet<65>tigen Sie den Link erneut!") ?>');
} else {
if (confirm('<?php echo getLngt("Eine E-Mail wird an Ihre erfasste Adresse geschickt!") ?>')) {
document.forms[0].f_act.value='pwdForgotten';
document.forms[0].submit();
}
}
}
-->
</script>
<script src="../include/lib_global.js" type="text/javascript">
</script>
<noscript>
<center>
<b><br>JavaScript ist nicht verf&uuml;gbar. Bitte aktivieren Sie JavaScript<br><br>
in Ihrem Browser, damit diese Seite ordnungsgem&auml;&szlig; funktioniert!</b><br><br>
</center>
</noscript>
</head>
<body leftmargin="1" topmargin="1" marginwidth="0" marginheight="0" link="#990000" vlink="#990000" alink="#990000" onLoad="<?php echo $phpCurrentNavigationOnLoad ?>initForm();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="maincontent" name="maincontent" id="maincontent">
<?php echo htmlDivLineSpacer("30px"); ?>
<div class="f12bp1_blue">
<?php echo $title ?>
</div>
<?php echo htmlDivLineSpacer("25px"); ?>
<?php
if($multipleAccounts) :
echo '
<div class="modal">
<h2>Bitte Account ausw&auml;hlen</h2>
<form action="login.php" method="POST">
<select name="sso_selected_account">
';
foreach ($accountsList as $acc) {
echo '<option value="'.$acc['usr_account'].'">'.$acc['usr_account'].'</option>';
}
echo '
</select>
<br>
<br>
<button type="submit" style="width: 120px; height: 25px; padding-top: 0px; background: rgb(84, 184, 251); color: rgb(0, 0, 0); font-size: 12pt; font-weight: bold; font-style: normal; font-family: Helvetica, Arial; border: 1px solid rgb(204, 204, 204); appearance: none; cursor: pointer;">Weiter</button>
</form>
</div>';
else :
?>
<div>
<?php echo getLngt("Bitte melden Sie sich an:") ?>
</div>
<?php echo htmlDivLineSpacer("25px"); ?>
<!-- $_SERVER['SERVER_NAME']-->
<?php
$parSSOEnabled = "1";
if ($parSSOEnabled == "1"){
$tenantId = 'a70b907f-9db5-417e-a1a4-77a71bd0c8b5';
$clientId = '94ee35c5-81fb-4ad6-8364-2a854a60851d';
$redirectUri = 'https://test.sb.assecutor.de/admin/o-auth.php';
// URL f<>r die Anmeldung bei Microsoft erstellen
$authorizeUrl = "https://login.microsoftonline.com/$tenantId/oauth2/v2.0/authorize";
$scope = 'openid profile email';
$_SESSION['state'] = bin2hex(openssl_random_pseudo_bytes(16)); // Schutz vor CSRF
$loginUrl = $authorizeUrl . '?' . http_build_query([
'client_id' => $clientId,
'response_type' => 'code',
'redirect_uri' => $redirectUri,
'response_mode' => 'query',
'scope' => $scope,
'state' => $_SESSION['state']
]);
echo '<div class="bsk-container" style="margin-top: 15px;">';
echo ' <a href="' . $loginUrl . '" style="font-family: \'Segoe UI\', sans-serif; font-size: 15px; font-weight: 600; color: #5E5E5E; background-color: #FFFFFF; padding: 12px 12px; text-decoration: none; border: 1px solid #8C8C8C; align-items: center; justify-content: center;">';
echo '<img src="../images/ms-symbollockup.png" alt="Microsoft Logo" style="height: 1em; width: 1em; top: .125em; position: relative; margin-right: 12px;">';
echo ' Mit Microsoft anmelden';
echo ' </a>';
echo '</div>';
// echo "<a href='$loginUrl'>". getLngt("Mit Microsoft anmelden") . "</a>";
echo htmlDivLineSpacer("50px");
}
?>
<details>
<summary>Klassisches Login</summary>
<br>
<form action="login.php" method="POST">
<input type="hidden" name="f_act" value="">
<div>
<div <?php echo setStyleHtmlDiv("150px","left"); ?>><?php echo getLngt("Name:") ?></div>
<div>
<input type="text" name="f_chk_account" value="<?php echo mcIsSet($f_chk_account) ?>" size="20" maxlength="20">
</div>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<div>
<div <?php echo setStyleHtmlDiv("150px","left"); ?>><?php echo getLngt("Passwort:") ?></div>
<div>
<input type="password" name="f_chk_password" value="" size="20" maxlength="20">
</div>
</div>
<?php echo htmlDivLineSpacer("20px"); ?>
<?php echo defineButton(getLngt("Anmelden"), "f_submit", "", "", "", "", "", "", "", "", "", "", "", "", "", getLngt("Anmelden") . " ALT+a", "a", true); ?>
<?php echo htmlDivLineSpacer("20px"); ?>
<?php
// $parLoginForgotPasswordEnabled = getParameterValue("0", "LOGIN_FORGOT_PASSWORD_ENABLED", "0", "0");
if ($parLoginForgotPasswordEnabled == "1") :
echo "<a href=\"javascript:forgot_password();\">" . getLngt("Passwort vergessen") . "</a>";
echo htmlDivLineSpacer("20px");
endif;
?>
<div class="f10bp1_red">
<?php echo $statusMessage; ?>
</div>
<input type="hidden" name="deviceIsKnown" value="">
</form>
</details>
</div>
<?php endif; ?>
</body>
</html>
<script type="text/javascript">
<!--
checkBrowser();
-->
</script>

28
html/admin/logout.php Normal file
View File

@@ -0,0 +1,28 @@
<?php
/*=======================================================================
*
* logout.php
*
* Autor: Carsten Annacker, Marc Vollmann
*
=======================================================================*/
include_once ("../include/global.inc.php");
include_once ("../include/auth.inc.php");
include_once ("../include/inc_user.inc.php");
// Reset user states
resetUserStates();
session_start();
session_unset();
session_destroy();
// Referer
header("Location: ../admin/start.php");
?>

699
html/admin/menu.php Normal file
View File

@@ -0,0 +1,699 @@
<?php
/*=================================================================================
*
* menu.php
*
* Autor: Marc Vollmann
*
* NOTE: Following steps are to do to include this menu page into another page:
* [0.] Include file "../admin/menu.php"
* Attention: Include lib "../include/html.inc.php" after "menu.php"
* [1.] Insert CSS-Lib. for navigation library (preparsed by PHP):
* <style type="text/css">
* <?php include_once ("../css/navigation.css.php"); ?>
* </style>
* [2.] Insert JS-Lib. for navigation library (preparsed by PHP):
* <script type="text/javascript">
* <?php include_once ("../include/menu.js.php"); ?>
* </script>
* [3.] Insert PHP-Parameter for output (menu, reduced menu, page title) into body of the page
* Attention: Do not forget the onLoad calls !!!
* <body ... onLoad="<?php echo $phpCurrentNavigationOnLoad ?> ..." ... >
* <?php echo $phpMenuOut ?>
* <?php echo $phpReducedMenuOut ?>
* <?php echo $phpPageTitelOut ?>
* [4.] Insert PHP-Parameter for storing current navigation item in <input type="hidden">
* <form> ... <?php echo $phpCurrentNavigationInputHidden ?> ... </form>
=================================================================================*/
include_once ("../include/global.inc.php");
include_once ("../include/auth.inc.php");
include_once ("../include/inc_user.inc.php");
// Check HTTP-Parameters
$httpVars = array("statusMessage", "currentNavigationItem", "menuActiveByPageTitel", "deactivateMenu");
getSecHttpVars("1", $httpVars);
getLanguage(__FILE__);
// Check parameter to disable menu
if ($deactivateMenuStatic == "1" || $deactivateMenu == "1") : $menuDisabled = true; endif;
if (!isset($menuDisabled)) : $menuDisabled = false; endif;
if ($menuActiveByPageTitel == "1") :
$menuActiveByPageTitel = true;
elseif ($menuActiveByPageTitel == "0") :
$menuActiveByPageTitel = false;
else :
$menuActiveByPageTitel = false;
endif;
// Check for used JS framework
if ($usedFramework != "1" && $usedFramework != "2") :
$usedFramework = getParameterValue("0", "FRAMEWORK_USED", "0", "0");
if ($usedFramework != "1" && $usedFramework != "2") :
$usedFramework = "1";
endif;
endif;
// Check kind of user agent
$isFirefox = true;
if (strpos($_SERVER['HTTP_USER_AGENT'], "Firefox") === false) {
$isFirefox = false;
}
$browser = $_SERVER['HTTP_USER_AGENT'] . "\n\n<br><br>";
$browserOk = false;
if (!(strpos($browser, "Firefox") === false)) : $browserOk = true; endif;
if (!$browserOk && !(strpos($browser, "FIREFOX") === false)) : $browserOk = true; endif;
if (!$browserOk && !(strpos($browser, "Edge") === false)) : $browserOk = true; endif;
if (!$browserOk && !(strpos($browser, "Chrome") === false)) : $browserOk = true; endif;
// Get user type
$userType = getFieldValueFromId("user","usr_id",$usr_id,"usr_type");
// Get hq_workmode
$hq_workmode = getFieldValueFromId("headquarters","hq_id",$hq_id,"hq_workmode");
// Get the rights of the employee logged in
$empRights = getRights($emp_id);
// Current activated navigation item
if ($currentNavigationItem == "") : $currentNavigationItem = ""; endif;
$currentNavigationLevel = 0;
// Get displayed background colors of the employee
$constMaskContentBgCol = getParameterValue($emp_id, "MASK_CONTENT_BGCOL", $hq_id);
// Constants
$constMenuItemWidth = "100px";
$constMenuColWidth = "100px";
$constBackground = "#CDD9FD";
$constMenuBackground = array();
$constMenuBackground[0] = "#1b12b9";
$constMenuBackground[1] = "#1b12b9";
$constMenuBackground[2] = "#4e45ec";
$constMenuBackground[3] = "#97bcFF";
$constMenuBackgroundImage = array();
$constMenuBackgroundImage[0] = "spacer_blue_menu_01.jpg";
$constMenuBackgroundImage[1] = "spacer_blue_menu_01.jpg";
$constMenuBackgroundImage[2] = "spacer_blue_menu_02.jpg";
$constMenuBackgroundImage[3] = "spacer_blue_menu_03.jpg";
$constMenuColor = array();
$constMenuColor[0] = "#FFFFFF";
$constMenuColor[1] = "#FFFFFF";
$constMenuColor[2] = "#FFFFFF";
$constMenuColor[3] = "#FFFFFF";
$constMaincontentBackground = "#CDD9FD";
$constMaincontent2Background = "#CDD9FD";
$constButtonBackground = "#54b8fb"; // Classic dark blue: #1b12b9
$constButtonColor = "#000000"; // #FFFFFF
$constButtonColor2 = "#4e45ec";
$constButtonOnMouseOverColor = "#FFFFFF"; // #97bcFF
$constListBgCol1 = "#AAAAFF";
$constListBgCol2 = "#AAAAFF";
$constListBgCol3 = "#CCCCFF";
$constListBgCol4 = "#CCCCFF";
$constPageHeadlineBgCol = "#1b12b9";
$constTickerBgCol = "#CDD9FD";
// Overwrite colors by employee parameter
if ($constMaskContentBgCol == "1") :
$constBackground = "#DDDDDD";
$constMaincontentBackground = "#DDDDDD";
$constMaincontent2Background = "#DDDDDD";
$constButtonBackground = "#AAAAAA";
$constButtonColor = "#FFFFFF";
$constButtonColor2 = "#000000";
$constButtonOnMouseOverColor = "#444444";
$constListBgCol1 = "#AAAAAA";
$constListBgCol2 = "#AAAAAA";
$constListBgCol3 = "#CCCCCC";
$constListBgCol4 = "#CCCCCC";
$constPageHeadlineBgCol = "#888888";
$constTickerBgCol = "#CDD9FD";
endif;
// *****************************************************************
// Navigation deep of the headquarters menu, number of sublevels
$jsMenuNavigationDeep = 2;
// Definition of the headquarters menu structure
$idColContainer = array();
$idColContainer[0] = array("menu_00");
$idColContainer[1] = array("menu_01", "menu_02", "menu_03");
$idColContainer[2] = array("menu_01_01", "menu_01_02", "menu_01_03", "menu_01_04", "menu_01_05", "menu_02_01", "menu_03_01", "menu_04_01", "menu_05_01");
// $idColContainer[3] = array("menu_01_02_01", "menu_01_02_02", "menu_01_02_03", "menu_01_02_04", "menu_01_02_05", "menu_01_02_06");
$idColContainer[3] = array("menu_01_02_01", "menu_01_02_02", "menu_01_02_03", "menu_01_02_05", "menu_01_02_06"); // Without "G<>ter"
/* Frachtverg<72>tungsmatrizen (leider nicht genutzt):
$idColContainer[3] = array("menu_01_02_01", "menu_01_02_07", "menu_01_02_02", "menu_01_02_08", "menu_01_02_03", "menu_01_02_04", "menu_01_02_05", "menu_01_02_06");
*/
// The array consists of "name", "URL", "target" and "menu access".
// The first dimension is defined according to the (sub)menu level
$menu[0]["impressum"] = array(getLngt("Impressum"), "javascript:mkImpressumPopupWin();", "", "", "", "2", array(), "1", "");
if ($userType == "1") :
$menu[0]["sprache"] = array(getLngt("Sprache"), "javascript:mkLanguagePopupWin();", "", "", "", "2", array(), "1", "");
endif;
$menu[0]["abmelden"] = array(getLngt("Abmelden"), "../admin/logout.php", "_top", "", "1", "2", array(), "", "");
// Headquarter
if ($userType == "1") :
// Get db-parameter for the number of lists (frames) to be displayed of the current employee
$empMaskMultiJoblist = getParameterValue($emp_id, "MASK_MULTI_JOBLIST");
$empMaskMultiJoblistMax = getParameterValue("0", "MASK_MULTI_JOBLIST_MAX", $hq_id);
if (!(is_numeric($empMaskMultiJoblist) && $empMaskMultiJoblist > 0 && $empMaskMultiJoblist <= $empMaskMultiJoblistMax)) :
$empMaskMultiJoblist = getParameterValue("0", "MASK_MULTI_JOBLIST", $hq_id);
if (!(is_numeric($empMaskMultiJoblist)) || !($empMaskMultiJoblist > 0)) : $empMaskMultiJoblist = "4"; endif;
endif;
// Define items
// [0]: Displayed text
// [1]: URL
// [2]: Target
// [3]: Access right
// [4]: (= "1") <=> Defines last item of the current container like "menu_01_01"
// [5]: (= "1") <=> Disables (!) container actions ("onMouseover", "onMouseout", "onClick")
// (= "2") <=> Disables (!) ONLY container action "onClick"
// [6]: Array of containers be visible by hovering and click
// [7]: (= "1") <=> Disables (!) navigation suffix "?currentNavigationItem=..." in navigation link
// [8]: String of GET-parameters added to the navigation link
$menu[1]["verwaltung"] = array(getLngt("Verwaltung"), "#", "", "", "", "", array("menu_01_01","menu_01_02","menu_01_03","menu_01_04","menu_01_05"), "1", "");
$menu[1]["auftraege"] = array(getLngt("Auftr<EFBFBD>ge"), "#", "", "", "", "", array("menu_02_01"), "1", "");
$menu[1]["listen"] = array(getLngt("Listen"), "../admin/jb_list_fs.php?maskNumOfWins=" . $empMaskMultiJoblist, "_blank", substr($empRights,4,1), "1", "", array(), "1", "");
$menu[1]["rechnungen"] = array(getLngt("Rechnungen"), "#", "", "", "", "", array("menu_03_01"), "1", "");
$menu[1]["vertrieb"] = array(getLngt("Vertrieb"), "../groupware/appointment.php", "", substr($empRights,11,1), "", "", array(), "", "");
$menu[1]["nachrichten"] = array(getLngt("Nachrichten"), "#", "", "", "1", "", array("menu_04_01"), "1", "");
$menu[1]["datentransfer"] = array(getLngt("Datentransfer"), "#", "", "", "", "", array("menu_05_01"), "1", "");
$menu[1]["statistik"] = array(getLngt("Statistik"), "../statistic/statistic.php", "", substr($empRights,8,1), "", "", array(), "", "");
$menu[1]["formulare"] = array(getLngt("Formulare"), "../admin/metafield_editor.php", "", substr($empRights,15,1), "1", "", array(), "", "");
$menu[2]["kunden"] = array(getLngt("Kunden"), "../admin/customer_list.php", "", substr($empRights,0,1), "", "", array(), "", "");
$menu[2]["transporteure"] = array(getLngt("Transporteure"), "../admin/courier_list.php", "", substr($empRights,1,1), "", "", array(), "", "");
$menu[2]["map"] = array(getLngt("Karten<EFBFBD>bersicht"), "../locating/map.php", "_blank", substr($empRights,19,1), "1", "", array(), "", "");
// $menu[2]["gueter"] = array(getLngt("G<>ter"), "#", "", "", "", "", array("menu_01_02_04"), "1", "");
$menu[2]["berichte"] = array(getLngt("Berichte"), "#", "", "", "", "", array("menu_01_02_06"), "1", "");
$menu[2]["preise"] = array(getLngt("Preise"), "#", "", "", "", "", array("menu_01_02_01"), "1", "");
$menu[2]["rabatte"] = array(getLngt("Rabatte"), "#", "", "", "1", "", array("menu_01_02_02"), "1", "");
/* Frachtverg<72>tungsmatrizen (leider nicht genutzt):
$menu[2]["preise"] = array(getLngt("Preise/Frachtverg."), "#", "", "", "", "", array("menu_01_02_01","menu_01_02_07"), "1", "");
$menu[2]["rabatte"] = array(getLngt("Rabatte"), "#", "", "", "1", "", array("menu_01_02_02","menu_01_02_08"), "1", "");
*/
// $menu[2]["mitarbeiter"] = array(getLngt("Mitarbeiter"), "../admin/employee_list.php", "", "", "", "", array(), "", ""); // substr($empRights,3,1);
// $menu[2]["mitarbeiter"] = array(getLngt("Mitarbeiter"), "#", "", "", "", "", array("menu_01_02_05"), "1", "");
$menu[2]["niederlassungen"] = array(getLngt("Niederlassungen"), "#", "", "", "", "", array("menu_01_02_05"), "1", "");
$menu[2]["feiertage"] = array(getLngt("Feiertage"), "../admin/public_holiday.php", "", substr($empRights,2,1), "", "", array(), "", "");
$menu[2]["anfahrtszeiten"] = array(getLngt("Anfahrtszeiten"), "../admin/traveltime.php", "", substr($empRights,2,1), "1", "", array(), "", "");
// $menu[2]["adressen"] = array(getLngt("Adressen"), "../admin/ad_admin.php", "", max(substr($empRights,0,1),substr($empRights,1,1)), "1", "", array(), "", "");
$menu[2]["adressen"] = array(getLngt("Adressen"), "#", "", "", "", "", array("menu_01_02_03"), "1", "");
$menu[2]["gruppen"] = array(getLngt("Gruppen"), "../admin/group.php", "", substr($empRights,8,1), "", "", array(), "", "");
// $menu[2]["kontakte"] = array(getLngt("Kontakte"), "../admin/metafield_list.php", "", substr($empRights,11,1), "1", "", array(), "", "category=" . ec("1") . "&categoryPageTitel=KONTAKTE");
// $menu[2]["extras"] = array(getLngt("Kessel Buntes"), "..//tools/statistic_finishment.php", "_blank", substr($empRights,46,1), "1", "", array(), "", "");
$menu[2]["filter"] = array(getLngt("Filter"), "../admin/filter.php", "", substr($empRights,32,1), "1", "", array(), "", "crf_admin=" . ec("100") . "");
// $menu[2]["berichte"] = array(getLngt("Berichte"), "#", "", "", "", "", array("menu_01_02_06"), "1", "");
$menu[2]["bewertung"] = array(getLngt("Bewertungen"), "../admin/metafield_list.php", "", substr($empRights,8,1), "", "", array(), "", "category=" . ec("15") . "&objId=1&categoryPageTitel=BEWERTUNGEN&f_act_mtfl=search&viewItemsMode=0");
// $menu[2]["filter"] = array(getLngt("Filter"), "../admin/filter.php", "", substr($empRights,32,1), "1", "", array(), "", "crf_admin=" . ec("100") . "");
$menu[2]["extras"] = array(getLngt("Kessel Buntes"), "..//tools/statistic_finishment.php", "_blank", substr($empRights,46,1), "1", "", array(), "", "");
$maskSingleJobedit = getParameterValue("0", "MASK_SINGLE_JOBEDIT", $hq_id);
if ($maskSingleJobedit == "1") :
$menu[2]["erfassung"] = array(getLngt("Einzelerfassung"), "javascript:actionEvent('job_edit')", "", substr($empRights,7,1), "", "", array(), "1", "");
else :
$menu[2]["erfassung"] = array(getLngt("Einzelerfassung"), "../jobs/job_edit.php", "_blank", substr($empRights,7,1), "", "", array(), "", "");
endif;
$menu[2]["listenerfassung"] = array(getLngt("Listenerfassung"), "../jobs/jb_edit_batch.php", "", substr($empRights,7,1), "1", "", array(), "", "");
// $menu[2]["disposition"] = array(getLngt("Disposition"), "javascript:openVehicleDisposition();", "", substr($empRights,7,1), "1", "", array(), "1", "");
// if (MASK_SINGLE_INVOICE == "1") :
$menu[2]["uebersicht"] = array(getLngt("<EFBFBD>bersicht"), "../invoice/invoice.php", "", substr($empRights,5,1), "", "", array(), "", "");
// else :
// $menu[2]["uebersicht"] = array(getLngt("<22>bersicht"), "../invoice/invoice.php", "_blank", substr($empRights,5,1), "", "", array(), "", "");
// endif;
$menu[2]["pdf_ausgabe"] = array(getLngt("PDF-Ausgabe"), "../jobs/jb_inv_assoc.php", "", substr($empRights,5,1), "", "", array(), "", "");
$menu[2]["csv_ausgabe"] = array(getLngt("CSV-Ausgabe"), "../jobs/jb_exp_csv.php", "", substr($empRights,5,1), "1", "", array(), "", "");
$menu[2]["devices"] = array(getLngt("Endger<EFBFBD>te"), "../admin/mf_history.php", "", substr($empRights,4,1), "", "", array(), "", "");
$menu[2]["newsticker"] = array(getLngt("Mitteilungen"), "../admin/newsticker.php", "", substr($empRights,18,1), "", "", array(), "", "");
$menu[2]["newsletter"] = array(getLngt("Newsletter"), "../admin/metafield_list.php", "", substr($empRights,17,1), "1", "", array(), "", "category=" . ec("10") . "&objId=1&categoryPageTitel=NEWSLETTER&f_act_mtfl=search&viewItemsMode=0");
$menu[2]["datenexport"] = array(getLngt("Datenexport"), "../export/export.php", "", substr($empRights,6,1), "", "", array(), "", "");
$menu[2]["datenimport"] = array(getLngt("Datenimport"), "../import/data_transfer.php", "", (substr($empRights,22,1) == "1" || substr($empRights,23,1) == "1" ? "1" : "0"), "", "", array(), "", "");
$menu[3]["servicepreise"] = array(getLngt("Servicepreise"), "../admin/services.php", "", (substr($empRights,2,1) == "1" && substr($empRights,29,1) == "1" ? "1" : "0"), "", "", array(), "", "mode=price");
$menu[3]["plz_preise"] = array(getLngt("PLZ-Preise"), "../admin/services_plz.php", "", (substr($empRights,2,1) == "1" && substr($empRights,29,1) == "1" ? "1" : "0"), "", "", array(), "", "mode=price");
$menu[3]["bereichspreise"] = array(getLngt("Bereichspreise"), "../admin/services_plz_area.php", "", (substr($empRights,2,1) == "1" && substr($empRights,29,1) == "1" ? "1" : "0"), "1", "", array(), "", "mode=price");
/* Frachtverg<72>tungsmatrizen (leider nicht genutzt):
$menu[3]["servicefuhrlohn"] = array(getLngt("Servicefrachtverg."), "../admin/services.php", "", (substr($empRights,2,1) == "1" && substr($empRights,29,1) == "1" ? "1" : "0"), "", "", array(), "", "mode=price&csId=-1");
// $menu[3]["servicefuhrlohn"] = array(getLngt("Servicefrachtverg."), "../admin/services.php", "", "0", "", "", array(), "", "mode=price&csId=-1");
$menu[3]["plz_fuhrlohn"] = array(getLngt("PLZ-Frachtverg."), "../admin/services_plz.php", "", (substr($empRights,2,1) == "1" && substr($empRights,29,1) == "1" ? "1" : "0"), "", "", array(), "", "mode=price&csId=-1");
$menu[3]["bereichsfuhrlohn"] = array(getLngt("Bereichsfrachtverg."), "../admin/services_plz_area.php", "", (substr($empRights,2,1) == "1" && substr($empRights,29,1) == "1" ? "1" : "0"), "1", "", array(), "", "mode=price&csId=-1");
*/
$menu[3]["servicerabatte"] = array(getLngt("Servicerabatte"), "../admin/services.php", "", (substr($empRights,2,1) == "1" && substr($empRights,29,1) == "1" ? "1" : "0"), "", "", array(), "", "mode=discount");
$menu[3]["plz_rabatte"] = array(getLngt("PLZ-Rabatte"), "../admin/services_plz.php", "", (substr($empRights,2,1) == "1" && substr($empRights,29,1) == "1" ? "1" : "0"), "", "", array(), "", "mode=discount");
$menu[3]["bereichsrabatte"] = array(getLngt("Bereichsrabatte"), "../admin/services_plz_area.php", "", (substr($empRights,2,1) == "1" && substr($empRights,29,1) == "1" ? "1" : "0"), "1", "", array(), "", "mode=discount");
/* Frachtverg<72>tungsmatrizen (leider nicht genutzt):
$menu[3]["servicefuhrlohnrabatte"] = array(getLngt("Srv-Fv.-Rab."), "../admin/services.php", "", (substr($empRights,2,1) == "1" && substr($empRights,29,1) == "1" ? "1" : "0"), "", "", array(), "", "mode=discount&csId=-1");
$menu[3]["plz_fuhrlohnrabatte"] = array(getLngt("PLZ-Fv.-Rabatte"), "../admin/services_plz.php", "", (substr($empRights,2,1) == "1" && substr($empRights,29,1) == "1" ? "1" : "0"), "", "", array(), "", "mode=discount&csId=-1");
$menu[3]["bereichsfuhrlohnrabatte"] = array(getLngt("Bereichsfrachtv.rab."), "../admin/services_plz_area.php", "", (substr($empRights,2,1) == "1" && substr($empRights,29,1) == "1" ? "1" : "0"), "1", "", array(), "", "mode=discount&csId=-1");
*/
$menu[3]["adressenverwaltung"] = array(getLngt("Allgemein"), "../admin/ad_admin.php", "", substr($empRights,2,1), "", "", array(), "", "");
$menu[3]["plz_adressen"] = array(getLngt("PLZ-Adressen"), "../admin/srvpa_list.php", "", substr($empRights,2,1), "", "", array(), "", "");
$menu[3]["bereichsadressen"] = array(getLngt("Bereichsadr."), "../admin/srvpaa_list.php", "", substr($empRights,2,1), "1", "", array(), "", "");
/*
$menu[3]["serviceeinheit"] = array(getLngt("Serviceeinheiten"), "../stock/article_list.php", "", substr($empRights,14,1), "", "", array(), "", "objecttypemode=" . ec("1"));
$menu[3]["artikel"] = array(getLngt("Artikel"), "../stock/article_list.php", "", substr($empRights,14,1), "", "", array(), "", "");
$menu[3]["lager"] = array(getLngt("L<>ger"), "../stock/stock.php", "", substr($empRights,14,1), "1", "", array(), "", "");
*/
$menu[3]["zentralenmitarbeiter"] = array(getLngt("Mitarbeiter"), "../admin/employee_list.php", "", "", "", "", array(), "", ""); // substr($empRights,3,1);
// $menu[3]["lagerist"] = array(getLngt("Lageristen"), "../admin/user_list.php", "", substr($empRights,3,1), "", "", array(), "", "userListOfType=" . ec("4"));
$menu[3]["zentralenkonfiguration"] = array(getLngt("Einstellungen"), "../admin/hq_admin.php", "", "", "1", "", array(), "", "");
$menu[3]["kd_berichte"] = array(getLngt("Kunden"), "../groupware/report.php", "_blank", (substr($empRights,0,1) == "1" && substr($empRights,16,1) == "1" ? "1" : "0"), "", "", array(), "", "rpObjType=cs");
$menu[3]["un_berichte"] = array(getLngt("Transporteure"), "../groupware/report.php", "_blank", (substr($empRights,1,1) == "1" && substr($empRights,16,1) == "1" ? "1" : "0"), "1", "", array(), "", "rpObjType=cr");
endif;
// Customer
if ($userType == "2") :
$jsMenuNavigationDeep = 1;
$idColContainer = array();
$idColContainer[0] = array("menu_00");
$idColContainer[1] = array("menu_01", "menu_02");
$idColContainer[2] = array("menu_01_01");
$idColContainer[3] = array();
// Get customer
$cscId = getFieldValueFromId("employee","emp_id",$emp_id,"csc_id");
$csId = getFieldValueFromId("costcenter","csc_id",$cscId,"cs_id");
$csJbedit = getFieldValueFromId("customer","cs_id",$csId,"cs_jbedit");
if ($hq_workmode != "0") :
$tmpMenuAccess = "0";
if ($csJbedit != "0") :
$tmpMenuAccess = "1";
endif;
else :
$tmpMenuAccess = "1";
endif;
// echo $customerId . "&nbsp;&nbsp;" . $cscIdRoot . "&nbsp;&nbsp;" . $cscIdActual . "<br>";
// echo ec($customerId) . "&nbsp;&nbsp;" . ec($cscIdRoot) . "&nbsp;&nbsp;" . ec($cscIdActual) . "<br>";
$menu[1]["kostenstellen"] = array(getLngt("Kostenstellen"), "../customer/costcenter.php", "", "", "", "", array(), "", "customerId=" . ec($customerId) . "&cscIdRoot=" . ec($cscIdRoot) . "&cscIdActual=" . ec($cscIdActual));
$menu[1]["auftraege"] = array(getLngt("Auftr<EFBFBD>ge"), "#", "", "", "", "", array("menu_01_01"), "1", "");
$menu[1]["zentralenmitarbeiter"] = array(getLngt("Mitarbeiter"), "../admin/employee_list.php", "", "1", "1", "", array(), "", "customerId=" . ec($customerId) . "&cscIdRoot=" . ec($cscIdRoot) . "&cscIdActual=" . ec($cscIdActual));
// $menu[1]["adressen"] = array(getLngt("Adressen"), "../customer/cscad_fs.php", "", substr($empRights,3,1), "", "", array(), "", "customerId=" . ec($customerId) . "&cscIdRoot=" . ec($cscIdRoot) . "&cscIdActual=" . ec($cscIdActual));
$menu[1]["datenexport"] = array(getLngt("Datenexport"), "../export/export.php", "", substr($empRights,7,1), "", "", array(), "", "customerId=" . ec($customerId) . "&cscIdRoot=" . ec($cscIdRoot) . "&cscIdActual=" . ec($cscIdActual));
$menu[1]["statistik"] = array(getLngt("Statistik"), "../statistic/statistic.php", "", substr($empRights,8,1), "", "", array(), "", "customerId=" . ec($customerId) . "&cscIdRoot=" . ec($cscIdRoot) . "&cscIdActual=" . ec($cscIdActual));
// Check for customer parameter for displaying the map view
if ($customerId != "") :
$constCsShowMapView = getParameterValue("0", "MASK_JB_MAP_VIEW_ENABLED_" . $customerId, "0");
if ($constCsShowMapView == "1") :
$menu[1]["map"] = array(getLngt("Karten<EFBFBD>bersicht"), "../locating/map.php", "_blank", "1", "1", "", array(), "", "");
endif;
endif;
if (MASK_SINGLE_JOBEDIT == "1") :
$menu[2]["erfassung"] = array(getLngt("Erfassung"), "javascript:actionEvent('job_edit2')", "", $tmpMenuAccess, "", "", array(), "1", "");
else :
$menu[2]["erfassung"] = array(getLngt("Erfassung"), "../jobs2/job_edit.php", "_blank", $tmpMenuAccess, "", "", array(), "1", "");
endif;
$menu[2]["listen"] = array(getLngt("Listen"), "../customer/jb_list.php", "", substr($empRights,4,1), "", "", array(), "", "customerId=" . ec($customerId) . "&cscIdRoot=" . ec($cscIdRoot) . "&cscIdActual=" . ec($cscIdActual));
$menu[2]["uebersicht"] = array(getLngt("<EFBFBD>bersicht"), "../invoice/invoice.php", "", substr($empRights,5,1), "1", "", array(), "", "customerId=" . ec($customerId) . "&cscIdRoot=" . ec($cscIdRoot) . "&cscIdActual=" . ec($cscIdActual));
endif;
// Courier
if ($userType == "3") :
$jsMenuNavigationDeep = 0;
$idColContainer = array();
$idColContainer[0] = array("menu_00");
$idColContainer[1] = array("menu_01");
$idColContainer[2] = array();
$idColContainer[3] = array();
$menu[1]["auftraege"] = array(getLngt("Auftr<EFBFBD>ge"), "../invoice/invoice_cr.php", "", "1", "", "", array(), "", "");
$menu[1]["passwort"] = array(getLngt("Passwort"), "../courier/cr_changepwd.php", "", "1", "1", "", array(), "", "");
endif;
// Warehouseman
if ($userType == "4") :
$jsMenuNavigationDeep = 0;
$idColContainer = array();
$idColContainer[0] = array("menu_00");
$idColContainer[1] = array("menu_01");
$idColContainer[2] = array();
$idColContainer[3] = array();
$menu[1]["lager"] = array(getLngt("L<EFBFBD>ger"), "../stock/stock.php", "", "1", "1", "", array(), "", "");
// $menu[1]["passwort"] = array(getLngt("Passwort"), "../courier/cr_changepwd.php", "", "1", "1", "", array(), "", "");
endif;
// Generate menu with structure and links
$jsMenuStruct = array();
$jsSubMenu = array();
$menuOut = "";
function generateMenu($menu, $idColContainer, $jsMenuStruct, $jsSubMenu, $menuStructPrefix) {
global $constMenuBackground, $constMenuBackgroundImage, $currentNavigationItem, $currentNavigationLevel;
$jsMenuStruct = array();
$jsSubMenu = array();
$menuOut = "";
if ($menuStructPrefix == "") : $menuStructPrefix = "menu_"; endif;
$menuLevels = count($menu);
for ($j = 0; $j < $menuLevels; $j++) :
$colCounter = 0;
$keyArray = array_keys($menu[$j]);
$keyArrayLen = count($keyArray);
$menuOut .= "<div class=\"" . $menuStructPrefix . pad($j, 2) . "\" id=\"" . (isset($idColContainer[$j][$colCounter]) ? $idColContainer[$j][$colCounter] : "") . "\">\n";
$jsMenuStruct[$j] = "\"";
for ($i = 0; $i < $keyArrayLen; $i++) :
if ($menu[$j][$keyArray[$i]][3] == "1" || $menu[$j][$keyArray[$i]][3] == "") :
$menuOut .= "<div class=\"menu_item_" . pad($j, 2) . "\" id=\"" . $keyArray[$i] . "\" name=\"" . $keyArray[$i] . "\" ";
if ($menu[$j][$keyArray[$i]][5] == "") :
$menuOut .= "onClick=\"setMenu('" . $keyArray[$i] . "','" . ($j - 1) . "')\" onMouseover=\"changeContent('" . $keyArray[$i] . "','over','" . ($j - 1) . "')\" onMouseout=\"changeContent('" . $keyArray[$i] . "','off','" . ($j - 1) . "')\"";
else :
if ($menu[$j][$keyArray[$i]][5] == "2") :
$menuOut .= "onMouseover=\"changeContent('" . $keyArray[$i] . "','over','" . ($j - 1) . "')\" onMouseout=\"changeContent('" . $keyArray[$i] . "','off','" . ($j - 1) . "')\"";
endif;
endif;
$menuOut .= ">";
$menuOut .= "<div><img src=\"../images/" . $constMenuBackgroundImage[$j] . "\" width=\"100%\" height=\"4\" border=\"0\"></div>";
// $menuOut .= "<div style=\"width:100px; height:4px; background:" . $constMenuBackground[$j] . ";\"></div>";
$menuOut .= "&nbsp;<a class=\"a_menu\" href=\"" . $menu[$j][$keyArray[$i]][1];
if ($menu[$j][$keyArray[$i]][7] != "1" || $menu[$j][$keyArray[$i]][8] != "") :
$menuOut .= "?";
if ($menu[$j][$keyArray[$i]][7] != "1") :
$menuOut .= "currentNavigationItem=" . $keyArray[$i];
if ($menu[$j][$keyArray[$i]][8] != "") :
$menuOut .= "&";
endif;
endif;
if ($menu[$j][$keyArray[$i]][8] != "") :
$menuOut .= $menu[$j][$keyArray[$i]][8];
endif;
endif;
$menuOut .= "\" ". ($menu[$j][$keyArray[$i]][2] != "" ? "target=\"" . $menu[$j][$keyArray[$i]][2] . "\"" : "") . ">&nbsp;" . $menu[$j][$keyArray[$i]][0];
$tmpStrLen = strlen($menu[$j][$keyArray[$i]][0]);
for ($k = $tmpStrLen; $k < 17; $k++) :
$menuOut .= "&nbsp;";
endfor;
$menuOut .= "</a>";
$menuOut .= "</div>\n";
else :
$menuOut .= "<div class=\"menu_item_" . pad($j, 2) . "\" id=\"" . $keyArray[$i] . "\" name=\"" . $keyArray[$i] . "\">";
$menuOut .= "<div><img src=\"../images/" . $constMenuBackgroundImage[$j] . "\" width=\"100%\" height=\"4\" border=\"0\"></div>";
// $menuOut .= "<div style=\"width:100px; height:4px; background:" . $constMenuBackground[$j] . ";\"></div>";
$menuOut .= "<span style=\"color:black;\">&nbsp;&nbsp;" . $menu[$j][$keyArray[$i]][0] . "</span>";
$menuOut .= "</div>\n";
endif;
// Check for reaching last element of the container like "menu_01_01"
if ($menu[$j][$keyArray[$i]][4] == "1") :
$colCounter++;
$tmpJ = $j;
if ($i == ($keyArrayLen - 1)) :
$tmpJ = $j + 1;
$colCounter = 0;
endif;
if ($i < ($keyArrayLen - 1)) :
$menuOut .= "</div>\n";
$menuOut .= "<div class=\"" . $menuStructPrefix . pad($tmpJ, 2) . "\" id=\"" . (isset($idColContainer[$tmpJ][$colCounter]) ? $idColContainer[$tmpJ][$colCounter] : "") . "\">\n";
endif;
endif;
// ONLY for remembering the current menu status (activated item)
// Get the navigation level from the $currentNavigationItem
if ($currentNavigationItem == $keyArray[$i]) :
$currentNavigationLevel = ($j - 1);
// Check for disabled navigation suffix
if ($menu[$j][$keyArray[$i]][7] == "1") :
$currentNavigationItem = "";
$currentNavigationLevel = 0;
endif;
endif;
//ONLY FOR JAVASCRIPT
// Menu structure
$jsMenuStruct[$j] .= $keyArray[$i];
if ($i < ($keyArrayLen - 1)) :
$jsMenuStruct[$j] .= "\",\"";
endif;
// Array of containers be visible by hovering and click
// Used for the structure in Javascript:
// subMenu["verwaltung"] = new Array("menu_01_01","menu_01_02","menu_01_03"); ...
$tmpLen = count($menu[$j][$keyArray[$i]][6]);
if ($tmpLen > 0) :
$jsSubMenu[] = array($keyArray[$i], $menu[$j][$keyArray[$i]][6]);
endif;
endfor;
$menuOut .= "</div>\n";
$jsMenuStruct[$j] .= "\"";
endfor;
return array($menuOut, $menuLevels, $jsMenuStruct, $jsSubMenu);
}
// Call generation of the MAIN MENU using globals
list ($menuOut, $menuLevels, $jsMenuStruct, $jsSubMenu) = generateMenu($menu, $idColContainer, $jsMenuStruct, $jsSubMenu, "");
// **********
// * OUTPUT *
// **********
$phpMenuOut = "";
$phpReducedMenuOut = "";
$phpPageTitelOut = "";
$phpHeadquartersOut = "";
$phpCurrentNavigationOnLoad = "";
$phpCurrentNavigationInputHidden = "";
if (!$menuDisabled) :
// Check activation of the user state items
$constMenuUserStateItems = getParameterValue("0", "MENU_USER_STATE_ITEMS", $hq_id);
if ($constMenuUserStateItems == "") : $constMenuUserStateItems = getParameterValue("0", "MENU_USER_STATE_ITEMS", "0"); endif;
// Get user states if activated
$showUserStateInfo = false;
$menuItemListArrayLen = 0;
if ($browserOk && $constMenuUserStateItems == "1" && isset($usr_id) && $usr_id > 0 && $userType == "1") :
// Global switch to show user state buttons
$showUserStateInfo = true;
$usrStateBoolArray = array();
$parMenuUserStateItemListOutput = getParameterValue("0", "MENU_USER_STATE_ITEMLIST_OUTPUT", $hq_id);
if ($parMenuUserStateItemListOutput == "") : $parMenuUserStateItemListOutput = getParameterValue("0", "MENU_USER_STATE_ITEMLIST_OUTPUT", "0"); endif;
if ($parMenuUserStateItemListOutput != "") :
$menuItemListArray = getKeyValueArrayFromString($parMenuUserStateItemListOutput);
$menuItemListArrayLen = count($menuItemListArray);
if ($menuItemListArrayLen > 0) :
$menuItemListKeyArray = array_keys($menuItemListArray);
$menuItemListKeyArrayLen = count($menuItemListKeyArray);
for ($i = 0; $i < $menuItemListKeyArrayLen; $i++) :
$menuItemKey = "usr_state_" . $menuItemListKeyArray[$i];
// User states
$usrStateBoolArray[$menuItemKey] = "0";
if (existsEntry("genericdatacontainer",array("gdc_obj_type","usr","gdc_obj_id",$usr_id,"gdc_gen_fieldname",$menuItemKey))) :
$usrStateBoolArray[$menuItemKey] = getFieldValueFromClause("genericdatacontainer","gdc_content","gdc_obj_type = 'usr' AND gdc_obj_id = '" . $usr_id . "' AND gdc_gen_fieldname = '" . $menuItemKey . "'");
endif;
endfor;
endif;
endif;
// User state disposition [template]
/*
$usrStateDispo = "0";
if (existsEntry("genericdatacontainer",array("gdc_obj_type","usr","gdc_obj_id",$usr_id,"gdc_gen_fieldname","usr_state_dispo"))) :
$usrStateDispo = getFieldValueFromClause("genericdatacontainer","gdc_content","gdc_obj_type = 'usr' AND gdc_obj_id = '" . $usr_id . "' AND gdc_gen_fieldname = 'usr_state_dispo'");
endif;
*/
// User state newsticker
$usrLastTifId = 0;
if (existsEntry("genericdatacontainer",array("gdc_obj_type","usr","gdc_obj_id",$usr_id,"gdc_gen_fieldname","usr_state_newsticker"))) :
$usrLastTifId = getFieldValueFromClause("genericdatacontainer","gdc_content","gdc_obj_type = 'usr' AND gdc_obj_id = '" . $usr_id . "' AND gdc_gen_fieldname = 'usr_state_newsticker'");
endif;
$tifIdLast = getMaxOfField("phoenix_group.tickerforum", "tif_id", "");
$numOfNewsToBeRead = getUserMessages("2", $usrLastTifId);
endif;
$phpCurrentNavigationOnLoad .= "adjustWidthsOnLoad();"; // Resize headline, etc.
$phpCurrentNavigationOnLoad .= "activateMenusByPageTitle();";
if ($userType == "1") :
$phpCurrentNavigationOnLoad .= "myhide('menu_reduced');";
endif;
if (!$isFirefox) :
$phpCurrentNavigationOnLoad .= "hideFocusOfLinkClass();";
endif;
$phpCurrentNavigationInputHidden = "<input type=\"hidden\" name=\"currentNavigationItem\" value=\"\">\n";
if ($currentNavigationItem != "") :
$phpCurrentNavigationOnLoad .= "setMenuOnLoad('" . $currentNavigationItem . "'," . $currentNavigationLevel . ");";
$phpCurrentNavigationInputHidden = "<input type=\"hidden\" name=\"currentNavigationItem\" value=\"" . $currentNavigationItem . "\">\n";
endif;
$phpCurrentNavigationInputHidden .= "<input type=\"hidden\" id=\"menuActiveByPageTitel\" name=\"menuActiveByPageTitel\" value=\"" . ($menuActiveByPageTitel ? "1" : "0") . "\">\n";
if ($showUserStateInfo) :
// Close "Info" per default
$phpCurrentNavigationOnLoad .= "myhide('page_info');";
// In the beginning of a script per default all state buttons are "off" (e.g. "red") and have individually to switched to "on" (e.g. "green")
if ($menuItemListKeyArrayLen > 0) :
for ($i = 0; $i < $menuItemListKeyArrayLen; $i++) :
$menuItemKey = "usr_state_" . $menuItemListKeyArray[$i];
$phpCurrentNavigationOnLoad .= "changeButtonMenuState('" . $menuItemKey . "','" . $menuItemKey . "','','2','" . $usrStateBoolArray[$menuItemKey] . "');";
endfor;
endif;
// $phpCurrentNavigationOnLoad .= "changeButtonMenuState('usr_state_dispo','menuUserStateDispo','','2','" . $usrStateDispo . "');";
// User state newsticker
if ($numOfNewsToBeRead == 0) :
$phpCurrentNavigationOnLoad .= "changeButtonMenuState('usr_state_newsticker','menuUserStateNews','Mitteilungen','1','" . $tifIdLast . "');";
endif;
endif;
// Complete menu
$phpMenuOut .= "<div class=\"menu\" name=\"menu\" id=\"menu\">\n";
// $phpMenuOut .= " <div class=\"logo\" name=\"logo\" " . ($userType == "1" ? "onClick=\"switchTicker('on');activateMenu('menu_reduced','menu');ticker();\"" : "") . ">\n";
$phpMenuOut .= " <div class=\"logo\" name=\"logo\">\n";
$phpMenuOut .= " <div style=\"width:121px; height:65px;\">\n";
$phpMenuOut .= " <div><img src=\"../images/votian24.png\" width=\"121\" height=\"65\" border=\"0\"></div>\n";
$phpMenuOut .= " </div>\n";
$phpMenuOut .= " </div>\n";
$phpMenuOut .= $menuOut;
$phpMenuOut .= "</div>\n";
// Reduced menu (only for headquarters)
if ($userType == "1") :
$reducedMenu[0]["mainmenu"] = array(getLngt("Menu") . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", "javascript:switchTicker('off');activateMenu('menu','menu_reduced');", "", "", "1", "2", array(), "1", "");
$reducedMenu[0]["ticker"] = array(getLngt("Ticker") . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", "javascript:switchTicker();", "", "", "1", "2", array(), "1", "");
$IdColContainerReducedMenu = array();
$IdColContainerReducedMenu[0] = array("menu_00");
$IdColContainerReducedMenu[1] = array();
$jsReducedMenuStruct = array();
$jsSubReducedMenu = array();
list ($reducedMenuOut, $reducedMenuLevels, $jsReducedMenuStruct, $jsSubReducedMenu) = generateMenu($reducedMenu, $IdColContainerReducedMenu, $jsReducedMenuStruct, $jsSubReducedMenu, "reduced_menu_");
$phpReducedMenuOut .= "<div class=\"menu_reduced\" name=\"menu_reduced\" id=\"menu_reduced\">\n";
$phpReducedMenuOut .= $reducedMenuOut . "\n";
// $phpReducedMenuOut .= "<img src=\"../images/spacer_bgcolor.jpg\" width=\"100%\" height=\"2\" border=\"0\">\n";
$phpReducedMenuOut .= "<div class=\"tickerOut\" name=\"tickerOut\" id=\"tickerOut\"></div>\n";
$phpReducedMenuOut .= "</div>\n";
endif;
// Check current employee for access to switch headquarters on the fly
/*
$empHqList = getParameterValue("0", "HEADQUARTERS_MULTIPLE_ACCESS_EMPLOYEES", "0");
$outHqSelection = "";
if (!$menuDisabled && $hq_id != "" && $userType == "1" && $empHqList != "") :
$empHqArray = getKeyValueArrayFromString($empHqList);
$tmpKeysArray = array_keys($empHqArray);
$tmpKeysArrayLen = count($tmpKeysArray);
// Check access to multiple headquarters selection
$showMultipleHqSelection = false;
for ($i = 0; $i < $tmpKeysArrayLen; $i++) :
if ($emp_id == $empHqArray[$tmpKeysArray[$i]]) :
$showMultipleHqSelection = true;
endif;
endfor;
if ($showMultipleHqSelection) :
$outHqSelection .= "<div style=\"float:left; font-size:14pt; font-family:Helvetica,Arial; font-style:normal; font-weight:normal; vertical-align:middle;background-color:" . $constPageHeadlineBgCol . "; color:#FFFFFF\" name=\"currHqSelectionReduced\" id=\"currHqSelectionReduced\" onClick=\"myshow('currHqSelection'); myhide('currHqSelectionReduced');\">\n";
$outHqSelection .= "&nbsp;" . strtoupper(getFieldValueFromId("headquarters","hq_id",$hq_id,"hq_mnemonic")) . "&nbsp;:&nbsp;:";
$outHqSelection .= "</div>\n";
$outHqSelection .= "<div style=\"float:left; background-color:" . $constPageHeadlineBgCol . "; color:#FFFFFF\" name=\"currHqSelection\" id=\"currHqSelection\" onClick=\"myshow('currHqSelectionReduced'); myhide('currHqSelection');\">";
for ($i = 0; $i < $tmpKeysArrayLen; $i++) :
$outHqSelection .= "&nbsp;<a class=\"a_menu\" href=\"../admin/relogin_old.php?currReferer=" . urlencode(getCurrentScript($_SERVER['REQUEST_URI'])) . "&currHqSelection=" . ec($tmpKeysArray[$i]) . "\">" . getFieldValueFromId("headquarters","hq_id",$tmpKeysArray[$i],"hq_mnemonic") . "</a>&nbsp;&nbsp;<br>";
endfor;
$outHqSelection .= "</div>";
$phpCurrentNavigationOnLoad .= "myhide('currHqSelection'); myshow('currHqSelectionReduced');";
endif;
endif;
*/
$outHqSelection = "";
if ($hq_id != "") :
$empHqList = getParameterValue("0", "HEADQUARTERS_MULTIPLE_ACCESS_EMPLOYEES", "0");
if (!$menuDisabled && $userType == "1" && $empHqList != "") :
$showMultipleHqSelection = isInParameterString($emp_id, $empHqList);
if ($showMultipleHqSelection) :
$tmpHqIdArray = getColVectorFromDB2ArrayByClause("mandatorheadquarters AS mdhq, headquarters AS hq", "hq.hq_id", "mdhq.md_id = '" . $md_id . "' AND mdhq.hq_id = hq.hq_id AND hq.hq_disabled = '0'", "", "hq.hq_mnemonic", "");
$tmpHqIdArrayLen = count($tmpHqIdArray);
$outHqSelection .= "<div style=\"float:left; font-size:14pt; font-family:Helvetica,Arial; font-style:normal; font-weight:normal; vertical-align:middle;background-color:" . $constPageHeadlineBgCol . "; color:#FFFFFF\" name=\"currHqSelectionReduced\" id=\"currHqSelectionReduced\" onClick=\"myshow('currHqSelection'); myhide('currHqSelectionReduced');\">\n";
$outHqSelection .= "&nbsp;" . strtoupper(getFieldValueFromId("headquarters","hq_id",$hq_id,"hq_mnemonic")) . "&nbsp;:&nbsp;:";
$outHqSelection .= "</div>\n";
$outHqSelection .= "<div style=\"float:left; background-color:" . $constPageHeadlineBgCol . "; color:#FFFFFF\" name=\"currHqSelection\" id=\"currHqSelection\" onClick=\"myshow('currHqSelectionReduced'); myhide('currHqSelection');\">";
for ($i = 0; $i < $tmpHqIdArrayLen; $i++) :
$outHqSelection .= "&nbsp;<a class=\"a_menu\" href=\"../admin/relogin.php?currReferer=" . urlencode(getCurrentScript($_SERVER['REQUEST_URI'])) . "&currHqSelection=" . ec($tmpHqIdArray[$i]) . "\">" . getFieldValueFromId("headquarters","hq_id",$tmpHqIdArray[$i],"hq_mnemonic") . "</a>&nbsp;&nbsp;<br>";
endfor;
$outHqSelection .= "</div>";
$phpCurrentNavigationOnLoad .= "myhide('currHqSelection'); myshow('currHqSelectionReduced');";
endif;
endif;
endif;
// Titel
$phpPageTitelOut .= $outHqSelection;
$phpPageTitelOut .= "<div class=\"page_headline\" name=\"page_headline\" id=\"page_headline\" onClick=\"activateMenusByPageTitle();\">\n";
$phpPageTitelOut .= " <span style=\"display: inline-block; width:250px;\">&nbsp;" . mcIsSet($pageTitel) . "</span>\n";
if ($showUserStateInfo) :
$phpPageTitelOut .= " &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \n";
$phpPageTitelOut .= " <button type=\"button\" class=\"buttonMenuUserInfo\" name=\"menuUserInfo\" id=\"menuUserInfo\" onClick=\"document.location.href = '../admin/start.php?noResetUserStates=1';\">" . getLngt("Info") . "</button>" . "\n";
$phpPageTitelOut .= " <button type=\"button\" class=\"buttonMenuUserState\" name=\"menuUserStateNews\" id=\"menuUserStateNews\" onClick=\"changeButtonMenuState('usr_state_newsticker','menuUserStateNews','Mitteilungen','1','" . $tifIdLast . "'); menuGetInfodata('usr_state_newsticker','3','" . $usrLastTifId . "');\">" . getLngt("Mitteilungen") . "</button>" . "\n";
// $phpPageTitelOut .= " <button type=\"button\" class=\"buttonMenuUserState\" name=\"menuUserStateDispo\" id=\"menuUserStateDispo\" onClick=\"menuGetInfodata('usr_state_dispo');\">" . getLngt("Vermittlung") . "</button>" . "\n";
for ($i = 0; $i < $menuItemListKeyArrayLen; $i++) :
$menuItemKey = "usr_state_" . $menuItemListKeyArray[$i];
$menuItemValue = $menuItemListArray[$menuItemListKeyArray[$i]];
$phpPageTitelOut .= " <button type=\"button\" class=\"buttonMenuUserState\" name=\"" . $menuItemKey . "\" id=\"" . $menuItemKey . "\" onClick=\"menuGetInfodata('" . $menuItemKey . "');\">" . getLngt($menuItemValue) . "</button>" . "\n";
endfor;
if (substr($empRights,0,1) == "1" && substr($empRights,11,1) == "1" && substr($empRights,36,1) == "1") :
$phpPageTitelOut .= " <button type=\"button\" class=\"buttonMenuUserInfo\" name=\"menuUserDashboardCS\" id=\"menuUserDashboardCS\" onClick=\"redirectLocation('../admin/dashb_cs.php');\">" . getLngt("Kundenakte") . "</button>" . "\n";
endif;
endif;
$phpPageTitelOut .= "</div>\n";
// Info
if ($showUserStateInfo) :
$phpPageInfoOut = "";
$phpPageInfoOut .= "<div class=\"page_info\" name=\"page_info\" id=\"page_info\">\n";
$phpPageInfoOut .= " <div name=\"page_info_menu\" id=\"page_info_menu\">\n";
// $phpPageInfoOut .= " <button class=\"buttonMenuUserInfo\" onClick=\"myhide('page_info');\">" . getLngt("Schlie<69>en") . "</button>" . "\n";
$phpPageInfoOut .= " </div>\n";
$phpPageInfoOut .= " <div style=\"padding:10px;\" name=\"page_info_content\" id=\"page_info_content\">\n";
$phpPageInfoOut .= " </div>\n";
$phpPageInfoOut .= "</div>\n";
$phpPageTitelOut .= $phpPageInfoOut; // Add "Info" to "Title"
endif;
endif;
?>

View File

@@ -0,0 +1,638 @@
<?php
/*=======================================================================
*
* metafield_editor.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act", "generic", "deactivateMenu",
"f_mtfc_id", "f_mtfc_mnemonic", "f_mtfc_description", "f_mtft_id", "f_mtft_name",
"f_mtfk_id", "f_mtfk_type", "f_mtfk_name", "f_mtfk_new_id", "f_filter_mtfk_name"));
getLanguage(__FILE__);
$pageTitel = getLngt("FORMULARE");
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
authCheckEmployeeRights($emp_id, "15", "1");
if ($hqId == "") : $hqId = $hq_id; endif;
$category = $f_mtfc_id; // Has to be set because of the following include
include_once ("../include/inc_metafield.inc.php");
getCurrentScript(__FILE__);
// Check for setting according to global usage
if ($gHqId) : $hqId = "0"; endif;
// Initialize value
if ($generic == "") : $generic = "1111"; endif;
mcTrim($f_mtfc_mnemonic);
mcTrim($f_mtfc_description);
mcTrim($f_mtft_name);
mcTrim($f_mtfk_type);
mcTrim($f_mtfk_name);
mcTrim($f_filter_mtfk_name); // Filter to reduce displayed number of global fields
mcIsSet($listOfEntries);
// Special treatment according to combined fields:
// E.g. "Str.-Hausnr.:123:124" is a combination of the fields 123 (here e.g. street) and 124 (here e.g. houseno.) with the description (name) "Str.-Hausnr."
// Now the whole fieldname "Str.-Hausnr.:123:124" will be automatically changed in "Str.-Hausnr." and the selected default type "ref:desc:xxx:yyy:..." will be changed in "ref:123:124".
if ($f_mtfk_type == "ref:desc:xxx:yyy:..." && $f_mtfk_name != "" && ($f_act == "saveFieldNew" || $f_act == "saveFieldModified")) :
$f_act = "saveFieldNew"; // The selection of the reference field does result in a new reference field
$tmpArray = spliti(":",$f_mtfk_name);
$tmpArrayLen = count($tmpArray);
$f_mtfk_type = "ref";
for ($i = 1; $i < $tmpArrayLen; $i++) :
$f_mtfk_type .= ":" . $tmpArray[$i];
endfor;
$f_mtfk_name = $tmpArray[0]; // E.g. "Str.-Hausnr."
endif;
// *** ACTION ***
// * Forms (categories) *
if ($f_act == "saveCategoryNew") :
if ($f_mtfc_mnemonic != "" && $f_mtfc_description != "") :
if (!existsEntry("metafieldcategory",array("mtfc_mnemonic",$f_mtfc_mnemonic))) :
if (!existsEntry("metafieldcategory",array("mtfc_description",$f_mtfc_description))) :
insertStmt("metafieldcategory", array("mtfc_mnemonic", $f_mtfc_mnemonic, "mtfc_description", $f_mtfc_description, "mtfc_group", ""));
$f_mtfc_mnemonic = "";
$f_mtfc_description = "";
else :
$statusMessage = getLngt("Der eingegebene Name existiert schon!");
endif;
else :
$statusMessage = getLngt("Das eingegebene Kürzel existiert schon!");
endif;
else :
$statusMessage = getLngt("Bitte vollständig eingeben!");
endif;
endif;
if ($f_act == "saveCategoryModified") :
if ($f_mtfc_id != "" && $f_mtfc_mnemonic != "" && $f_mtfc_description != "") :
if (existsEntry("metafieldcategory",array("mtfc_id",$f_mtfc_id))) :
if (!existsEntry("metafieldcategory",array("mtfc_description",$f_mtfc_description))) :
updateStmt("metafieldcategory","mtfc_id",$f_mtfc_id,array("mtfc_description", $f_mtfc_description));
$f_mtfc_description = "";
else :
$statusMessage = getLngt("Der eingegebene Name existiert schon!");
endif;
if (!existsEntry("metafieldcategory",array("mtfc_mnemonic",$f_mtfc_mnemonic))) :
updateStmt("metafieldcategory","mtfc_id",$f_mtfc_id,array("mtfc_mnemonic", $f_mtfc_mnemonic));
$f_mtfc_mnemonic = "";
else :
$statusMessage = getLngt("Das eingegebene Kürzel existiert schon!");
endif;
else :
$statusMessage = getLngt("Das eingegebene Formular existiert nicht!");
endif;
else :
$statusMessage = getLngt("Bitte vollständig eingeben!");
endif;
endif;
// * Global field vector *
if ($f_act == "saveFieldNew") :
if ($f_mtfk_type != "" && $f_mtfk_name != "") :
// if (existsEntry("metafieldkey",array("mtfk_type",$f_mtfk_type))) : // Only existing type !!!
if (!existsEntry("metafieldkey",array("mtfk_name",$f_mtfk_name))) :
insertStmt("metafieldkey", array("mtfk_type", $f_mtfk_type, "mtfk_name", $f_mtfk_name));
$f_mtfk_type = "";
$f_mtfk_name = "";
else :
$statusMessage = getLngt("Der eingegebene Name existiert schon!");
endif;
// else :
// $statusMessage = getLngt("Der Typ ist ungültig!");
// endif;
else :
$statusMessage = getLngt("Bitte vollständig eingeben!");
endif;
endif;
if ($f_act == "saveFieldModified") :
if ($f_mtfk_id != "" && $f_mtfk_type != "" && $f_mtfk_name != "") :
if (existsEntry("metafieldkey",array("mtfk_id",$f_mtfk_id))) :
if (!existsEntry("metafieldkey",array("mtfk_name",$f_mtfk_name))) :
updateStmt("metafieldkey","mtfk_id",$f_mtfk_id,array("mtfk_name", $f_mtfk_name));
$f_mtfk_name = "";
else :
$statusMessage = getLngt("Der eingegebene Name existiert schon!");
endif;
if (existsEntry("metafieldkey",array("mtfk_type",$f_mtfk_type))) :
updateStmt("metafieldkey","mtfk_id",$f_mtfk_id,array("mtfk_type", $f_mtfk_type));
$f_mtfk_type = "";
endif;
else :
$statusMessage = getLngt("Das eingegebene Formular existiert nicht!");
endif;
else :
$statusMessage = getLngt("Bitte vollständig eingeben!");
endif;
endif;
// * Template *
if ($f_act == "saveTemplateNew") :
if ($f_mtft_name != "") :
if (!existsEntry("metafieldtemplate",array("mtft_name",$f_mtft_name))) :
insertStmt("metafieldtemplate", array("mtft_name", $f_mtft_name, "mtft_group", "", "mtft_content", ""));
$f_mtft_name = "";
else :
$statusMessage = getLngt("Der eingegebene Name existiert schon!");
endif;
else :
$statusMessage = getLngt("Bitte vollständig eingeben!");
endif;
endif;
if ($f_act == "saveTemplateModified") :
if ($f_mtft_id != "" && $f_mtft_name != "") :
if (existsEntry("metafieldtemplate",array("mtft_id",$f_mtft_id))) :
if (!existsEntry("metafieldtemplate",array("mtft_name",$f_mtft_name))) :
updateStmt("metafieldtemplate","mtft_id",$f_mtft_id,array("mtft_name", $f_mtft_name));
$f_mtft_name = "";
else :
$statusMessage = getLngt("Der eingegebene Name existiert schon!");
endif;
else :
$statusMessage = getLngt("Das eingegebene Template existiert nicht!");
endif;
else :
$statusMessage = getLngt("Bitte vollständig eingeben!");
endif;
endif;
// * Category fields *
if ($f_act == "saveCategoryFieldNew") :
if ($f_mtfk_new_id != "") :
if (!existsEntry("metafieldcategorykey",array("mtfc_id",$f_mtfc_id,"mtfk_id",$f_mtfk_new_id,"hq_id",$hqId))) :
insertStmt("metafieldcategorykey", array("mtfc_id", $f_mtfc_id, "mtfk_id", $f_mtfk_new_id, "hq_id", $hqId, "mtfck_sort", ($mtfck_mtfckIdsLen + 1)));
else :
$statusMessage = getLngt("Dieses Feld existiert schon im Formular!");
endif;
else :
$statusMessage = getLngt("Bitte eines der globalen Felder auswählen!");
endif;
endif;
if ($f_act == "saveCategoryFieldSort") :
if ($f_mtfc_id != "") :
for ($i = 0; $i < $mtfck_mtfckIdsLen; $i++) :
list ($newSortValueToBeStored) = getSecHttpVars("1",array("f_" . $mtfck_mtfkIds[$i]));
updateStmt("metafieldcategorykey","mtfc_id",$f_mtfc_id,array("mtfck_sort", $newSortValueToBeStored),"hq_id = '" . $hqId . "' AND mtfk_id = '" . $mtfck_mtfkIds[$i] . "'");
endfor;
else :
$statusMessage = getLngt("Es ist kein Formular gewählt!");
endif;
endif;
// Load the meta field structure in memory
initMetaFieldStructure();
// * Output of the forms (categories) *
// Statement for metafieldcategory
$sqlquery = "SELECT mtfc.mtfc_id, mtfc.mtfc_mnemonic, mtfc.mtfc_description"
. " FROM metafieldcategory AS mtfc"
. " ORDER BY mtfc.mtfc_description";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
// Table with header
$numOfRows = 1;
$lineToggler = 0;
$tableOfRowsForm = "<tr><td align=\"left\">" . getLngt("Beschreibung") . "&nbsp;&nbsp;&nbsp;</td><td align=\"center\">&nbsp;" . getLngt("Bearbeiten") . "&nbsp;</td><td align=\"center\">&nbsp;" . getLngt("Gruppen") . "&nbsp;</td><td align=\"center\">&nbsp;" . getLngt("Inhalt") . "&nbsp;</td></tr>";
while ($row = $result->fetch_assoc()):
$numOfRows++;
if ($lineToggler == 0) : $lineToggler = 1; else : $lineToggler = 0; endif;
$cellColor = getListColor($numOfRows, $lineToggler);
$tableOfRowsForm .= "<tr>";
$tableOfRowsForm .= "<td align=\"left\" bgcolor=\"" . $cellColor ."\">&nbsp;" . $row["mtfc_description"] . "&nbsp;&nbsp;&nbsp;</td>";
$tableOfRowsForm .= "<td align=\"center\" bgcolor=\"" . $cellColor ."\">&nbsp;<a href=\"javascript:editCategory('" . $row["mtfc_id"] . "','" . $row["mtfc_mnemonic"] . "','" . $row["mtfc_description"] . "');\"><img src=\"../images/arrow_right.png\" border=\"0\" height=\"10\" width=\"25\"></a></td>";
$tableOfRowsForm .= "<td align=\"center\" bgcolor=\"" . $cellColor ."\">&nbsp;<a href=\"javascript:openGroups('mtfc','" . $row["mtfc_id"] . "');\"><img src=\"../images/arrow_right.png\" border=\"0\" height=\"10\" width=\"25\"></a></td>";
$tableOfRowsForm .= "<td align=\"center\" bgcolor=\"" . $cellColor ."\">&nbsp;<a href=\"javascript:categoryFields('" . $row["mtfc_id"] . "');\"><img src=\"../images/arrow_right.png\" border=\"0\" height=\"10\" width=\"25\"></a></td>";
$tableOfRowsForm .= "</tr>";
endwhile;
$result->free();
// * Output of the global fields *
// Statement for metafieldcategory
$whereClause = "";
$orderByClause = "mtfk.mtfk_name";
if ($f_filter_mtfk_name != "") :
$whereClause = " WHERE mtfk.mtfk_name LIKE '" . $f_filter_mtfk_name . "%'";
endif;
$sqlquery = "SELECT mtfk.mtfk_id, mtfk.mtfk_type, mtfk.mtfk_name"
. " FROM metafieldkey AS mtfk"
. $whereClause
. " ORDER BY " . $orderByClause;
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
// Table with header
$numOfRows = 1;
$lineToggler = 0;
$tableOfRowsField = "<tr><td align=\"left\">" . getLngt("Nr.") . "&nbsp;&nbsp;&nbsp;</td><td align=\"left\">" . getLngt("Name") . "&nbsp;&nbsp;&nbsp;</td><td align=\"center\">&nbsp;" . getLngt("Bearbeiten") . "&nbsp;</td></tr>";
while ($row = $result->fetch_assoc()):
$numOfRows++;
if ($lineToggler == 0) : $lineToggler = 1; else : $lineToggler = 0; endif;
$cellColor = getListColor($numOfRows, $lineToggler);
$tableOfRowsField .= "<tr>";
$tableOfRowsField .= "<td align=\"left\" bgcolor=\"" . $cellColor ."\">&nbsp;" . $row["mtfk_id"] . "&nbsp;&nbsp;&nbsp;</td>";
$tableOfRowsField .= "<td align=\"left\" bgcolor=\"" . $cellColor ."\">&nbsp;" . $row["mtfk_name"] . "&nbsp;&nbsp;&nbsp;</td>";
// $tableOfRowsField .= "<td align=\"left\" bgcolor=\"" . $cellColor ."\">&nbsp;" . $row["mtfk_type"] . "&nbsp;&nbsp;&nbsp;</td>";
$tableOfRowsField .= "<td align=\"center\" bgcolor=\"" . $cellColor ."\">&nbsp;<a href=\"javascript:editField('" . $row["mtfk_id"] . "','" . $row["mtfk_type"] . "','" . $row["mtfk_name"] . "');\"><img src=\"../images/arrow_right.png\" border=\"0\" height=\"10\" width=\"25\"></a></td>";
// $tableOfRowsField .= "<td align=\"center\" bgcolor=\"" . $cellColor ."\">&nbsp;<a href=\"javascript:FieldMembers('" . $row["mtfk_id"] . "');\"><img src=\"../images/arrow_right.png\" border=\"0\" height=\"10\" width=\"25\"></a></td>";
// $tableOfRowsField .= "<td align=\"center\" bgcolor=\"" . $cellColor ."\">&nbsp;<a href=\"javascript:finishPage('" . $row["mtfk_id"] . "','" . $row["mtfk_type"] . "','" . $row["mtfk_name"] . "');\">" . $row["mtfk_name"] . "</a></td>";
$tableOfRowsField .= "</tr>";
endwhile;
$result->free();
// * Output of the templates *
$mtfcTemplateMode = getParameterValue("0", "MTFC_TPL_MODE", "0");
if ($mtfcTemplateMode == "1") :
// Statement for metafieldtemplate
$sqlquery = "SELECT mtft.mtft_id, mtft.mtft_name"
. " FROM metafieldtemplate AS mtft"
. " ORDER BY mtft.mtft_name";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
// Table with header
$numOfRows = 1;
$lineToggler = 0;
$tableOfRowsTemplate = "<tr><td align=\"left\">" . getLngt("Beschreibung") . "&nbsp;&nbsp;&nbsp;</td><td align=\"center\">&nbsp;" . getLngt("Bearbeiten") . "&nbsp;</td><td align=\"center\">&nbsp;" . getLngt("Gruppen") . "&nbsp;</td><td align=\"center\">&nbsp;" . getLngt("Inhalt") . "&nbsp;</td></tr>";
while ($row = $result->fetch_assoc()):
$numOfRows++;
if ($lineToggler == 0) : $lineToggler = 1; else : $lineToggler = 0; endif;
$cellColor = getListColor($numOfRows, $lineToggler);
$tableOfRowsTemplate .= "<tr>";
$tableOfRowsTemplate .= "<td align=\"left\" bgcolor=\"" . $cellColor ."\">&nbsp;" . $row["mtft_name"] . "&nbsp;&nbsp;&nbsp;</td>";
$tableOfRowsTemplate .= "<td align=\"center\" bgcolor=\"" . $cellColor ."\">&nbsp;<a href=\"javascript:editTemplate('" . $row["mtft_id"] . "','" . $row["mtft_name"] . "');\"><img src=\"../images/arrow_right.png\" border=\"0\" height=\"10\" width=\"25\"></a></td>";
$tableOfRowsTemplate .= "<td align=\"center\" bgcolor=\"" . $cellColor ."\">&nbsp;<a href=\"javascript:openGroups('mtft','" . $row["mtft_id"] . "');\"><img src=\"../images/arrow_right.png\" border=\"0\" height=\"10\" width=\"25\"></a></td>";
$tableOfRowsTemplate .= "<td align=\"center\" bgcolor=\"" . $cellColor ."\">&nbsp;<a href=\"javascript:openContent('" . $row["mtft_id"] . "');\"><img src=\"../images/arrow_right.png\" border=\"0\" height=\"10\" width=\"25\"></a></td>";
$tableOfRowsTemplate .= "</tr>";
endwhile;
$result->free();
endif;
// * Output of the fields of a specified category (form) *
if ($f_mtfc_id != "") :
$numOfRows = 1;
$lineToggler = 0;
$tableOfcategoryField = "<tr><td align=\"left\">" . getLngt("Name") . "&nbsp;&nbsp;&nbsp;</td><td align=\"center\">&nbsp;" . getLngt("Sortierung") . "&nbsp;</td></tr>";
for ($i = 0; $i < $mtfck_mtfckIdsLen; $i++) :
$numOfRows++;
if ($lineToggler == 0) : $lineToggler = 1; else : $lineToggler = 0; endif;
$cellColor = getListColor($numOfRows, $lineToggler);
$tableOfcategoryField .= "<tr>";
$tableOfcategoryField .= "<td align=\"left\" bgcolor=\"" . $cellColor ."\">&nbsp;" . $mtfk_allFieldNames[$mtfck_mtfkIds[$i]] . "&nbsp;&nbsp;&nbsp;</td>";
$tableOfcategoryField .= "<td align=\"left\" bgcolor=\"" . $cellColor ."\">&nbsp;<select class=\"f8np1\" name=\"f_" . $mtfck_mtfkIds[$i] . "\">" . addOptionsFromRange(1, $mtfck_mtfckIdsLen, $mtfck_mtfkSortedIds[$mtfck_mtfkIds[$i]], "", "", "") . "</select>&nbsp;&nbsp;&nbsp;</td>";
$tableOfcategoryField .= "</tr>";
endfor;
endif;
?>
<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 type="text/javascript">
<!--
// NAVIGATION
<?php echo $jsMenuOut; ?>
// GENERIC function
function finishPage(grp_id,grp_name) {
<?php if (substr($generic, 0,1) == "1") : ?> opener.document.forms[0].g_grp_id.value = grp_id; <?php endif; ?>
<?php if (substr($generic, 2,1) == "1") : ?> opener.document.forms[0].g_grp_name.value = grp_name; <?php endif; ?>
self.close();
};
function finishPage2(f_act) {
document.forms[0].f_act.value = f_act;
document.forms[0].submit();
};
function editCategory(mtfc_id,mtfc_mnemonic,mtfc_description) {
document.forms[0].f_mtfc_id.value = mtfc_id;
document.forms[0].f_mtfc_mnemonic.value = mtfc_mnemonic;
document.forms[0].f_mtfc_description.value = mtfc_description;
};
function editField(mtfk_id,mtfk_type,mtfk_name) {
document.forms[0].f_mtfk_id.value = mtfk_id;
document.forms[0].f_mtfk_type.value = mtfk_type;
document.forms[0].f_mtfk_name.value = mtfk_name;
};
function editTemplate(mtft_id,mtft_name) {
document.forms[0].f_mtft_id.value = mtft_id;
document.forms[0].f_mtft_name.value = mtft_name;
};
function categoryFields(mtfc_id) {
document.forms[0].f_mtfc_id.value = mtfc_id;
document.forms[0].submit();
};
function openContent(mtft_id) {
var widthPopupWin = 1500;
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/metafield_template.php?mtft_id=" + mtft_id + "&deactivateMenu=1","","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
};
function openGroups(mtf_type, mtf_id) {
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=" + mtf_type + "&itemId=" + mtf_id,"","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
};
-->
</script>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>displayStatusMessage();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="maincontent2" name="maincontent" id="maincontent">
<form action="../admin/metafield_editor.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="generic" value="<?php echo $generic ?>">
<input type="hidden" name="f_mtfc_id" value="<?php echo $f_mtfc_id ?>">
<input type="hidden" name="f_mtfk_id" value="<?php echo $f_mtfk_id ?>">
<input type="hidden" name="f_mtft_id" value="<?php echo $f_mtft_id ?>">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<?php echo htmlDivLineSpacer("20px"); ?>
<!-- FORMS (CATEGORIES) -->
<div style="float:left;">
<div>
<div class="f12bp1_blue"><?php echo getLngt("Formulare") ?></div>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<div>
<table class="f10np1" border="0" cellpadding="0">
<?php echo $tableOfRowsForm ?>
</table>
</div>
<?php echo htmlDivLineSpacer("20px"); ?>
<div>
<?php echo getLngt("(Neues) Formular:") ?>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<div>
<div <?php echo setStyleHtmlDiv("150px","left"); ?>><?php echo getLngt("Kürzel:") ?></div>
<div>
<input type="text" name="f_mtfc_mnemonic" value="<?php echo $f_mtfc_mnemonic ?>" maxlength="30" size="30">
</div>
</div>
<?php echo htmlDivLineSpacer("10px", "", "left"); ?>
<div>
<div <?php echo setStyleHtmlDiv("150px","left"); ?>><?php echo getLngt("Bezeichnung:") ?></div>
<div>
<input type="text" name="f_mtfc_description" value="<?php echo $f_mtfc_description ?>" maxlength="100" size="30">
</div>
</div>
<?php echo htmlDivLineSpacer("10px", "", "left"); ?>
<div>
<?php echo defineButtonType10(getLngt("Hinzufügen"), "action_new", "finishPage2('saveCategoryNew');", "120", "left", "3"); ?>
<?php echo defineButtonType10(getLngt("Umbenennen"), "action_rename", "finishPage2('saveCategoryModified');", "120", "left", "3"); ?>
</div>
<?php echo htmlDivLineSpacer("30px", "", "left"); ?>
<div>
<?php echo $listOfEntries ?>
</div>
</div>
<!-- SPACER -->
<div <?php echo setStyleHtmlDiv("80px","left"); ?>>&nbsp;</div>
<!-- FIELDS -->
<div style="float:left;">
<div>
<div class="f12bp1_blue"><?php echo getLngt("Globale Felder") ?></div>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<div>
<div <?php echo setStyleHtmlDiv("250","left"); ?>>
<?php echo getLngt("Anzeigefilter") ?>&nbsp;:&nbsp;&nbsp;<input type="text" name="f_filter_mtfk_name" value="<?php echo $f_filter_mtfk_name ?>" maxlength="15" size="15">
</div>
<?php echo defineButtonType10(getLngt("Anzeigen"), "action_field_show", "document.forms[0].submit();", "120", "", ""); ?>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<div>
<table class="f10np1" border="0" cellpadding="0">
<?php echo $tableOfRowsField ?>
</table>
</div>
<?php echo htmlDivLineSpacer("20px"); ?>
<div>
<?php echo getLngt("(Neues) Feld:") ?>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<div>
<div <?php echo setStyleHtmlDiv("150px","left"); ?>><?php echo getLngt("Typ:") ?></div>
<div>
<select name="f_mtfk_type">
<?php
echo addOptionsFromArray(getColVectorFromDB2ArrayByClause("metafieldkey", "mtfk_type", "", "", "mtfk_type", "DISTINCT"),$f_mtfk_type,"1");
echo addOptionsFromAssociativeArray($metaTypeMappingArray, "", "", "2", "db:");
echo addOptionsFromAssociativeArray($metaTypeSystemArray, "", "", "2", "sys:");
?>
</select>
</div>
</div>
<?php echo htmlDivLineSpacer("10px", "", "left"); ?>
<div>
<div <?php echo setStyleHtmlDiv("150px","left"); ?>><?php echo getLngt("Name:") ?></div>
<div>
<input type="text" name="f_mtfk_name" value="<?php echo $f_mtfk_name ?>" maxlength="100" size="30">
</div>
</div>
<?php echo htmlDivLineSpacer("10px", "", "left"); ?>
<div>
<?php echo defineButtonType10(getLngt("Hinzufügen"), "action_field_new", "finishPage2('saveFieldNew');", "120", "left", "3"); ?>
<?php echo defineButtonType10(getLngt("Umbenennen"), "action_field_rename", "finishPage2('saveFieldModified');", "120", "left", "3"); ?>
</div>
<?php echo htmlDivLineSpacer("30px", "", "left"); ?>
</div>
<?php if ($mtfcTemplateMode == "1") : ?>
<!-- SPACER -->
<div <?php echo setStyleHtmlDiv("80px","left"); ?>>&nbsp;</div>
<!-- TEMPLATES -->
<div style="float:left;">
<div>
<div class="f12bp1_blue"><?php echo getLngt("Vorlagen") ?></div>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<div>
<table class="f10np1" border="0" cellpadding="0">
<?php echo $tableOfRowsTemplate ?>
</table>
</div>
<?php echo htmlDivLineSpacer("20px"); ?>
<div>
<?php echo getLngt("(Neue) Vorlage:") ?>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<?php echo htmlDivLineSpacer("10px", "", "left"); ?>
<div>
<div <?php echo setStyleHtmlDiv("150px","left"); ?>><?php echo getLngt("Name:") ?></div>
<div>
<input type="text" name="f_mtft_name" value="<?php echo $f_mtft_name ?>" maxlength="100" size="30">
</div>
</div>
<?php echo htmlDivLineSpacer("10px", "", "left"); ?>
<div>
<?php echo defineButtonType10(getLngt("Hinzufügen"), "action_new", "finishPage2('saveTemplateNew');", "120", "left", "3"); ?>
<?php echo defineButtonType10(getLngt("Umbenennen"), "action_rename", "finishPage2('saveTemplateModified');", "120", "left", "3"); ?>
</div>
<?php echo htmlDivLineSpacer("30px", "", "left"); ?>
<div>
<?php echo $listOfEntries ?>
</div>
</div>
<?php endif; ?>
<?php if ($f_mtfc_id != "") : ?>
<!-- SPACER -->
<div <?php echo setStyleHtmlDiv("80px","left"); ?>>&nbsp;</div>
<!-- FIELDS OF A SPECIFIED FORM -->
<div style="float:left;">
<div>
<div class="f12bp1_blue"><?php echo getLngt("Felder des Formulars") ?>:&nbsp;<?php echo getFieldValueFromId("metafieldcategory","mtfc_id",$f_mtfc_id,"mtfc_description"); ?></div>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<div>
<table class="f10np1" border="0" cellpadding="0">
<?php echo $tableOfcategoryField ?>
</table>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<div>
<?php echo defineButtonType10(getLngt("Sortierung speichern"), "action_categoryfield_sort", "finishPage2('saveCategoryFieldSort');", "200", "left", "3"); ?>
</div>
<?php echo htmlDivLineSpacer("30px", "", "left"); ?>
<div>
<?php echo getLngt("(Neues) Formularfeld:") ?>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<div>
<div>
<select class="f8np1" name="f_mtfk_new_id">
<?php echo addOptionsAndTextsFromArrays(mtfk_getAllIDs("mtfk_id"), getColVectorFromDB2ArrayByClause("metafieldkey", "mtfk_name", "", "", "mtfk_id"), "", "1"); ?>
</select>
</div>
</div>
<?php echo htmlDivLineSpacer("10px", "", "left"); ?>
<div>
<?php echo defineButtonType10(getLngt("Hinzufügen"), "action_categoryfield_new", "finishPage2('saveCategoryFieldNew');", "120", "left", "3"); ?>
</div>
<?php echo htmlDivLineSpacer("30px", "", "left"); ?>
</div>
<?php endif; ?>
<?php echo htmlDivLineSpacer("20px"); ?>
</form>
</div>
</body>
</html>

View File

@@ -0,0 +1,680 @@
<?php
/*=======================================================================
*
* metafield_list.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act_mtfl", "orderClause", "f_hq_id", "deactivateMenu", "f_searchmode", "statusMessage", "callMode", "callObjId",
"deactivateMenu", "generatePDF", "category", "objId", "categoryPageTitel", "f_search", "f_letter", "f_objIdRemove",
"viewItemsMode", "presetFields"));
getLanguage(__FILE__);
$pageTitel = getLngt($categoryPageTitel);
mcIsSet($mtfvKeysArrayLen, 0);
mcIsSet($includeMode);
if ($includeMode == "") :
include_once ("../admin/menu.php");
endif;
include_once ("../include/html.inc.php");
if ($category == "") : $category = "1"; endif; // Contact
include_once ("../include/inc_metafield.inc.php");
include_once ('../groupware/vcard/class.vCard.inc.php');
getCurrentScript(__FILE__);
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
authCheckEmployeeRights($emp_id, "0", "1");
// View mode
if ($viewItemsMode == "") : $viewItemsMode = "1"; endif;
$outputViewMode = "";
// Special treatment according to the "mode of call"
$specialCallMode = "";
if ($callObjId != "") :
// [1.] Customer contacts
if ($category == "1") :
if ($callMode == "1") :
$tmpCsEid = getFieldValueFromId("customer", "cs_id", $callObjId, "cs_eid");
$tmpCmpId = getFieldValueFromId("customer", "cs_id", $callObjId, "cmp_id");
$tmpCmpComp = getFieldValueFromId("company", "cmp_id", $tmpCmpId, "cmp_comp");
if ($viewItemsMode == "1") :
$specialCallMode = "<div><span class=\"f10bp1\">" . getLngt("KUNDE") . ":&nbsp;&nbsp;&nbsp;" . $tmpCsEid . "&nbsp;&nbsp;&nbsp;(" . $tmpCmpComp . ")</span></div>\n";
else :
$specialCallMode = "<tr><td class=\"f10bp1\" colspan=\"" . $mtfck_mtfckIdsLen . "\">" . getLngt("KUNDE") . ":&nbsp;&nbsp;&nbsp;" . $tmpCsEid . "&nbsp;&nbsp;&nbsp;(" . $tmpCmpComp . ")<br><br></td></tr>\n";
endif;
if ($f_act_mtfl == "") :
$f_act_mtfl = "search";
endif;
endif;
endif;
endif;
$f_search = trim($f_search);
// Init mail address for VCards with the mail address of the user
$f_vcard_email = getFieldValueFromId("user", "usr_id", $usr_id, "usr_email");
$htmlClass01 = "class=\"smaller\""; // input,select
$htmlClass02 = "class=\"f7np1\""; // write
$numOfRows = 0;
// Mandator filter
if ($f_hq_id == "") : $f_hq_id = array(); endif;
if (count($f_hq_id) == 0) : array_push($f_hq_id, $hq_id); endif;
if ($presetFields != "") : $presetFields = urldecode($presetFields); endif;
$tableHeaderSearchFields = "";
// OUTPUT: Table header search fields
/*
$tableHeaderSearchFields .= "<td>&nbsp;</td>";
$searchString = "";
for ($j = 0; $j < $mtfck_mtfckIdsLen; $j++) :
getSecHttpVars("1",array("f_" . $j));
${("f_" . $j)} = trim(${("f_" . $j)});
$searchString .= ${("f_" . $j)};
$cellColor = getListColor(1, 1);
$tableHeaderSearchFields .= "<td bgcolor=\"" . $cellColor . "\">" . "<input type=\"text\" " . $htmlClass01 . " name=\"f_" . $j . "\" value=\"" . ${("f_" . $j)} . "\">" . "</td>\n";
endfor;
*/
// Usage of only one search field according to an OR-search in all fields
$tableHeaderSearchFields .= "<td colspan=\"" . $mtfck_mtfckIdsLen . "\">" . getLngt("Suchbegriff") . ":&nbsp;&nbsp;" . "<input type=\"text\" " . $htmlClass01 . " name=\"f_search\" value=\"" . $f_search . "\" size=\"40\" placeholder=\"" . getLngt("Suchbegriff") . "\">" . "<br><br></td>\n";
// OUTPUT: Table header column links
$tableHeaderLinks = "<td>Bearbeiten&nbsp;</td>";
for ($j = 0; $j < $mtfck_mtfckIdsLen; $j++) :
$tableHeaderLinks .= "<td>" . $mtfk_allFieldNames[$mtfck_mtfkIds[$j]] . "&nbsp;&nbsp;</td>";
/*
$cellColor = getListColor(1, 1);
$tableHeaderLinks .= "<a href=\"javascript:document.forms[0].orderClause.value='" . $mtfck_mtfckIds[$j] . "';document.forms[0].f_act_mtfl.value='search';document.forms[0].submit();\">&nbsp;" . $mtfk_allFieldNames[$mtfck_mtfkIds[$j]] . "&nbsp;</a>";
*/
endfor;
$tableHeaderLinks .= "<td>Löschen&nbsp;</td>";
// Remove specified object
if ($f_act_mtfl == "remove" && $f_objIdRemove != "") :
TA("B");
deleteStmt("metafieldvalue","mtfv_id = " . $f_objIdRemove);
$f_act_mtfl = "search";
TA("C");
TA("E");
endif;
// Generate search-resultset
if ($f_searchmode == "") : $f_searchmode = "1"; endif;
if ($f_act_mtfl == "search") :
$doSearch = TRUE;
if (strlen($f_search) == 0 && $callMode == "" && $f_letter == "") :
$doSearch = FALSE;
if (getCountOfTable("metafieldvalue") <= (MAX_CARDINALITY * 10)) :
$doSearch = TRUE;
endif;
endif;
if ($doSearch) :
if ($f_searchmode == "1") : $prefix = "%"; else : $prefix = ""; endif;
$whereClause = "";
$objIdArray = array();
if ($callMode != "" && $callObjId != "") :
// [1.] Customer contacts
if ($category == "1") :
if ($callMode == "1") :
// Get the object IDs equal to
$sqlquery = "SELECT DISTINCT mtfv.mtfv_id"
. " FROM metafieldvalue AS mtfv, metafieldcategorykey AS mtfck, metafieldkey AS mtfk"
. " WHERE mtfv.mtfv_value = '" . $callObjId . "' AND"
. " mtfck.mtfc_id = '" . $category . "' AND"
. " mtfv.mtfck_id = mtfck.mtfck_id AND"
. " mtfk.mtfk_id = mtfck.mtfk_id AND"
. " mtfk.mtfk_type = 'co2cs'";
endif;
endif;
else :
/* Use this to search in each field by AND (like lists for cs, cr, etc.)
for ($j = 0; $j < $mtfck_mtfckIdsLen; $j++) :
if ($whereClause != "" && ${("f_" . $j)} != "") : $whereClause .= " OR "; endif;
if (${("f_" . $j)} != "") : $whereClause .= "(mtfv.mtfck_id = '" . $mtfck_mtfckIds[$j] . "' AND mtfv.mtfv_value LIKE '" . $prefix . ${("f_" . $j)} . "%')"; endif;
endfor;
if ($whereClause != "") : $whereClause = " WHERE " . $whereClause; endif;
*/
if ($f_search != "") : $whereClause .= " AND mtfv.mtfv_value LIKE '" . $prefix . $f_search . "%'"; endif;
if ($f_letter != "") : $whereClause .= " AND mtfv.mtfv_value LIKE '" . $f_letter . "%' AND (mtfk.mtfk_name = 'Name' OR mtfk.mtfk_type = 'surname')"; endif;
// In the first step get the involved object IDs
$sqlquery = "SELECT DISTINCT mtfv.mtfv_id"
. " FROM metafieldvalue AS mtfv, metafieldcategorykey AS mtfck, metafieldkey AS mtfk"
. " WHERE mtfv.mtfck_id = mtfck.mtfck_id AND"
. " mtfck.mtfc_id = '" . $category . "' AND"
. " mtfck.mtfk_id = mtfk.mtfk_id"
. $whereClause;
// Special search for type co2cs, additional search in customer data
if ($whereClause != "" && $f_letter == "") :
$sqlquery2 = "SELECT DISTINCT mtfv.mtfv_id"
. " FROM metafieldvalue AS mtfv, metafieldcategorykey AS mtfck, metafieldkey AS mtfk, customer AS cs, company AS cmp"
. " WHERE mtfv.mtfck_id = mtfck.mtfck_id AND"
. " mtfck.mtfc_id = '" . $category . "' AND"
. " mtfk.mtfk_id = mtfck.mtfk_id AND"
. " mtfk.mtfk_type = 'co2cs' AND"
. " cs.cs_id = mtfv.mtfv_value AND"
. " cs.cmp_id = cmp.cmp_id AND"
. " (cs.cs_eid LIKE '" . $prefix . $f_search . "%' OR"
. " cmp.cmp_comp LIKE '" . $prefix . $f_search . "%')";
$sqlquery = "(" . $sqlquery . ") UNION (" . $sqlquery2 . ")";
endif;
endif;
$result = $db->dbQ($sqlquery);
while ($row = $result->fetch_assoc()):
$objIdArray[] = $row["mtfv_id"];
endwhile;
$result->free();
if (count($objIdArray) > 0) :
// Next step get all object informations of all involved objects
$whereClauseHQ = " mtfck.hq_id IN " . getSQLMandatorArray($f_hq_id) . " ";
if ($gHqId) : $whereClauseHQ = " mtfck.hq_id = '0' "; endif;
$sqlquery = "SELECT mtfv.mtfck_id, mtfv.mtfv_id, mtfv.mtfv_value, mtfk.mtfk_type"
. " FROM metafieldvalue AS mtfv, metafieldcategorykey AS mtfck, metafieldkey AS mtfk"
. " WHERE mtfv.mtfv_id IN (" . implode(",",$objIdArray) . ") AND"
. " mtfck.mtfc_id = '" . $category . "' AND"
. " mtfk.mtfk_id = mtfck.mtfk_id AND "
. " mtfv.mtfck_id = mtfck.mtfck_id AND "
. $whereClauseHQ
. " ORDER BY mtfv.mtfv_id, mtfck.mtfck_sort";
$result = $db->dbQ($sqlquery);
if ($viewItemsMode == "1") :
if ($category == "1") :
// *** [Contacts] ***
// Converts formular DB data into an array and sorts it according to a special column
$mtfvArray = array();
$mtfvTypeArray = array();
$constContactSortFields = getParameterValue("0", "MASK_CONTACT_SORT_FIELDS", "0");
if ($constContactSortFields == "") : $constContactSortFields = "1,2"; endif; // Sort contacts by "Name" (here first coumn)
$mtfvArraySortColArray = spliti(",",$constContactSortFields);
convertFormdataToArray();
// Get fields of the header to be displayed (according to contact it will be the "name" and the "firstname")
$constContactHeaderFieldsDisplayed = getParameterValue("0", "MASK_CONTACT_HEADER_FIELDS_DISPLAYED", "0");
if ($constContactHeaderFieldsDisplayed == "") : $constContactHeaderFieldsDisplayed = "1,2"; endif;
$contactHeaderFieldsDisplayedArray = spliti(",",$constContactHeaderFieldsDisplayed);
// Get fields of the body to be displayed
$constContactBodyFieldsDisplayed = getParameterValue("0", "MASK_CONTACT_BODY_FIELDS_DISPLAYED", "0");
if ($constContactBodyFieldsDisplayed == "") : $constContactBodyFieldsDisplayed = "3,4,5,6,7,8,9,10"; endif;
$contactBodyFieldsDisplayedArray = spliti(",",$constContactBodyFieldsDisplayed);
// Get ADDRESS fields of the body to be displayed ([0]=street, [1]=housenumber, [2]=zipcode, [3]=city)
$constContactAddressFieldsDisplayed = getParameterValue("0", "MASK_CONTACT_ADDRESS_FIELDS_DISPLAYED", "0");
if ($constContactAddressFieldsDisplayed == "") : $constContactAddressFieldsDisplayed = "8,9"; endif;
$contactAddressFieldsDisplayedArray = spliti(",",$constContactAddressFieldsDisplayed);
$styleCell = "float:left;width:350px;height:180px;border:4px;border-style:outset;border-color:#1b12b9;margin:2px;";
$styleHeader = "height:20px;background-color:#4e45ec;padding:5px;color:#FFFFFF;cursor:pointer;";
$styleBody = "height:110px;background-color:#97bcFF;padding:5px;";
$styleFooter = "height:20px;background-color:#6e65ff;padding:5px;color:#FFFFFF;";
$styleFontHeader = "f10np1";
$styleFontBody = "f8np1";
$styleFontFooter = "f8np1";
for ($i = 0; $i < $mtfvKeysArrayLen; $i++) :
$VCard = array();
$outputViewMode .= "<div style=\"". $styleCell ."\">\n";
// Card header
$outputViewMode .= " <div style=\"". $styleHeader ."\" onClick=\"javascript:openMetaFieldSpecial('" . ec($mtfvKeysArray[$i]) . "');\"><span class=\"" . $styleFontHeader . "\">" . substr($mtfvArray[$mtfvKeysArray[$i]][$contactHeaderFieldsDisplayedArray[0]] . ", " . $mtfvArray[$mtfvKeysArray[$i]][$contactHeaderFieldsDisplayedArray[1]], 0, 29) . "</span></div>\n";
$VCard["n_family"] = $mtfvArray[$mtfvKeysArray[$i]][$contactHeaderFieldsDisplayedArray[0]];
if ($VCard["n_family"] == "") : $VCard["n_family"] = "_"; endif;
$VCard["n_given"] = $mtfvArray[$mtfvKeysArray[$i]][$contactHeaderFieldsDisplayedArray[1]];
if ($VCard["n_given"] == "") : $VCard["n_given"] = "_"; endif;
// $VCard["fn"] = $mtfvArray[$mtfvKeysArray[$i]][$contactHeaderFieldsDisplayedArray[1]] . " " . $mtfvArray[$mtfvKeysArray[$i]][$contactHeaderFieldsDisplayedArray[0]];
$VCard["adr_one_street"] = $mtfvArray[$mtfvKeysArray[$i]][$contactAddressFieldsDisplayedArray[0]] . " " . $mtfvArray[$mtfvKeysArray[$i]][$contactAddressFieldsDisplayedArray[1]];
$VCard["adr_one_locality"] = $mtfvArray[$mtfvKeysArray[$i]][$contactAddressFieldsDisplayedArray[3]];
$VCard["adr_one_region"] = " ";
$VCard["adr_one_countryname"] = $mtfvArray[$mtfvKeysArray[$i]][$contactAddressFieldsDisplayedArray[4]];
$VCard["adr_one_postalcode"] = $mtfvArray[$mtfvKeysArray[$i]][$contactAddressFieldsDisplayedArray[2]];
/*
[n_family] => Simon
[n_given] => Frank
[n_middle] =>
[n_prefix] =>
[n_suffix] =>
[fn] => Frank Simon
[org_name] => Rotterdam Immobilien GmbH
[org_unit] =>
[title] => Bankfachwirt, Vertrieb
[tel_work] => 02173 9150 12
[tel_cell] => 0163 691 5012
[tel_fax] => 02173 9150 11
[address2] =>
[adr_one_street] => Rotterdam Immobilien GmbH Hauptstra=DFe 41
[adr_one_locality] => Langenfeld
[adr_one_region] =>
[adr_one_postalcode] => 40764
[adr_one_countryname] => Deutschland
[label] => Rotterdam Immobilien GmbH Hauptstra=DFe 41 Langenfeld 40764 Deutschland
[url] => http://www.rotterdam-bau.de
[email] => simon@rotterdam-bau.de
[email_type] => PREF
[tel_prefer] =>
[adr_one_type] =>
[adr_two_type] =>
*/
$tmpArray = $mtfvArray[$mtfvKeysArray[$i]];
$tmpArrayLen = count($tmpArray);
$outputViewMode .= " <div style=\"". $styleBody ."\">";
for ($j = 0; $j < $tmpArrayLen; $j++) :
// Check column to be displayed
$displayCurrField = in_array($j, $contactBodyFieldsDisplayedArray);
// Card body
if ($displayCurrField) :
$outputViewMode .= " <div style=\"float:left;width:80px;\"><span class=\"" . $styleFontBody . "\">" . $mtfk_allFieldNames[$mtfck_mtfkIds[$j]] . "</span></div>";
$outputViewMode .= " <div style=\"float:left;width:10px;\"><span class=\"" . $styleFontBody . "\">:</span></div>";
endif;
$ftype = $mtfvTypeArray[$mtfvKeysArray[$i]][$j];
$valueToBeDisplayed = $mtfvArray[$mtfvKeysArray[$i]][$j];
if ($ftype == "co2cs") :
$tmpCsId = $valueToBeDisplayed;
$tmpCmpId = getFieldValueFromId("customer", "cs_id", $tmpCsId, "cmp_id");
$tmpCmpComp1 = trim(getFieldValueFromId("company", "cmp_id", $tmpCmpId, "cmp_comp"));
$VCard["org_name"] = $tmpCmpComp1;
$valueToBeDisplayed = getFieldValueFromId("customer", "cs_id", $valueToBeDisplayed, "cs_eid");
if ($valueToBeDisplayed != "" && $tmpCmpComp1 != "") :
$valueToBeDisplayed .= "<br>[" . trim($tmpCmpComp1) . "]";
endif;
elseif ($ftype == "mail_business" && $valueToBeDisplayed != "") :
if ($displayCurrField) :
$outputViewMode .= " <div><span class=\"" . $styleFontBody . "\"><b><a href=\"mailto:" . $valueToBeDisplayed . "\">" . $valueToBeDisplayed . "</a></b></span></div>";
endif;
$VCard["email"] = $valueToBeDisplayed;
$VCard["email_type"] = "PREF";
elseif ($ftype == "url_business" && $valueToBeDisplayed != "") :
if ($displayCurrField) :
$outputViewMode .= " <div><span class=\"" . $styleFontBody . "\"><b><a href=\"" . $valueToBeDisplayed . "\">" . $valueToBeDisplayed . "</a></b></span></div>";
endif;
$VCard["url_work"] = $valueToBeDisplayed;
elseif ($ftype == "mobile_business" && $valueToBeDisplayed != "") :
if ($displayCurrField) :
$outputViewMode .= " <div><span class=\"" . $styleFontBody . "\"><b>" . $valueToBeDisplayed . "</b></span></div>";
endif;
$VCard["tel_cell"] = $valueToBeDisplayed;
elseif ($ftype == "phone_business" && $valueToBeDisplayed != "") :
if ($displayCurrField) :
$outputViewMode .= " <div><span class=\"" . $styleFontBody . "\"><b>" . $valueToBeDisplayed . "</b></span></div>";
endif;
$VCard["tel_work"] = $valueToBeDisplayed;
elseif ($ftype == "fax_business" && $valueToBeDisplayed != "") :
if ($displayCurrField) :
$outputViewMode .= " <div><span class=\"" . $styleFontBody . "\"><b>" . $valueToBeDisplayed . "</b></span></div>";
endif;
$VCard["tel_fax"] = $valueToBeDisplayed;
elseif ($ftype == "phone_private" && $valueToBeDisplayed != "") :
if ($displayCurrField) :
$outputViewMode .= " <div><span class=\"" . $styleFontBody . "\"><b>" . $valueToBeDisplayed . "</b></span></div>";
endif;
// $VCard[] = $valueToBeDisplayed;
elseif ($ftype == "birthdate" && $valueToBeDisplayed != "") :
if ($displayCurrField) :
$outputViewMode .= " <div><span class=\"" . $styleFontBody . "\"><b>" . $valueToBeDisplayed . "</b></span></div>";
endif;
$VCard["bday"] = substr($valueToBeDisplayed,3,2) . "/" . substr($valueToBeDisplayed,0,2) . "/" . substr($valueToBeDisplayed,6,4);
else :
if ($displayCurrField) :
$outputViewMode .= " <div><span class=\"" . $styleFontBody . "\"><b>" . $valueToBeDisplayed . "</b></span></div>";
endif;
endif;
endfor;
$outputViewMode .= " </div>\n";
// Create vCard object
$vCardObj = new vCard();
$VCardString = $vCardObj->out($VCard);
// $VCardString = nl2br($VCardString);
$VCardStringJs = my_str_check_js($VCardString);
$VCardStringHttp = my_str_check_http($VCardString);
// Card footer
$outputViewMode .= " <div style=\"". $styleFooter ."\"><span class=\"" . $styleFontFooter . "\">\n";
$outputViewMode .= " &nbsp;<a href=\"javascript:vCardOfMetaFieldObject('" . $VCardStringJs . "');\"><img src=\"../images/vcard.gif\" border=\"0\" height=\"20\" width=\"20\"></a>&nbsp;&nbsp;&nbsp;";
$outputViewMode .= " &nbsp;<a href=\"javascript:vCardSendPerMail('" . urlencode($VCardStringHttp) . "','" . urlencode($VCard["n_given"]) . " " . urlencode($VCard["n_family"]) . "','vcf');\"><img src=\"../images/vcard.gif\" border=\"0\" height=\"20\" width=\"20\"></a>&nbsp;&nbsp;&nbsp;";
$outputViewMode .= " &nbsp;<a href=\"javascript:removeMetaFieldObject('" . ec($mtfvKeysArray[$i]) . "');\"><img src=\"../images/waste.png\" border=\"0\" height=\"20\" width=\"16\"></a>&nbsp;";
$outputViewMode .= " </span></div>\n";
$outputViewMode .= "</div>\n";
endfor;
elseif ($category == "10") :
// *** [Newsletter] ***
// $viewItemsMode = "0";
$statusMessage = getLngt("Für die Newsletter steht keine Kartenansicht zur Verfügung! Bitte zur Listenansicht wechseln!");
endif;
else :
// *** Default output as a list, table with header ***
$lineToggler = 0;
$remObjId = "";
$tableOfRows .= "<tr>";
while ($row = $result->fetch_assoc()):
if ($remObjId == "" || $remObjId != $row["mtfv_id"]) :
if ($remObjId != "") :
$tableOfRows .= "<td align=\"center\" ".$htmlClass02." bgcolor=\"" . $cellColor ."\"><a href=\"javascript:removeMetaFieldObject('" . ec($remObjId) . "');\">&nbsp;<img src=\"../images/waste.png\" border=\"0\" height=\"15\" width=\"12\">&nbsp;</a></td>";
$tableOfRows .= "</tr><tr>";
endif;
$numOfRows++;
$remObjId = $row["mtfv_id"];
if ($lineToggler == 0) : $lineToggler = 1; else : $lineToggler = 0; endif;
$cellColor = getListColor($numOfRows, $lineToggler);
$tableOfRows .= "<td align=\"center\" ".$htmlClass02." bgcolor=\"" . $cellColor ."\"><a href=\"javascript:openMetaFieldSpecial('" . ec($remObjId) . "');\">&nbsp;<img src=\"../images/arrow_right.png\" border=\"0\" height=\"10\" width=\"25\">&nbsp;</a></td>";
endif;
$valueToBeDisplayed = $row["mtfv_value"];
if ($row["mtfk_type"] == "co2cs") :
$tmpCsId = $valueToBeDisplayed;
$tmpCmpId = getFieldValueFromId("customer", "cs_id", $tmpCsId, "cmp_id");
$tmpCmpComp1 = trim(getFieldValueFromId("company", "cmp_id", $tmpCmpId, "cmp_comp"));
$valueToBeDisplayed = getFieldValueFromId("customer", "cs_id", $valueToBeDisplayed, "cs_eid");
if ($valueToBeDisplayed != "" && $tmpCmpComp1 != "") :
$valueToBeDisplayed .= "<br>[" . trim($tmpCmpComp1) . "]";
endif;
elseif ($row["mtfk_type"] == "checkboxes_hq") :
$tmpHqArray = spliti(",", $row["mtfv_value"]);
$tmpHqArrayLen = count($tmpHqArray);
for ($i = 0; $i < $tmpHqArrayLen; $i++) :
$tmpHqArray[$i] = getFieldValueFromId("headquarters","hq_id",$tmpHqArray[$i],"hq_mnemonic");
endfor;
$valueToBeDisplayed = implode(",",$tmpHqArray);
elseif (substr($row["mtfk_type"],0,7) == "select:") : // SELECT FIELD
$subTypeArray = spliti(":",$row["mtfk_type"]);
$table = $subTypeArray[1];
if ($table == "vht") :
$valueToBeDisplayed = getFieldValueFromClause("metatype","mt_value","mt_type = 'vehicletype' AND mt_sort = '" . $row["mtfv_value"] . "' AND mt_objid = '0'");
endif;
if ($table == "grp") :
$valueToBeDisplayed = getFieldValueFromId("groups","grp_id",$row["mtfv_value"],"grp_name");
endif;
if ($table == "br") :
$valueToBeDisplayed = getFieldValueFromId("branch","br_id",$row["mtfv_value"],"br_name");
endif;
endif;
$tableOfRows .= "<td ".$htmlClass02." bgcolor=\"" . $cellColor ."\">&nbsp;" . $valueToBeDisplayed . "</td>";
endwhile;
$tableOfRows .= "<td align=\"center\" ".$htmlClass02." bgcolor=\"" . $cellColor ."\"><a href=\"javascript:removeMetaFieldObject('" . ec($remObjId) . "');\">&nbsp;<img src=\"../images/waste.png\" border=\"0\" height=\"15\" width=\"12\">&nbsp;</a></td>";
$tableOfRows .= "</tr>";
$result->free();
endif;
endif;
else :
$statusMessage = getLngt("Es erfolgte keine Suche!");
endif;
endif;
$headerOps = "&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;";
$headerOps .= "<a href=\"javascript:openMetaFieldSpecial('');\">&nbsp;" . "Neuer Eintrag" . "&nbsp;</a>";
$pageHeadline = "<span class=\"f12bp1_blue\">" . ($pageTitel != "" ? strtoupper($pageTitel) . "</span>" : strtoupper($mtfcDescription) . "</span>" . " &nbsp;&nbsp;&nbsp;&nbsp;" . $mtfObjAddressArr["comp"] . ($mtfObjAddressArr["comp2"] != "" ? " :: " . $mtfObjAddressArr["comp2"] : ""));
?>
<?php if ($includeMode == "") : ?>
<html>
<head>
<title><?php echo $pageTitel ?></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 ("../include/js_framework.inc.php"); ?>
<script type="text/javascript">
<!--
// NAVIGATION
<?php echo $jsMenuOut; ?>
function setFocusContactSearch() {
document.forms[0].f_search.focus();
};
function clearFields() {
if (document.forms[0].f_search) {document.forms[0].f_search.value = ''};
};
/*
function clearFields() {
<?php
for ($j = 0; $j < $mtfck_mtfckIdsLen; $j++) :
echo "if (document.forms[0].f_" . $j . ") {document.forms[0].f_" . $j . ".value = ''};";
endfor;
?>
};
*/
function openMetaFieldSpecial(objId) {
var widthPopupWin = 1024;
var heightPopupWin = 900;
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
var popupWin;
if (objId != '') {
popupWin = window.open("../admin/metafield_special.php?deactivateMenu=1&category=<?php echo ec($category); ?>&specialPageTitle=<?php echo $categoryPageTitel ?>&objId=" + objId ,"","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
} else {
// Preset field values for new entries only
popupWin = window.open("../admin/metafield_special.php?deactivateMenu=1&category=<?php echo ec($category); ?>&specialPageTitle=<?php echo $categoryPageTitel ?>&objId=" + objId + "&callObjId=<?php echo $callObjId ?>&presetFields=<?php echo urlencode($presetFields) ?>" ,"","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
}
};
function removeMetaFieldObject(objId) {
if (confirm('<?php echo getLngt("Möchten Sie den Eintrag wirklich löschen?") ?>')) {
document.forms[0].f_act_mtfl.value='remove';
document.forms[0].f_objIdRemove.value=objId;
document.forms[0].submit();
};
};
function vCardOfMetaFieldObject(VCard) {
// var outVCard = VCard.join("<br>");
// document.forms[0].f_vcard_text.value = outVCard;
document.forms[0].f_vcard_text.value = VCard;
};
function vCardSendPerMail(VCard,file_name,file_ext) {
// vCardOfMetaFieldObject(VCard);
email = document.forms[0].f_vcard_email.value;
if (email != '') {
if (confirm('<?php echo getLngt("Die angezeigte VCard wird an die folgende Mailadresse gesendet:") ?> ' + email)) {
var widthPopupWin = 700;
var heightPopupWin = 300;
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
var popupWin;
popupWin = window.open("../include/email_send.php?f_act=mailsend&f_closeWin=1&f_attachment=" + encodeURI(VCard) + "&f_subject=VCard&f_email=" + email + "&f_mimetype=text/x-vcard&f_fileName=" + encodeURI(file_name) + "&f_extension=" + file_ext ,"","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
}
} else {
alert('<?php echo getLngt("Bitte tragen Sie eine Emailadresse ein!") ?>');
}
};
function searchContactPrefix(letter) {
document.forms[0].f_act_mtfl.value = 'search';
document.forms[0].f_letter.value = letter;
document.forms[0].submit();
}
-->
</script>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>displayStatusMessage();setFocusContactSearch();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="mc_page-header">
<?php echo $pageHeadline ?>
</div>
<div class="maincontent mc_elem" name="maincontent" id="maincontent">
<form action="../admin/metafield_list.php" method="post">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<?php endif; ?>
<input type="hidden" name="f_act_mtfl" value="">
<input type="hidden" name="category" value="<?php echo $category ?>">
<input type="hidden" name="orderClause" value="<?php echo $orderClause ?>">
<input type="hidden" name="categoryPageTitel" value="<?php echo $categoryPageTitel ?>">
<input type="hidden" name="f_objIdRemove" value="">
<input type="hidden" name="callMode" value="<?php echo $callMode ?>">
<input type="hidden" name="callObjId" value="<?php echo $callObjId ?>">
<input type="hidden" name="presetFields" value="<?php echo $presetFields ?>">
<input type="hidden" name="f_letter" value="">
<?php echo htmlDivLineSpacer("10px"); ?>
<!-- Headquarters checkboxes -->
<?php
mcIsset($hqCheckboxesExist, false);
if (!$hqCheckboxesExist && authCheckEmployeeRights($emp_id, "10") && $gHqId == false) :
echo getHeadquartersCheckboxes($f_hq_id);
echo htmlDivLineSpacer("10px", "", "left");
endif;
?>
<div>
<a href="javascript:document.forms[0].f_act_mtfl.value='search';document.forms[0].submit();">&nbsp;<?php echo getLngt("Suchen") ?>&nbsp;</a>
&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;
<a href="javascript:clearFields();"><?php echo getLngt("Suchbegriff zurücksetzen") ?></a>
&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;
<?php echo getLngt("Option:") ?>&nbsp;&nbsp;
<input type="radio" name="f_searchmode" value="0" <?php if ($f_searchmode == "0") : echo "checked"; endif; ?>> <?php echo getLngt("Präfix") ?>
<input type="radio" name="f_searchmode" value="1" <?php if ($f_searchmode == "1") : echo "checked"; endif; ?>> <?php echo getLngt("Teilwort") ?>
<?php echo $headerOps ?>
&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;
<?php echo getLngt("Ansicht:") ?>&nbsp;&nbsp;
<input type="radio" name="viewItemsMode" value="0" <?php if ($viewItemsMode == "0") : echo "checked"; endif; ?>> <?php echo getLngt("Liste") ?>
<input type="radio" name="viewItemsMode" value="1" <?php if ($viewItemsMode == "1") : echo "checked"; endif; ?>> <?php echo getLngt("Karten") ?>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<?php if ($viewItemsMode == "1") : ?>
<div style="float:left;width:300px;"><input type="text" <?php echo $htmlClass01 ?> name="f_search" value="<?php echo $f_search ?>" size="35" placeholder="<?php echo getLngt("Suchbegriff") ?>"></div>
<?php
echo defineButtonType08(getLngt("A"), "action_A", "searchContactPrefix('A');", "20", "left", "2");
echo defineButtonType08(getLngt("B"), "action_B", "searchContactPrefix('B');", "20", "left", "2");
echo defineButtonType08(getLngt("C"), "action_C", "searchContactPrefix('C');", "20", "left", "2");
echo defineButtonType08(getLngt("D"), "action_D", "searchContactPrefix('D');", "20", "left", "2");
echo defineButtonType08(getLngt("E"), "action_E", "searchContactPrefix('E');", "20", "left", "2");
echo defineButtonType08(getLngt("F"), "action_F", "searchContactPrefix('F');", "20", "left", "2");
echo defineButtonType08(getLngt("G"), "action_G", "searchContactPrefix('G');", "20", "left", "2");
echo defineButtonType08(getLngt("H"), "action_H", "searchContactPrefix('H');", "20", "left", "2");
echo defineButtonType08(getLngt("I"), "action_I", "searchContactPrefix('I');", "20", "left", "2");
echo defineButtonType08(getLngt("J"), "action_J", "searchContactPrefix('J');", "20", "left", "2");
echo defineButtonType08(getLngt("K"), "action_K", "searchContactPrefix('K');", "20", "left", "2");
echo defineButtonType08(getLngt("L"), "action_L", "searchContactPrefix('L');", "20", "left", "2");
echo defineButtonType08(getLngt("M"), "action_M", "searchContactPrefix('M');", "20", "left", "2");
echo defineButtonType08(getLngt("N"), "action_N", "searchContactPrefix('N');", "20", "left", "2");
echo defineButtonType08(getLngt("O"), "action_O", "searchContactPrefix('O');", "20", "left", "2");
echo defineButtonType08(getLngt("P"), "action_P", "searchContactPrefix('P');", "20", "left", "2");
echo defineButtonType08(getLngt("Q"), "action_Q", "searchContactPrefix('Q');", "20", "left", "2");
echo defineButtonType08(getLngt("R"), "action_R", "searchContactPrefix('R');", "20", "left", "2");
echo defineButtonType08(getLngt("S"), "action_S", "searchContactPrefix('S');", "20", "left", "2");
echo defineButtonType08(getLngt("T"), "action_T", "searchContactPrefix('T');", "20", "left", "2");
echo defineButtonType08(getLngt("U"), "action_U", "searchContactPrefix('U');", "20", "left", "2");
echo defineButtonType08(getLngt("V"), "action_V", "searchContactPrefix('V');", "20", "left", "2");
echo defineButtonType08(getLngt("W"), "action_W", "searchContactPrefix('W');", "20", "left", "2");
echo defineButtonType08(getLngt("X"), "action_X", "searchContactPrefix('X');", "20", "left", "2");
echo defineButtonType08(getLngt("Y"), "action_Y", "searchContactPrefix('Y');", "20", "left", "2");
echo defineButtonType08(getLngt("Z"), "action_Z", "searchContactPrefix('Z');", "20", "left", "2");
?>
<?php echo htmlDivLineSpacer("20px"); ?>
<?php echo $specialCallMode ?>
<?php echo htmlDivLineSpacer("20px"); ?>
<?php echo $outputViewMode ?>
<?php echo htmlDivLineSpacer("20px", "", "left"); ?>
<?php if ($mtfvKeysArrayLen > 0) : ?>
<div><span class="f8np1"><?php echo getLngt("VCard:") ?></span></div>
<?php echo htmlDivLineSpacer("5px"); ?>
<div><textarea name="f_vcard_text" cols="70" rows="10"></textarea></div>
<?php echo htmlDivLineSpacer("5px"); ?>
<div><?php echo getLngt("Mailadresse:") ?> <input type="text" name="f_vcard_email" value="<?php echo $f_vcard_email ?>" size="49" maxlength="50"></div>
<?php endif; ?>
<?php else : ?>
<div>
<table class="f8np1" border="0" cellpadding="0">
<tr>
<?php echo $tableHeaderSearchFields ?>
</tr>
<?php echo $specialCallMode ?>
<tr>
<?php echo $tableHeaderLinks ?>
</tr>
<?php echo $tableOfRows ?>
</table>
</div>
<?php endif; ?>
<?php echo htmlDivLineSpacer("10px"); ?>
<!--
<div>
<?php echo getLngt("Anzahl Einträge:") ?> <?php echo $numOfRows ?><?php if ($numOfRows == "0" && $f_act_mtfl == "search" && $statusMessage == "") : echo " " . getLngt("(Keine Einträge gefunden.)"); endif; ?>
</div>
-->
<?php if ($includeMode == "") : ?>
</form>
</div>
</body>
</html>
<?php endif; ?>

View File

@@ -0,0 +1,391 @@
<?php
/*=======================================================================
*
* metafield_special.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
$httpVars = array("f_act", "statusMessage", "deactivateMenu", "generatePDF", "category", "objId",
"cascadingObjType", "specialPageTitle", "hideButtons", "editMode", "f_uploadImgFile",
"callObjId", "presetFields");
getSecHttpVars("1", $httpVars);
getLanguage(__FILE__);
if ($specialPageTitle == "") : $specialPageTitle = getLngt("KONTAKT"); endif;
$pageTitel = getLngt($specialPageTitle);
if ($generatePDF != "1") :
include_once ("../geo/geocode.inc.php");
endif;
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
// "$objId" and "$category" (and additional "$cascadingObjType") have to be defined HERE !!!
include_once ("../include/inc_metafield.inc.php");
getCurrentScript(__FILE__);
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
if (!(authCheckEmployeeRights($emp_id, "0") || authCheckEmployeeRights($emp_id, "1") || authCheckEmployeeRights($emp_id, "14"))) :
gotoReferer("1");
endif;
// Formular enabled for entering data or display printable view
if ($editMode == "") : $editMode = "1"; endif; // Default edit mode is enabled
// Init
$f_secretFileName = "";
$f_extension = "";
$javaScriptOut = "";
// ***************************************
// * Operations for the metafield object *
// ***************************************
// Save object data
if ($f_act == "saveObjectData" && $editMode == "1") :
saveObjectData();
endif;
// Upload image (photo, etc.)
if ($f_act == "uploadImgFile") :
$importPath = "../documents/images/";
$tempPath = "../temp/download/";
$pathSeparator = "/";
if ($_FILES['f_uploadImgFile']['size'] <= 300000) :
if (!move_uploaded_file($_FILES['f_uploadImgFile']['tmp_name'], $importPath . $_FILES['f_uploadImgFile']['name'])) :
$statusMessage = "Die Bilddatei wurde leider nicht hochgeladen!";
endif;
else :
$statusMessage = "Die Bilddatei ist für den Upload zu groß! Derzeit ist eine Beschränkung auf 300K eingestellt!";
// Delete real file if does exist
$retVal = removeFile($_FILES['f_uploadImgFile']['name'], $importPath, $pathSeparator);
endif;
// Delete temp file if does exist
// $retVal = removeFile($_FILES['f_uploadImgFile']['tmp_name'], $tempPath, $pathSeparator);
endif;
// Get current template stored in metafieldcategory for output
$currTemplateId = getFieldValueFromId("metafieldcategory","mtfc_id",$category,"mtft_id");
$atLeastOneImageDoesExistInForm = false; // Init according to image file upload
// Generate output
// getDBData("tour", $objId); // Get associative array for tour data of ALL stations. Has to be called here BEFORE calling function "outputMetaFieldSpecial()" !!!!
$outputMetaFieldsHtml = outputMetaFieldSpecial($currTemplateId, $editMode);
$outputMetaFieldsHtmlPHP = $outputMetaFieldsHtml[0];
$outputMetaFieldsHtmlJS = $outputMetaFieldsHtml[1];
// Parse template
$jsFormularFinishPageFunc = "finishPage();";
if ($currTemplateId != "" && $currTemplateId != "0") :
$contentOfCurrTemplate = getFieldValueFromId("metafieldtemplate","mtft_id",$currTemplateId,"mtft_content");
if (!(strpos($contentOfCurrTemplate, "formularFinishPage") === FALSE)) :
$jsFormularFinishPageFunc = "formularFinishPage();";
endif;
endif;
// ******************************************************************************************************************
// Output to PDF
if ($generatePDF == "1" && $companyId != "") :
$includePDFGeneric = "1";
$f_act = "generatePDFMetafield";
include_once ("../admin/pdf_generic.php");
die();
endif;
// Output to EMAIL
$mailHtmlOut = "";
$sendMail = "0";
if ($editMode == "3") :
$mailHtmlOut .= "<html>\n";
$mailHtmlOut .= " <head>\n";
$mailHtmlOut .= " <title>" . $pageTitel . "</title>\n";
$mailHtmlOut .= " <link rel=\"stylesheet\" type=\"text/css\" href=\"../css/phoenix.css\">\n";
$mailHtmlOut .= " <script type=\"text/javascript\">\n";
$mailHtmlOut .= $outputMetaFieldsHtmlJS;
$mailHtmlOut .= " </script>\n";
$mailHtmlOut .= " </head>\n";
$mailHtmlOut .= " <body>\n";
// $mailHtmlOut .= " <div>\n";
// $mailHtmlOut .= " <div>\n";
$mailHtmlOut .= $outputMetaFieldsHtmlPHP;
// $mailHtmlOut .= " </div>\n";
// $mailHtmlOut .= " </div>\n";
$mailHtmlOut .= " </body>\n";
$mailHtmlOut .= "</html>\n";
// $mailHtmlOut = urlencode(my_str_check_http($mailHtmlOut));
$f_secretFileName = "news_" . md5($emp_id);
$f_extension = "htm";
// Remove old file(s)
foreach (glob("../temp/download/" . $f_secretFileName . "." . $f_extension) as $fileNameToBoRemoved) {
if (file_exists($fileNameToBoRemoved)) :
unlink($fileNameToBoRemoved);
endif;
}
// Write new file according to the current employee
writeToFile("../temp/download/" . $f_secretFileName . "." . $f_extension, $mailHtmlOut); // write attachement data into file
$sendMail = "1";
endif;
// Output to PDF
$outPdf = "0";
if ($editMode == "4") :
$outPdf = "1";
endif;
$headlineObjectOut = "";
if ($mtfcMnemonic == "cs" || $mtfcMnemonic == "cr") :
$headlineObjectOut = $mtfObjDataArr["comp"] . ($mtfObjDataArr["comp2"] != "" ? " :: " . $mtfObjDataArr["comp2"] : "");
elseif ($mtfcMnemonic == "crvh") :
$headlineObjectOut = $mtfObjDataArr["crvh_sid"] . ($mtfObjDataArr["crvh_vh_sign"] != "" ? " :: " . $mtfObjDataArr["crvh_vh_sign"] : "");
endif;
$pageHeadline = "<span class=\"f12bp1_blue\">" . strtoupper($mtfcDescription) . "</span>" . " &nbsp;&nbsp;&nbsp;&nbsp;" . $headlineObjectOut;
?>
<html>
<head>
<title><?php echo $pageTitel ?></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 src="../include/searchLists.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
// NAVIGATION
<?php echo $jsMenuOut; ?>
// JQuery.Request
function mtfAjaxRequestSync(url, data) {
$.ajax({
type: "GET",
url: url,
data: data,
async: false,
success: function(msg){eval(msg);}
});
}
function clearAllFields() {
document.location.href = "metafield_special.php?deactivateMenu=1&category=<?php echo ec($category) ?>";
};
function reloadPage() {
document.forms[0].submit();
};
<?php echo $outputMetaFieldsHtmlJS ?>
function openGroups(customerId) {
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=cs&itemId=" + customerId,"","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
};
function switchEditMode(mode) {
document.forms[0].editMode.value = mode;
if (mode == '0') {
document.forms[0].hideButtons.value = '1';
}
finishPage();
}
function check4print() {
<?php if ($editMode == "0") : ?>
window.print();
<?php endif; ?>
}
function sendPerMail() {
sendMail = '<?php echo $sendMail; ?>';
if (sendMail == '1') {
var widthPopupWin = 1000;
var heightPopupWin = 800;
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
var popupWin;
popupWin = window.open("../include/email_send.php?f_act=_nop_&f_content=_file_&f_mimetype=text/html&f_contentFileName=<?php echo $f_secretFileName ?>&f_contentFileExtension=<?php echo $f_extension ?>" ,"","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
}
};
function generatePDF() {
pdfOut = '<?php echo $outPdf; ?>';
if (pdfOut == '1') {
var widthPopupWin = 1000;
var heightPopupWin = 800;
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
var popupWin;
popupWin = window.open("../admin/metafield_special_cron.php?category=<?php echo ec($category) ?>&objId=<?php echo ec($objId) ?>&cascadingObjType=<?php echo $cascadingObjType ?>&sendToClientFileDownload=1" ,"","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
}
};
<?php if ($atLeastOneImageDoesExistInForm) : ?>
function finishPageUpload(f_act_value) {
document.forms[1].f_act.value=f_act_value;
document.forms[1].submit();
};
<?php endif; ?>
// This function acts with the preset fields got by post
function presetFields() {
<?php
if ($category != "" && $callObjId != "" && $presetFields != "") :
$remObjId = $objId;
$objId = $callObjId;
$presetFields = urldecode($presetFields);
$presetFieldsArray = getKeyValueArrayFromString($presetFields);
$tmpKeys = array_keys($presetFieldsArray);
$tmpKeysLen = count($tmpKeys);
for ($i = 0; $i < $tmpKeysLen; $i++) :
echo "if (document.forms[0].f_mtfv_" . $category . "_" . $tmpKeys[$i] . ") {\n";
echo " document.forms[0].f_mtfv_" . $category . "_" . $tmpKeys[$i] . ".value='" . getFieldValueBySpecialCall($presetFieldsArray[$tmpKeys[$i]]) . "';\n";
echo "};\n";
endfor;
$presetFields = "";
$presetFieldsArray = "";
$objId = $remObjId;
endif;
?>
}
// This function acts according to the actions (e.g. buttons [e.g. new association regarding "co2cs"]) of the page by itself.
function presetFieldsByAction() {
var elemMtfv = eval('document.forms[0].f_mtfv_' + document.forms[0].doPresetFieldsPerAction.value);
var elemPresetFields = eval('document.forms[0].f_presetFields_' + document.forms[0].doPresetFieldsPerAction.value);
var elemPresetFt = eval('document.forms[0].f_presetFt_' + document.forms[0].doPresetFieldsPerAction.value);
var elemPresetCategory = eval('document.forms[0].f_presetCategory_' + document.forms[0].doPresetFieldsPerAction.value);
mtfAjaxRequestSync('../groupware/ajaxReqGroup.php', 'ft=' + elemPresetFt.value + '&presetFields=' + elemPresetFields.value + '&searchValue=' + elemMtfv.value + '&category=' + elemPresetCategory.value);
document.forms[0].doPresetFieldsPerAction.value = ''; // Reset value !!!
}
-->
</script>
</head>
<body class="menu_bgcol" onLoad="<?php echo $phpCurrentNavigationOnLoad ?><?php echo $javaScriptOut ?>displayStatusMessage();presetFields();check4print();sendPerMail();generatePDF();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="mc_page-header">
<?php echo $pageHeadline ?>
</div>
<?php if ($hideButtons == "") : ?>
<div>
<?php echo defineButtonType08(getLngt("Speichern"), "action_save", $jsFormularFinishPageFunc, "90", "left", "3"); ?>
<?php
if ($editMode != "0" && $editMode != "3" && $editMode != "4") :
echo defineButtonType08(getLngt("Drucken"), "action_print", "switchEditMode(0);", "90", "left", "3");
echo defineButtonType08(getLngt("PDF"), "action_pdf", "switchEditMode(4);", "90", "left", "3");
echo defineButtonType08(getLngt("Email"), "action_email", "switchEditMode(3);", "90", "left", "3");
endif;
?>
<?php echo defineButtonType08(getLngt("Zurücksetzen"), "action_reset", "clearAllFields();", "90", "left", "3"); ?>
<?php echo defineButtonType08(getLngt("Schließen"), "action_close", "window.close();", "90", "left", "3"); ?>
</div>
<?php endif; ?>
<?php if ($hideButtons != "") : ?>
<div>
<?php
if ($editMode == "1") :
echo defineButtonType08(getLngt("Speichern"), "action_save", $jsFormularFinishPageFunc, "90", "left", "3");
echo defineButtonType08(getLngt("Drucken"), "action_print", "switchEditMode(0);", "90", "left", "3");
echo defineButtonType08(getLngt("PDF"), "action_pdf", "switchEditMode(4);", "90", "left", "3");
echo defineButtonType08(getLngt("Email"), "action_email", "switchEditMode(3);", "90", "left", "3");
elseif ($editMode == "2") :
echo defineButtonType08(getLngt("Schließen"), "action_close", "window.close();", "90", "left", "3");
endif;
?>
</div>
<?php endif; ?>
<?php if (!(($editMode == "0" || $editMode == "4") && $hideButtons == "1")) : echo htmlDivLineSpacer("20px", "", "left"); endif; ?>
<div class="maincontent2 mc_elem" name="maincontent" id="maincontent">
<form name="metafield_special" action="../admin/metafield_special.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="category" value="<?php echo $category ?>">
<input type="hidden" name="objId" value="<?php echo $objId ?>">
<input type="hidden" name="cascadingObjType" value="<?php echo $cascadingObjType ?>">
<input type="hidden" name="specialPageTitle" value="<?php echo $specialPageTitle ?>">
<input type="hidden" name="editMode" value="<?php echo $editMode ?>">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<input type="hidden" name="hideButtons" value="<?php echo $hideButtons ?>">
<input type="hidden" name="doPresetFieldsPerAction" value="">
<?php if (!(($editMode == "0" || $editMode == "4") && $hideButtons == "1")) : echo htmlDivLineSpacer("10px"); endif; ?>
<div>
<?php echo $outputMetaFieldsHtmlPHP; ?>
</div>
<?php if (!(($editMode == "0" || $editMode == "4") && $hideButtons == "1")) : echo htmlDivLineSpacer("5px", "", "left"); endif; ?>
</form>
<?php if ($atLeastOneImageDoesExistInForm && $editMode == "1") : ?>
<form name="upload_file" action="../admin/metafield_special.php" enctype="multipart/form-data" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="category" value="<?php echo $category ?>">
<input type="hidden" name="objId" value="<?php echo $objId ?>">
<input type="hidden" name="cascadingObjType" value="<?php echo $cascadingObjType ?>">
<input type="hidden" name="specialPageTitle" value="<?php echo $specialPageTitle ?>">
<input type="hidden" name="editMode" value="<?php echo $editMode ?>">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<input type="hidden" name="hideButtons" value="<?php echo $hideButtons ?>">
<?php echo getLngt("Hier können Sie eine Bilddatei (Foto) zum Hochladen auswählen:") ?>&nbsp;
<input type="hidden" name="MAX_FILE_SIZE" value="300000">
<input name="f_uploadImgFile" type="file" size="50" accept="image/*">
<input type="button" value="Upload" onClick="finishPageUpload('uploadImgFile');">
</form>
<?php endif; ?>
</div>
</body>
</html>

View File

@@ -0,0 +1,395 @@
<?php
/*=======================================================================
*
* metafield_special_cron.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
$autoMode = false;
if (!isset($argv[1]) || $argv[1] == "") :
include_once ("../include/auth.inc.php");
$httpVars = array("category", "objId", "cascadingObjType", "specialPageTitle", "sendToClientInlineDisplay", "sendToClientFileDownload", "fileTargetType",
"auth", "mailToAdresses", "mailCcAdresses", "mailBccAdresses", "pdfPageSize",
"ftp_db_parameter", "ftp_server", "ftp_user_name", "ftp_user_pass", "ftp_ssl", "ftp_remotepath",
"customerId", "cscIdRoot", "cscIdActual");
getSecHttpVars("1", $httpVars);
$autoMode = false;
$isCron = false;
else :
$category = ""; $objId = ""; $cascadingObjType = ""; $specialPageTitle = ""; $mailToAdresses = ""; $mailCcAdresses = ""; $mailBccAdresses = ""; $pdfPageSize = "";
$isCron = true;
if ($argv[1] == "acapella7890") :
$autoMode = true;
$category = $argv[2];
$objId = $argv[3];
$cascadingObjType = $argv[4];
$specialPageTitle = $argv[5];
$mailToAdresses = $argv[6];
$mailCcAdresses = $argv[7];
$mailBccAdresses = $argv[8];
$pdfPageSize = $argv[9];
$ftp_db_parameter = $argv[10];
$ftp_server = $argv[11];
$ftp_user_name = $argv[12];
$ftp_user_pass = $argv[13];
$ftp_ssl = $argv[14];
$ftp_remotepath = $argv[15];
endif;
endif;
require_once ("../include/WkHtmlToPdf.php");
// Execution-Time for script
set_time_limit(120);
getLanguage(__FILE__);
// if ($specialPageTitle == "") : $specialPageTitle = $objId; endif;
mcIsSet($debug, false);
$pageTitel = getLngt($specialPageTitle);
include_once ("../include/html.inc.php");
include_once ("../include/ftp.inc.php");
include_once ("../include/email/htmlMimeMail.php");
// "$objId" and "$category" (and additional "$cascadingObjType") have to be defined HERE !!!
include_once ("../include/inc_metafield.inc.php");
getCurrentScript(__FILE__);
if (!$autoMode) :
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1"; $usrAccessArray["cs"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
if ($userTypeName == "hq") :
if (!(authCheckEmployeeRights($emp_id, "0") || authCheckEmployeeRights($emp_id, "1") || authCheckEmployeeRights($emp_id, "7") || authCheckEmployeeRights($emp_id, "14"))) :
gotoReferer("1");
endif;
elseif ($userTypeName == "cs") :
if (!(authCheckEmployeeRights($emp_id, "4"))) :
gotoReferer("1");
endif;
endif;
$hqId = $hq_id;
endif;
function generateOutputHTML ($htmlSnip, $pageTitel = "") {
$htmlOut = "";
$htmlOut .= "<html>\n";
$htmlOut .= " <head>\n";
$htmlOut .= " <title>" . $pageTitel . "</title>\n";
$htmlOut .= " </head>\n";
$htmlOut .= " <body>\n";
$htmlOut .= $htmlSnip;
$htmlOut .= " </body>\n";
$htmlOut .= "</html>\n";
return $htmlOut;
}
// Try to get headquartes. It is important send mails !!!!
if ($hqId == "" && $objId != "" && is_numeric($objId)) :
if ($cascadingObjType = "jb") :
$hqId = getFieldValueFromId("job","jb_id",$objId,"hq_id");
endif;
endif;
// Check for sending mail if requested
$sendMail = false;
$mailToAdressesArray = array();
if ($mailToAdresses != "" && $hqId != "") :
$sendMail = true;
$mailToAdressesArray = spliti(",",$mailToAdresses);
// Proprietary check regarding to the categories !!!!
if ($category = "300") :
$gdcContext = getFieldValueFromClause("genericdatacontainer", "gdc_context", "gdc_obj_type = '" . $cascadingObjType . "' AND gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = 'mobile_photos'");
if (!strpos($gdcContext, "MAIL_SENT=OK") === FALSE) :
$sendMail = false; // Mail had been sent in the past. Do not send again!
endif;
endif;
endif;
// Check for sending per (S)FTP if requested
$sendFTP = false;
if ($ftp_server != "" && $ftp_user_name != "" && $ftp_user_pass != "") :
$sendFTP = true;
if ($ftp_ssl == "") : $ftp_ssl = "0"; endif;
if ($ftp_remotepath == "") : $ftp_remotepath = ""; endif;
else :
if ($ftp_db_parameter != "") :
$ftp_server = getParameterValue("0", "FTP_SERVER_" . $ftp_db_parameter, "0");
$ftp_user_name = getParameterValue("0", "FTP_USER_" . $ftp_db_parameter, "0");
$ftp_user_pass = getParameterValue("0", "FTP_PASSWORD_" . $ftp_db_parameter, "0");
$ftp_ssl = getParameterValue("0", "FTP_SSL_" . $ftp_db_parameter, "0");
$ftp_remotepath = getParameterValue("0", "FTP_REMOTEPATH_" . $ftp_db_parameter, "0");
if ($ftp_server != "" && $ftp_user_name != "" && $ftp_user_pass != "") :
$sendFTP = true;
if ($ftp_ssl == "") : $ftp_ssl = "0"; endif;
endif;
endif;
endif;
if ($debug) :
echo "\n category :" . $category;
echo "\n objId :" . $objId;
echo "\n cascadingObjType :" . $cascadingObjType;
echo "\n specialPageTitle :" . $specialPageTitle;
echo "\n mailToAdresses :" . $mailToAdresses;
echo "\n mailCcAdresses :" . $mailCcAdresses;
echo "\n mailBccAdresses :" . $mailBccAdresses;
echo "\n pdfPageSize :" . $pdfPageSize;
echo "\n ftp_db_parameter :" . $ftp_db_parameter;
echo "\n ftp_server :" . $ftp_server;
echo "\n ftp_user_name :" . $ftp_user_name;
echo "\n ftp_user_pass :" . $ftp_user_pass;
echo "\n ftp_ssl :" . $ftp_ssl;
echo "\n ftp_remotepath :" . $ftp_remotepath . "\n\n";
endif;
// Get current template stored in metafieldcategory for output
$currTemplateId = getFieldValueFromId("metafieldcategory","mtfc_id",$category,"mtft_id");
$atLeastOneImageDoesExistInForm = false; // Init according to image file upload
// Generate output
$absoluteSystemPath = getAbsoluteSystemPath(); // Definition of absolute path, filename and extension. Has to be called here BEFORE calling function "outputMetaFieldSpecial()" !!!!
getDBData("job", $objId); // Get associative array for JOB data. Has to be called here BEFORE calling function "outputMetaFieldSpecial()" !!!!
getDBData("tour", $objId); // Get associative array for TOUR data of ALL stations. Has to be called here BEFORE calling function "outputMetaFieldSpecial()" !!!!
getDBData("tourservice", $objId);
getDBData("tourarticle", $objId);
// print_r($jobData); die();
$editMode = 3; // Prepare for HTML email to convert e.g. to PDF
$outputMetaFieldsHtml = outputMetaFieldSpecial($currTemplateId, $editMode, $absoluteSystemPath);
$outputMetaFieldsHtmlPHP = $outputMetaFieldsHtml[0];
$outputMetaFieldsHtmlJS = $outputMetaFieldsHtml[1];
// Parse template
$jsFormularFinishPageFunc = "finishPage();";
if ($currTemplateId != "" && $currTemplateId != "0") :
$contentOfCurrTemplate = getFieldValueFromId("metafieldtemplate","mtft_id",$currTemplateId,"mtft_content");
if (!(strpos($contentOfCurrTemplate, "formularFinishPage") === FALSE)) :
$jsFormularFinishPageFunc = "formularFinishPage();";
endif;
endif;
// Check configuration for output
if (isset($sendToClientInlineDisplay) && $sendToClientInlineDisplay == "1") : $sendToClientInlineDisplay = true; else : $sendToClientInlineDisplay = false; endif;
if (isset($sendToClientFileDownload) && $sendToClientFileDownload == "1") : $sendToClientFileDownload = true; else : $sendToClientFileDownload = false; endif;
if (!isset($fileTargetType) || $fileTargetType == "") : $fileTargetType = "pdf"; endif;
// ******************************************************************************************************************
// Generate filename
// $f_secretFileName = "news_" . md5($objId);
$f_secretFileName = md5($category) . "_" . $objId;
// Source filename
$fileExtensionSource = "html";
$fileName = "../temp/download/" . $f_secretFileName . "." . $fileExtensionSource;
$fileNameConversion = "/temp/download/" . $f_secretFileName;
// Target filename
$fileExtensionTarget = $fileTargetType;
$fileNameTarget = "../temp/download/" . $f_secretFileName . "." . $fileExtensionTarget;
// Generate HTML WITH ABSOLUTE path for creating PDF, etc.
$htmlOut = generateOutputHTML($outputMetaFieldsHtmlPHP);
// $htmlOut = urlencode(my_str_check_http($htmlOut));
// $htmlOut = str_replace("/var/www/html/images/", "../images/", $htmlOut);
// $htmlOut = str_replace("../", "EMC2/", $htmlOut);
// echo $htmlOut; die();
// Remove old file(s)
foreach (glob($fileName) as $fileNameToBoRemoved) {
if (file_exists($fileNameToBoRemoved)) :
unlink($fileNameToBoRemoved);
endif;
}
// Write new file according to the current employee
// writeToFile($fileName, $htmlOut); // Write attachement data into file
// **** Convert HTML file ****
// Call script e.g.: https://212.79.60.73/htm/admin/metafield_special_cron.php?category=302&objId=150017&cascadingObjType=jb&sendToClientFileDownload=1&pdfPageSize=label60x40
$pdfGlobalOptions = array();
$pdfPageOptions = array();
if ($pdfPageSize != "") :
if ($pdfPageSize == "label60x40") :
$pdfGlobalOptions = array('page-height' => '40mm', 'page-width' => '60mm', 'margin-bottom' => '1mm', 'margin-left' => '3mm', 'margin-right' => '1mm', 'margin-top' => '1mm');
$pdfPageOptions = array('disable-smart-shrinking');
else :
$pdfGlobalOptions = array('page-size' => $pdfPageSize);
endif;
endif;
if ($pdfGlobalOptions == "" || !is_array($pdfGlobalOptions)) :
$pdf = new WkHtmlToPdf;
else :
// $pdfGlobalOptions['enable-local-file-access'] = true;
$pdf = new WkHtmlToPdf($pdfGlobalOptions);
endif;
$pdf->addPage($htmlOut, $pdfPageOptions); // Add a HTML file, a HTML string or a page from a URL ["$pdf->addPage($fileName);" OR "$pdf->addPage('http://assecutor.de');" possible]
// $pdf->addCover('mycover.html'); // Add a cover (same sources as above are possible)
// $pdf->addToc(); // Add a Table of contents
// Save the PDF
if (!$pdf->saveAs($fileNameTarget)) :
throw new Exception('Could not create PDF: '.$pdf->getError());
endif;
// Send to client for inline display
if ($sendToClientInlineDisplay == "1") :
$pdf->send();
endif;
// Send to client for file download
if ($sendToClientFileDownload == "1") :
// echo "fileNameTarget = " . $fileNameTarget . "<br>";
$pdf->send($fileNameTarget);
endif;
// Send mail if requested per setting at least one "mail to" address
if ($sendMail) :
// Generate HTML WITH RELATIVE path for creating mail
$outputMetaFieldsHtml = outputMetaFieldSpecial($currTemplateId, $editMode);
$outputMetaFieldsHtmlPHP = $outputMetaFieldsHtml[0];
$htmlOut = generateOutputHTML($outputMetaFieldsHtmlPHP);
// Get current timestamp
$currentTime = getDateTime("0");
// Define constants
$constMailSenderAddress = getParameterValue("0", "MAIL_SENDER_ADDRESS", $hqId);
if ($category == "300") :
$logFile = getParameterValue("0", "AUTOMAILER_ACCEPTANCE_PROTOCOL_LOGFILE", $hqId);
if ($logFile == "") : $logFile = getParameterValue("0", "AUTOMAILER_ACCEPTANCE_PROTOCOL_LOGFILE", "0"); endif;
endif;
// Take default log for mails triggered by CRON independent from the type
if ($logFile == "") : $logFile = getParameterValue("0", "AUTOMAILER_CRON_LOGFILE", $hqId); endif;
if ($logFile == "") : $logFile = getParameterValue("0", "AUTOMAILER_CRON_LOGFILE", "0"); endif;
if ($logFile == "") : $logFile = "../log/automailer_cron.log"; endif;
// Send mail to admin@assecutor.de
$mailObj = new htmlMimeMail();
$mailObj->setFrom($constMailSenderAddress);
if ($mailCcAdresses != "") :
$mailObj->setCc($mailCcAdresses);
endif;
if ($mailBccAdresses != "") :
$mailObj->setBcc($mailBccAdresses);
endif;
$mailObj->setSubject($pageTitel . " (" . $objId . ")");
// HTML
$mailObj->setHtml($htmlOut, null, "./");
// Attachment
if ($fileTargetType == "pdf" && file_exists($fileNameTarget)) :
$attachment = $mailObj->getFile($fileNameTarget);
$mailObj->addAttachment($attachment, $pageTitel . "_" . $objId . "." . $fileExtensionTarget, 'application/pdf');
endif;
$writeToLogfile = true;
$mailResult = $mailObj->send($mailToAdressesArray, 'smtp');
if ($mailResult) :
if ($category == "300") :
// Special case for service acceptance protocol
$res = updateStmt("genericdatacontainer","gdc_obj_type","jb",array("gdc_context", "MAIL_SENT=OK"),"gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = 'mail_srv_acc_prot' AND gdc_context LIKE '%SEND_IN_PROGRESS%'");
// Write logdata into log file
writeToFile($logFile, "[" . $pageTitel . "] [Status: OK] [Time: " . $currentTime . "] [Job: " . $objId . "] [From: " . $constMailSenderAddress . "] [To: " . $mailToAdresses . "] [Cc: " . $mailCcAdresses . "] [Bcc: " . $mailBccAdresses . "]");
$writeToLogfile = false;
elseif ($category == "9999") :
// ....
endif;
// Write logdata into log file if not have been done before
if ($writeToLogfile) :
writeToFile($logFile, "[" . $pageTitel . "] [Status: OK] [Time: " . $currentTime . "] [Object: " . $objId . "] [Type: " . $cascadingObjType . "] [To: " . $mailToAdresses . "] [Cc: " . $mailCcAdresses . "] [Bcc: " . $mailBccAdresses . "]");
endif;
else :
if ($category == "300") :
// Special case for service acceptance protocol
// IN CASE OF SENDING MAIL FAILED, DO NOT UPDATE ANYTHING, BECAUSE THE NEXT CRON WILL CATCH IT AGAIN!!!!
// updateStmt("genericdatacontainer","gdc_obj_type","jb",array("gdc_context", "MAIL_SENT=NOT_OK"),"gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = 'mobile_photos'");
// Unlock semaphore if necessary (e.g. mail has not been sent)
$res = updateStmt("genericdatacontainer", "gdc_obj_id", $objId, array("gdc_context", "MAIL_SENT=NOT_OK"), "gdc_obj_type = 'jb' AND gdc_gen_fieldname = 'mail_srv_acc_prot' AND gdc_context LIKE '%SEND_IN_PROGRESS%'");
elseif ($category == "9999") :
// ....
endif;
endif;
$mailObj = NULL;
// Remove stored temporary sign images on the filesystem
/*
$tmpSignPath = "../temp/signs/";
$imgFilenamesLen = count($imgFilenames);
if (SIGNS_PATH != "") : $tmpSignPath = SIGNS_PATH; endif;
for ($im = 0; $im < $imgFilenamesLen; $im++) :
if (file_exists($tmpSignPath . $imgFilenames[$im])) :
unlink($tmpSignPath . $imgFilenames[$im]);
endif;
endfor;
*/
endif;
// Take PDF and put to the remote FTP environment
if ($sendFTP) :
$opArray = ftpUpload($f_secretFileName . "." . $fileExtensionTarget, $f_secretFileName . "." . $fileExtensionTarget, $ftp_server, $ftp_user_name, $ftp_user_pass, "../temp/download/", $ftp_remotepath, $ftp_ssl);
if ($opArray[0] == "0") :
if ($category == "300") :
// Special case for service acceptance protocol
$res = updateStmt("genericdatacontainer","gdc_obj_type","jb",array("gdc_context", "LETTER_SENT=OK"),"gdc_obj_id = '" . $objId . "' AND gdc_gen_fieldname = 'letter_srv_acc_prot' AND gdc_context LIKE '%SEND_IN_PROGRESS%'");
// Write logdata into log file
writeToFile($logFile, "[" . $pageTitel . "] [Status: OK] [Time: " . $currentTime . "] [Job: " . $objId . "]");
$writeToLogfile = false;
elseif ($category == "9999") :
// ....
endif;
// Write logdata into log file if not have been done before
if ($writeToLogfile) :
writeToFile($logFile, "[" . $pageTitel . "] [Status: OK] [Time: " . $currentTime . "] [Object: " . $objId . "] [Type: " . $cascadingObjType . "]");
endif;
else :
if ($category == "300") :
// Unlock semaphore if necessary (e.g. mail has not been sent)
$res = updateStmt("genericdatacontainer", "gdc_obj_id", $objId, array("gdc_context", "LETTER_SENT=NOT_OK"), "gdc_obj_type = 'jb' AND gdc_gen_fieldname = 'letter_srv_acc_prot' AND gdc_context LIKE '%SEND_IN_PROGRESS%'");
elseif ($category == "9999") :
// ....
endif;
endif;
if ($ftp_ssl == "2") :
sftpQuitConnection($connId);
else :
ftpQuitConnection($connId);
endif;
endif;
echo $htmlOut;
?>

View File

@@ -0,0 +1,118 @@
<?php
/*=======================================================================
*
* metafield_template.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
$httpVars = array("f_act", "statusMessage", "deactivateMenu", "mtft_id", "mtft_content");
getSecHttpVars("1", $httpVars);
getLanguage(__FILE__);
$mtft_name = getFieldValueFromId("metafieldtemplate","mtft_id",$mtft_id,"mtft_name");
$pageTitel = getLngt("VORLAGE") . ": " . $mtft_name;
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
authCheckEmployeeRights($emp_id, "0", "1");
if ($f_act == "mtft_save") :
if ($mtft_id != "" && is_numeric($mtft_id)) :
// Convert content according to html specification
$mtft_content = my_str_check_http($mtft_content);
updateStmt("metafieldtemplate","mtft_id",$mtft_id,array("mtft_content", $mtft_content));
$statusMessage = "Die Vorlage wurde gespeichert!";
else :
$statusMessage = "Die Vorlage konnte nicht gespeichert werden!";
endif;
endif;
// Get content of the current template ID
$mtft_content = getFieldValueFromId("metafieldtemplate","mtft_id",$mtft_id,"mtft_content");
$mtft_content = htmlspecialchars($mtft_content);
?>
<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 finishPage2(f_act) {
document.forms[0].f_act.value = f_act;
document.forms[0].submit();
};
-->
</script>
</head>
<body class="menu_bgcol" onLoad="<?php echo $phpCurrentNavigationOnLoad ?>displayStatusMessage();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="maincontent2" name="maincontent" id="maincontent">
<form name="metafield_controller" action="../admin/metafield_template.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="mtft_id" value="<?php echo ec($mtft_id) ?>">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<center>
<?php echo htmlDivLineSpacer("10px"); ?>
<textarea name="mtft_content" cols="170" rows="50"><?php echo $mtft_content ?></textarea>
<?php echo htmlDivLineSpacer("10px"); ?>
<?php echo defineButtonType08("Speichern", "action_store", "finishPage2('mtft_save');", "100", ""); ?>
<?php echo htmlDivLineSpacer("5px"); ?>
</center>
</form>
</div>
</body>
</html>

761
html/admin/mf_history.php Normal file
View File

@@ -0,0 +1,761 @@
<?php
/*=======================================================================
*
* mf_history.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act", "customerId", "cscIdRoot", "cscIdActual", "op",
"day_from", "month_from", "year_from", "day_to", "month_to", "year_to",
"f_mf_id", "f_prio", "f_state", "f_usr_type", "statusMessage",
"f_usr_sender", "f_usr_receiver", "f_filter", "f_msggrp",
"f_subject_group", "f_body_group", "f_cr_sid_msg", "f_reload"));
getLanguage(__FILE__);
$pageTitel = getLngt("NACHRICHTEN");
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
getCurrentScript(__FILE__);
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
authCheckEmployeeRights($emp_id, "4", "1");
// Filters
$whereClauseState = "";
$checkedStateArray = array();
// If NO checkbox is activated NO entry will be shown => Switch automatically to "SHOW ALL"
if ($f_state == "") :
$f_state = "1";
for ($i = 0; $i <= $f_state; $i++) :
$checkedStateArray[$i] = "checked";
endfor;
$whereClauseState .= " AND mf.mf_state <= '" . $f_state . "' ";
else :
$stateFieldLength = count($f_state);
if ($stateFieldLength > 0) :
for ($i = 0; $i < $stateFieldLength; $i++) :
$whereClauseState .= " mf.mf_state = '" . $f_state[$i] . "' ";
if ($i < ($stateFieldLength - 1)) : $whereClauseState .= " OR "; endif;
$checkedStateArray[$f_state[$i]] = "checked";
endfor;
$whereClauseState = "AND (" . $whereClauseState . ")";
endif;
endif;
$whereClauseFilter = "";
if (!isset($f_filter) || $f_filter == "") : $f_filter = array(); endif;
$checkedFilterArray = array();
$filterFieldLength = count($f_filter);
if ($filterFieldLength > 0) :
// 1. Filter
$j = array_search("0", $f_filter);
if (!($j === FALSE)) :
$checkedFilterArray[0] = "checked";
$whereClauseFilter .= " AND mf.mf_type <> '1' ";
endif;
// 1. Filter
$j = array_search("1", $f_filter);
if (!($j === FALSE)) :
$checkedFilterArray[1] = "checked";
$whereClauseFilter .= " AND mf.mf_type = '1' ";
endif;
// ... More filters ...
// $checkedFilterArray[2] = "";
// ...
else :
// First call of the page, no reload
if ($f_reload == "") :
$checkedFilterArray[0] = "checked";
$whereClauseFilter .= " AND mf.mf_type <> '1' ";
$checkedFilterArray[1] = "";
endif;
endif;
if ($f_prio == "") : $f_prio = "3"; endif; // All msgs with this prio and higher (<= $f_prio)
if ($f_usr_type == "") : $f_usr_type = "0"; endif; // "0" = All msgs., ">0" = All msgs only with this user type (== $f_usr_type)
// Get the number of message groups according to the current mandator
$numOfMsgGroups = getCountOfTable("messagegroup", "hq_id = '" . $hq_id . "'");
// Get the current time
$currentTime = getDateTime("0");
// Initialisations
$limitOfRowsDisplayed = "1000"; // For limitation of the rows displayed
$f_subject_group = trim($f_subject_group);
$f_subject_group = str_replace("'", "", $f_subject_group);
$f_body_group = trim($f_body_group);
$f_body_group = str_replace("'", "", $f_body_group);
// Maximum of chars to be inserted into a message
$maxMsgLength = getParameterValue("0", "MESSAGE_MAX_BODY_LENGTH", $hq_id);
if ($maxMsgLength == "" || $maxMsgLength == "0") :
$maxMsgLength = 250;
endif;
$f_body_group = substr($f_body_group,0,$maxMsgLength);
// Get the array for formatting the database-values for the output according to the defined type
$outputFormatField = defineOutputFormats();
// Check range of date. All fields have to be set
if ($day_from == "" || $month_from == "" || $year_from == "" ||
$day_to == "" || $month_to == "" || $year_to == "") :
// Initialize date-ranges to the current date
$fromDateRange = getDateTime("1") . "000000";
$toDateRange = getDateTime("1") . "235959";
$day_from = getDateTime("day");
$month_from = getDateTime("month");
$year_from = getDateTime("year");
$day_to = getDateTime("day");
$month_to = getDateTime("month");
$year_to = getDateTime("year");
else :
$fromDateRange = $year_from . pad($month_from,2) . pad($day_from,2) . "000000";
$toDateRange = $year_to . pad($month_to,2) . pad($day_to,2) . "235959";
endif;
function postParseHistory ($textToParse) {
$textToParse = trim($textToParse);
if ($textToParse != "") :
// Iterate ALL occurrences of "<postparser>...</postparser>"
while (!(strpos($textToParse, "<postparser>") === FALSE)) {
$beginTagPosBegin = strpos($textToParse, "<postparser>");
$beginTagPosEnd = $beginTagPosBegin + 12;
$endTagPosBegin = strpos($textToParse, "</postparser>");
$endTagPosEnd = $endTagPosBegin + 13;
if ($beginTagPosEnd < $endTagPosBegin) :
$tagContent = substr($textToParse, $beginTagPosEnd, $endTagPosBegin - $beginTagPosEnd);
// $tagContent contains 0. "mf_id", 1. "mf_usr_type", 2. "mf_state", 3. "usr_id_sender" , 4. "mf_pre_id" , 5. "usr_id_first_reader" , 6. "usr_id_answerer"
$tmp = spliti(",",$tagContent);
$tagContent = "";
// If message is read
if ($tmp[2] >= "2") :
$usrNameFirstReader = "";
if ($tmp[5] != "" && $tmp[5] > 0) :
$usrNameFirstReader = "&nbsp;[" . getFieldValueFromId("phoenix.user", "usr_id", $tmp[5], "usr_firstname") . "&nbsp;" . getFieldValueFromId("phoenix.user", "usr_id", $tmp[5], "usr_name") . "]";
endif;
$tagContent .= "- " . getLngt("Nachricht gelesen") . $usrNameFirstReader;
endif;
// If sender is courier ...
if ($tmp[1] == "3") :
// If message is read
if ($tmp[2] < "2") :
$tagContent .= "<input type=\"button\" value=\"" . getLngt("Gelesen") . "\" onClick=\"javascript:finishPage('read','" . $tmp[0] . "','');\">\n";
endif;
// If message not is answered yet
if ($tmp[2] < "3") :
$tagContent .= "<br>";
$tagContent .= "<input type=\"button\" value=\"" . getLngt("Antworten") . "\" onClick=\"javascript:finishPage('answered','" . $tmp[0] . "','" . $tmp[3] . "');\"><br>\n";
$tagContent .= "Betreff: <input type=\"text\" name=\"f_subject_" . $tmp[0] . "\" value=\"\" size=\"40\" maxlength=\"40\"><br>\n";
$tagContent .= getLngt("Text:") . " &nbsp;&nbsp;&nbsp;&nbsp;<input type=\"text\" name=\"f_body_" . $tmp[0] . "\" value=\"\" size=\"40\" maxlength=\"100\">\n";
else :
$usrNameAnswerer = "";
if ($tmp[6] != "" && $tmp[6] > 0) :
$usrNameAnswerer = "&nbsp;[" . getFieldValueFromId("phoenix.user", "usr_id", $tmp[6], "usr_firstname") . "&nbsp;" . getFieldValueFromId("phoenix.user", "usr_id", $tmp[6], "usr_name") . "]";
endif;
$tagContent .= "<br>";
$tagContent .= "- " . getLngt("Nachricht beantwortet") . $usrNameAnswerer;
endif;
endif;
// Show number of original request message
if ($tmp[4] > "0") :
$tagContent .= "- " . getLngt("Anfragenachricht") . " " . $tmp[4] . "<br>";
endif;
// Substitute text fragment
$textToParse = substr_replace($textToParse, $tagContent, $beginTagPosBegin, $endTagPosEnd - $beginTagPosBegin);
endif;
}
endif;
return $textToParse;
}
// Message was read by the employee
if ($f_act == "read") :
if ($f_mf_id != "" && $f_mf_id != "0") :
$mfState = getFieldValueFromId("phoenix_log.messageforum", "mf_id", $f_mf_id, "mf_state");
// Message was not read or answered => Change "mf_state"
if ($mfState < "2") :
$res = updateStmt("phoenix_log.messageforum", "mf_id", $f_mf_id, array("mf_state", "2", "mf_acknowledge", $currentTime), "mf_state < '2'");
if ($db->affected_rows == 1) :
// Write first reader of the message
$res = updateStmt("phoenix_log.messageforum", "mf_id", $f_mf_id, array("usr_id_first_reader", $usr_id));
else :
$statusMessage = getLngt("Nachricht wurde gerade als gelesen markiert! Bitte die Seite nochmal neu laden!");
endif;
else :
$statusMessage = getLngt("Nachricht wurde gerade als gelesen markiert! Bitte die Seite nochmal neu laden!");
endif;
else :
$statusMessage = getLngt("Intergritätsfehler! Die Nachricht konnte nicht referenziert werden!");
endif;
endif;
// Message was answered by the employee
if ($f_act == "answered") :
if ($f_mf_id != "" && $f_mf_id != "0") :
list($f_subject, $f_body) = getSecHttpVars("1",array("f_subject_" . $f_mf_id, "f_body_" . $f_mf_id));
$f_subject = str_replace("'", "", $f_subject);
$f_body = str_replace("'", "", $f_body);
$mfState = getFieldValueFromId("phoenix_log.messageforum", "mf_id", $f_mf_id, "mf_state");
// Message was not answered => Change "mf_state"
if ($mfState < "3") :
// Change original message
$res = updateStmt("phoenix_log.messageforum", "mf_id", $f_mf_id, array("mf_state", "3", "usr_id_answerer", $f_usr_sender, "mf_acknowledge", $currentTime), "mf_state < '3'");
if ($db->affected_rows == 1) :
// Generate new message (the answer)
insertStmt("phoenix_log.messageforum", array("mf_createtime", $currentTime, "usr_id_sender", $f_usr_sender, "hq_id", $hq_id, "usr_id_receiver", $f_usr_receiver,
"mf_usr_type", "1", "mf_subject", $f_subject, "mf_body", $f_body, "mf_pre_id", $f_mf_id));
else :
$statusMessage = getLngt("Nachricht wurde gerade als beantwortet markiert! Bitte die Seite nochmal neu laden!");
endif;
else :
$statusMessage = getLngt("Nachricht wurde gerade als beantwortet markiert! Bitte die Seite nochmal neu laden!");
endif;
else :
$statusMessage = getLngt("Intergritätsfehler! Die Nachricht konnte nicht referenziert werden!");
endif;
endif;
// Message to couriers belonging to one or more groups
if ($f_act == "sendmsg") :
if ($f_body_group != "") :
// Identify couriers belonging to at least one group
$whereClauseMsggrp = "";
if ($f_cr_sid_msg == "") :
$msggrpFieldLength = count($f_msggrp);
if ($f_msggrp != "" && $msggrpFieldLength > 0) :
for ($i = 0; $i < $msggrpFieldLength; $i++) :
$whereClauseMsggrp .= " cr.cr_msggrp LIKE '%," . $f_msggrp[$i] . ",%' ";
if ($i < ($msggrpFieldLength - 1)) : $whereClauseMsggrp .= " OR "; endif;
endfor;
$whereClauseMsggrp = "AND (" . $whereClauseMsggrp . ")";
$tmpSqlquery = "SELECT DISTINCT cr.usr_id"
. " FROM courier AS cr, company AS cmp"
. " WHERE cr.hq_id = '" . $hq_id . "' AND cmp.cmp_id = cr.cmp_id AND cmp.cmp_archived = '0' AND cmp.cmp_authenticated = '1' "
. $whereClauseMsggrp
. " ORDER BY cr.cr_id";
$result = $db->query($tmpSqlquery);
if (DB::isError($result)) die ("$PHP_SELF 5: {$tmpSqlquery} " . $result->getMessage() . ": " . $tmpSqlquery);
while ($row = $result->fetch_assoc()):
insertStmt("phoenix_log.messageforum", array("mf_type", "1", "mf_createtime", $currentTime, "usr_id_sender", $f_usr_sender,
"hq_id", $hq_id, "usr_id_receiver", $row["usr_id"], "mf_usr_type", "1",
"mf_subject", $f_subject_group, "mf_body", $f_body_group, "mf_pre_id", "0"));
endwhile;
$result->free();
// Initialisieren
$f_subject_group = "";
$f_body_group = "";
$statusMessage = getLngt("Die Nachricht wurde verschickt!");
else :
$statusMessage = getLngt("Bitte selektieren Sie mindestens eine Nachrichtengruppe oder einen speziellen Transporteur!");
endif;
else :
$tmpUsrId = getFieldValueFromId("courier", "cr_sid", $f_cr_sid_msg, "usr_id");
insertStmt("phoenix_log.messageforum", array("mf_type", "0", "mf_createtime", $currentTime, "usr_id_sender", $f_usr_sender,
"hq_id", $hq_id, "usr_id_receiver", $tmpUsrId, "mf_usr_type", "1",
"mf_subject", $f_subject_group, "mf_body", $f_body_group, "mf_pre_id", "0"));
$statusMessage = getLngt("Die Nachricht wurde an") . " " . $f_cr_sid_msg . " " . getLngt("verschickt!");
// Initialisieren
$f_subject_group = "";
$f_body_group = "";
endif;
else :
$statusMessage = getLngt("Bitte tragen Sie etwas in das Nachrichtenfeld ein!");
endif;
endif;
// Message to all active couriers of all headquarters
if ($f_act == "sendAllActive") :
if ($f_body_group != "") :
// Get all active couriers
$constAmStarttimeInDays = getParameterValue("0", "MESSAGE_MIN_DAYS_BEFORE", "0");
if ($constAmStarttimeInDays == "" || !is_numeric($constAmStarttimeInDays)) : $constAmStarttimeInDays = 7; endif;
$minAvailableTime = getDateTime("datetime_plus_offset", array(0,0,0,0,-($constAmStarttimeInDays),0), "Y-m-d H:i:s");
$tmpSqlquery = "SELECT DISTINCT cr.usr_id"
. " FROM courier AS cr, company AS cmp"
. " WHERE cr.cr_availabletime > '" . $minAvailableTime . "' AND cmp.cmp_id = cr.cmp_id AND cmp.cmp_archived = '0' AND cmp.cmp_authenticated = '1'"
. " ORDER BY cr.cr_id";
$result = $db->query($tmpSqlquery);
if (DB::isError($result)) die ("$PHP_SELF 5: {$tmpSqlquery} " . $result->getMessage() . ": " . $tmpSqlquery);
while ($row = $result->fetch_assoc()):
insertStmt("phoenix_log.messageforum", array("mf_type", "1", "mf_createtime", $currentTime, "usr_id_sender", $f_usr_sender,
"hq_id", $hq_id, "usr_id_receiver", $row["usr_id"], "mf_usr_type", "1",
"mf_subject", $f_subject_group, "mf_body", $f_body_group, "mf_pre_id", "0"));
endwhile;
$result->free();
// Initialisieren
$f_subject_group = "";
$f_body_group = "";
$statusMessage = getLngt("Die Nachricht wurde verschickt!");
else :
$statusMessage = getLngt("Bitte tragen Sie etwas in das Nachrichtenfeld ein!");
endif;
endif;
// --- MESSAGE HISTORY ------------------
// From table "messageforum"
$fieldClause = "mf.mf_id, mf.mf_createtime, mf.mf_expiration, mf.mf_delivery,mf.mf_acknowledge," .
"mf.usr_id_sender, mf.usr_id_receiver, mf.usr_id_first_reader, mf.usr_id_answerer," .
"mf.mf_usr_type, mf.mf_state, mf.mf_prio, mf.mf_subject, mf.mf_body, mf.mf_pre_id," .
"CONCAT(usr_s.usr_firstname,'<br>',usr_s.usr_name,'<br>',cr_s.cr_sid,'<br>',cr_s.cr_mobile_pda,'<br>',usr_s.usr_phone,'<br>',usr_s.usr_phone2) AS usr_from," .
"CONCAT(usr_r.usr_firstname,'<br>',usr_r.usr_name,'<br>',cr_r.cr_sid,'<br>',cr_r.cr_mobile_pda,'<br>',usr_r.usr_phone,'<br>',usr_r.usr_phone2) AS usr_to," .
"CONCAT(mf.mf_id,',',mf.mf_usr_type,',',mf.mf_state,',',mf.usr_id_sender,',',mf.mf_pre_id,',',mf.usr_id_first_reader,',',mf.usr_id_answerer) AS mf_special";
$fromClause = "phoenix_log.messageforum AS mf " .
"LEFT JOIN phoenix.user AS usr_s ON mf.usr_id_sender = usr_s.usr_id " .
"LEFT JOIN phoenix.courier AS cr_s ON usr_s.usr_id = cr_s.usr_id " .
"LEFT JOIN phoenix.user AS usr_r ON mf.usr_id_receiver = usr_r.usr_id " .
"LEFT JOIN phoenix.courier AS cr_r ON usr_r.usr_id = cr_r.usr_id ";
$whereClause = "mf.hq_id = '" . $hq_id . "' AND ";
$whereClause .= "mf.mf_createtime >= '$fromDateRange' AND mf.mf_createtime <= '$toDateRange' AND ";
$whereClause .= "mf.mf_prio <= '" . $f_prio . "' " . $whereClauseState;
$whereClause .= $whereClauseFilter;
if ($f_usr_type != "0") :
$whereClause .= " AND mf.mf_user_type = '" . $f_usr_type . "'";
endif;
$orderByClause = "mf.mf_createtime DESC LIMIT 0," . $limitOfRowsDisplayed;
$sqlquery = generateStatement($fieldClause,$fromClause,$whereClause,$orderByClause);
// echo $sqlquery . "<br>";
// Send request to database
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
// Generate list with header
$titleArray = array(getLngt("Lfd")."&nbsp;&nbsp;",getLngt("Zeitpunkt")."&nbsp;&nbsp;",getLngt("Sender")."&nbsp;&nbsp;",getLngt("Empfänger")."&nbsp;&nbsp;",getLngt("Betreff")."&nbsp;&nbsp;",getLngt("Text")."&nbsp;&nbsp;",getLngt("Aktion"));
$fieldArray = array("mf_id","mf_createtime","usr_from","usr_to","mf_subject","mf_body","mf_special");
$aligns = "r,c,l,l,l,l,l,l";
$alignArray = spliti(",",$aligns);
$alignTitles = "center";
$widths = "30,80,100,100,100,200,350";
$widthArray = spliti(",",$widths);
$summationField = "";
$postParserField = "mf_special";
$mode = "1"; // Output from DB-RESULT
$sortDBField = ""; // Used in following include-file for sorting per column;
include ("../include/inc_list_defineoutput.inc.php");
$result->free();
// Message groups and mailing
$outMsgGroups = addCheckboxesFromTable ("f_msggrp", "messagegroup", "msggrp_id", "msggrp_name", "msggrp_id", "hq_id =" . $hq_id, "", "<br><br>");
// Special courier
$outCouriers = "<select name=\"f_cr_sid_msg\" onChange=\"msgToSpecialCourier();\">\n";
$outCouriers .= "<option value=\"\" selected>&nbsp;</option>\n";
$outCouriers .= "<option value=\"\"><b>" . getLngt("ONLINE:") . "</b></option>\n";
$outCouriers .= addOptionsFromTable("courier", "cr_sid", "cr_sid", "cr_sid", "cr_available = '1' AND hq_id = '" . $hq_id . "'", "");
$outCouriers .= "<option value=\"\">&nbsp;</option>\n";
$outCouriers .= "<option value=\"\"><b>" . getLngt("OFFLINE:") . "</b></option>\n";
$outCouriers .= addOptionsFromTable("courier", "cr_sid", "cr_sid", "cr_sid", "cr_available != '1' AND cr_sid != '' AND (NOT isnull(cr_availabletime)) AND cr_availabletime > '" . getDateTime("datetime_plus_offset", array(0,0,0,-1,0,0), $formatStr = "Y-m-d H:i:s") . "' AND hq_id = '" . $hq_id . "'", "");
$outCouriers .= "</select>\n";
// *** ONLY OUTPUT ***
// Post parsing if necessary
if ($postParserField != "") :
$tableBody = postParseHistory($tableBody);
endif;
// Define output table
$historyentry = $tableHeader . $tableBody;
$currentFrameName = ""; // Empty string for "main frame"
// Date-ranges
$filter_dateranges = getLngt("Von:") . "\n";
$filter_dateranges .= "<select name=\"day_from\" class=\"f8np1\" onchange=\"fillDateFields(0, '" . $currentFrameName . "', 'mf_history', 'day_from', 'day_from', 'month_from', 'year_from', '', '', '')\"></select>\n";
$filter_dateranges .= "<select name=\"month_from\" class=\"f8np1\" onchange=\"fillDateFields(0, '" . $currentFrameName . "', 'mf_history', 'month_from', 'day_from', 'month_from', 'year_from', '', '', '')\"></select>\n";
$filter_dateranges .= "<select name=\"year_from\" class=\"f8np1\" onchange=\"fillDateFields(0, '" . $currentFrameName . "', 'mf_history', 'year_from', 'day_from', 'month_from', 'year_from', '', '', '')\"></select>\n";
$filter_dateranges .= "</td><td>&nbsp;&nbsp;" . getLngt("bis:") . "\n";
$filter_dateranges .= "<select name=\"day_to\" class=\"f8np1\" onchange=\"fillDateFields(0, '" . $currentFrameName . "', 'mf_history', 'day_to', 'day_to', 'month_to', 'year_to', '', '', '')\"></select>\n";
$filter_dateranges .= "<select name=\"month_to\" class=\"f8np1\" onchange=\"fillDateFields(0, '" . $currentFrameName . "', 'mf_history', 'month_to', 'day_to', 'month_to', 'year_to', '', '', '')\"></select>\n";
$filter_dateranges .= "<select name=\"year_to\" class=\"f8np1\" onchange=\"fillDateFields(0, '" . $currentFrameName . "', 'mf_history', 'year_to', 'day_to', 'month_to', 'year_to', '', '', '')\"></select>\n";
// Javascript-function as template only for
$js_date = "<script type=\"text/javascript\">\n";
$js_date .= "<!--\n";
$js_date .= "function initForm() {\n";
$js_date .= " fillDateFields(1,\"" . $currentFrameName . "\",\"mf_history\",\"\",\"day_from\",\"month_from\",\"year_from\",\"\",\"\",\"\");\n";
$js_date .= " setDateTimeFields(\"" . $currentFrameName . "\",\"mf_history\",".$day_from.",".$month_from.",".$year_from.", \"\", \"\", \"day_from\", \"month_from\", \"year_from\", \"\", \"\", \"\");\n";
$js_date .= " fillDateFields(1,\"" . $currentFrameName . "\",\"mf_history\", \"\", \"day_to\", \"month_to\", \"year_to\", \"\", \"\", \"\");\n";
$js_date .= " setDateTimeFields(\"" . $currentFrameName . "\",\"mf_history\",".$day_to.",".$month_to.",".$year_to.", \"\", \"\", \"day_to\", \"month_to\", \"year_to\", \"\", \"\", \"\");\n";
$js_date .= "}\n";
$js_date .= "-->\n";
$js_date .= "</script>\n";
?>
<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/lib_global.js" type="text/javascript"></script>
<?php echo $js_date ?>
<script type="text/javascript">
// NAVIGATION
<?php echo $jsMenuOut; ?>
var numOfMsgGroups = "<?php echo $numOfMsgGroups ?>";
function finishPage(f_act, mf_id, usr_id_receiver) {
var doSubmit = true;
document.forms[0].f_act.value = f_act;
document.forms[0].f_mf_id.value = mf_id;
document.forms[0].f_usr_receiver.value = usr_id_receiver;
if (f_act == 'answered') {
var f_Subject = eval('document.forms[0].f_subject_' + mf_id);
var f_Body = eval('document.forms[0].f_body_' + mf_id);
if (f_Body.value == '') {
doSubmit = false;
alert('<?php echo getLngt("Bitte tragen Sie etwas in das Nachrichtenfeld ein!") ?>');
}
}
if (doSubmit == true) {
document.forms[0].submit();
}
};
function finishPage2() {
var doSubmit = true;
document.forms[0].f_act.value = 'sendmsg';
var f_Subject = document.forms[0].f_subject_group.value;
f_Subject = f_Subject.replaceAll("'", "");
var f_Body = document.forms[0].f_body_group.value;
f_Body = f_Body.replaceAll("'", "");
if (f_Body == '') {
doSubmit = false;
alert('<?php echo getLngt("Bitte tragen Sie etwas in das Nachrichtenfeld ein!") ?>');
}
if (doSubmit == true) {
document.forms[0].f_subject_group.value = f_Subject;
document.forms[0].f_body_group.value = f_Body;
document.forms[0].submit();
}
};
function finishPageAllActive() {
var doSubmit = true;
var f_Subject = document.forms[0].f_subject_group.value;
f_Subject = f_Subject.replaceAll("'", "");
var f_Body = document.forms[0].f_body_group.value;
f_Body = f_Body.replaceAll("'", "");
if (f_Body == '') {
doSubmit = false;
alert('<?php echo getLngt("Bitte tragen Sie zumindest etwas in das Nachrichtenfeld ein!") ?>');
}
if (doSubmit == true) {
if (confirm('<?php echo getLngt("Soll die Nachricht jetzt an alle Fahrer verschickt werden?") ?>')) {
document.forms[0].f_act.value = 'sendAllActive';
document.forms[0].f_subject_group.value = f_Subject;
document.forms[0].f_body_group.value = f_Body;
document.forms[0].submit();
}
}
};
function msgToSpecialCourier() {
// Deactivate checked groups if special courier is selected
if (document.forms[0].f_cr_sid_msg.options[0].selected == false) {
for (i = 0; i < numOfMsgGroups; i++) {
document.getElementsByName('f_msggrp[]')[i].checked = false;
document.getElementsByName('f_msggrp[]')[i].disabled = true;
}
} else {
for (i = 0; i < numOfMsgGroups; i++) {
document.getElementsByName('f_msggrp[]')[i].disabled = false;
}
}
};
function finishPageSubmit() {
document.forms[0].submit();
}
function openCourierMessagegroupList() {
var widthPopupWin = 1200;
var heightPopupWin = 1024;
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
var popupWin;
popupWin = window.open("../admin/courier_msggroup_list.php","","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
};
// ----------------------------------
var timer1;
var timer2;
var docTitle = document.title;
var docTitle2 = '<?php echo getLngt("**** NEUE NACHRICHT ****") ?>';
var blinkingActivated = false;
var timer1CallCounter = 0;
var timer1CallCounterMax = 10;
var notificationDisplayed = false;
var numOfNewMsgs = <?php echo getCountOfTable("phoenix_log.messageforum", "hq_id = '" . $hq_id . "' AND mf_createtime >= '" . getDateTime("3") . " 00:00:00' AND mf_createtime <= '" . getDateTime("3") . " 23:59:59' AND mf_usr_type = '3' AND mf_state < '2'")?>;
/*
var timer2 = window.setInterval(
function () {
document.title = document.title === docTitle ? docTitle2 : docTitle;
}, 500);
*/
// Start blinking header
function startBlinkingHeader () {
if (!blinkingActivated) {
timer2 = window.setInterval(
function () {
document.title = document.title === docTitle ? docTitle2 : docTitle;
blinkingActivated = true;
}, 500);
}
}
// Stop blinking header
function stopBlinkingHeader () {
if (blinkingActivated) {
window.clearInterval(timer2);
document.title = docTitle;
blinkingActivated = false;
}
}
function checkNewMfMsg () {
// Get number of new messages from the devices
ajaxRequestGet('../include/ajaxReqLib.php', 'mode=2&submode=1&db_table=phoenix_log.messageforum&db_return_field= ' + encodeURI(escape("COUNT(*) AS num")) + '&clause=' + encodeURI(escape("hq_id = '<?php echo $hq_id ?>' AND mf_createtime >= '<?php echo getDateTime("3") . " 00:00:00" ?>' AND mf_usr_type = '3' AND mf_state < '2'")));
if (retValue != '' && !isNaN(retValue)) {
if (retValue > 0) {
if (retValue != numOfNewMsgs) {
finishPageSubmit();
} else {
startBlinkingHeader();
sendNotification();
}
} else {
stopBlinkingHeader();
}
}
timer1CallCounter++;
if (timer1CallCounter == timer1CallCounterMax) {
timer1CallCounter = 0;
notificationDisplayed = false;
}
}
function startTimeout () {
// Set timer for checking blinking state
timer1 = window.setInterval("checkNewMfMsg()", 5000);
}
function ask_for_permission () {
Notification.requestPermission(function(){});
}
function sendNotification () {
if (!notificationDisplayed) {
notificationDisplayed = true;
new Notification('<?php echo getLngt("NEUE NACHRICHT") ?>', {
body: '<?php echo getLngt("Es liegt eine neue Fahrernachricht vor!") ?>'
});
}
}
</script>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>initForm();ask_for_permission();startTimeout();displayStatusMessage();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="maincontent" name="maincontent" id="maincontent">
<form name="mf_history" action="../admin/mf_history.php" method="post" target="">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="f_mf_id" value="">
<input type="hidden" name="f_prio" value="<?php echo ec($f_prio) ?>">
<input type="hidden" name="usr_type" value="<?php echo ec($usr_type) ?>">
<input type="hidden" name="f_usr_sender" value="<?php echo ec($usr_id) ?>">
<input type="hidden" name="f_usr_receiver" value="">
<input type="hidden" name="f_reload" value="1">
<?php echo $phpCurrentNavigationInputHidden ?>
<?php echo htmlDivLineSpacer("20px"); ?>
<!- Message groups -->
<div>
<!- Groups -->
<div <?php echo setStyleHtmlDiv("250px","left"); ?>>
<div class="f12bp1_blue">Gruppen</div>
<?php echo htmlDivLineSpacer("15px"); ?>
<?php echo $outMsgGroups ?>
</div>
<!- Message -->
<div <?php echo setStyleHtmlDiv("450px","left"); ?>>
<div class="f12bp1_blue"><?php echo getLngt("Nachricht") ?></div>
<?php echo htmlDivLineSpacer("15px"); ?>
<div <?php echo setStyleHtmlDiv("60px","left"); ?>><?php echo getLngt("Betreff:") ?></div>
<div><input type="text" name="f_subject_group" value="<?php echo $f_subject_group ?>" size="45" maxlength="40"></div>
<div <?php echo setStyleHtmlDiv("60px","left","150px"); ?>><?php echo getLngt("Text:") ?></div>
<div><textarea name="f_body_group" cols="40" rows="5"><?php echo $f_body_group ?></textarea><br>
(<?php echo getLngt("Max.") ?> <?php echo $maxMsgLength ?> <?php echo getLngt("Zeichen") ?>)
</div>
<?php
// ADMIN-Button to send update message to ALL active couriers
$allEmpIdRootArr = getColVectorFromDB2ArrayByClause("headquarters", "hq_admin", "", "", "");
$allUsrIdRootArr = getColVectorFromDB2ArrayByClause("employee", "usr_id", "emp_id IN (" . implode(",", $allEmpIdRootArr) . ")", "", "");
if (in_array($usr_id, $allUsrIdRootArr)) :
echo htmlDivLineSpacer("20px");
echo defineButtonType10(getLngt("Nachricht an ALLE aktiven Fahrer ALLER NLn"), "action_active_send", "finishPageAllActive();", "330", "left", "3");
endif;
?>
</div>
<!- Actions -->
<div>
<div class="f12bp1_blue">&nbsp;</div>
<?php echo htmlDivLineSpacer("15px"); ?>
<?php echo defineButton(getLngt("Senden"), "action_send", "finishPage2();", "left", "", "", "", "75px"); ?>
<div>&nbsp;</div>
<?php echo htmlDivLineSpacer("20px"); ?>
<div><?php echo getLngt("Nur senden an:") ?> <?php echo $outCouriers ?></div>
</div>
</div>
<?php echo htmlDivLineSpacer("20px","","left"); ?>
<?php echo defineButton(getLngt("Zuordnungsliste"), "cr_msggrp_list", "openCourierMessagegroupList()", "", "", "", "", "150px"); ?>
<?php echo htmlDivLineSpacer("30px","","left"); ?>
<div class="f12bp1_blue"><?php echo getLngt("Bisherige Nachrichten") ?></div>
<?php echo htmlDivLineSpacer("15px"); ?>
<!- Date ranges -->
<div>
<?php echo $filter_dateranges ?>
</div>
<?php echo htmlDivLineSpacer("15px"); ?>
<!- State / Filter -->
<div>
<!- State -->
<div <?php echo setStyleHtmlDiv("150px","left"); ?>><?php echo getLngt("Nachrichtenstatus:") ?></div>
<div>
<?php echo getLngt("Noch nicht ausgelieferte ungelesene") ?>&nbsp;<input class="smaller" type="checkbox" name="f_state[]" value="0" <?php echo $checkedStateArray[0] ?>>
&nbsp;&nbsp;
<?php echo getLngt("Ausgelieferte ungelesene") ?>&nbsp;<input class="smaller" type="checkbox" name="f_state[]" value="1" <?php echo $checkedStateArray[1] ?>>
&nbsp;&nbsp;
<?php echo getLngt("Gelesene") ?>&nbsp;<input class="smaller" type="checkbox" name="f_state[]" value="2" <?php echo $checkedStateArray[2] ?>>
&nbsp;&nbsp;
<?php echo getLngt("Beantwortete") ?>&nbsp;<input class="smaller" type="checkbox" name="f_state[]" value="3" <?php echo $checkedStateArray[3] ?>>
</div>
</div>
<div>
<!- Filter -->
<div <?php echo setStyleHtmlDiv("150px","left"); ?>><?php echo getLngt("Filter:") ?></div>
<div>
<?php echo getLngt("Zentralennachrichten ausblenden") ?>&nbsp;<input class="smaller" type="checkbox" name="f_filter[]" value="0" <?php echo $checkedFilterArray[0] ?>>
&nbsp;&nbsp;
<?php echo getLngt("Nur Zentralennachrichten anzeigen") ?>&nbsp;<input class="smaller" type="checkbox" name="f_filter[]" value="1" <?php echo $checkedFilterArray[1] ?>>
&nbsp;&nbsp;
</div>
</div>
<?php echo htmlDivLineSpacer("15px"); ?>
<!- Actions -->
<?php echo defineButton(getLngt("Aktualisieren"), "refresh", "finishPageSubmit()", "", "", "", "", "115px"); ?>
<?php echo htmlDivLineSpacer("20px"); ?>
<div>
<div>
<?php if ($rowCounter > 1000) : echo getLngt("Mehr als") . " " . $limitOfRowsDisplayed . " " . getLngt("Datensätze werden nicht dargestellt"); endif; ?>
<?php echo htmlDivLineSpacer("20px"); ?>
</div>
</div>
<!- History -->
<div>
<table cellspacing="0" cellpadding="0" vspace="0" hspace="0">
<?php echo $historyentry ?>
</table>
</div>
</div>
</form>
</div>
</body>
</html>

397
html/admin/nearBySearch.php Normal file
View File

@@ -0,0 +1,397 @@
<?php
/*=======================================================================
*
* nearBySearch.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
getSecHttpVars("1", array("phrase", "compareType"));
getLanguage(__FILE__);
$deactivateMenuStatic = "1";
$pageTitel = getLngt("ÄHNLICHE SUCHERGEBNISSE");
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
getCurrentScript(__FILE__);
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
$debugON = false;
$regexpSQLArray = array();
$numOfChecksArray = array();
$phrase = trim($phrase);
$phraseOrg = $phrase;
// if (getEmpIdOfRootAdmin($userTypeName) == $emp_id) :
// echo $phrase . "<br>";
$phrase = str_replace(" mit ", " ", $phrase);
$phrase = str_replace(" und ", " ", $phrase);
$phrase = str_replace(" oder ", " ", $phrase);
$phrase = str_replace(" GmbH", "", $phrase);
$phrase = str_replace(" Co.", "", $phrase);
$phrase = str_replace(" KG", "", $phrase);
$phrase = str_replace("&", "", $phrase);
$phrase = str_replace("#", "", $phrase);
$phrase = str_replace("'", "", $phrase);
// echo $phrase . "<br>";
// Signs to be escaped for reg exp: . \ + * ? [ ^ ] $ ( ) { } = ! < > | : -
$specialSignsArray = array("/\!/", "/§/", "/%/", "/\-/", "/_/", "/\./", "/\:/", "/,/", "/;/", "/\$/", "/\?/", "/\+/", "/\*/", "/\|/", "/\=/", "/\(/", "/\)/", "/\[/", "/\]/", "/\</", "/\>/");
$phrase = preg_replace ($specialSignsArray, "", $phrase); // Remove special signs
// echo $phrase . "<br>";
// die();
// endif;
$wordArray = spliti(" ", $phrase);
$wordArrayLen = count($wordArray);
if ($wordArrayLen > 3) :
$wordArray = array($wordArray[0], $wordArray[1], $wordArray[2]);
$wordArrayLen = count($wordArray);
endif;
// Executes similarity search for the current headquarters logged in only
$parFilterHQ = getParameterValue("0", "SIMILARITY_SEARCH_FILTER_HQ", "0");
$whereClauseHQ = "";
if (!isset($compareType)) : $compareType = "cs"; endif;
$compareField = " cmp.cmp_comp ";
if ($compareType == "cs") :
$compareField = " cmp.cmp_comp ";
if ($parFilterHQ == "1" && $hq_id != "") :
$whereClauseHQ = " AND cs.hq_id = '" . $hq_id . "' ";
endif;
endif;
if ($compareType == "cr") :
$compareField = " cmp.cmp_comp ";
if ($parFilterHQ == "1" && $hq_id != "") :
$whereClauseHQ = " AND cr.hq_id = '" . $hq_id . "' ";
endif;
endif;
for ($i = 0; $i < $wordArrayLen; $i++) :
$phrase = $wordArray[$i];
$phraseLen = strlen($phrase);
$regexpSQLArray[$i] = array();
$numOfChecksArray[$i] = 0;
if ($phraseLen > 0) :
// [1.] Exact match by subtring
$regexpSQLArray[$i][] = " LIKE '%" . $phrase . "%'";
// [2.] All letters have to be found in the same sort sequence following directly
// Example: "test" => ("blah test blah", "blah tttteeeesssstttt blah", "teeeeest")
$tmpRegexp = "";
for ($j = 0; $j < $phraseLen; $j++) :
$char = substr($phrase, $j, 1);
$tmpRegexp .= $char . "+";
endfor;
$regexpSQLArray[$i][] = " REGEXP '" . $tmpRegexp . "'";
// [3.] One of the letters could be another, but the rest has to match
// Example: "test" => ("xxxxrestxxxxtastxxxxtertxxxxtesaxxxx")
for ($j = 0; $j < $phraseLen; $j++) :
$tmpSubstrLeft = substr($phrase, 0, $phraseLen - $j - 1);
$tmpSubstrRight = substr($phrase, $phraseLen - $j);
$regexpSQLArray[$i][] = " REGEXP '" . $tmpSubstrLeft . "[[:alnum:][:blank:]]?" . $tmpSubstrRight . "'";
endfor;
// [4.] All letters have to be found in the same sort sequence
// Example: "test" => ("blahxxxxxtyyyyyyyezzzzzzsxxxxtyyyyyblah") [look for letters "t","e","s","t"]
$tmpRegexp = "";
for ($j = 0; $j < $phraseLen; $j++) :
$char = substr($phrase, $j, 1);
$tmpRegexp .= $char . "+[[:alnum:][:blank:]]*";
endfor;
// $regexpSQLArray[$i][] = " REGEXP '" . $tmpRegexp . "'";
// SELECT cmp_comp, SOUNDEX(cmp_comp) FROM company WHERE (CAST(SUBSTRING(SOUNDEX(cmp_comp),2) AS UNSIGNED) - CAST(SUBSTRING(SOUNDEX('Frie'),2) AS UNSIGNED)) < 10
$numOfChecksArray[$i] = count($regexpSQLArray[$i]);
endif;
endfor;
// ---- DEBUG ----
if ($debugON) :
echo "regexpSQLArray:<br>";
print_r($regexpSQLArray);
echo "<br><br>";
endif;
// ---------------
// Function to generate the WHERE clause according to the phrases
function generateWhereClause ($addedVector = array()) {
global $whereClauseArray, $weightArray, $compareField;
$whereClauseArrayLen = count($whereClauseArray);
$addedVectorLen = count($addedVector);
$newWhereClauseArray = array();
$newWeightArray = array();
if ($addedVectorLen > 0) :
$count = 0;
if ($whereClauseArrayLen > 0) :
for ($i = 0; $i < $whereClauseArrayLen; $i++) :
for ($j = 0; $j < $addedVectorLen; $j++) :
$newWhereClauseArray[$count] = $whereClauseArray[$i];
array_push($newWhereClauseArray[$count], $compareField . $addedVector[$j] . " ");
$newWeightArray[$count] = max($weightArray[$i] + (10 - $j), 50);
$count++;
endfor;
endfor;
else :
for ($j = 0; $j < $addedVectorLen; $j++) :
$newWhereClauseArray[$count] = array($compareField . $addedVector[$j] . " ");
$newWeightArray[$count] = (10 - $j);
$count++;
endfor;
endif;
endif;
$whereClauseArray = $newWhereClauseArray;
$weightArray = $newWeightArray;
}
// Generate WHERE clause array
$whereClauseArray = array();
$weightArray = array();
$numOfChecksArrayLen = count($numOfChecksArray);
if ($numOfChecksArrayLen > 0) :
for ($k = 0; $k < $numOfChecksArrayLen; $k++) :
generateWhereClause($regexpSQLArray[$k]);
endfor;
endif;
// Extend WHERE clause for exact match
for ($i = 0; $i < $wordArrayLen; $i++) :
$whereClauseArrayLen = count($whereClauseArray);
$whereClauseArray[$whereClauseArrayLen][0] = $compareField . "= '" . $wordArray[$i] . "' ";
$weightArray[$whereClauseArrayLen] = 100;
endfor;
// Extend WHERE clause for exact match by prefix
for ($i = 0; $i < $wordArrayLen; $i++) :
$whereClauseArrayLen = count($whereClauseArray);
$whereClauseArray[$whereClauseArrayLen][0] = $compareField . "LIKE '" . $wordArray[$i] . "%' ";
$weightArray[$whereClauseArrayLen] = 70;
endfor;
// Extend WHERE clause for exact match by prefix AND combination with other expressions
for ($i = 0; $i < $wordArrayLen; $i++) :
$numOfChecksArrayLen = count($numOfChecksArray);
if ($numOfChecksArrayLen > 0) :
for ($k = 0; $k < $numOfChecksArrayLen; $k++) :
if ($i != $k) :
$addedVectorLen = count($regexpSQLArray[$k]);
for ($j = 0; $j < $addedVectorLen; $j++) :
$whereClauseArrayLen = count($whereClauseArray);
$whereClauseArray[$whereClauseArrayLen][0] = $compareField . "LIKE '" . $wordArray[$i] . "%' ";
$whereClauseArray[$whereClauseArrayLen][1] = $compareField . $regexpSQLArray[$k][$j] . " ";
$weightArray[$whereClauseArrayLen] = 90 - $j;
endfor;
endif;
endfor;
endif;
endfor;
// ---------------
if ($debugON) :
echo "whereClauseArray:<br>";
print_r($whereClauseArray);
echo "<br><br>";
echo "weightArray:<br>";
print_r($weightArray);
echo "<br><br>";
endif;
// ---------------
// Iterate WHERE clause array and define SQL statements
$output = "";
$sqlStatementArray = array();
$whereClauseArrayLen = count($whereClauseArray);
if ($whereClauseArrayLen > 0) :
// Iterate word vector (each component is a word) with different number of check statements
for ($k = 0; $k < $whereClauseArrayLen; $k++) :
// Generate statements according to the regular expressions
$whereClause = implode(" AND ", $whereClauseArray[$k]);
$whereClause .= " AND ";
if ($compareType == "cr") :
$sqlStatementArray[] = "SELECT cmp.cmp_id, cmp.cmp_comp, cmp.cmp_comp2, cr.cr_eid, hq.hq_mnemonic, '" . $weightArray[$k] . "' AS mysort"
. " FROM company AS cmp, courier AS cr, user AS usr, address AS ad, headquarters AS hq"
. " WHERE " . $whereClause
. " cmp.cmp_id = cr.cmp_id AND"
. " cr.usr_id = usr.usr_id AND"
. " cmp.ad_id = ad.ad_id AND"
. " cr.hq_id = hq.hq_id" . $whereClauseHQ;
else : // "cs"
$sqlStatementArray[] = "SELECT cmp.cmp_id, cmp.cmp_comp, cmp.cmp_comp2, cs.cs_eid, hq.hq_mnemonic, '" . $weightArray[$k] . "' AS mysort"
. " FROM company AS cmp, customer AS cs, employee AS emp, user AS usr, address AS ad, headquarters AS hq"
. " WHERE " . $whereClause
. " cmp.cmp_id = cs.cmp_id AND"
. " cs.cs_admin = emp.emp_id AND"
. " emp.usr_id = usr.usr_id AND"
. " cmp.ad_id = ad.ad_id AND"
. " cs.hq_id = hq.hq_id" . $whereClauseHQ;
endif;
endfor;
// Generate UNION statement
$sqlQuery = "(" . implode(") UNION (", $sqlStatementArray) . ") ORDER BY mysort DESC, cmp_comp";
// ---- DEBUG ----
if ($debugON) :
echo "<br><br>" . $sqlQuery . "<br><br>";
endif;
// ---------------
$result = $db->query($sqlQuery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
// Generate unique array
$rowArray = array();
while ($row = $result->fetch_assoc()):
if (!is_array($rowArray[$row["cs_eid"]])) :
$rowArray[$row["cs_eid"]] = array($row["mysort"], $row["cmp_comp"], $row["cmp_comp2"], $row["cs_eid"], $row["cmp_id"]);
endif;
endwhile;
$result->free();
// Output
/*
$keyArray = array_keys($rowArray);
$keyArrayLen = count($keyArray);
for ($j = 0; $j < $regexpSQLArrayLen; $j++) :
for ($i = 0; $i < $keyArrayLen; $i++) :
if ($rowArray[$keyArray[$i]][0] == $j) :
echo $rowArray[$keyArray[$i]][0] . "&nbsp;&nbsp;&nbsp;&nbsp;" . $rowArray[$keyArray[$i]][1] . "&nbsp;&nbsp;&nbsp;&nbsp;" . $rowArray[$keyArray[$i]][2] . "&nbsp;&nbsp;&nbsp;&nbsp;" . $rowArray[$keyArray[$i]][3] . "&nbsp;&nbsp;&nbsp;&nbsp;" . $rowArray[$keyArray[$i]][4] . "<br>";
endif;
endfor;
endfor;
*/
$keyArray = array_keys($rowArray);
$keyArrayLen = count($keyArray);
$output .= "<table>";
for ($i = 0; $i < $keyArrayLen; $i++) :
$output .= "<tr>";
$output .= "<td><a href=\"../admin/customer_special.php?companyId=" . $rowArray[$keyArray[$i]][4] . "\" target=\"_blank\">" . $rowArray[$keyArray[$i]][3] . "</a></td><td>" . $rowArray[$keyArray[$i]][1] . "</td><td>" . $rowArray[$keyArray[$i]][2] . "</td>";
$output .= "</tr>";
endfor;
$output .= "</table>";
endif;
?>
<html lang="de">
<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 type="text/javascript">
<!--
// NAVIGATION
<?php echo $jsMenuOut; ?>
var refreshStatus = 1;
function startReload() {
if (refreshStatus == 1) {
// self.location.reload();
// document.forms[0].submit();
this.close();
}
}
function startTimeout() {
self.setTimeout("startReload()", 90000);
}
function finishPage(f_act) {
document.forms[0].f_act.value = f_act;
document.forms[0].submit();
};
function openCustomerSpecial(cmpId) {
var widthPopupWin = 900;
var heightPopupWin = 750;
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
var popupWin;
popupWin = window.open("../admin/customer_special.php?companyId=" + cmpId ,"","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
};
-->
</script>
<noscript>
<center>
<b><br>JavaScript ist nicht verf&uuml;gbar. Bitte aktivieren Sie JavaScript<br><br>
in Ihrem Browser, damit diese Seite ordnungsgem&auml;&szlig; funktioniert!</b><br><br>
</center>
</noscript>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>startTimeout();displayStatusMessage();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="maincontent" name="maincontent" id="maincontent">
<form action="../admin/nearBySearch.php" method="post">
<input type="hidden" name="f_act" value="">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<input type="hidden" name="compareType" value="<?php echo ec($compareType) ?>">
<?php echo htmlDivLineSpacer("10px"); ?>
<div class="f12bp1_blue">
<?php echo getLngt("Ähnlichkeitssuche"); ?>
</div>
<?php echo htmlDivLineSpacer("20px"); ?>
<div style="float:left;">
<input type="text" name="phrase" value="<?php echo $phraseOrg ?>" size="50" maxlength="50">&nbsp;&nbsp;
</div>
<?php echo defineButtonType10(getLngt("Neue Suche"), "action_list", "finishPage('search');", "120", "left", "5"); ?>
<?php echo defineButtonType10(getLngt("Schließen"), "action_list", "window.close();", "120", "left"); ?>
<?php echo htmlDivLineSpacer("30px", "", "left"); ?>
<div class="f10bp1_blue">
<?php echo getLngt("Suchergebnisse"); ?>
</div>
<?php echo htmlDivLineSpacer("20px"); ?>
<div class="f12bp1_blue">
<?php echo $output ?>
</div>
<?php echo htmlDivLineSpacer("30px"); ?>
</form>
</div>
</body>
</html>

465
html/admin/newsticker.php Normal file
View File

@@ -0,0 +1,465 @@
<?php
/*=======================================================================
*
* newsticker.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act", "customerId", "cscIdRoot", "cscIdActual",
"day_from", "month_from", "year_from", "day_to", "month_to", "year_to",
"f_tif_id", "f_tif_subject", "f_tif_text", "f_tif_unerasable", "statusMessage",
"f_emp_id_insert", "f_hq_id_insert", "f_filter", "f_emp_id_creator",
"f_tif_unerasable", "f_tifIdToRemove"));
getLanguage(__FILE__);
$pageTitel = getLngt("MITTEILUNGEN");
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
getCurrentScript(__FILE__);
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
authCheckEmployeeRights($emp_id, "18", "1");
// Get the emp_id of the root admin because he/she is allowed to change a password of an employee
$empIdRootAdmin = getEmpIdOfRootAdmin($userTypeName);
if ($f_hq_id_insert == "") : $f_hq_id_insert = 0; endif;
if ($f_emp_id_insert == "") : $f_emp_id_insert = 0; endif;
if ($f_tif_unerasable == "") : $f_tif_unerasable = 0; endif;
// Get the current time
$currentTime = getDateTime("0");
// Remove all old ticker messages automatically by calling this script (!!!)
// Without calling this script the table "tickerforum" can not increase!
deleteStmt("phoenix_group.tickerforum","tif_endtime < '" . $currentTime . "' AND tif_unerasable != '1'");
// Initialisations
$limitOfRowsDisplayed = "300"; // For limitation of the rows displayed
$f_tif_subject = trim($f_tif_subject);
$f_tif_text = trim($f_tif_text);
$f_tif_text = str_replace("'", "", $f_tif_text);
// $f_tif_text = str_replace("\"", '', $f_tif_text);
// Maximum of chars to be inserted into a message
$maxMsgLength = getParameterValue("0", "NEWSTICKER_MAX_BODY_LENGTH", $hq_id);
if ($maxMsgLength == "" || $maxMsgLength == "0") :
$maxMsgLength = 1000;
endif;
$f_tif_text = substr($f_tif_text,0,$maxMsgLength);
// Get the array for formatting the database-values for the output according to the defined type
$outputFormatField = defineOutputFormats();
// Check range of date. All fields have to be set
if ($day_from == "" || $month_from == "" || $year_from == "" ||
$day_to == "" || $month_to == "" || $year_to == "") :
// Initialize date-ranges to the current date
$fromDateRange = getDateTime("3") . " 00:00:00";
$toDateRange = getDateTime("3") . " 23:59:59";
$day_from = getDateTime("day");
$month_from = getDateTime("month");
$year_from = getDateTime("year");
$day_to = getDateTime("day");
$month_to = getDateTime("month");
$year_to = getDateTime("year");
else :
$fromDateRange = $year_from . "-" . pad($month_from,2) . "-" . pad($day_from,2) . " 00:00:00";
$toDateRange = $year_to . "-" . pad($month_to,2) . "-" . pad($day_to,2) . " 23:59:59";
endif;
function postParseHistory ($textToParse) {
global $empIdRootAdmin, $emp_id;
$textToParse = trim($textToParse);
if ($textToParse != "") :
// Iterate ALL occurrences of "<postparser>...</postparser>"
while (!(strpos($textToParse, "<postparser>") === FALSE)) {
$beginTagPosBegin = strpos($textToParse, "<postparser>");
$beginTagPosEnd = $beginTagPosBegin + 12;
$endTagPosBegin = strpos($textToParse, "</postparser>");
$endTagPosEnd = $endTagPosBegin + 13;
if ($beginTagPosEnd < $endTagPosBegin) :
$tagContent = substr($textToParse, $beginTagPosEnd, $endTagPosBegin - $beginTagPosEnd);
// $tagContent contains 0. "tif_id", 1. "hq_id", 2. "emp_id", 3. "emp_id_creator"
$tmp = spliti(",",$tagContent);
// Init
$tagContent = "";
// Response
$tagContent .= "<button type=\"button\" class=\"buttonAction\" onClick=\"respondCreator('" . $tmp[3] . "');\">" . getLngt("Antworten") . "</button>";
// Remove message, created by myself only
$buttonClass = "buttonActionDisabled";
if ($emp_id == $tmp[3] || ($empIdRootAdmin != "" && $emp_id == $empIdRootAdmin)) :
$buttonClass = "buttonAction";
endif;
$tagContent .= "<button type=\"button\" class=\"" . $buttonClass . "\" onClick=\"removeTifEntryFinishPage('" . $tmp[0] . "');\">" . getLngt("Entfernen") . "</button>";
// Substitute text fragment
$textToParse = substr_replace($textToParse, $tagContent, $beginTagPosBegin, $endTagPosEnd - $beginTagPosBegin);
endif;
}
endif;
return $textToParse;
}
// Remove newsticker entry
if ($f_act == "removeTifEntry") :
if ($f_tifIdToRemove != "") :
deleteStmt("phoenix_group.tickerforum","tif_id = ".$f_tifIdToRemove);
$f_tifIdToRemove = ""; // Reset ID
else:
$statusMessage = getLngt("Es wurde kein Eintrag zum Löschen selektiert!");
endif;
endif;
// Message to couriers belonging to one or more groups
if ($f_act == "sendmsg") :
if ($f_tif_text != "") :
if ($toDateRange >= $currentTime) :
$statusMessage = getLngt("Die Tickermeldung wurde eingestellt!");
// If the message was inserted for a special employee, a potential headquarter information will be deleted
if ($f_emp_id_insert != "" && $f_emp_id_insert != "0" && $f_hq_id_insert != "" && $f_hq_id_insert != "0") :
$f_hq_id_insert = "0";
$statusMessage .= " " . getLngt("Es wurde ein bestimmter Empfänger selektiert, deshalb wird die Zentralenauswahl verworfen!");
endif;
if (substr($fromDateRange, 0, 10) < substr($currentTime, 0, 10)) :
$fromDateRange = $currentTime;
if (authCheckEmployeeRights($emp_id, "10")) :
$statusMessage .= " " . getLngt("Der Startzeitpunkt wurde auf den aktuellen Zeitpunkt gelegt, da ein vergangenes Startdatum nicht zulässig ist!");
endif;
endif;
insertStmt("phoenix_group.tickerforum", array("hq_id", $f_hq_id_insert, "emp_id", $f_emp_id_insert, "emp_id_creator", $emp_id,
"tif_createtime ", $currentTime, "tif_starttime", $fromDateRange, "tif_endtime", $toDateRange,
"tif_subject", "", "tif_text", $f_tif_text, "tif_unerasable", $f_tif_unerasable));
// Initialisieren
$f_tif_subject = "";
$f_tif_text = "";
else :
$statusMessage = getLngt("Das Endedatum sollte nicht in der Vergangenheit liegen!");
endif;
else :
$statusMessage = getLngt("Bitte erfassen Sie erst einen neuen Eintrag!");
endif;
endif;
// --- Current newsticker data ------------------
if (true) :
// From table "messageforum"
$fieldClause = "hq.hq_name, tif.tif_id, tif.hq_id, tif.emp_id, tif.emp_id_creator,tif.tif_createtime," .
"LEFT(tif.tif_starttime, 10) AS tif_starttime, LEFT(tif.tif_endtime, 10) AS tif_endtime, tif.tif_subject, tif.tif_text, tif.tif_unerasable," .
"CONCAT(usr_s.usr_firstname,'<br>',usr_s.usr_name,'<br>','[',hq_s.hq_mnemonic,']') AS usr_from," .
"CONCAT(usr_r.usr_firstname,'<br>',usr_r.usr_name,'<br>','[',hq_r.hq_mnemonic,']') AS usr_to," .
"CONCAT(tif.tif_id,',',tif.hq_id,',',tif.emp_id,',',tif.emp_id_creator) AS tif_special";
$fromClause = "phoenix_group.tickerforum AS tif " .
"LEFT JOIN phoenix.headquarters AS hq ON tif.hq_id = hq.hq_id " .
"LEFT JOIN phoenix.employee AS emp_s ON tif.emp_id_creator = emp_s.emp_id " .
"LEFT JOIN phoenix.user AS usr_s ON emp_s.usr_id = usr_s.usr_id " .
"LEFT JOIN phoenix.headquarters AS hq_s ON usr_s.hq_id = hq_s.hq_id " .
"LEFT JOIN phoenix.employee AS emp_r ON tif.emp_id = emp_r.emp_id " .
"LEFT JOIN phoenix.user AS usr_r ON emp_r.usr_id = usr_r.usr_id " .
"LEFT JOIN phoenix.headquarters AS hq_r ON usr_r.hq_id = hq_r.hq_id ";
// $whereClause = "tif.tif_createtime >= '$fromDateRange' AND tif.tif_createtime <= '$toDateRange'";
$whereClause = "tif.tif_unerasable != '1'";
$whereClause .= " AND (tif.emp_id_creator = '" . $emp_id . "' OR tif.emp_id = '" . $emp_id . "' OR"
. " ( (isnull(tif.emp_id) OR tif.emp_id = '0') AND tif.hq_id = '" . $hq_id . "') OR"
. " ( (isnull(tif.emp_id) OR tif.emp_id = '0') AND (isnull(tif.hq_id) OR tif.hq_id = '0') ) )";
$orderByClause = "tif.tif_createtime DESC LIMIT 0," . $limitOfRowsDisplayed;
$sqlquery = generateStatement($fieldClause,$fromClause,$whereClause,$orderByClause);
// echo $sqlquery . "<br>";
// Send request to database
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
// Generate list with header
$titleArray = array(getLngt("Erstellung")."&nbsp;&nbsp;",getLngt("Gültig von")."&nbsp;&nbsp;",getLngt("bis")."&nbsp;&nbsp;",getLngt("Absender")."&nbsp;&nbsp;",getLngt("an&nbsp;Zentrale")."&nbsp;&nbsp;",getLngt("an&nbsp;Empfänger")."&nbsp;&nbsp;",getLngt("Mitteilung")."&nbsp;&nbsp;",getLngt("Aktionen"));
$fieldArray = array("tif_createtime","tif_starttime","tif_endtime","usr_from","hq_name","usr_to","tif_text","tif_special");
$aligns = "c,c,c,c,c,c,l,c";
if ($empIdRootAdmin != "" && $emp_id == $empIdRootAdmin) :
$titleArray = array_merge(array(getLngt("Nr.")."&nbsp;&nbsp;"), $titleArray);
$fieldArray = array_merge(array("tif_id"), $fieldArray);
$aligns = "r," . $aligns;
endif;
$alignArray = spliti(",",$aligns);
$alignTitles = "center";
$widths = "30,80,80,80,100,100,100,400,200";
$widthArray = spliti(",",$widths);
$summationField = "";
$postParserField = "tif_special";
$mode = "1"; // Output from DB-RESULT
$sortDBField = ""; // Used in following include-file for sorting per column;
include ("../include/inc_list_defineoutput.inc.php");
$result->free();
endif;
// *** ONLY OUTPUT ***
// Post parsing if necessary
if ($postParserField != "") :
$tableBody = postParseHistory($tableBody);
$tableBody = nl2br($tableBody);
endif;
// Define output table
$historyentry = $tableHeader . $tableBody;
$currentFrameName = ""; // Empty string for "main frame"
// Date-ranges
$filter_dateranges = getLngt("Gültig von") . "\n";
$filter_dateranges .= "<select name=\"day_from\" class=\"f8np1\" onchange=\"fillDateFields(0, '" . $currentFrameName . "', 'tif_history', 'day_from', 'day_from', 'month_from', 'year_from', '', '', '')\"></select>\n";
$filter_dateranges .= "<select name=\"month_from\" class=\"f8np1\" onchange=\"fillDateFields(0, '" . $currentFrameName . "', 'tif_history', 'month_from', 'day_from', 'month_from', 'year_from', '', '', '')\"></select>\n";
$filter_dateranges .= "<select name=\"year_from\" class=\"f8np1\" onchange=\"fillDateFields(0, '" . $currentFrameName . "', 'tif_history', 'year_from', 'day_from', 'month_from', 'year_from', '', '', '')\"></select>\n";
$filter_dateranges .= "</td><td>&nbsp;&nbsp;" . getLngt("bis:") . "\n";
$filter_dateranges .= "<select name=\"day_to\" class=\"f8np1\" onchange=\"fillDateFields(0, '" . $currentFrameName . "', 'tif_history', 'day_to', 'day_to', 'month_to', 'year_to', '', '', '')\"></select>\n";
$filter_dateranges .= "<select name=\"month_to\" class=\"f8np1\" onchange=\"fillDateFields(0, '" . $currentFrameName . "', 'tif_history', 'month_to', 'day_to', 'month_to', 'year_to', '', '', '')\"></select>\n";
$filter_dateranges .= "<select name=\"year_to\" class=\"f8np1\" onchange=\"fillDateFields(0, '" . $currentFrameName . "', 'tif_history', 'year_to', 'day_to', 'month_to', 'year_to', '', '', '')\"></select>\n";
// Javascript-function as template only for
$js_date = "<script type=\"text/javascript\">\n";
$js_date .= "<!--\n";
$js_date .= "function initForm() {\n";
$js_date .= " fillDateFields(1,\"" . $currentFrameName . "\",\"tif_history\",\"\",\"day_from\",\"month_from\",\"year_from\",\"\",\"\",\"\");\n";
$js_date .= " setDateTimeFields(\"" . $currentFrameName . "\",\"tif_history\",".$day_from.",".$month_from.",".$year_from.", \"\", \"\", \"day_from\", \"month_from\", \"year_from\", \"\", \"\", \"\");\n";
$js_date .= " fillDateFields(1,\"" . $currentFrameName . "\",\"tif_history\", \"\", \"day_to\", \"month_to\", \"year_to\", \"\", \"\", \"\");\n";
$js_date .= " setDateTimeFields(\"" . $currentFrameName . "\",\"tif_history\",".$day_to.",".$month_to.",".$year_to.", \"\", \"\", \"day_to\", \"month_to\", \"year_to\", \"\", \"\", \"\");\n";
$js_date .= "}\n";
$js_date .= "-->\n";
$js_date .= "</script>\n";
?>
<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"); ?>
.buttonAction, .buttonActionDisabled
{ height:25px; width:100px;
font-size:8pt; font-family:Verdana,Helvetica,Arial; font-style:normal; font-weight:normal;
vertical-align:middle;
color:#ffffff;
}
.buttonAction
{ background-color:<?php echo $constMenuBackground[2] ?>; }
.buttonActionDisabled
{ background-color:#999999; pointer-events: none; }
</style>
<?php include_once ("../include/js_framework.inc.php"); ?>
<script src="../include/lib_global.js" type="text/javascript"></script>
<script src="../include/checkFormTags.js" type="text/javascript"></script>
<?php echo $js_date ?>
<script type="text/javascript">
// NAVIGATION
<?php echo $jsMenuOut; ?>
function finishPage(f_act, mf_id, usr_id_receiver) {
var doSubmit = true;
document.forms[0].f_act.value = f_act;
document.forms[0].f_mf_id.value = mf_id;
document.forms[0].f_usr_receiver.value = usr_id_receiver;
if (f_act == 'answered') {
var f_Subject = eval('document.forms[0].f_subject_' + mf_id);
var f_Body = eval('document.forms[0].f_body_' + mf_id);
if (f_Subject.value == '' || f_Body.value == '') {
doSubmit = false;
alert('<?php echo getLngt("Bitte tragen Sie etwas in die Felder Betreff und Text ein!") ?>');
}
}
if (doSubmit == true) {
document.forms[0].submit();
}
};
function finishPage2() {
var doSubmit = true;
document.forms[0].f_act.value = 'sendmsg';
// var f_subject = document.forms[0].f_tif_subject;
// $('#f_tif_text').val(encodeURI(escape($('#f_tif_text').val())));
$('#f_tif_text').val(trim($('#f_tif_text').val()));
var f_text = trim($('#f_tif_text').val());
if (f_text.value == '') {
doSubmit = false;
alert('<?php echo getLngt("Bitte tragen Sie einen Mitteilungstext ein!") ?>');
}
if (doSubmit == true) {
document.forms[0].submit();
}
};
function finishPageSubmit() {
document.forms[0].submit();
}
function setSelectboxAttr (elem_id) {
if (elem_id != '') {
if ($(elem_id).children("option:selected").val() != '0') {
$(elem_id).css("background-color", "#ffff77");
} else {
$(elem_id).css("background-color", "#ff7777");
};
};
}
function respondCreator (empIdCreator) {
setSelectedValue('f_emp_id_insert', empIdCreator);
setSelectboxAttr('#f_emp_id_insert'); // Set the background color
$('#f_tif_text').focus();
}
function removeTifEntryFinishPage(tifIdToRemove) {
if (confirm('<?php echo getLngt("Möchten Sie den Eintrag wirklich löschen?") ?>')) {
document.forms[0].f_act.value='removeTifEntry';
document.forms[0].f_tifIdToRemove.value=tifIdToRemove;
document.forms[0].submit();
}
};
function execBodyOnLoad() {
initForm();
setSelectboxAttr('#f_emp_id_insert');
displayStatusMessage();
$('#f_tif_text').focus();
}
</script>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>execBodyOnLoad();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="maincontent" name="maincontent" id="maincontent">
<form name="tif_history" action="../admin/newsticker.php" method="post" target="">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="f_tif_id" value="">
<input type="hidden" name="f_tifIdToRemove" value="">
<?php echo $phpCurrentNavigationInputHidden ?>
<?php echo htmlDivLineSpacer("20px"); ?>
<!- Message -->
<div class="f12bp1_blue"><?php echo getLngt("Mitteilungen") ?></div>
<?php echo htmlDivLineSpacer("15px"); ?>
<div>
<div
<?php echo setStyleHtmlDiv("150px","left"); ?>><?php echo getLngt("Neue Nachricht:") ?>
<?php echo htmlDivLineSpacer("30px"); ?>
<?php echo defineButton(getLngt("Senden"), "action_send", "finishPage2();", "left", "", "", "", "115px"); ?>
</div>
<div>
<?php echo "<textarea id=\"f_tif_text\" name=\"f_tif_text\" cols=\"100\" rows=\"10\">" . $f_tif_text . "</textarea>"; ?>
</div>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<div>
<div <?php echo setStyleHtmlDiv("150px","left"); ?>>&nbsp;</div>
<div style="float:left">
<!- Date ranges -->
<?php echo $filter_dateranges ?>
&nbsp;&nbsp;&nbsp;
<!-- According to mandator rights a ticker message can be sent to all employees of ALL headquarters -->
<?php if (authCheckEmployeeRights($emp_id, "10")) : ?>
<?php echo getLngt("Zentrale") ?>:&nbsp;
<select id="f_hq_id_insert" name="f_hq_id_insert">
<option value="0" selected><?php echo getLngt("Alle") ?></option>
<?php echo addOptionsFromTable("headquarters","hq_id","hq_mnemonic","hq_id","",$hq_id); ?>
</select>
&nbsp;&nbsp;&nbsp;
<?php echo getLngt("Empfänger") ?>:&nbsp;
<select id="f_emp_id_insert" name="f_emp_id_insert" onchange="setSelectboxAttr('#f_emp_id_insert');">
<option value="0" selected><?php echo getLngt("Alle") ?></option>
<?php echo addOptionsFromTable("user AS usr, employee AS emp, headquarters AS hq","emp.emp_id","CONCAT(usr_name,', ',usr_firstname,' [',hq_mnemonic,']') AS usr_combined","usr.usr_name","usr.usr_type = '1' AND usr.hq_id = hq.hq_id AND emp.usr_id = usr.usr_id ", ""); ?>
</select>
<?php else : ?>
<?php echo getLngt("Empfänger") ?>:&nbsp;
<select id="f_emp_id_insert" name="f_emp_id_insert" onchange="setSelectboxAttr('#f_emp_id_insert');">
<option value="0" selected><?php echo getLngt("Alle") ?></option>
<?php echo addOptionsFromTable("user AS usr, employee AS emp","emp.emp_id","CONCAT(usr_name,', ',usr_firstname) AS usr_combined","usr.usr_name","usr.hq_id = '" . $hq_id . "' AND usr.usr_type = '1' AND emp.usr_id = usr.usr_id ", ""); ?>
</select>
<?php endif; ?>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</div>
<?php /* echo defineButton(getLngt("Senden"), "action_send", "finishPage2();", "left", "", "", "", "75px"); */ ?>
</div>
<?php echo htmlDivLineSpacer("40px","","left"); ?>
<div class="f12bp1_blue"><?php echo getLngt("Bisherige Nachrichten") ?></div>
<?php echo htmlDivLineSpacer("20px"); ?>
<?php echo defineButton(getLngt("Aktualisieren"), "action_submit", "finishPageSubmit()", "", "", "", "", "115px"); ?>
<div>
<?php
if ($rowCounter > 1000) :
echo getLngt("Mehr als") . " " . $limitOfRowsDisplayed . " " . getLngt("Datensätze werden nicht dargestellt");
echo htmlDivLineSpacer("20px");
endif;
?>
</div>
<!- History -->
<div>
<table cellspacing="0" cellpadding="0" vspace="0" hspace="0">
<?php echo $historyentry ?>
</table>
</div>
</div>
</form>
</div>
</body>
</html>

146
html/admin/o-auth.php Normal file
View File

@@ -0,0 +1,146 @@
<?php
session_start();
$tenantId = 'a70b907f-9db5-417e-a1a4-77a71bd0c8b5';
$clientId = '94ee35c5-81fb-4ad6-8364-2a854a60851d';
$clientSecret = 'Qri8Q~8_VIBHxCkd4XvL2oEsOyn9RoQ3LKjZSbDx';
$redirectUri = 'https://test.sb.assecutor.de/admin/o-auth.php';
// ==============================
// Sicherheit prüfen: State
// ==============================
if (empty($_GET['state']) || $_GET['state'] !== $_SESSION['state']) {
$_SESSION['sso_error'] = 'Fehler: ' . "Ungültiger State.";
header("Location: login.php");
exit;
}
// ==============================
// Fehler von Microsoft prüfen
// ==============================
if (isset($_GET['error'])) {
$_SESSION['sso_error'] = 'Fehler: ' . htmlspecialchars($_GET['error']);
header("Location: login.php");
exit;
}
// ==============================
// Authorization Code prüfen
// ==============================
$code = $_GET['code'] ?? null;
if (!$code) {
$_SESSION['sso_error'] = 'Fehler: Kein Autorisierungscode erhalten.';
header("Location: login.php");
exit;
}
// ==============================
// Token-Anfrage
// ==============================
$tokenUrl = "https://login.microsoftonline.com/$tenantId/oauth2/v2.0/token";
$data = [
'client_id' => $clientId,
'client_secret' => $clientSecret,
'grant_type' => 'authorization_code',
'code' => $code,
'redirect_uri' => $redirectUri,
'scope' => 'openid profile email offline_access'
];
$options = [
'http' => [
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data)
]
];
$context = stream_context_create($options);
$response = @file_get_contents($tokenUrl, false, $context);
if ($response === false) {
$error = error_get_last();
$_SESSION['sso_error'] = 'Fehler bei der Token-Anforderung: ' . ($error['message'] ?? 'unbekannt');
header("Location: login.php");
exit;
}
$tokenData = json_decode($response, true);
if (isset($tokenData['error'])) {
$_SESSION['sso_error'] = 'Fehler: ' . htmlspecialchars($tokenData['error_description'] ?? $tokenData['error']);
header("Location: login.php");
exit;
}
$accessToken = $tokenData['access_token'] ?? null;
$idToken = $tokenData['id_token'] ?? null;
if (!$accessToken || !$idToken) {
$_SESSION['sso_error'] = 'Kein Access Token oder ID-Token erhalten.';
header("Location: login.php");
exit;
}
// ==============================
// ID-Token dekodieren
// ==============================
$parts = explode('.', $idToken);
if (count($parts) !== 3) {
$_SESSION['sso_error'] = 'Ungültiges ID-Token-Format.';
header("Location: login.php");
exit;
}
// Payload dekodieren
$payload = $parts[1];
$payload .= str_repeat('=', (4 - strlen($payload) % 4) % 4);
$json = base64_decode(strtr($payload, '-_', '+/'));
$idPayload = json_decode($json, true);
if (json_last_error() !== JSON_ERROR_NONE) {
$_SESSION['sso_error'] = 'Fehler beim Parsen des ID-Token-Payloads.';
header("Location: login.php");
exit;
}
// ==============================
// UPN oder alternative Identifier
// ==============================
$loginName = null;
if (isset($idPayload['upn']) && $idPayload['upn'] !== null) {
$loginName = $idPayload['upn'];
} elseif (isset($idPayload['preferred_username']) && $idPayload['preferred_username'] !== null) {
$loginName = $idPayload['preferred_username'];
} elseif (isset($idPayload['email']) && $idPayload['email'] !== null) {
$loginName = $idPayload['email'];
}
if (!$loginName) {
$_SESSION['sso_error'] = 'Kein gültiger Benutzername im Token enthalten.';
header("Location: login.php");
exit;
}
// ==============================
// Session setzen
// ==============================
$_SESSION['sso'] = $loginName;
$_SESSION['payload'] = json_encode($idPayload);
//
//// Gruppen / Rollen
//if (!empty($idPayload['roles'])) {
// $_SESSION['sso_roles'] = $idPayload['roles'];
// header("Location: login.php");
// exit;
//} elseif (!empty($idPayload['groups'])) {
// $_SESSION['sso_groups'] = $idPayload['groups'];
// header("Location: login.php");
// exit;
//} else {
// $_SESSION['sso_groups_error'] = 'Keine Gruppen oder Rollen im Token enthalten.';
// header("Location: login.php");
// exit;
//}
header("Location: login.php");
exit;

902
html/admin/pdf_generic.php Normal file
View File

@@ -0,0 +1,902 @@
<?php
/*=======================================================================
*
* pdf_generic.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
if (!isset($automailer) || $automailer != "1") :
include_once ("../include/auth.inc.php");
endif;
include_once ("../include/image.inc.php");
include_once ("../include/jb_detail_history.inc.php");
// Check this file
if (mcIsSet($includePDFGeneric) != "1") :
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act", "customerId", "cscIdRoot", "cscIdActual", "statusMessage", "deactivateMenu",
"jbId", "csId", "crId", "storeAsFile", "dbhistory"));
endif;
$phpVer56Plus = false;
if (substr(phpversion(), 0, 3) >= "5.6") :
$phpVer56Plus = true;
endif;
$pageTitel = "PDF-Generator";
// include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
// Check for authentication access and granted rights
if (!isset($automailer) || $automailer != "1") :
$usrAccessArray["hq"] = "1"; $usrAccessArray["cs"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
endif;
// Execution-Time for script
set_time_limit(0);
$outputFormatField = defineOutputFormats();
// Init
mcIsSet($jbId);
mcIsSet($storeAsFile);
$utf8euro = mb_convert_encoding("", 'UTF-8');
$utf8sz = mb_convert_encoding("ß", 'UTF-8');
// Include functions
include_once ("../include/inc_pdf.inc.php");
// *********************************************
// TESTABSCHNITTE
// [0.] Ausgabeeinstellungen
/*
error_reporting(E_ALL);
ini_set('display_errors', 1);
*/
// [I.] Auflistung verfügbarer Methoden
/*
try {
// Erstelle eine neue PDFlib-Instanz
$pdf = new PDFlib();
// Überprüfe, welche Methoden verfügbar sind
echo "Verfügbare Methoden in PDFlib:<br>";
$methods = get_class_methods($pdf);
foreach ($methods as $method) {
echo $method . "<br>";
}
} catch (PDFlibException $e) {
echo "PDFlib-Fehler: " . $e->get_errmsg();
} catch (Exception $e) {
echo "Allgemeiner Fehler: " . $e->getMessage();
}
*/
// [II.] Voreinstellungen abfragen
/*
$pdf = new PDFlib();
$pdf->set_option("errorpolicy=exception");
echo "Fehlernummer: " . $pdf->get_errnum() . "<br>";
*/
// die();
// *********************************************
// ***********************************
// * Generate PDF document for a JOB *
// ***********************************
if ($f_act == "generatePDFJob") :
if ($jbId != "") :
// Decision to use the job archive or normal tables
$dbhistory = checkHistoryLevel($dbhistory, "jb", $jbId);
$dbhistory = getDBNames($dbhistory);
$automailer = "1"; // Takes care for NO web output in jb_details
$f_act = ""; // Takes care for NO operation in jb_details
// Declare PDF File
getPDFObject(getLicenceKey());
// PDF_open_file($pdf);
// open new PDF file; insert a file name to create the PDF on disk
if ($pdf->begin_document("", "") == 0) {
die("Error: " . $pdf->get_errmsg());
}
setPDFInfo("Auftragsdetails");
setPDFParameter();
$font = $pdf->load_font("Arial", "winansi", "");
// Current job and mail address
$job_id = $jbId; // Prepare for "jb_details.php" ...
$currentHqId = getFieldValueFromId($dbh_jb,"jb_id",$job_id,"hq_id");
// Get number of entries in tour to scale the width of the PDF-page
$pdfPageWidth = getParameterValue("0", "PDF_PAGE_WIDTH", $hq_id);
if ($pdfPageWidth == "" || !is_numeric($pdfPageWidth)) : $pdfPageWidth = 595; endif;
$pdfPageHeight = getParameterValue("0", "PDF_PAGE_HEIGHT", $hq_id);
if ($pdfPageHeight == "" || !is_numeric($pdfPageHeight)) : $pdfPageHeight = 842; endif;
// Get number of stations of the current job
$numOfTourEntries = getCountOfTable($dbh_tr, "jb_id = '" . $job_id . "'");
// Number of displayed stations per line
$constPDFNumOfStationsPerLine = getParameterValue("0", "PDF_JB_STATIONS_PER_LINE", $hq_id);
if ($constPDFNumOfStationsPerLine == "" || !is_numeric($constPDFNumOfStationsPerLine)) : $constPDFNumOfStationsPerLine = 4; endif;
// Offset for rows
$pdfTextOffsetRow = getParameterValue("0", "PDF_TEXT_OFFSET_LINE", $hq_id);
if ($pdfTextOffsetRow == "" || !is_numeric($pdfTextOffsetRow)) : $pdfTextOffsetRow = "10"; endif;
$pdfLineFeed = getParameterValue("0", "PDF_JB_STATIONS_LINE_FEED", $hq_id);
if ($pdfLineFeed == "" || !is_numeric($pdfLineFeed)) : $pdfLineFeed = "0"; endif;
if ($pdfLineFeed == "1" && $numOfTourEntries > 5) :
$pdfPageWidth += (($numOfTourEntries - 5) * 200);
endif;
pdfNewPage();
// Check for getting real or historic job data
$takeRealJobData = checkForTakingRealOrHistoricJobData("0");
if ($takeRealJobData) :
// ****************************
// *** Use current job data ***
// ****************************
if ($job_id != "" && $currentHqId != "") :
ob_start();
if ($takeRealJobData) :
$tmpJobDataArray = getJobSnapshot($job_id, "1", "0");
endif;
ob_end_clean(); // Erases output buffer
endif;
// Job data
$result = $db->query($sqlqueryJob);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage() . ": " . $sqlStatementArray[0]);
$titles = "Fahrzeug,Auftragszeit,Annahme,Erledigung";
$fields = "vht_value,jb_ordertime,jb_taketime,jb_finishtime";
$displayFormats = "1,1,1,14"; // Look for mcglobal.php
$titlesArray = spliti(",",$titles);
$fieldsArray = spliti(",",$fields);
$displayFormatsArray = spliti(",",$displayFormats);
$fieldsLength = count($fieldsArray);
$pdfCurrentPositionYJobData = $pdfCurrentPositionY - 15;
while ($row = $result->fetch_assoc()):
for ($j = 0; $j < $fieldsLength; $j++) :
if (trim($titlesArray[$j]) == "") : $titlesArray[$j] = " "; endif;
$tmpVarName = $fieldsArray[$j];
$row[$tmpVarName] = str_replace("<br>", " ", $row[$tmpVarName]);
$row[$tmpVarName] = str_replace("&nbsp;", " ", $row[$tmpVarName]);
if ($displayFormatsArray[$j] == "") : $displayFormatsArray[$j] = "1"; endif;
$pdfCurrentPositionYJobData = $pdfCurrentPositionYJobData - $pdfTextOffsetRow;
$tmpOut = $titlesArray[$j] . ": ";
if (!mb_check_encoding($tmpOut, 'UTF-8')) {
$tmpOut = mb_convert_encoding($tmpOut, 'UTF-8');
}
$pdf->show_xy($tmpOut, 15, $pdfCurrentPositionYJobData);
$tmpOut = formatOutput($row[$tmpVarName],$outputFormatField[$tmpVarName],$displayFormatsArray[$j]);
if (!mb_check_encoding($tmpOut, 'UTF-8')) {
$tmpOut = mb_convert_encoding($tmpOut, 'UTF-8');
}
$pdf->show_xy($tmpOut, 100, $pdfCurrentPositionYJobData);
$job_cr_sid = $row["cr_sid"];
endfor;
endwhile;
$result->free();
// Courier data
if ($sqlqueryCourier != "") :
$result = $db->query($sqlqueryCourier);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage() . ": " . $sqlStatementArray[2]);
$titles = "Name,Vorname,SID";
$fields = "usr_name,usr_firstname,cr_sid";
$titlesArray = spliti(",",$titles);
$fieldsArray = spliti(",",$fields);
$fieldsLength = count($fieldsArray);
$pdfCurrentPositionYCourierData = $pdfCurrentPositionY - 15;
while ($row = $result->fetch_assoc()):
for ($j = 0; $j < $fieldsLength; $j++) :
if (trim($titlesArray[$j]) == "") : $titlesArray[$j] = " "; endif;
$tmpVarName = $fieldsArray[$j];
// Take cr_sid from job because (1:n)-relation "courier:vehicle"
if ($tmpVarName == "cr_sid") :
$row[$tmpVarName] = $job_cr_sid;
endif;
$row[$tmpVarName] = str_replace("<br>", " ", $row[$tmpVarName]);
$row[$tmpVarName] = str_replace("&nbsp;", " ", $row[$tmpVarName]);
$pdfCurrentPositionYCourierData = $pdfCurrentPositionYCourierData - $pdfTextOffsetRow;
$tmpOut = $titlesArray[$j] . ": ";
if (!mb_check_encoding($tmpOut, 'UTF-8')) {
$tmpOut = mb_convert_encoding($tmpOut, 'UTF-8');
}
$pdf->show_xy($tmpOut, 250, $pdfCurrentPositionYCourierData);
$tmpOut = formatOutput($row[$tmpVarName],$outputFormatField[$tmpVarName]);
if (!mb_check_encoding($tmpOut, 'UTF-8')) {
$tmpOut = mb_convert_encoding($tmpOut, 'UTF-8');
}
$pdf->show_xy($tmpOut, 300, $pdfCurrentPositionYCourierData);
endfor;
endwhile;
$result->free();
endif;
// Job costs
if ($sqlqueryCosts != "") :
$result = $db->query($sqlqueryCosts);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage() . ": " . $sqlStatementArray[3]);
$titles = "Kostenstelle,EID,Kunde,Leistung,Betrag";
$fields = "csc_name,cs_eid,cmp_comp,trs_srv_name,business_volume";
$titlesArray = spliti(",",$titles);
$fieldsArray = spliti(",",$fields);
$fieldsLength = count($fieldsArray);
$sumOfBusinessVolume = 0;
$rowCounter = 0;
$pdfCurrentPositionYCostsData = min($pdfCurrentPositionYJobData, $pdfCurrentPositionYCourierData) - 25;
while ($row = $result->fetch_assoc()):
if ($row["business_volume"] != 0) :
$rowCounter++;
$pdfTextOffsetCol = 0; // Offset for cols
if ($rowCounter == 1) :
$tmpOut = $titlesArray[$j] . ": ";
if (!mb_check_encoding($tmpOut, 'UTF-8')) {
$tmpOut = mb_convert_encoding($tmpOut, 'UTF-8');
}
$pdf->show_xy($tmpOut . ": ", (15 + $pdfTextOffsetCol), $pdfCurrentPositionYCostsData);
endif;
$pdfCurrentPositionYCostsData = $pdfCurrentPositionYCostsData - $pdfTextOffsetRow;
for ($j = 0; $j < $fieldsLength; $j++) :
if (trim($titlesArray[$j]) == "") : $titlesArray[$j] = " "; endif;
$tmpVarName = $fieldsArray[$j];
$row[$tmpVarName] = str_replace("<br>", " ", $row[$tmpVarName]);
$row[$tmpVarName] = str_replace("&nbsp;", " ", $row[$tmpVarName]);
$row[$tmpVarName] = substr($row[$tmpVarName],0,30);
// Summation field
if ($tmpVarName == "business_volume") :
$sumOfBusinessVolume += $row[$tmpVarName];
endif;
mcArrIsSet($outputFormatField, $tmpVarName);
$outField = formatOutput($row[$tmpVarName],$outputFormatField[$tmpVarName]);
$outField = substr($outField,0,25);
// Format business volume
if ($tmpVarName == "business_volume") :
$outField = pad($outField,8," ");
endif;
if (!mb_check_encoding($outField, 'UTF-8')) {
$outField = mb_convert_encoding($outField, 'UTF-8');
}
$pdf->show_xy($outField, (15 + $pdfTextOffsetCol), $pdfCurrentPositionYCostsData);
$pdfTextOffsetCol = $pdfTextOffsetCol + 125;
endfor;
endif;
endwhile;
$result->free();
if ($rowCounter > 0) :
$pdfTextOffsetCol = $pdfTextOffsetCol - 125;
$sumOfBusinessVolume = number_format(round($sumOfBusinessVolume,2), 2, ",", ".");
$sumOfBusinessVolume = pad($sumOfBusinessVolume,8," ");
$pdfCurrentPositionYCostsData = $pdfCurrentPositionYCostsData - $pdfTextOffsetRow;
$pdf->show_xy("GESAMT", (15 + $pdfTextOffsetCol - 50), $pdfCurrentPositionYCostsData);
$pdf->show_xy($sumOfBusinessVolume, (15 + $pdfTextOffsetCol), $pdfCurrentPositionYCostsData);
endif;
endif;
// Tour data
$result = $db->query($sqlqueryTour);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage() . ": " . $sqlStatementArray[1]);
$titles = "Firma,Zusatz,Person,Straße + Hausnr.,PLZ + Ort,EID,Kostenstelle,Tel.,Kommissionsnr.,Erledigungszeit,Klartext,Unterschrift";
$fields = "tr_comp,tr_comp2,tr_person,ad_street_hsno,ad_zipcode_city,cs_eid,csc_name,tr_phone,tr_commission_no,tr_finishtime,tr_signname,tr_sign";
$titlesArray = spliti(",",$titles);
$fieldsArray = spliti(",",$fields);
$fieldsLength = count($fieldsArray);
$rowCounter = 0;
$numOfPrintedTourLine = 1;
$pdfCurrentPositionYTourDataOffset = 0;
$pdfTextOffsetCol = 0; // Offset for cols
$imgFilenames = array();
while ($row = $result->fetch_assoc()):
$rowCounter++;
if ($rowCounter > 1 && (($rowCounter - 1) % $constPDFNumOfStationsPerLine) == 0) :
$pdfCurrentPositionYTourDataOffset = $pdfCurrentPositionYTourDataOffset + 180;
$pdfTextOffsetCol = 0;
$numOfPrintedTourLine++;
endif;
if ($numOfPrintedTourLine == 4) :
$pdf->end_page_ext("");
$pdfCurrentPositionYTourDataOffset = 0;
pdfNewPage(430);
$numOfPrintedTourLine = 0;
endif;
$pdfCurrentPositionYTourData = $pdfCurrentPositionYCostsData - 25 - $pdfCurrentPositionYTourDataOffset;
for ($j = 0; $j < $fieldsLength; $j++) :
if (trim($titlesArray[$j]) == "") : $titlesArray[$j] = " "; endif;
if (($rowCounter - 1) % $constPDFNumOfStationsPerLine == 0) :
$tmpOut = $titlesArray[$j] . ": ";
if (!mb_check_encoding($tmpOut, 'UTF-8')) {
$tmpOut = mb_convert_encoding($tmpOut, 'UTF-8');
}
$pdf->show_xy($tmpOut . ": ", (15 + $pdfTextOffsetCol), $pdfCurrentPositionYTourData);
endif;
$tmpVarName = $fieldsArray[$j];
${$tmpVarName} = mcArrIsSet($row, $tmpVarName);
$outField = "";
// if (${$tmpVarName} == "null") : ${$tmpVarName} = ""; endif;
if (${$tmpVarName} != "") :
// ${$tmpVarName} = mb_convert_encoding(${$tmpVarName}, 'UTF-8');
mcArrIsSet($outputFormatField, $tmpVarName);
$outField = formatOutput(${$tmpVarName},$outputFormatField[$tmpVarName]);
endif;
// Customer-sign
if ($tmpVarName == "tr_sign") :
if ($row["tr_sign"] != "") :
$rawCoord = splitRawCoordinates($row["tr_sign"]);
$maxCoord = checkMaxCoordinates($rawCoord);
$tmpSignPath = "../temp/signs/";
if (SIGNS_PATH != "") : $tmpSignPath = SIGNS_PATH; endif;
$imgFilename = $tmpSignPath . $job_id . "_" . $row["tr_sort"] . ".png";
$imgFilenames[] = $imgFilename;
$im = createSignImage($rawCoord);
$boolImg = true;
if (!file_exists($imgFilename)) :
$boolImg = imagepng($im, $imgFilename);
endif;
if ($boolImg) :
$image1 = $pdf->load_image("png", $imgFilename, "");
if ($image1 != -1) :
// pdf_place_image($pdf, $image1, (100 + $pdfTextOffsetCol), ($pdfCurrentPositionYTourData - $maxCoord[1]), 0.5);
// $pdf->fit_image($image1, (100 + $pdfTextOffsetCol), ($pdfCurrentPositionYTourData - $maxCoord[1]), "scale 0.5" );
// $pdf->fit_image($image1, (100 + $pdfTextOffsetCol), $pdfCurrentPositionYTourData - 50, "scale 0.4" );
$pdf->fit_image($image1, (100 + $pdfTextOffsetCol), $pdfCurrentPositionYTourData - 50, "boxsize {100 50} fitmethod meet" );
endif;
endif;
endif;
endif;
// Finishtime of the stop
if ($tmpVarName == "tr_finishtime") :
mcIsSet($tr_finishtime);
if (substr($tr_finishtime,0,4) == "1970") :
$outField = "";
endif;
endif;
// Do not show customer data if external costcenter
if ($tmpVarName == "usr_phone" || $tmpVarName == "usr_email" || $tmpVarName == "cs_eid") :
$tmpCscPath = mcArrIsSet($row, "csc_path");
if ($tmpCscPath != "" &&!(strpos(strtoupper($tmpCscPath), "//EXTERN//") === FALSE)) :
$outField = "";
endif;
endif;
if ($tmpVarName != "tr_sign") : // all but the sign !!!
if ($outField == "&nbsp;") : $outField = ""; endif;
$outField = substr($outField, 0, 24);
if (!mb_check_encoding($outField, 'UTF-8')) {
$outField = mb_convert_encoding($outField, 'UTF-8');
}
$pdf->show_xy($outField, (100 + $pdfTextOffsetCol), $pdfCurrentPositionYTourData);
endif;
$pdfCurrentPositionYTourData = $pdfCurrentPositionYTourData - $pdfTextOffsetRow;
endfor;
$pdfTextOffsetCol = $pdfTextOffsetCol + 120;
endwhile;
$result->free();
// Remove stored temporary images (signs) on the filesystem
$tmpSignPath = "../temp/signs/";
$imgFilenamesLen = count($imgFilenames);
if (SIGNS_PATH != "") : $tmpSignPath = SIGNS_PATH; endif;
for ($im = 0; $im < $imgFilenamesLen; $im++) :
if (file_exists($tmpSignPath . $imgFilenames[$im])) :
unlink($tmpSignPath . $imgFilenames[$im]);
endif;
endfor;
else :
// ***********************************
// *** Use historic job (raw) data ***
// ***********************************
// Job data
$titles = "Fahrzeug,Auftragszeit,Annahme,Erledigung";
$fields = "vht_value,jb_ordertime,jb_taketime,jb_finishtime";
$titlesArray = spliti(",",$titles);
$fieldsArray = spliti(",",$fields);
$fieldsLength = count($fieldsArray);
$pdfCurrentPositionYJobData = $pdfCurrentPositionY - 15;
for ($j = 0; $j < $fieldsLength; $j++) :
if (trim($titlesArray[$j]) == "") : $titlesArray[$j] = " "; endif;
$tmpVarName = $fieldsArray[$j];
$fieldValue = ${"jb_" . $tmpVarName};
$fieldValue = str_replace("<br>", " ", $fieldValue);
$fieldValue = str_replace("&nbsp;", " ", $fieldValue);
$pdfCurrentPositionYJobData = $pdfCurrentPositionYJobData - $pdfTextOffsetRow;
$tmpOut = $titlesArray[$j] . ": ";
if (!mb_check_encoding($tmpOut, 'UTF-8')) {
$tmpOut = mb_convert_encoding($tmpOut, 'UTF-8');
}
$pdf->show_xy($tmpOut, 15, $pdfCurrentPositionYJobData);
if (!mb_check_encoding($fieldValue, 'UTF-8')) {
$fieldValue = mb_convert_encoding($fieldValue, 'UTF-8');
}
$pdf->show_xy($fieldValue, 100, $pdfCurrentPositionYJobData);
$job_cr_sid = $jb_cr_sid;
endfor;
// Courier data
$titles = "Name,Vorname,SID";
$fields = "usr_name,usr_firstname,cr_sid";
$titlesArray = spliti(",",$titles);
$fieldsArray = spliti(",",$fields);
$fieldsLength = count($fieldsArray);
$pdfCurrentPositionYCourierData = $pdfCurrentPositionY - 15;
for ($j = 0; $j < $fieldsLength; $j++) :
if (trim($titlesArray[$j]) == "") : $titlesArray[$j] = " "; endif;
$tmpVarName = $fieldsArray[$j];
$fieldValue = ${"cr_" . $tmpVarName};
// Take cr_sid from job because (1:n)-relation "courier:vehicle"
if ($tmpVarName == "cr_sid") :
$fieldValue = $job_cr_sid;
endif;
$fieldValue = str_replace("<br>", " ", $fieldValue);
$fieldValue = str_replace("&nbsp;", " ", $fieldValue);
$pdfCurrentPositionYCourierData = $pdfCurrentPositionYCourierData - $pdfTextOffsetRow;
$tmpOut = $titlesArray[$j] . ": ";
if (!mb_check_encoding($tmpOut, 'UTF-8')) {
$tmpOut = mb_convert_encoding($tmpOut, 'UTF-8');
}
$pdf->show_xy($tmpOut . ": ", 250, $pdfCurrentPositionYCourierData);
$tmpOut = formatOutput($fieldValue,$outputFormatField[$tmpVarName]);
if (!mb_check_encoding($tmpOut, 'UTF-8')) {
$tmpOut = mb_convert_encoding($tmpOut, 'UTF-8');
}
$pdf->show_xy($tmpOut, 300, $pdfCurrentPositionYCourierData);
endfor;
// Job costs
// $titles = "Kostenstelle,EID,Kunde,Leistung,Betrag";
$titles = "GESAMTBETRAG";
// $fields = "csc_name,cs_eid,cmp_comp,trs_srv_name,business_volume";
$fields = "business_volume";
$titlesArray = spliti(",",$titles);
$fieldsArray = spliti(",",$fields);
$fieldsLength = count($fieldsArray);
$sumOfBusinessVolume = 0;
$pdfTextOffsetCol = 0; // Offset for cols
$pdfCurrentPositionYCostsData = min($pdfCurrentPositionYJobData, $pdfCurrentPositionYCourierData) - 25;
for ($j = 0; $j < $fieldsLength; $j++) :
if (trim($titlesArray[$j]) == "") : $titlesArray[$j] = " "; endif;
$tmpVarName = $fieldsArray[$j];
$fieldValue = "";
// Summation field
if ($tmpVarName == "business_volume") :
if (mcIsSet($costs_sum_withoutmarkup) != "") :
$fieldValue = $costs_sum_withoutmarkup;
endif;
if (mcIsSet($costs_sum) != "") :
$fieldValue = $costs_sum;
endif;
endif;
$tmpOut = $titlesArray[$j] . ": ";
if (!mb_check_encoding($tmpOut, 'UTF-8')) {
$tmpOut = mb_convert_encoding($tmpOut, 'UTF-8');
}
$pdf->show_xy($tmpOut . ": " . $fieldValue, (15 + $pdfTextOffsetCol), $pdfCurrentPositionYCostsData);
// $pdf->show_xy($titlesArray[$j] . ": ", (450 + $pdfTextOffsetCol), $pdfCurrentPositionYCostsData);
// $pdf->show_xy($fieldValue, (520 + $pdfTextOffsetCol), $pdfCurrentPositionYCostsData);
$pdfTextOffsetCol = $pdfTextOffsetCol + 125;
endfor;
/*
if ($rowCounter > 0) :
$pdfTextOffsetCol = $pdfTextOffsetCol - 150;
$sumOfBusinessVolume = number_format(round($sumOfBusinessVolume,2), 2, ",", ".");
$sumOfBusinessVolume = pad($sumOfBusinessVolume,8," ");
$pdfCurrentPositionYCostsData = $pdfCurrentPositionYCostsData - $pdfTextOffsetRow;
$pdf->show_xy($fieldValue . " GESAMT", (15 + $pdfTextOffsetCol), $pdfCurrentPositionYCostsData);
endif;
*/
// Tour data
$titles = "Firma,Zusatz,Person,Straße + Hausnr.,PLZ + Ort,EID,Kostenstelle,Tel.,Kommissionsnr.,Erledigungszeit,Klartext,Unterschrift";
$fields = "tr_comp,tr_comp2,tr_person,ad_street_hsno,ad_zipcode_city,cs_eid,csc_name,tr_phone,tr_commission_no,tr_finishtime,tr_signname,tr_sign";
$titlesArray = spliti(",",$titles);
$fieldsArray = spliti(",",$fields);
$fieldsLength = count($fieldsArray);
$rowCounter = 0;
$pdfCurrentPositionYTourDataOffset = 0;
$pdfTextOffsetCol = 0; // Offset for cols
$numOfPrintedTourLine = 1;
$imgFilenames = array();
mcIsSet($tr_numberofstations, 0);
for ($i = 0; $i < $tr_numberofstations; $i++) :
$rowCounter++;
if ($rowCounter > 1 && (($rowCounter - 1) % $constPDFNumOfStationsPerLine) == 0) :
$pdfCurrentPositionYTourDataOffset = $pdfCurrentPositionYTourDataOffset + 180;
$pdfTextOffsetCol = 0;
$numOfPrintedTourLine++;
endif;
if ($numOfPrintedTourLine == 4) :
$pdf->end_page_ext("");
$pdfCurrentPositionYTourDataOffset = 0;
pdfNewPage(430);
$numOfPrintedTourLine = 0;
endif;
$pdfCurrentPositionYTourData = $pdfCurrentPositionYCostsData - 25 - $pdfCurrentPositionYTourDataOffset;
for ($j = 0; $j < $fieldsLength; $j++) :
if (trim($titlesArray[$j]) == "") : $titlesArray[$j] = " "; endif;
if (($rowCounter - 1) % $constPDFNumOfStationsPerLine == 0) :
$tmpOut = $titlesArray[$j] . ": ";
if (!mb_check_encoding($tmpOut, 'UTF-8')) {
$tmpOut = mb_convert_encoding($tmpOut, 'UTF-8');
}
$pdf->show_xy($tmpOut, (15 + $pdfTextOffsetCol), $pdfCurrentPositionYTourData);
endif;
$tmpVarName = $fieldsArray[$j];
$fieldValue = ${"tr_" . $rowCounter. "_" . $tmpVarName};
// $outField = formatOutput($fieldValue,$outputFormatField[$tmpVarName]);
$outField = $fieldValue;
// Customer-sign
if ($tmpVarName == "tr_sign") :
if ($fieldValue != "") :
$rawCoord = splitRawCoordinates($fieldValue);
$maxCoord = checkMaxCoordinates($rawCoord);
$tmpSignPath = "../temp/signs/";
if (SIGNS_PATH != "") : $tmpSignPath = SIGNS_PATH; endif;
$imgFilename = $tmpSignPath . $job_id . "_" . ($i + 1) . ".png";
$imgFilenames[] = $imgFilename;
$im = createSignImage($rawCoord);
$boolImg = true;
if (!file_exists($imgFilename)) :
$boolImg = imagepng($im, $imgFilename);
endif;
if ($boolImg) :
$image1 = $pdf->load_image("png", $imgFilename, "");
if ($image1 != -1) :
// $pdf->fit_image($image1, (100 + $pdfTextOffsetCol), ($pdfCurrentPositionYTourData - $maxCoord[1]), "scale 0.5" );
// $pdf->fit_image($image1, (100 + $pdfTextOffsetCol), $pdfCurrentPositionYTourData - 50, "scale 0.4" );
$pdf->fit_image($image1, (100 + $pdfTextOffsetCol), $pdfCurrentPositionYTourData - 50, "boxsize {100 50} fitmethod meet" );
endif;
endif;
endif;
endif;
// Finishtime of the stop
if ($tmpVarName == "tr_finishtime") :
mcIsSet($tr_finishtime);
if (substr($tr_finishtime,0,4) == "1970") :
$outField = "";
endif;
endif;
// Do not show customer data if external costcenter
/*
if ($tmpVarName == "usr_phone" || $tmpVarName == "usr_email" || $tmpVarName == "cs_eid") :
if (!(strpos(strtoupper($row["csc_path"]), "//EXTERN//") === FALSE)) :
$outField = "";
endif;
endif;
*/
if ($tmpVarName != "tr_sign") : // all but the sign !!!
if ($outField == "&nbsp;") : $outField = ""; endif;
$outField = substr($outField, 0, 24);
if (!mb_check_encoding($outField, 'UTF-8')) {
$outField = mb_convert_encoding($outField, 'UTF-8');
}
$pdf->show_xy($outField, (100 + $pdfTextOffsetCol), $pdfCurrentPositionYTourData);
endif;
$pdfCurrentPositionYTourData = $pdfCurrentPositionYTourData - $pdfTextOffsetRow;
endfor;
$pdfTextOffsetCol = $pdfTextOffsetCol + 120;
endfor;
// Remove stored temporary images (signs) on the filesystem
$tmpSignPath = "../temp/signs/";
$imgFilenamesLen = count($imgFilenames);
if (SIGNS_PATH != "") : $tmpSignPath = SIGNS_PATH; endif;
for ($im = 0; $im < $imgFilenamesLen; $im++) :
if (file_exists($tmpSignPath . $imgFilenames[$im])) :
unlink($tmpSignPath . $imgFilenames[$im]);
endif;
endfor;
endif;
$pdf->end_page_ext("");
if ($storeAsFile == "1") :
if ($pdfFile == "") : $pdfFile = "Auftrag_" . $jbId . ".pdf"; endif;
closePDFObjectAsFile($pdfFile);
else :
closePDFObject("Auftrag_" . $jbId);
die();
endif;
else :
$statusMessage = "Es wurde kein Auftrag selektiert!";
endif;
endif;
// ****************************************
// * Generate PDF document for a CUSTOMER *
// ****************************************
if ($f_act == "generatePDFCustomer") :
if ($csId != "") :
$f_act = ""; // Takes care for NO operation in jb_details
// Declare PDF File
getPDFObject(getLicenceKey());
// PDF_open_file($pdf);
// open new PDF file; insert a file name to create the PDF on disk
if ($pdf->begin_document("", "") == 0) {
die("Error: " . $pdf->get_errmsg());
}
setPDFInfo("Kunde");
setPDFParameter();
$font = $pdf->load_font("Arial", "winansi", "");
// $pdf->setfont($font, 16);
// echo "font = " . $font . "<br>"; die();
ob_start();
ob_end_clean(); // Erases output buffer
// Get number of entries in tour to scale the width of the PDF-page
$pdfPageWidth = 500;
$pdfPageHeight = 700;
$tabulator_00 = 15;
$tabulator_01 = 110;
$pdf->begin_page_ext(0,0, "width=" . $pdfPageWidth . " height=" . $pdfPageHeight);
$pdf->setfont($font, 12);
if (!mb_check_encoding($f_cmp_comp, 'UTF-8')) {$f_cmp_comp = mb_convert_encoding($f_cmp_comp, 'UTF-8');};
if (!mb_check_encoding($f_cmp_comp2, 'UTF-8')) {$f_cmp_comp2 = mb_convert_encoding($f_cmp_comp2, 'UTF-8');};
$offset = 0;
$pdf->show_xy("Kunde: ", $tabulator_00, $pdfPageHeight - ($offset + 30));
$pdf->show_xy($f_cmp_comp, $tabulator_01, $pdfPageHeight - ($offset + 30));
$pdf->show_xy($f_cmp_comp2, $tabulator_01, $pdfPageHeight - ($offset + 45));
$pdf->show_xy("[". $f_cs_eid . "]", $tabulator_01, $pdfPageHeight - ($offset + 60));
$pdf->setfont($font, 10);
if (!mb_check_encoding($f_cmp_tax_idno, 'UTF-8')) {$f_cmp_tax_idno = mb_convert_encoding($f_cmp_tax_idno, 'UTF-8');};
$offset = 80;
$pdf->show_xy("Steuernr.: ", $tabulator_00, $pdfPageHeight - $offset);
$pdf->show_xy($f_cmp_tax_idno, $tabulator_01, $pdfPageHeight - $offset);
if (!mb_check_encoding($f_cmp_stax_idno, 'UTF-8')) {$f_cmp_stax_idno = mb_convert_encoding($f_cmp_stax_idno, 'UTF-8');};
$offset = 90;
$pdf->show_xy("USt.-Nr.: ", $tabulator_00, $pdfPageHeight - $offset);
$pdf->show_xy($f_cmp_stax_idno, $tabulator_01, $pdfPageHeight - $offset);
if (!mb_check_encoding($f_cmp_bank, 'UTF-8')) {$f_cmp_bank = mb_convert_encoding($f_cmp_bank, 'UTF-8');};
$offset = 110;
$pdf->show_xy("Bankverbindung: ", $tabulator_00, $pdfPageHeight - $offset);
$pdf->show_xy($f_cmp_bank, $tabulator_01, $pdfPageHeight - $offset);
$pdf->show_xy("Konto: " . $f_cmp_bankacc . " BLZ: " . $f_cmp_bankno, $tabulator_01, $pdfPageHeight - ($offset + 10));
if (!mb_check_encoding($f_ad_street, 'UTF-8')) {$f_ad_street = mb_convert_encoding($f_ad_street, 'UTF-8');};
if (!mb_check_encoding($f_ad_city, 'UTF-8')) {$f_ad_city = mb_convert_encoding($f_ad_city, 'UTF-8');};
$offset = 140;
$pdf->show_xy("Stra" . $utf8sz . "e, Nr.: ", $tabulator_00, $pdfPageHeight - $offset);
$pdf->show_xy($f_ad_street . " " . $f_cmp_hsno, $tabulator_01, $pdfPageHeight - $offset);
$pdf->show_xy("PLZ, Ort: ", $tabulator_00, $pdfPageHeight - ($offset + 10));
$pdf->show_xy($f_ad_zipcode . " " . $f_ad_city, $tabulator_01, $pdfPageHeight - ($offset + 10));
$offset = 170;
$pdf->show_xy("Email: ", $tabulator_00, $pdfPageHeight - $offset);
$pdf->show_xy($f_usr_email, $tabulator_01, $pdfPageHeight - $offset);
$pdf->show_xy("Mail bei:", $tabulator_00, $pdfPageHeight - ($offset + 10));
$pdf->show_xy("Erledigung: " . ($f_cs_jbstatusmail == "1" ? "Ja" : "Nein") . " Abholung: " . ($f_cs_jbstatusmail2 == "1" ? "Ja" : "Nein") . " Erfassung: " . ($f_cs_jbstatusmail3 == "1" ? "Ja" : "Nein") , $tabulator_01, $pdfPageHeight - ($offset + 10));
$offset = 200;
$pdf->show_xy("Telekommunik.: ", $tabulator_00, $pdfPageHeight - $offset);
$pdf->show_xy("Tel.: " . $f_usr_phone . " Mobil: " . $f_usr_phone2, $tabulator_01, $pdfPageHeight - $offset);
$pdf->show_xy("Fax: " . $f_usr_fax, $tabulator_01, $pdfPageHeight - ($offset + 10));
if (!mb_check_encoding($f_usr_name, 'UTF-8')) {$f_usr_name = mb_convert_encoding($f_usr_name, 'UTF-8');};
if (!mb_check_encoding($f_usr_firstname, 'UTF-8')) {$f_usr_name = mb_convert_encoding($f_usr_firstname, 'UTF-8');};
$offset = 230;
$pdf->show_xy("Benutzer: ", $tabulator_00, $pdfPageHeight - $offset);
$pdf->show_xy("Name: " . $f_usr_name . " Vorname: " . $f_usr_firstname, $tabulator_01, $pdfPageHeight - $offset);
$pdf->show_xy("Zugangskonto: " . $f_usr_account, $tabulator_01, $pdfPageHeight - ($offset + 10));
$offset = 260;
$pdf->show_xy("Status: ", $tabulator_00, $pdfPageHeight - $offset);
$pdf->show_xy(($f_cmp_authenticated == "1" ? "Nicht gesperrt" : "Gesperrt") . " und " . ($f_cmp_visible == "1" ? "sichtbar" : "nicht sichtbar"), $tabulator_01, $pdfPageHeight - $offset);
$offset = 280;
$pdf->show_xy("Rabatt: ", $tabulator_00, $pdfPageHeight - $offset);
$pdf->show_xy($f_cs_discount . " % (auf Fixpreis: " . ($f_cs_fixprice_discount == "1" ? "Aktiv" : "Nicht aktiv") . ")", $tabulator_01, $pdfPageHeight - $offset);
$pdf->show_xy("Porto: ", $tabulator_00, $pdfPageHeight - ($offset + 10));
$pdf->show_xy($f_cmp_postage . " " . $utf8euro, $tabulator_01, $pdfPageHeight - ($offset + 10));
$pdf->show_xy("Provision: ", $tabulator_00, $pdfPageHeight - ($offset + 20));
$pdf->show_xy($f_cs_prov . " %", $tabulator_01, $pdfPageHeight - ($offset + 20));
$pdf->show_xy("Zuschlag: ", $tabulator_00, $pdfPageHeight - ($offset + 30));
$pdf->show_xy($f_cs_markup_prov . " % (" . ($f_cs_markup == "1" ? "aktiv" : "nicht aktiv") . ")", $tabulator_01, $pdfPageHeight - ($offset + 30));
$pdf->show_xy("MwSt.: ", $tabulator_00, $pdfPageHeight - ($offset + 40));
$pdf->show_xy($g_tx_value . " % (" . $g_tx_sign . ")", $tabulator_01, $pdfPageHeight - ($offset + 40));
$pdf->show_xy("Versand: ", $tabulator_00, $pdfPageHeight - ($offset + 50));
$pdf->show_xy("Rechnung an Zentrale: " . ($f_cmp_inv2hq_0 == "checked" ? "JA" : "NEIN") . " " . "Einzelrechnung: " . ($f_cmp_inv2hq_1 == "checked" ? "JA" : "NEIN"), $tabulator_01, $pdfPageHeight - ($offset + 50));
$pdf->show_xy("Kommiss.-Nr.: ", $tabulator_00, $pdfPageHeight - ($offset + 60));
$pdf->show_xy("Erforderlich im Auftrag: " . ($f_cs_commission_no_1 == "checked" ? "JA" : "NEIN"), $tabulator_01, $pdfPageHeight - ($offset + 60));
$pdf->show_xy("Vermittlung: ", $tabulator_00, $pdfPageHeight - ($offset + 70));
$pdf->show_xy("Listenkunde: " . ($f_cs_jobbatch_0 == "checked" ? "JA" : "NEIN") . " " . "Anforderung: " . ($f_cs_cr_fav_only_0 == "checked" ? "JA" : "NEIN") . " " . "Rechnungstext: " . ($f_cs_invtext_mode_0 == "checked" ? "JA" : "NEIN"), $tabulator_01, $pdfPageHeight - ($offset + 70));
$offset = 370;
$pdf->show_xy("Branche: ", $tabulator_00, $pdfPageHeight - $offset);
$pdf->show_xy($g_br_name . " (" . $g_br_key . ")", $tabulator_01, $pdfPageHeight - $offset);
mcIsSet($adInvoiceFields, array());
mcArrIsSet($adInvoiceFields, 0); mcArrIsSet($adInvoiceFields, 1); mcArrIsSet($adInvoiceFields, 2);
if (!mb_check_encoding($adInvoiceFields[0], 'UTF-8')) {$adInvoiceFields[0] = mb_convert_encoding($adInvoiceFields[0], 'UTF-8');};
if (!mb_check_encoding($adInvoiceFields[1], 'UTF-8')) {$adInvoiceFields[1] = mb_convert_encoding($adInvoiceFields[1], 'UTF-8');};
if (!mb_check_encoding($adInvoiceFields[2], 'UTF-8')) {$adInvoiceFields[2] = mb_convert_encoding($adInvoiceFields[2], 'UTF-8');};
$offset = 390;
$pdf->show_xy("Abw. Rechn.: ", $tabulator_00, $pdfPageHeight - $offset);
if ($adIdRootInvoice != "" && ($adIdRootInvoice != $f_ad_id || $adHsnoRootInvoice != $f_cmp_hsno)) :
$pdf->show_xy($adInvoiceFields[0] . " " . $adHsnoRootInvoice, $tabulator_01, $pdfPageHeight - $offset);
$pdf->show_xy($adInvoiceFields[1] . " " . $adInvoiceFields[2], $tabulator_01, $pdfPageHeight - ($offset + 10));
else :
$pdf->show_xy("Keine", $tabulator_01, $pdfPageHeight - $offset);
endif;
if (!mb_check_encoding($cmpCompRootInvoice, 'UTF-8')) {$cmpCompRootInvoice = mb_convert_encoding($cmpCompRootInvoice, 'UTF-8');};
if (!mb_check_encoding($cmpComp2RootInvoice, 'UTF-8')) {$cmpComp2RootInvoice = mb_convert_encoding($cmpComp2RootInvoice, 'UTF-8');};
$offset = 420;
$pdf->show_xy("Abw. Firma: ", $tabulator_00, $pdfPageHeight - $offset);
if (($cmpCompRootInvoice != $f_cmp_comp || $cmpComp2RootInvoice != $f_cmp_comp2)) :
$pdf->show_xy($cmpCompRootInvoice, $tabulator_01, $pdfPageHeight - $offset);
$pdf->show_xy($cmpComp2RootInvoice, $tabulator_01, $pdfPageHeight - ($offset + 10));
else :
$pdf->show_xy("Keine", $tabulator_01, $pdfPageHeight - $offset);
endif;
if (!mb_check_encoding($g_cscad_comp, 'UTF-8')) {$g_cscad_comp = mb_convert_encoding($g_cscad_comp, 'UTF-8');};
$offset = 450;
$pdf->show_xy("Bezahler: ", $tabulator_00, $pdfPageHeight - $offset);
if ($g_csc_id != "" && $g_cscad_comp != "") :
$pdf->show_xy($g_cscad_comp, $tabulator_01, $pdfPageHeight - $offset);
// $pdf->show_xy($g_cscad_comp2, $tabulator_01, $pdfPageHeight - ($offset + 10));
else :
$pdf->show_xy("Selbst", $tabulator_01, $pdfPageHeight - $offset);
endif;
if (!mb_check_encoding($g2_cmp_comp, 'UTF-8')) {$g2_cmp_comp = mb_convert_encoding($g2_cmp_comp, 'UTF-8');};
$offset = 470;
$pdf->show_xy("Metakunde: ", $tabulator_00, $pdfPageHeight - $offset);
if ($g2_csc_id != "" && $g2_cmp_comp != "") :
$pdf->show_xy($g2_cmp_comp, $tabulator_01, $pdfPageHeight - $offset);
// $pdf->show_xy($g_cscad_comp, $tabulator_01, $pdfPageHeight - ($offset + 10));
else :
$pdf->show_xy("Keiner", $tabulator_01, $pdfPageHeight - $offset);
endif;
if (!mb_check_encoding($f_cmp_remark, 'UTF-8')) {$f_cmp_remark = mb_convert_encoding($f_cmp_remark, 'UTF-8');};
if (!mb_check_encoding($f_cmp_remark2, 'UTF-8')) {$f_cmp_remark2 = mb_convert_encoding($f_cmp_remark2, 'UTF-8');};
$offset = 490;
$pdf->show_xy("Bemerkung: ", $tabulator_00, $pdfPageHeight - $offset);
// $pdf->show_boxed($f_cmp_remark, $tabulator_01, $pdfPageHeight - $offset - 100, 350, 100, "left", "");
$textflow = $pdf->create_textflow($f_cmp_remark, "font={$font} fontsize=8");
// Output text for "$f_cmp_remark"
$offset -= 10;
$boxOffset = 10;
do {
$textflow = $pdf->create_textflow($f_cmp_remark, "font={$font} fontsize=8");
$result = $pdf->fit_textflow($textflow, $tabulator_01, $pdfPageHeight - $offset - $boxOffset, 350, $pdfPageHeight - $offset, "blind=true");
// $pdf->show_xy("X-" . $boxOffset, $tabulator_01, $pdfPageHeight - $offset - $boxOffset);
// $pdf->show_xy("X", 350, $pdfPageHeight - $offset);
if ($result == "_boxfull") {
$boxOffset += 10;
}
} while ($result == "_boxfull");
$textflow = $pdf->create_textflow($f_cmp_remark, "font={$font} fontsize=8");
$pdf->fit_textflow($textflow, $tabulator_01, $pdfPageHeight - $offset - $boxOffset, 350, $pdfPageHeight - $offset, "");
$offset += $boxOffset + 20;
$pdf->show_xy("Interne", $tabulator_00, $pdfPageHeight - $offset);
$pdf->show_xy("Bemerkung", $tabulator_00, $pdfPageHeight - $offset - 10);
// $pdf->show_boxed($f_cmp_remark2, $tabulator_01, $pdfPageHeight - $offset - 210, 350, 100, "left", "");
$textflow = $pdf->create_textflow($f_cmp_remark2, "font={$font} fontsize=8");
// Output text for "$f_cmp_remark2"
$offset -= 10;
$boxOffset = 10;
do {
$textflow = $pdf->create_textflow($f_cmp_remark2, "font={$font} fontsize=8");
$result = $pdf->fit_textflow($textflow, $tabulator_01, $pdfPageHeight - $offset - $boxOffset, 350, $pdfPageHeight - $offset, "blind=true");
// $pdf->show_xy("X-" . $boxOffset, $tabulator_01, $pdfPageHeight - $offset - $boxOffset);
// $pdf->show_xy("X", 350, $pdfPageHeight - $offset);
if ($result == "_boxfull") {
$boxOffset += 10;
}
} while ($result == "_boxfull");
$textflow = $pdf->create_textflow($f_cmp_remark2, "font={$font} fontsize=8");
$pdf->fit_textflow($textflow, $tabulator_01, $pdfPageHeight - $offset - $boxOffset, 350, $pdfPageHeight - $offset, "");
$offset += $boxOffset + 20;
$pdf->setfont($font, 8);
$pdf->end_page_ext("");
if ($storeAsFile == "1") :
if ($pdfFile == "") : $pdfFile = "Kunde_" . $csId . ".pdf"; endif;
closePDFObjectAsFile($pdfFile);
else :
closePDFObject("Kunde_" . $csId);
die();
endif;
else :
$statusMessage = "Es wurde kein Kunde selektiert!";
endif;
endif;
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,268 @@
<?php
/*=======================================================================
*
* premium_details.php
*
* Autor: Carsten Annacker
*
=======================================================================*/
//error_reporting(E_ALL ^ (E_DEPRECATED | E_NOTICE | E_STRICT));
include_once("../include/auth.inc.php");
include_once("../include/global.inc.php");
$log_file_name = "../log/premium_details_" . date("Ym") . ".log";
if (!authCheckEmployeeRights($emp_id, "1")) : die ("$PHP_SELF: Access denied!"); endif;
$httpVarsArray = array("crvh_id");
getSecHttpVars("1", $httpVarsArray);
if (trim($crvh_id) == "") {
$crvh_id = isset($_POST["f_crvh_id"]) ? trim($_POST["f_crvh_id"]) : (isset($_GET["crvh_id"]) ? trim($_GET["crvh_id"]) : 0);
}
$crvh_sid = "";
if ($crvh_id != 0) {
$crvh_sid = $db->getOne("SELECT crvh_sid FROM couriervehicle WHERE crvh_id = '" . $crvh_id . "'");
}
if ($crvh_sid == "") {
$crvh_sid = "(Fahrzeug fehlt)";
$error_text = "<b>Es wurde kein Fahrzeug übergeben!<b>";
}
$sql_query = "SELECT usr_account, usr_firstname, usr_name FROM user WHERE usr_id = " . $usr_id;
$res = $db->query($sql_query);
if (DB::isError($res)) reportDie ("$PHP_SELF: '$sql_query'" . $res->getMessage());
$row = $res->fetch_assoc();
myWriteLog($row["usr_firstname"] . " " . $row["usr_name"] . " (" . $row["usr_account"] . ")");
$res->free();
$content = "";
$error_text .= "<br><br>";
if ($crvh_sid != "(Fahrzeug fehlt)") {
$sql_query = "SELECT gdc_content, gdc_context" .
" FROM genericdatacontainer WHERE gdc_obj_id = " . $crvh_id . " AND gdc_obj_type = 'crvh' AND gdc_gen_fieldname = 'crvh_premium' AND gdc_context = ''" .
" ORDER BY gdc_content";
$res = query_and_log($sql_query, $db);
$nextElem = 1;
$sum = 0;
while ($row = $res->fetch_assoc()) {
$crvh_premium_data = explode("|", $row["gdc_content"]);
$content .= "<tr><td align=left ". '><input name="crvh_premium_text_' . $crvh_premium_data[0] . '" type="text" size="40" maxlength="60" value = "' . $crvh_premium_data[1] .'" class="input inputBig">' . "</td>";
$content .= "<td align=right ". '>&nbsp;<input name="crvh_premium_amount_' . $crvh_premium_data[0] . '" type="text" size="8" maxlength="10" value = "' . $crvh_premium_data[2] . '" class="input inputBigRight" onchange="checkAmount(' . $crvh_premium_data[0] . ')">' . "</td>";
$content .= "<td align=center ". '><input type="checkbox" name="crvh_premium_repeat_' . $crvh_premium_data[0] . '" value="1" class="input inputBigCenter"' . ($crvh_premium_data[3] == "true" ? ' checked' : '') . '>' . "</td>";
$content .= "<td align=left ". '><input name="crvh_premium_comment_' . $crvh_premium_data[0] . '" type="text" size="40" maxlength="60" value = "' . $crvh_premium_data[4] . '" class="input inputBig">' . "</td>";
$content .= '<td><a href="javascript:save_row(' . $crvh_id . ', 3, ' . $crvh_premium_data[0] . ')">&nbsp;<img src=../images/trash.jpg alt="löschen" title="löschen"></a>' . "</td></tr>\n";
$sum += str_replace(",", ".", $crvh_premium_data[2]);
$nextElem = $crvh_premium_data[0] + 1;
}
$res->free();
$content .= "<tr><td align=left ". '><input name="crvh_premium_text_' . $nextElem . '" type="text" size="40" maxlength="60" value = "" class="input inputBig"">' . "</td>";
$content .= "<td align=right ". '>&nbsp;<input name="crvh_premium_amount_' . $nextElem . '" type="text" size="8" maxlength="10" value = "" class="input inputBigRight" onchange="checkAmount(' . $nextElem . ')">' . "</td>";
$content .= "<td align=center ". '><input type="checkbox" name="crvh_premium_repeat_' . $nextElem . '" value="1" class="input inputBigCenter">' . "</td>";
$content .= "<td align=left ". '><input name="crvh_premium_comment_' . $nextElem . '" type="text" size="40" maxlength="60" value = "" class="input inputBig">' . "</td></tr>\n";
$content .= "<tr><td align=left><span class=\"textBig\">Summe:</span></td><td align=right><span class=\"textBig\" style=\"color:red\">" . str_replace(".", ",", sprintf("%01.2f", $sum)) . "</span></td><td></td><td align=right>" .
'<button type="button" class="buttonAction" name="action_save" onMouseover="document.getElementsByName(\'action_save\')[0].style.color=\'#97bcFF\'" onMouseout="document.getElementsByName(\'action_save\')[0].style.color=\'#FFFFFF\'" ' .
'onClick="save_rows(' . $crvh_id . ', ' . $nextElem . ')">Speichern</button>' . "</td></tr>\n";
query_and_log("UPDATE couriervehicle SET crvh_partner_premium = " . $sum . " WHERE crvh_id = " . $crvh_id, $db);
$sql_query = "SELECT gdc_content, gdc_context" .
" FROM genericdatacontainer WHERE gdc_obj_id = " . $crvh_id . " AND gdc_obj_type = 'crvh' AND gdc_gen_fieldname = 'crvh_premium' AND gdc_context != ''" .
" ORDER BY gdc_context DESC";
$res = query_and_log($sql_query, $db);
$rowCnt = 0;
$sum = 0;
$prev_gdc_context = "";
while ($row = $res->fetch_assoc()) {
if ($rowCnt % 2 == 0) { $cC = "bgcolor=\"#DDDDDD\""; $cC2 = "bgcolor=\"#EEEEEE\""; }
if ($rowCnt++ % 2 == 1) { $cC = "bgcolor=\"#BBBBFF\""; $cC2 = "bgcolor=\"#CCCCFF\""; }
if ($prev_gdc_context != $row["gdc_context"]) {
if ($prev_gdc_context != "")
$content .= "<tr><td align=left><span class=\"textBig\">Summe:</span></td><td align=right><span class=\"textBig\" style=\"color:red\">" . str_replace(".", ",", sprintf("%01.2f", $sum)) . "</span></td><td></td><td></td><tr>\n";
$content .= "<tr><td><span class=\"textBig\">&nbsp;</span></td><td></td><td></td><td></td><td></td></tr>\n";
$sum = 0;
$prev_gdc_context = $row["gdc_context"];
}
$colCnt = 0;
$crvh_premium_data = explode("|", $row["gdc_content"]);
$content .= "<tr><td align=left " . ($colCnt++ % 2 == 1 ? $cC : $cC2) . '><span class="textBig">' . $crvh_premium_data[1] . "</span></td>";
$content .= "<td align=right " . ($colCnt++ % 2 == 1 ? $cC : $cC2) . '><span class="textBig">' . $crvh_premium_data[2] . "</span></td>";
$content .= "<td align=center " . ($colCnt++ % 2 == 1 ? $cC : $cC2) . '><span class="textBig">' . ($crvh_premium_data[3] == "true" ? 'ja' : '') . "</span></td>";
$content .= "<td align=left " . ($colCnt++ % 2 == 1 ? $cC : $cC2) . '><span class="textBig">' . $crvh_premium_data[4] . "</span></td>";
$content .= "<td align=left " . ($colCnt++ % 2 == 1 ? $cC : $cC2) . '><span class="textBig">' . formDate($row["gdc_context"]) . "</span></td></tr>\n";
$sum += str_replace(",", ".", $crvh_premium_data[2]);
}
$res->free();
$content .= "<tr><td align=left><span class=\"textBig\">Summe:</span></td><td align=right><span class=\"textBig\" style=\"color:red\">" . str_replace(".", ",", sprintf("%01.2f", $sum)) . "</span></td><td></td><td></td><tr>\n";
$content =
"<table border=0 cellspacing=0 cellpadding=0 vspace=0 hspace=0>\n" .
"<tr><td align=left><span class=\"textBig\">Text</span></td><td align=left><span class=\"textBig\">Betrag in &#8364</span></td>" .
"<td align=center><span class=\"textBig\">wiederholen</span></td><td align=center><span class=\"textBig\">Bemerkung</span></td>" .
"<td align=center><span class=\"textBig\">Export</span></td></tr>\n" .
$content .
"</table>\n";
}
function formDate($sqlDate) {
return substr($sqlDate, 8, 2) . "." . substr($sqlDate, 5, 2) . "." . substr($sqlDate, 0, 4). "&nbsp;" . substr($sqlDate, 10, 9);
}
function query_and_log($sql_query, $db) {
//echo $sql_query . "<br>";
// if (substr($sql_query, 0, 6) != "SELECT")
myWriteLog("\$sql_query = $sql_query");
$res = $db->query($sql_query);
if (DB::isError($res)) reportDie ("$PHP_SELF: '$sql_query' : " . $res->getMessage());
return $res;
};
function myWriteLog($log_text) {
global $log_file_name;
$fileHandle = @fopen($log_file_name, 'a');
@fwrite($fileHandle, "[" . date("Y-m-d H:i:s") . "] " . $log_text . "\n");
@fclose($fileHandle);
}
/**************************************************************************************************************************************************/
// HTML-Output
?>
<html>
<head>
<title>Partnerprämie für <?php echo $crvh_sid;?></title>
<link rel="stylesheet" type="text/css" href="../css/phoenix.css">
<style type="text/css">
.textBig {font-size: 12pt}
.inputBig {font-size: 12pt; margin: 0px}
.inputBigRight {font-size: 12pt; margin: 0px; text-align: right}
.inputBigCenter {font-size: 12pt; margin: 0px; text-align: center}
.buttonAction {font-size: 12pt; font-weight:bold; font-style:normal; width:100px; height:24px; background:#1b12b9; color:#FFFFFF}
// .buttonAction {width:100px; height:22px; background:#1b12b9; color:#FFFFFF; font-size:10pt; font-weight:bold; font-style:normal; font-family:Helvetica,Arial}
//.button {
// background-color: #4CAF50; /* Green */
// border: none;
// color: white;
// padding: 15px 32px;
// text-align: center;
// text-decoration: none;
// display: inline-block;
// font-size: 16px;
// margin: 4px 2px;
// cursor: pointer;
//}
</style>
<script src="../js/jquery.js"></script>
<script type="text/javascript">
<!--
function checkAmount(no) {
if ((document.getElementsByName("crvh_premium_amount_" + no)[0].value.trim() != "") &&
isNaN(document.getElementsByName("crvh_premium_amount_" + no)[0].value.trim().replace(/,/,"."))) {
alert("Betrag bitte in der Form '999999,99' eingeben.");
document.getElementsByName("crvh_premium_amount_" + no)[0].value = "";
document.getElementsByName("crvh_premium_amount_" + no)[0].focus();
}
// Sicherstellen, dass nur höchstens zwei Nachkommastellen eingegeben werden.
var parts = document.getElementsByName("crvh_premium_amount_" + no)[0].value.trim().replace(/,/,".").split(".");
if (parts.length > 1) {
if (parts[1].length > 2) {
alert("Betrag bitte in der Form '999999,99' eingeben.");
document.getElementsByName("crvh_premium_amount_" + no)[0].value = "";
document.getElementsByName("crvh_premium_amount_" + no)[0].focus();
} else {
if (parts[1].length < 1) {
document.getElementsByName("crvh_premium_amount_" + no)[0].value = document.getElementsByName("crvh_premium_amount_" + no)[0].value.trim() + "00";
} else {
if (parts[1].length < 2) {
document.getElementsByName("crvh_premium_amount_" + no)[0].value = document.getElementsByName("crvh_premium_amount_" + no)[0].value.trim() + "0";
}
}
}
} else {
if (parts[0].length > 0) {
document.getElementsByName("crvh_premium_amount_" + no)[0].value = document.getElementsByName("crvh_premium_amount_" + no)[0].value.trim() + ",00";
}
}
}
function ajaxRequestGet(url, data) {
$.ajax({
type: "GET",
url: url,
data: data,
async: false,
cache: false,
success: function(msg){eval(msg);}
});
}
function save_rows(crvh_id, no) {
for (var i = 1; i < no; i++) {
if (typeof(document.getElementsByName("crvh_premium_text_" + i)[0]) != 'undefined')
save_row(crvh_id, 2, i);
}
if (document.getElementsByName("crvh_premium_text_" + no)[0].value.trim() != "" ||
document.getElementsByName("crvh_premium_amount_" + no)[0].value.trim() != "")
save_row(crvh_id, 1, no);
document.premium_details.submit();
}
function save_row(crvh_id, act, no) {
if (act == 3)
if (!confirm("Eintrag wirklich löschen?"))
return;
var crvh_premium_text = document.getElementsByName("crvh_premium_text_" + no)[0].value.trim();
var crvh_premium_amount = document.getElementsByName("crvh_premium_amount_" + no)[0].value.trim();
var crvh_premium_repeat = document.getElementsByName("crvh_premium_repeat_" + no)[0].checked;
var crvh_premium_comment = document.getElementsByName("crvh_premium_comment_" + no)[0].value.trim();
if ((act == 1 || act == 2) && (crvh_premium_text == "" || crvh_premium_amount == "")) {
alert("Bitte mindestens die ersten beiden Felder ausfüllen!");
return;
}
//alert('act=' + act + '&crvh_id=' + crvh_id + '&no=' + no + '&gdc_content=' + no + "|" + crvh_premium_text + "|" + crvh_premium_amount + "|" + crvh_premium_repeat + "|" + crvh_premium_comment)
ajaxRequestGet('../include/ajaxReqPremium_details.php', 'act=' + act + '&crvh_id=' + crvh_id + '&no=' + no + '&gdc_content=' + no + "|" + crvh_premium_text + "|" + crvh_premium_amount + "|" + crvh_premium_repeat + "|" + crvh_premium_comment);
if (act == 3)
document.premium_details.submit();
}
-->
</script>
</head>
<body>
<div style="width:100%; height:10px;"> </div>
<div class="f10bp1_blue" style="text-align: center; font-size: 14pt">Abrechnung Export für <?php echo $crvh_sid;?></div>
<div style="width:100%; height:20px;"> </div>
<table border="0" width="100%" cellspacing="0" cellpadding="0" vspace="0" hspace="0">
<tr>
<td>
&nbsp;
</td>
<td align="center">
<table border="0" cellspacing="0" cellpadding="0" vspace="0" hspace="0">
<tr>
<td align="center">
<span style="color:red;font-size:12pt"> <?php echo $error_text; ?> </span>
<form name="premium_details" action="premium_details.php" method="post">
<input type="hidden" name="f_crvh_id" value="<?php echo $crvh_id;?>">
<?php echo $content; ?>
</form>
</td>
</tr>
</table>
</td>
<td>
&nbsp;
</td>
</tr>
</table>
</body>
</html>

File diff suppressed because it is too large Load Diff

616
html/admin/pt_list.php Normal file
View File

@@ -0,0 +1,616 @@
<?php
/*=======================================================================
*
* pt_list.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act", "generic", "genNum", "f_mode", "companyId", "orderClause", "statusMessage", "f_cmp_authenticated", "f_searchmode", "f_cmp_match",
"f_cmp_comp", "f_cmp_comp2", "f_cs_eid", "f_usr_name", "f_usr_phone", "f_usr_email", "f_csc_name",
"f_street", "f_hsno", "f_zipcode", "f_city", "f_country", "f_remark", "f_person", "tourno", "f_show_invisible",
"cscIdRoot", "customerId", "cscIdActual", "f_hq_id", "deactivateMenu"));
// Execution-Time for script
set_time_limit(120);
getLanguage(__FILE__);
$deactivateMenuStatic = "1";
$pageTitel = getLngt("INTERESSENTENLISTE");
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
getCurrentScript(__FILE__);
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
if (!(authCheckEmployeeRights($emp_id, "0") || authCheckEmployeeRights($emp_id, "7"))) : gotoReferer("1"); endif;
$numOfRows = 0;
$htmlClass01 = "class=\"smaller\""; // input,select
// Mandator filter
if ($f_hq_id == "") : $f_hq_id = array(); endif;
if (count($f_hq_id) == 0) : array_push($f_hq_id, $hq_id); endif;
// Current number of headquarters
$numOfHq = getCountOfTable("headquarters");
if ($f_searchmode == "") : $f_searchmode = "1"; endif;
if ($genNum == "") : $genNum = ""; endif; // "Generic number" to use more javascript parameters ("g_", "g2_" <=> genNum = "2", "g3_" <=> genNum = "3")
$f_cmp_comp = trim($f_cmp_comp);
$f_cmp_comp2 = trim($f_cmp_comp2);
// Parameter for displayed column SEQUENCE
/*
$displayedListCols = getParameterValue($emp_id, "MASK_CSCSC_LIST_COLS");
if ($displayedListCols == "") :
$displayedListCols = getParameterValue("0", "MASK_CSCSC_LIST_COLS", $hqId);
if ($displayedListCols == "") :
// Default settings
$displayedListCols = "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";
endif;
endif;
*/
$displayedListCols = "cmp_comp,cmp_comp2,cs_eid,cmp_match,cmp_authenticated_img,ad_street,cmp_hsno,ad_zipcode,ad_city,cmp_remark,usr_phone";
$displayedListColsArray = spliti(",",$displayedListCols);
$displayedListColsArrayLen = count($displayedListColsArray);
// Parameter for displayed column LENGTH
/*
$displayedListLenCols = getParameterValue($emp_id, "MASK_CSCSC_LIST_LEN_COLS");
if ($displayedListLenCols == "") :
$displayedListLenCols = getParameterValue("0", "MASK_CSCSC_LIST_LEN_COLS", $hqId);
if ($displayedListLenCols == "") :
// Default settings
$displayedListLenCols = "30,15,11,20,30,5,20,5,5,20,20";
endif;
endif;
*/
$displayedListLenCols = "30,15,11,30,5,20,5,5,20,20,20,15";
$displayedListLenColsArray = spliti(",",$displayedListLenCols);
// Get constants for fields to be searched in
$constSearchPtlistCmpcompCmpmatch = SEARCH_CSCSCLIST_CMPCOMP_CMPMATCH; // Use constant like definition for customer
$constSearchPtlistCmpcompCseid = SEARCH_CSCSCLIST_CMPCOMP_CSEID; // Use constant like definition for customer
$constSearchPtlistCmpcompCscadphone = SEARCH_CSCSCLIST_CMPCOMP_CSCADPHONE; // Use constant like definition for customer
// Check consistence of used fields per JavaScript
$tableHeaderSearchFieldsExtra = ""; // Defines the extra hidden fields to be integrated for search
$j = array_search("cmp_match",$displayedListColsArray);
if ($j === FALSE) : $tableHeaderSearchFieldsExtra .= "<input type=\"hidden\" name=\"f_cmp_match\" value=\"\">"; endif;
$j = array_search("cs_eid",$displayedListColsArray);
if ($j === FALSE) : $tableHeaderSearchFieldsExtra .= "<input type=\"hidden\" name=\"f_cs_eid\" value=\"\">"; endif;
$j = array_search("cscad_phone",$displayedListColsArray);
if ($j === FALSE) : $tableHeaderSearchFieldsExtra .= "<input type=\"hidden\" name=\"f_usr_phone\" value=\"\">"; endif;
$f_cmp_match = trim($f_cmp_match);
if ($constSearchPtlistCmpcompCmpmatch == "1" && $f_cmp_match == "") : $f_cmp_match = trim($f_cmp_comp); endif;
$f_cs_eid = trim($f_cs_eid);
if ($constSearchPtlistCmpcompCseid == "1" && $f_cs_eid == "") : $f_cs_eid = trim($f_cmp_comp); endif;
$f_usr_phone = trim($f_usr_phone);
if ($constSearchPtlistCmpcompCscadphone == "1" && $f_usr_phone == "") : $f_usr_phone = trim($f_cmp_comp); endif;
$f_usr_name = trim($f_usr_name);
$f_usr_phone = trim($f_usr_phone);
$f_usr_email = trim($f_usr_email);
$f_street = trim($f_street);
$f_hsno = trim($f_hsno);
$f_zipcode = trim($f_zipcode);
$f_city = trim($f_city);
$f_country = trim($f_country);
$f_remark = trim($f_remark);
// Flag for "show invisible prospects"
if ($f_show_invisible == "" || count($f_show_invisible) == 0) :
$f_show_invisible = "0";
else:
$f_show_invisible = "1";
endif;
// OUTPUT: Page header option fields
$pageHeaderOptionFields = "";
if (TRUE) :
$pageHeaderOptionFields .= "<a href=\"javascript:document.forms[0].f_act.value='search';document.forms[0].submit();\">&nbsp;" . getLngt("Suchen") . "&nbsp;</a>\n";
$pageHeaderOptionFields .= "&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;\n";
$pageHeaderOptionFields .= "<a href=\"javascript:clearFields();\">" . getLngt("Felder&nbsp;zurücksetzen") . "</a>\n";
$pageHeaderOptionFields .= "&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;\n";
$pageHeaderOptionFields .= getLngt("Option:") . "&nbsp;&nbsp;\n";
$pageHeaderOptionFields .= "<input type=\"radio\" name=\"f_searchmode\" value=\"0\" " . ($f_searchmode == "0" ? "checked" : "") . ">&nbsp;" . getLngt("Präfix") . "\n";
$pageHeaderOptionFields .= "<input type=\"radio\" name=\"f_searchmode\" value=\"1\" " . ($f_searchmode == "1" ? "checked" : "") . ">&nbsp;" . getLngt("Teilwort") . "\n";
$pageHeaderOptionFields .= "<br><br>\n";
$pageHeaderOptionFields .= getLngt("Ausgeblendete&nbsp;anzeigen") . "&nbsp;\n";
$pageHeaderOptionFields .= "<input type=\"checkbox\" name=\"f_show_invisible[]\" value=\"1\" " . ($f_show_invisible == "1" ? "checked" : "") . ">\n";
// $pageHeaderOptionFields .= "&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;\n";
$pageHeaderOptionFields .= "<br><br><br>\n";
endif;
// OUTPUT: Table header search fields
$tableHeaderSearchFields = "";
if (TRUE) :
$dspColHeaderSearchFieldArray["cmp_comp"] = "<input type=\"text\" " . $htmlClass01 . " name=\"f_cmp_comp\" value=\"" . $f_cmp_comp . "\" onBlur=\"javascript:checkSearchParameters('cmp_comp');\" _SIZE_MACRO_>";
$dspColHeaderSearchFieldArray["cmp_comp2"] = "<input type=\"text\" " . $htmlClass01 . " name=\"f_cmp_comp2\" value=\"" . $f_cmp_comp2 . "\" _SIZE_MACRO_>";
$dspColHeaderSearchFieldArray["cs_eid"] = "<input type=\"text\" " . $htmlClass01 . " name=\"f_cs_eid\" value=\"" . $f_cs_eid . "\" _SIZE_MACRO_>";
$dspColHeaderSearchFieldArray["cmp_match"] = "<input type=\"text\" " . $htmlClass01 . " name=\"f_cmp_match\" value=\"" . $f_cmp_match . "\" _SIZE_MACRO_>";
$dspColHeaderSearchFieldArray["cmp_authenticated_img"] = "<a href=\"javascript:document.forms[0].f_act.value='search';document.forms[0].submit();\">&nbsp;" . getLngt("Suchen") . "&nbsp;</a>";
$dspColHeaderSearchFieldArray["usr_name"] = "<input type=\"text\" " . $htmlClass01 . " name=\"f_usr_name\" value=\"" . $f_usr_name . "\" _SIZE_MACRO_>";
$dspColHeaderSearchFieldArray["usr_phone"] = "<input type=\"text\" " . $htmlClass01 . " name=\"f_usr_phone\" value=\"" . $f_usr_phone . "\" _SIZE_MACRO_>";
$dspColHeaderSearchFieldArray["usr_email"] = "<input type=\"text\" " . $htmlClass01 . " name=\"f_usr_email\" value=\"" . $f_usr_email . "\" _SIZE_MACRO_>";
$dspColHeaderSearchFieldArray["ad_street"] = "<input type=\"text\" " . $htmlClass01 . " name=\"f_street\" value=\"" . $f_street . "\" _SIZE_MACRO_>";
$dspColHeaderSearchFieldArray["cmp_hsno"] = "<input type=\"text\" " . $htmlClass01 . " name=\"f_hsno\" value=\"" . $f_hsno . "\" _SIZE_MACRO_>";
$dspColHeaderSearchFieldArray["ad_zipcode"] = "<input type=\"text\" " . $htmlClass01 . " name=\"f_zipcode\" value=\"" . $f_zipcode . "\" _SIZE_MACRO_>";
$dspColHeaderSearchFieldArray["ad_city"] = "<input type=\"text\" " . $htmlClass01 . " name=\"f_city\" value=\"" . $f_city . "\" _SIZE_MACRO_>";
$dspColHeaderSearchFieldArray["cmp_remark"] = "<input type=\"text\" " . $htmlClass01 . " name=\"f_remark\" value=\"" . $f_remark . "\" _SIZE_MACRO_>";
$tmpKeys = array_keys($dspColHeaderSearchFieldArray);
for ($i = 0; $i < $displayedListColsArrayLen; $i++) {
// Search for the value "$displayedListColsArray" in "$dspColArray" and get the key (index)
$j = array_search($displayedListColsArray[$i], $tmpKeys);
if (!($j === FALSE)) :
// Define length (html attribute "size") of the field and substitute macro
if ($displayedListLenColsArray[$i] == "" || $displayedListLenColsArray[$i] == "0") :
$dspColHeaderSearchFieldArray[$tmpKeys[$j]] = str_replace("_SIZE_MACRO_", "", $dspColHeaderSearchFieldArray[$tmpKeys[$j]]);
else :
$dspColHeaderSearchFieldArray[$tmpKeys[$j]] = str_replace("_SIZE_MACRO_", " size=\"" . $displayedListLenColsArray[$i] . "\" ", $dspColHeaderSearchFieldArray[$tmpKeys[$j]]);
endif;
$cellColor = getListColor(1, 1);
$tableHeaderSearchFields .= "<td bgcolor=\"" . $cellColor . "\">" . $dspColHeaderSearchFieldArray[$tmpKeys[$j]] . "</td>";
endif;
}
endif;
// OUTPUT: Table header column links
$tableHeaderLinks = "";
if (TRUE) :
$dspColHeaderLinksArray = array();
$dspColHeaderLinksArray["cmp_comp"] = "<a href=\"javascript:submitPage('pt.pt_cmp_comp');\">&nbsp;" . getLngt("Firma") . "&nbsp;</a></td>";
$dspColHeaderLinksArray["cmp_comp2"] = "<a href=\"javascript:submitPage('pt.pt_cmp_comp2');\">&nbsp;" . getLngt("Firma2") . "&nbsp;</a></td>";
$dspColHeaderLinksArray["cs_eid"] = "<a href=\"javascript:submitPage('pt.pt_cs_eid');\">&nbsp;" . getLngt("ExtID") . "&nbsp;</a></td>";
$dspColHeaderLinksArray["cmp_match"] = "<a href=\"javascript:submitPage('pt.pt_cmp_match');\">&nbsp;" . getLngt("Freitext") . "&nbsp;</a></td>";
$dspColHeaderLinksArray["cmp_authenticated_img"] = "&nbsp;" . getLngt("Freigabe") . "&nbsp;</td>";
$dspColHeaderLinksArray["usr_name"] = "<a href=\"javascript:submitPage('pt.pt_usr_name');\">&nbsp;" . getLngt("Admin-Name") . "</a></td>";
$dspColHeaderLinksArray["usr_phone"] = "<a href=\"javascript:submitPage('pt.pt_usr_phone');\">&nbsp;" . getLngt("Admin-Telefon") . "</a></td>";
$dspColHeaderLinksArray["usr_email"] = "<a href=\"javascript:submitPage('pt.pt_usr_email');\">&nbsp;" . getLngt("Admin-Email") . "</a></td>";
$dspColHeaderLinksArray["ad_street"] = "<a href=\"javascript:submitPage('ad.ad_street');\">&nbsp;" . getLngt("Straße") . "</a></td>";
$dspColHeaderLinksArray["cmp_hsno"] = "<a href=\"javascript:submitPage('pt.pt_cmp_hsno');\">&nbsp;" . getLngt("Hausnr.") . "</a></td>";
$dspColHeaderLinksArray["ad_zipcode"] = "<a href=\"javascript:submitPage('ad.ad_zipcode');\">&nbsp;" . getLngt("PLZ") . "</a></td>";
$dspColHeaderLinksArray["ad_city"] = "<a href=\"javascript:submitPage('ad.ad_city');\">&nbsp;" . getLngt("Ort") . "</a></td>";
$dspColHeaderLinksArray["cmp_remark"] = "<a href=\"javascript:submitPage('pt.pt_cmp_remark');\">&nbsp;" . getLngt("Bemerkung") . "</a></td>";
$tmpKeys = array_keys($dspColHeaderLinksArray);
for ($i = 0; $i < $displayedListColsArrayLen; $i++) {
// Search for the value "$displayedListColsArray" in "$dspColArray" and get the key (index)
$j = array_search($displayedListColsArray[$i], $tmpKeys);
if (!($j === FALSE)) :
$cellColor = getListColor(0, 0);
$tableHeaderLinks .= "<td bgcolor=\"" . $cellColor . "\">" . $dspColHeaderLinksArray[$tmpKeys[$j]] . "</td>";
endif;
}
endif;
// if called e.g. by the first time with empty search-fields
$searchValues = $f_cmp_comp . $f_cmp_comp2 . $f_cmp_match . $f_cs_eid . $f_street . $f_hsno . $f_zipcode . $f_city . $f_country . $f_remark . $f_usr_phone;
// Generate search-resultset
if ($f_act == "search" && $searchValues != "") :
if (strlen($f_cmp_comp) > 2 || strlen($f_cmp_comp2) > 2 || strlen($f_cmp_match) > 2 || strlen($f_cs_eid) > 2 ||
strlen($f_street) > 2 || strlen($f_hsno) > 0 || strlen($f_zipcode) > 2 || strlen($f_city) > 2 ||
strlen($f_remark) > 2 || strlen($f_usr_phone) > 2) :
// *******************************************
// * Selection of the customers for the list *
// *******************************************
if ($f_searchmode == "1") : $prefix = "%"; else : $prefix = ""; endif;
$whereClause = "";
// Check for search value in pt.pt_cmp_comp OR pt.pt_cmp_match
if ($f_cmp_comp != "") :
$whereClause .= "pt.pt_cmp_comp LIKE '" . $prefix . $f_cmp_comp . "%'";
if (($constSearchPtlistCmpcompCmpmatch == "1" && $f_cmp_match != "") ||
($constSearchPtlistCmpcompCseid == "1" && $f_cs_eid != "") ||
($constSearchPtlistCmpcompCscadphone == "1" && $f_usr_phone != "")) :
$whereClause = " (" . $whereClause;
if ($constSearchPtlistCmpcompCmpmatch == "1" && $f_cmp_match != "") :
$whereClause .= " OR pt.pt_cmp_match LIKE '" . $prefix . $f_cmp_match . "%'";
endif;
if ($constSearchPtlistCmpcompCseid == "1" && $f_cs_eid != "") :
$whereClause .= " OR pt.pt_cs_eid LIKE '" . $prefix . $f_cs_eid . "%'";
endif;
if ($constSearchPtlistCmpcompCscadphone == "1" && $f_usr_phone != "") :
$whereClause .= " OR pt.pt_usr_phone LIKE '" . $prefix . $f_usr_phone . "%'";
endif;
$whereClause .= ") ";
endif;
endif;
if ($whereClause != "" && $f_cmp_comp2 != "") : $whereClause .= " AND "; endif;
if ($f_cmp_comp2 != "") : $whereClause .= "pt.pt_cmp_comp2 LIKE '" . $prefix . $f_cmp_comp2 . "%'"; endif;
// Check for search value in pt.pt_cmp_comp OR pt.pt_cmp_match
if ($constSearchPtlistCmpcompCmpmatch != "1") :
if ($whereClause != "" && $f_cmp_match != "") : $whereClause .= " AND "; endif;
if ($f_cmp_match != "") : $whereClause .= "pt.pt_cmp_match LIKE '" . $prefix . $f_cmp_match . "%'"; endif;
endif;
// Check for search value in pt.pt_cmp_comp OR pt.pt_cs_eid
if ($constSearchPtlistCmpcompCseid != "1") :
if ($whereClause != "" && $f_cs_eid != "") : $whereClause .= " AND "; endif;
if ($f_cs_eid != "") : $whereClause .= "pt.pt_cs_eid LIKE '" . $prefix . $f_cs_eid . "%'"; endif;
endif;
// Check for search value in pt.pt_cmp_comp OR pt.pt_usr_phone
if ($constSearchPtlistCmpcompCscadphone != "1") :
if ($whereClause != "" && $f_usr_phone != "") : $whereClause .= " AND "; endif;
if ($f_usr_phone != "") : $whereClause .= "pt.pt_usr_phone LIKE '" . $prefix . $f_usr_phone . "%'"; endif;
endif;
if ($whereClause != "" && $f_usr_name != "") : $whereClause .= " AND "; endif;
if ($f_usr_name != "") : $whereClause .= "pt.pt_usr_name LIKE '" . $prefix . $f_usr_name . "%'"; endif;
if ($whereClause != "" && $f_usr_email != "") : $whereClause .= " AND "; endif;
if ($f_usr_email != "") : $whereClause .= "pt.pt_usr_email LIKE '" . $prefix . $f_usr_email . "%'"; endif;
// if ($whereClause != "" && $f_cmp_iln != "") : $whereClause .= " AND "; endif;
// if ($f_cmp_iln != "") : $whereClause .= "pt.pt_cmp_iln LIKE '" . $prefix . $f_cmp_iln . "%'"; endif;
// if ($whereClause != "" && $f_cmp_tax_idno != "") : $whereClause .= " AND "; endif;
// if ($f_cmp_tax_idno != "") : $whereClause .= "pt.pt_cmp_tax_idno LIKE '" . $prefix . $f_cmp_tax_idno . "%'"; endif;
// if ($whereClause != "" && $f_cmp_bank != "") : $whereClause .= " AND "; endif;
// if ($f_cmp_bank != "") : $whereClause .= "pt.pt_cmp_bank LIKE '" . $prefix . $f_cmp_bank . "%'"; endif;
// if ($whereClause != "" && $f_cmp_bankno != "") : $whereClause .= " AND "; endif;
// if ($f_cmp_bankno != "") : $whereClause .= "pt.pt_cmp_bankno LIKE '" . $prefix . $f_cmp_bankno . "%'"; endif;
// if ($whereClause != "" && $f_cmp_bankacc != "") : $whereClause .= " AND "; endif;
// if ($f_cmp_bankacc != "") : $whereClause .= "pt.pt_cmp_bankacc LIKE '" . $prefix . $f_cmp_bankacc . "%'"; endif;
if ($whereClause != "" && $f_street != "") : $whereClause .= " AND "; endif;
if ($f_street != "") : $whereClause .= "ad.ad_street LIKE '" . $f_street . "%'"; endif;
if ($whereClause != "" && $f_hsno != "") : $whereClause .= " AND "; endif;
if ($f_hsno != "") : $whereClause .= "pt.pt_cmp_hsno LIKE '" . $f_hsno . "%'"; endif;
if ($whereClause != "" && $f_zipcode != "") : $whereClause .= " AND "; endif;
if ($f_zipcode != "") : $whereClause .= "ad.ad_zipcode LIKE '" . $f_zipcode . "%'"; endif;
if ($whereClause != "" && $f_city != "") : $whereClause .= " AND "; endif;
if ($f_city != "") : $whereClause .= "ad.ad_city LIKE '" . $f_city . "%'"; endif;
if ($whereClause != "" && $f_country != "") : $whereClause .= " AND "; endif;
if ($f_country != "") : $whereClause .= "ad.ad_country LIKE '" . $f_country . "%'"; endif;
if ($whereClause != "" && $f_remark != "") : $whereClause .= " AND "; endif;
if ($f_remark != "") : $whereClause .= "pt.pt_cmp_remark LIKE '" . $f_remark . "%'"; endif;
// Check authentication
// Enable again 4 cashMode (... damit die "eigentliche" Funktion des Sperrens wieder aufgenommen werden kann !!!!!!!!!!!!!!!!!!)
// if ($whereClause != "" && $f_cmp_authenticated == "1") : $whereClause .= " AND "; endif;
// if ($f_cmp_authenticated == "1") : $whereClause .= "cmp.cmp_authenticated LIKE '" . $f_cmp_authenticated . "%'"; endif;
// Show "invisible" prospects
if ($f_show_invisible != "1") :
if ($whereClause != "") : $whereClause .= " AND "; endif;
$whereClause .= " pt.pt_cmp_visible = '1'";
endif;
if ($whereClause != "") : $whereClause .= " AND "; endif;
if ($orderClause == "") : $orderClause = "pt.pt_cmp_comp"; endif;
$sqlquery = "SELECT pt.pt_id, pt.pt_cs_eid, pt.pt_cs_commission_no, pt.pt_cs_discount, pt.pt_cs_fixprice_discount, "
. " pt.pt_cmp_comp, pt.pt_cmp_comp2, pt.pt_cmp_authenticated, pt.pt_cmp_remark, pt.pt_cmp_match, pt.pt_cmp_cashmode,"
. " pt.tx_id, pt.ad_id, pt.pt_cmp_hsno,pt.pt_usr_phone,"
. " ad.ad_street, ad.ad_zipcode, ad.ad_city, ad.ad_country"
. " FROM prospect AS pt, address AS ad"
. " WHERE " .$whereClause
. " pt.hq_id IN " . getSQLMandatorArray($f_hq_id) . " AND"
. " pt.ad_id = ad.ad_id"
. " ORDER BY " . $orderClause;
// echo $sqlquery . "<br>";
getDb2Connection(); // Try to connect request server because of performance
$result = $db2->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: '$sqlquery': " . $result->getMessage());
// Table with header
$rowCounter = 0;
$lineToggler = 0;
while ($row = $result->fetch_assoc()):
$numOfRows++;
$dspColArray = array();
$tableOfRows .= "<tr>";
// $dspColArray["cmp_comp"] = "<td__BGCOL__>&nbsp;__START__" . $row["pt_cmp_comp"] . "__END__</td>";
$dspColArray["cmp_comp"] = "<td__BGCOL__>&nbsp;<a href=\"javascript:finishPage('" . $row["pt_id"] . "','" . my_str_check_js($row["ad_street"]) . "','" . $row["pt_cmp_hsno"] . "','" . $row["ad_zipcode"] . "','" . my_str_check_js($row["ad_city"]) . "','" . my_str_check_js($row["ad_country"]) . "','" . my_str_check_js($row["pt_cmp_remark"]) . "','" . $row["tx_id"] . "','" . $row["pt_cs_eid"] . "','" . $row["pt_cs_commission_no"] . "','" . $row["pt_cmp_authenticated"] . "','" . $row["pt_cs_discount"] . "','" . my_str_check_js($row["pt_cmp_comp"]) . "','" . my_str_check_js($row["pt_cmp_comp2"]) . "'," . $row["pt_cs_fixprice_discount"] . ");\">__START__" . my_str_check_html($row["pt_cmp_comp"]) . "__END__</a></td>";
$dspColArray["cmp_comp2"] = "<td__BGCOL__>&nbsp;__START__" . $row["pt_cmp_comp2"] . "__END__</td>";
$dspColArray["cs_eid"] = "<td__BGCOL__>&nbsp;__START__" . $row["pt_cs_eid"] . "__END__</td>";
$dspColArray["cmp_match"] = "<td__BGCOL__>&nbsp;__START__" . $row["cmp_match"] . "__END__</td>";
$authImgName = "circle_red.png";
if ($row["pt_cmp_authenticated"] == "1") : $authImgName = "circle_green.png"; endif;
$dspColArray["cmp_authenticated_img"] = "<td align=\"center\"__BGCOL__><img src=\"../images/" . $authImgName . "\" border=\"0\" height=\"10\" width=\"25\"></td>";
$cashmodeImgName = "circle_green.png";
if ($row["pt_cmp_cashmode"] == "1") : $cashmodeImgName = "circle_red.png"; endif;
// Enable 4 cashMode
// $dspColArray["usr_name"] = "<td align=\"center\"><img src=\"../images/" . $cashmodeImgName . "\" border=\"0\" height=\"10\" width=\"25\"></td>";
$dspColArray["usr_name"] = "<td__BGCOL__>&nbsp;__START__" . $row["pt_usr_name"] . "__END__</td>";
$dspColArray["usr_phone"] = "<td__BGCOL__>&nbsp;__START__" . $row["pt_usr_phone"] . "__END__</td>";
$dspColArray["usr_email"] = "<td__BGCOL__>&nbsp;__START__" . $row["pt_usr_email"] . "__END__</td>";
$dspColArray["ad_street"] = "<td__BGCOL__>&nbsp;__START__" . $row["ad_street"] . "__END__</td>";
$dspColArray["cmp_hsno"] = "<td__BGCOL__>&nbsp;__START__" . $row["pt_cmp_hsno"] . "__END__</td>";
$dspColArray["ad_zipcode"] = "<td__BGCOL__>&nbsp;__START__" . $row["ad_zipcode"] . "__END__</td>";
$dspColArray["ad_city"] = "<td__BGCOL__>&nbsp;__START__" . $row["ad_city"] . "__END__</td>";
$dspColArray["cmp_remark"] = "<td__BGCOL__>&nbsp;__START__" . $row["pt_cmp_remark"] . "__END__</td>";
// Generate list
$rowCounter++;
$tmpKeys = array_keys($dspColArray);
for ($i = 0; $i < $displayedListColsArrayLen; $i++) {
// Search for the value "$displayedListColsArray" in "$dspColArray" and get the key (index)
$j = array_search($displayedListColsArray[$i], $tmpKeys);
if (!($j === FALSE)) :
// Define length (html attribute "size") of the field and substitute macro
if ($displayedListLenColsArray[$i] == "" || $displayedListLenColsArray[$i] == "0") :
$dspColArray[$tmpKeys[$j]] = str_replace("__START__", "", $dspColArray[$tmpKeys[$j]]);
$dspColArray[$tmpKeys[$j]] = str_replace("__END__", "", $dspColArray[$tmpKeys[$j]]);
else :
// content of db-fields
$tagBegin = "__START__";
$tagEnd = "__END__";
if (!(strpos($dspColArray[$tmpKeys[$j]], $tagBegin) === FALSE) && !(strpos($dspColArray[$tmpKeys[$j]], $tagEnd) === FALSE)) :
$pos0 = strpos($dspColArray[$tmpKeys[$j]], $tagBegin); // begin of tagBegin (first occurrence)
$pos1 = strpos($dspColArray[$tmpKeys[$j]], $tagBegin) + strlen($tagBegin); // end of tagBegin (first occurrence)
$pos2 = strpos($dspColArray[$tmpKeys[$j]], $tagEnd); // begin of tagEnd (first occurrence)
$pos3 = strpos($dspColArray[$tmpKeys[$j]], $tagEnd) + strlen($tagEnd); // end of tagEnd (first occurrence)
if ($pos2 - $pos1 > 0) :
// first get the content of the tag
$fieldContent = substr($dspColArray[$tmpKeys[$j]], $pos1, $pos2 - $pos1);
$fieldContent = substr($fieldContent, 0, $displayedListLenColsArray[$i]);
// replace original content with string-content
$dspColArray[$tmpKeys[$j]] = substr_replace($dspColArray[$tmpKeys[$j]], $fieldContent, $pos0, $pos3 - $pos0);
endif;
endif;
endif;
if ($lineToggler == 0) : $lineToggler = 1; else : $lineToggler = 0; endif;
$cellColor = getListColor($rowCounter, $lineToggler);
$dspColArray[$tmpKeys[$j]] = str_replace("__START__", "", $dspColArray[$tmpKeys[$j]]);
$dspColArray[$tmpKeys[$j]] = str_replace("__END__", "", $dspColArray[$tmpKeys[$j]]);
$dspColArray[$tmpKeys[$j]] = str_replace("__BGCOL__", " bgcolor=\"" . $cellColor ."\"", $dspColArray[$tmpKeys[$j]]);
$tableOfRows .= $dspColArray[$tmpKeys[$j]] . "\n";
endif;
}
if ($lineToggler == 0) : $lineToggler = 1; else : $lineToggler = 0; endif;
$tableOfRows .= "</tr>\n";
endwhile;
$result->free();
else :
$statusMessage = getLngt("Bei Eingabe weniger als 3 Zeichen in mindestens einem Feld erfolgt keine Suche!");
endif;
endif;
?>
<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 type="text/javascript">
<!--
// NAVIGATION
<?php echo $jsMenuOut; ?>
<?php if ($generic == "") : ?>
function finishPage(pt_id,street,hsno,zipcode,city,country,cmp_remark,tx_id,cs_eid,cs_commission_no,cmp_authenticated,cs_discount,cmp_comp,cmp_comp2,cs_fixprice_discount) {
if (tourno > -1)
{
opener.setJobList(tourno, opener.jl_csc_id, csc_id);
opener.setJobList(tourno, opener.jl_tr_comp, comp);
opener.setJobList(tourno, opener.jl_tr_person, person);
opener.setJobList(tourno, opener.jl_ad_street, street);
opener.setJobList(tourno, opener.jl_tr_hsno, hsno);
opener.setJobList(tourno, opener.jl_ad_zipcode, zipcode);
opener.setJobList(tourno, opener.jl_ad_city, city);
opener.setJobList(tourno, opener.jl_tr_remark, remark);
opener.setJobList(tourno, opener.jl_csc_id_payer, "false");
opener.setJobList(tourno, opener.jl_hide_tr_remark, "true");
if (csc_id_payer != "" && csc_id_payer != 0)
{
opener.setCsc_id_payer(csc_id_payer, csc_id_payer_comp);
opener.parent.job_options.document.tourOptions.payer_is_default.value = "true";
}
} else {
opener.setCsc_id_payer(csc_id, comp);
if (tx_id != "" && tx_id != 0)
{
opener.checkJb_sales_tax_rate_sign(tx_id);
opener.checkCs_filter(cs_filter);
}
<?php if (MASK_CASH_PAYER_SELECT == "1") : ?>
opener.parent.job_tour.document.tourForm.jb_costsplit.checked = true;
opener.checkCostsplit(true);
<?php endif; ?>
}
if (cs_eid != "" && cs_eid != 0)
{
opener.add_cs_eid(csc_id, cs_eid, cs_commission_no, comp, cmp_authenticated, cmp_remark, cs_jobbatch, cs_discount, cs_filter, tx_id, name, is_extern, cs_id, cs_fixprice_discount, cs_prov);
}
self.setTimeout("opener.refreshFormFields()", 100);
self.setTimeout("opener.resetSignificantPriceValues()", 150);
// opener.refreshFormFields();
self.setTimeout("opener.checkSendTour()", 200);
// opener.checkSendTour();
self.setTimeout("self.close()", 300);
// self.close();
};
<?php else : ?>
// GENERIC function
function finishPage(pt_id,street,hsno,zipcode,city,country,cmp_remark,tx_id,cs_eid,cs_commission_no,cmp_authenticated,cs_discount,cmp_comp,cmp_comp2,cs_fixprice_discount) {
<?php if (substr($generic, 0,1) == "1") : ?> opener.document.forms[0].g<?php echo $genNum; ?>_pt_id.value = pt_id; <?php endif; ?>
<?php if (substr($generic, 1,1) == "1") : ?> opener.document.forms[0].g<?php echo $genNum; ?>_pt_cmp_comp.value = cmp_comp; <?php endif; ?>
<?php if (substr($generic, 2,1) == "1") : ?> opener.document.forms[0].g<?php echo $genNum; ?>_pt_cmp_comp2.value = cmp_comp2; <?php endif; ?>
<?php if (substr($generic, 3,1) == "1") : ?> opener.document.forms[0].g<?php echo $genNum; ?>_ad_street.value = street; <?php endif; ?>
<?php if (substr($generic, 4,1) == "1") : ?> opener.document.forms[0].g<?php echo $genNum; ?>_pt_cmp_hsno.value = hsno; <?php endif; ?>
<?php if (substr($generic, 5,1) == "1") : ?> opener.document.forms[0].g<?php echo $genNum; ?>_ad_zipcode.value = zipcode; <?php endif; ?>
<?php if (substr($generic, 6,1) == "1") : ?> opener.document.forms[0].g<?php echo $genNum; ?>_ad_city.value = city; <?php endif; ?>
<?php if (substr($generic, 7,1) == "1") : ?> opener.document.forms[0].g<?php echo $genNum; ?>_ad_country.value = country; <?php endif; ?>
<?php if (substr($generic, 8,1) == "1") : ?> opener.document.forms[0].g<?php echo $genNum; ?>_pt_cs_eid.value = cs_eid; <?php endif; ?>
<?php if (substr($generic, 9,1) == "1") : ?> opener.document.forms[0].g<?php echo $genNum; ?>_pt_cmp_remark.value = remark; <?php endif; ?>
self.close();
};
<?php endif; ?>
function clearFields() {
document.forms[0].f_cmp_comp.value = '';
if (document.forms[0].f_cmp_comp2) {document.forms[0].f_cmp_comp2.value = ''};
if (document.forms[0].f_cmp_match) {document.forms[0].f_cmp_match.value = ''};
if (document.forms[0].f_cs_eid) {document.forms[0].f_cs_eid.value = ''};
if (document.forms[0].f_csc_name) {document.forms[0].f_csc_name.value = ''};
if (document.forms[0].f_street) {document.forms[0].f_street.value = ''};
if (document.forms[0].f_hsno) {document.forms[0].f_hsno.value = ''};
if (document.forms[0].f_zipcode) {document.forms[0].f_zipcode.value = ''};
if (document.forms[0].f_city) {document.forms[0].f_city.value = ''};
if (document.forms[0].f_country) {document.forms[0].f_country.value = 'DE'};
if (document.forms[0].f_remark) {document.forms[0].f_remark.value = ''};
if (document.forms[0].f_person) {document.forms[0].f_person.value = ''};
if (document.forms[0].f_usr_phone) {document.forms[0].f_usr_phone.value = ''};
};
function checkSearchParameters(field_from) {
if (field_from == 'cmp_comp') {
// Check for search value in cmp_name to be also searched in cmp_match
if (<?php echo $constSearchPtlistCmpcompCmpmatch ?> == 1) {
document.forms[0].f_cmp_match.value = document.forms[0].f_cmp_comp.value;
}
if (<?php echo $constSearchPtlistCmpcompCseid ?> == 1) {
document.forms[0].f_cs_eid.value = document.forms[0].f_cmp_comp.value;
}
if (<?php echo $constSearchPtlistCmpcompCscadphone ?> == 1) {
document.forms[0].f_usr_phone.value = document.forms[0].f_cmp_comp.value;
}
}
};
function submitPage(orderClause) {
document.forms[0].orderClause.value = orderClause;
document.forms[0].f_act.value='search';
document.forms[0].submit();
};
function hqCheckAll(numOfHq) {
for (i = 0; i < numOfHq; i++) {
document.getElementsByName('f_hq_id[]')[i].checked = true;
}
}
function hqUncheckAll(numOfHq) {
for (i = 0; i < numOfHq; i++) {
document.getElementsByName('f_hq_id[]')[i].checked = false;
}
}
function openCustomerStatistics(csEid) {
var widthPopupWin = 900;
var heightPopupWin = 700;
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
var popupWin;
popupWin = window.open("../statistic/statistic.php?f_act=calculate&f_category=3&f_statistic=51&g_cs_eid="+csEid+"&noStatisticMenu=1&outputColumnMode=0&outputTitle=Monatsübersicht&specialAligns=l,l,l,l,r&day_from=01&month_from=01&year_from=<?php echo getDateTime('lastyear'); ?>&day_to=<?php echo getDateTime('day'); ?>&month_to=<?php echo getDateTime('month'); ?>&year_to=<?php echo getDateTime('year'); ?>","","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
};
-->
</script>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>displayStatusMessage();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="maincontent" name="maincontent" id="maincontent">
<form action="../admin/pt_list.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="orderClause" value="<?php echo $orderClause ?>">
<input type="hidden" name="tourno" value="<?php echo $tourno ?>">
<input type="hidden" name="generic" value="<?php echo $generic ?>">
<input type="hidden" name="genNum" value="<?php echo $genNum ?>">
<input type="hidden" name="f_cmp_authenticated" value="<?php echo $f_cmp_authenticated ?>">
<?php echo $tableHeaderSearchFieldsExtra ?>
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<?php echo htmlDivLineSpacer("10px"); ?>
<div class="f10bp1_blue">
<?php echo $pageTitel ?>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<!-- Headquarters checkboxes -->
<?php if (authCheckEmployeeRights($emp_id, "10")) : ?>
<?php echo getHeadquartersCheckboxes($f_hq_id, $numOfHq); ?>
<?php echo htmlDivLineSpacer("10px", "", "left"); ?>
<?php endif; ?>
<?php echo htmlDivLineSpacer("10px"); ?>
<div>
<?php echo $pageHeaderOptionFields ?>
</div>
<?php echo htmlDivLineSpacer("15px"); ?>
<div>
<table border="0">
<tr>
<td>
<table border="0">
<tr>
<td>
<table class="f8np1" border="0" cellpadding="0">
<tr>
<?php echo $tableHeaderSearchFields ?>
</tr>
<tr>
<?php echo $tableHeaderLinks ?>
</tr>
<?php echo $tableOfRows ?>
</table>
<br><br>
<?php echo getLngt("Anzahl Einträge:") ?> <?php echo $numOfRows ?><?php if ($numOfRows == "0" && $f_act == "search" && $statusMessage == "") : echo " " . getLngt("(Keine Einträge gefunden.)"); endif; ?>
</td>
</tr>
</table>
</td>
</table>
</div>
</form>
</div>
</body>
</html>

View File

@@ -0,0 +1,370 @@
<?php
/*=======================================================================
*
* public_holiday.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/global.inc.php");
include_once ("../include/auth.inc.php");
include_once ("../include/calendar.inc.php");
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act","f_year","f_month", "f_day", "f_time_from", "f_time_to",
"f_holidays", "f_year2", "statusMessage", "deactivateMenu"));
getLanguage(__FILE__);
$pageTitel = getLngt("FEIERTAGE");
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
getCurrentScript(__FILE__);
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
// authCheckEmployeeRights($emp_id, "2", "1");
$currentYear = getDateTime("year");
$currentMonth = getDateTime("month");
$currentDay = getDateTime("day");
if ($f_year == "") : $f_year = $currentYear ; endif;
if ($f_month == "") : $f_month = getDateTime("month") ; endif;
if ($f_holidays == "") : $f_holidays = array(); endif;
$holidaysLen = count($f_holidays);
$output2 = "";
$output3 = "";
/*
$cmpComp = "";
$cmpComp2 = "";
if ($csId != "0") :
$cmpId = getFieldValueFromId("customer","cs_id",$csId,"cmp_id");
$tmpFields = getFieldsValueFromId("company","cmp_id",$cmpId,array("cmp_comp","cmp_comp2"));
$cmpComp = $tmpFields[0];
$cmpComp2 = $tmpFields[1];
endif;
*/
// *** Storing-processes ***
// *** BEGIN ***************
// Store entries
if ($f_act != "" && $f_act == "save") :
// Check consistency of the parameter
if ($f_year >= $currentYear) :
if ($f_holidays != "") :
TA("B");
// To reach more performance, first delete all entries of the year and then store the new list
deleteStmt("publicholiday","ph_year = '" . $f_year . "' AND hq_id = '" . $hq_id . "'");
// Iterate all months
for ($i_month = 1; $i_month <= 12; $i_month++) :
// Get number of days of the month
$numOfDays = daysPerMonth($f_year, $i_month);
// Iterate all days of the current month
for ($i_day = 1; $i_day <= $numOfDays; $i_day++) :
// Search for the value in "$f_holidays" and get the key (index)
$j = array_search($i_month . "_" . $i_day, $f_holidays);
if (!($j === FALSE)) :
// insert new public holiday
list ($nameOfHoliday) = getHttpVars(array("f_". $i_month . "_" . $i_day));
$tmpFields = array("hq_id", $hq_id, "ph_year", $f_year, "ph_month", $i_month, "ph_day", $i_day, "ph_name", $nameOfHoliday);
insertStmt("publicholiday",$tmpFields);
endif;
endfor;
endfor;
TA("C");
TA("E");
else :
$statusMessage = getLngt("In der Vergangenheit liegende Tage werden nicht gespeichert!");
endif;
else :
$statusMessage = getLngt("Vergangene Jahre können nicht geändert werden!");
endif;
endif;
// *** END ***************
// Get all public holidays of the specified year
if (TRUE) :
$sqlquery = "SELECT ph.ph_id, ph.ph_year, ph.ph_month, ph.ph_day, ph.ph_time_from, ph.ph_time_to, ph.ph_name"
. " FROM publicholiday AS ph"
. " WHERE hq_id = '" . $hq_id . "' AND ph.ph_year = '" . $f_year . "'"
. " ORDER BY ph.ph_month, ph.ph_day, ph.ph_time_from";
$result = $db->dbQ($sqlquery);
// Get only first row of the result set
$row = $result->fetch_assoc();
// If activated, load data for initialization
if ($f_act == "load" && $f_year2 != "") :
$sqlquery2 = "SELECT ph.ph_id, ph.ph_year, ph.ph_month, ph.ph_day, ph.ph_time_from, ph.ph_time_to, ph.ph_name"
. " FROM publicholiday AS ph"
. " WHERE hq_id = '" . $hq_id . "' AND ph.ph_year = '" . $f_year2 . "'"
. " ORDER BY ph.ph_month, ph.ph_day, ph.ph_time_from";
$result2 = $db->dbQ($sqlquery2);
// Get only first row of the result set
$row2 = $result2->fetch_assoc();
endif;
$output = "";
// Define anchor links
$monthAnchorLinks = getMonthAnchorLinks();
// Iterate all months
for ($i_month = 1; $i_month <= 12; $i_month++) :
// Title of the month
$output .= "<tr>\n";
$output .= "<td class=\"f10bp1_blue\" colspan=\"3\"><a name=\"" . $i_month . "\">" . monthName($i_month) . "</a></td>\n";
$output .= "<td><br><br>";
$output .= defineButtonType10(getLngt("Speichern"), "action_save", "finishPage('save','Wollen Sie die Einträge speichern?');", "100", "left", "3");
$output .= "<br>" . $monthAnchorLinks . "</td>\n";
$output .= "</tr>\n";
// Get number of days of the month
$numOfDays = daysPerMonth($f_year, $i_month);
// Iterate all days of the current month
for ($i_day = 1; $i_day <= $numOfDays; $i_day++) :
$output .= "<tr>\n";
$output .= " <td align=\"right\" width=\"40\">" . $i_day . ".</td>\n";
$output .= " <td>" . weekDayNameMapping(getDateTime("format",array("0","0","0",$i_month,$i_day,$f_year),"l"),"1") . "</td>\n";
$isChecked = "";
$isDisabled = "";
$nameOfHoliday = "";
// Disable fields if date is in the past because they should not to be modified
if ($f_year < $currentYear || ($f_year == $currentYear && $i_month < $currentMonth) ||
($f_year == $currentYear && $i_month == $currentMonth && $i_day <= $currentDay)) :
$isDisabled = " disabled";
endif;
// Check single values according to the database result
if ($i_month == $row["ph_month"] && $i_day == $row["ph_day"]) :
// Get values of the current row
$isChecked = " checked";
$nameOfHoliday = $row["ph_name"];
// Get next row
$row = $result->fetch_assoc();
if (!is_array($row)) :
$row = array();
mcArrIsSet($row, "ph_month");
mcArrIsSet($row, "ph_day");
endif;
endif;
// If initialization mode is active AND NOT disabled, check single values according to the database result of the second result
if ($f_act == "load" && $f_year2 != "") :
if ($i_month == $row2["ph_month"] && $i_day == $row2["ph_day"]) :
// Get values of the current row
if (!$isDisabled && !$isChecked) :
$isChecked = " checked";
$nameOfHoliday = $row2["ph_name"];
endif;
// Get next row
$row2 = $result2->fetch_assoc();
if (!is_array($row2)) :
$row2 = array();
mcArrIsSet($row2, "ph_month");
mcArrIsSet($row2, "ph_day");
endif;
endif;
endif;
// Show enabled/disabled checkbox according to an existing db-entry
$output .= " <td align=\"center\" width=\"30\"><input type=\"checkbox\" name=\"f_holidays[]\" value=\"" . $i_month . "_" . $i_day . "\"" . $isChecked . " " . $isDisabled . "></td>\n";
// Optional name of the public holiday
$output .= " <td><input type=\"text\" name=\"f_" . $i_month . "_" . $i_day . "\" value=\"" . $nameOfHoliday . "\" size=\"50\"" . $isDisabled . "></td>\n";
$output .= "</tr>\n";
endfor;
endfor;
$result->free();
endif;
// Get all years distinct
if (TRUE) :
$sqlquery = "SELECT DISTINCT ph.ph_year"
. " FROM publicholiday AS ph"
. " WHERE hq_id = '" . $hq_id . "'"
. " ORDER BY ph.ph_year";
$result = $db->dbQ($sqlquery);
$currentYearInList = FALSE;
$nextYearInList = FALSE;
// First pulldown for selecting the year to be displayed
$output2 .= "<span class=\"f12bp1_blue\">" . getLngt("Auswahl Jahr") . "</span>&nbsp;&nbsp;";
$output2 .= "<select name=\"f_year\" onChange=\"submit();\">\n";
$output2 .= " <option value=\"0\">" . getLngt("Default") . "</option>\n"; // Default option for initialization
// Second pulldown for initializing of the current year
$output3 .= "<select name=\"f_year2\" onChange=\"finishPage('load','" . getLngt("Wollen Sie die aktuellen Einträge überladen?") . "');\">\n";
$output3 .= " <option value=\"0\">" . getLngt("Default") . "</option>\n"; // Default option for initialization
while ($row = $result->fetch_assoc()):
$isSelected = "";
if ($f_year == $row["ph_year"]) : $isSelected = " selected"; endif;
$output2 .= " <option value=\"" . $row["ph_year"] . "\"" . $isSelected . ">" . $row["ph_year"] . "</option>\n";
if ($currentYear == $row["ph_year"]) : $currentYearInList = TRUE; endif;
if ($currentYear + 1 == $row["ph_year"]) : $nextYearInList = TRUE; endif;
// Second pulldown
if ($row["ph_year"] < $f_year) :
$isSelected = "";
if ($f_year2 == $row["ph_year"]) : $isSelected = " selected"; endif;
$output3 .= " <option value=\"" . $row["ph_year"] . "\"" . $isSelected . ">" . $row["ph_year"] . "</option>\n";
endif;
endwhile;
// add option for the current year if necessary
if (!$currentYearInList) :
$isSelected = "";
if ($f_year == $currentYear) : $isSelected = " selected"; endif;
$output2 .= " <option value=\"" . $currentYear . "\"" . $isSelected . ">" . $currentYear . "</option>\n";
endif;
// add option for the next year if necessary
if (!$nextYearInList) :
$isSelected = "";
if ($f_year == $currentYear + 1) : $isSelected = " selected"; endif;
$output2 .= " <option value=\"" . ($currentYear + 1) . "\"" . $isSelected . ">" . ($currentYear + 1) . "</option>\n";
endif;
// First pulldown
$output2 .= "</select>\n";
// Second pulldown
$output3 .= "</select>\n";
$result->free();
endif;
// Only for output
$title = "";
if ($f_year == "0") :
$title .= getLngt("(Default)");
else :
$title .= $f_year;
endif;
?>
<html lang="de">
<head>
<title><?php echo $pageTitel ?></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 finishPage(f_act,text) {
if (confirm(text)) {
document.forms[0].f_act.value = f_act;
document.forms[0].submit();
}
};
-->
</script>
<noscript>
<center>
<b><br>JavaScript ist nicht verf&uuml;gbar. Bitte aktivieren Sie JavaScript<br><br>
in Ihrem Browser, damit diese Seite ordnungsgem&auml;&szlig; funktioniert!</b><br><br>
</center>
</noscript>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>displayStatusMessage();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="mc_page-header">
<?php echo $title ?>
</div>
<div class="maincontent mc_elem" name="maincontent" id="maincontent">
<form action="../admin/public_holiday.php" method="post" target="">
<input type="hidden" name="f_act" value="">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<table border="0" width="100%">
<tr>
<td>
<table border="0">
<tr>
<td colspan="4">
<?php echo $output2 ?>
</td>
</tr>
<?php echo $output ?>
</table>
</td>
</tr>
<tr>
<td>
<?php echo htmlDivLineSpacer("15px"); ?>
<div style="float:left">
<?php echo $output3 ?>
&nbsp;&nbsp;&nbsp;
</div>
<?php echo defineButtonType10(getLngt("Einträge&nbsp;ins&nbsp;akt.&nbsp;Jahr&nbsp;integrieren"), "action_new", "finishPage('load','" . getLngt("Wollen Sie die aktuellen Einträge integrieren?") . "');", "250", "left", "3") ?>
</td>
</tr>
</table>
</form>
</div>
</body>
</html>

View File

@@ -0,0 +1,54 @@
<?php
/*=======================================================================
*
* push_autoranking.php
*
* Autor: Marc Vollmann, Carsten Annacker
*
=======================================================================*/
include_once ("../include/global.inc.php");
include_once ("../include/caglobal.inc.php");
include_once ("../include/dbconnect.inc.php");
include_once("../include/auth.inc.php");
list($jb_id, $ignore_fav_only) = getHttpVars(array("jb_id", "ignore_fav_only"));
// Update job
//updateStmt("job", "jb_id", $jb_id, array("cr_id_order", "", "jb_status", "8", "cr_sid", ""));
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
$javascript = "";
$jb_status = getFieldValueFromId("job", "jb_id", "$jb_id", "jb_status");
$jb_globaljob = getFieldValueFromId("job", "jb_id", "$jb_id", "jb_globaljob");
if ($jb_status == 1)
$javascript .= "alert('Zurückstellen in automatische Vermittlung nicht möglich: Auftrag ist bereits angenommen!');\n";
if ($jb_status == 2)
$jb_status = getFieldValueFromId("job", "jb_id", "$jb_id", "jb_status");
if ($jb_status != 1 && $jb_status != 2):
// Update job
$jbStatusString = " (jb_status = '9' OR jb_status = '0' OR jb_status = '8') ";
$res = updateStmt("job", "jb_id", $jb_id, array("cr_id", "", "cr_id_order", "", "jb_status", "8", "cr_sid", "", "jb_globaljob", "0"), "(" . $jbStatusString . ")");
writeToLogDB(54, $hq_id, $jb_id, $usr_id, "", "", "", "");
deleteStmt("genericdatacontainer", "gdc_obj_type = 'jb' AND gdc_obj_id = " . $jb_id . " AND gdc_gen_fieldname = 'jb_ignore_fav_only'");
if ($ignore_fav_only == "1") {
insertStmt("genericdatacontainer", array("gdc_obj_type", "jb", "gdc_obj_id", $jb_id, "gdc_gen_fieldname", "jb_ignore_fav_only", "gdc_content", "1", "gdc_context", date("Y-m-d H:i:s")));
writeToLogDB(144, $hq_id, $jb_id, $usr_id, "", "", "", "");
}
if ($jb_globaljob == 1)
$javascript .= "alert('Auftrag war \"an alle\", ist jetzt aber wieder ein normaler Auftrag');\n";
endif;
$javascript .=
"opener.close();\n" .
"self.close();\n";
// Inhalt des temporären Fensters erzeugen und ausgeben
$output = file_get_contents(GETDATAHTMLTPL);
$output = str_replace("{_javascript_}", $javascript, $output);
echo $output;
?>

View File

@@ -0,0 +1,61 @@
<?php
/*=======================================================================
*
* push_manual.php
*
* Autor: Marc Vollmann, Carsten Annacker
*
=======================================================================*/
include_once ("../include/global.inc.php");
include_once ("../include/caglobal.inc.php");
include_once ("../include/dbconnect.inc.php");
include_once("../include/auth.inc.php");
list($jb_id, $ignore_fav_only) = getHttpVars(array("jb_id", "ignore_fav_only"));
// Update job
//updateStmt("job", "jb_id", $jb_id, array("cr_id_order", "", "jb_status", "8", "cr_sid", ""));
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
$javascript = "";
$jb_status = getFieldValueFromId("job", "jb_id", "$jb_id", "jb_status");
$jb_globaljob = getFieldValueFromId("job", "jb_id", "$jb_id", "jb_globaljob");
if ($jb_status != 2):
$jbHqId = getFieldValueFromId("job","jb_id",$jb_id,"hq_id");
$crIdCurrent = getFieldValueFromId("job","jb_id",$jb_id,"cr_id");
$crIdOrderCurrent = getFieldValueFromId("job","jb_id",$jb_id,"cr_id_order");
// Update job
$res = updateStmt("job", "jb_id", $jb_id, array("cr_id", "", "cr_id_order", "", "jb_status", "9", "cr_sid", "", "jb_globaljob", "0"));
writeToLogDB(185, $hq_id, $jb_id, $usr_id, "", "", "", "");
// Insert PDA command to remove job (take cr_id/cr_id_order before changing)
$currentTimePDA = getDateTime("datetime_plus_offset", array(0,0,30,0,0,0), $formatStr = "Y-m-d H:i:s");
//echo "jb_id = " . $jb_id . "<br>\n";
//echo "crIdCurrent = " . $crIdCurrent . "<br>\n";
//echo "crIdOrderCurrent = " . $crIdOrderCurrent . "<br>\n";
//echo "jbHqId = " . $jbHqId . "<br>\n";
//echo "currentTimePDA = " . $currentTimePDA . "<br>\n";
if ($crIdCurrent != "" && $crIdCurrent != "0") :
insertPDACommand($jbHqId, $crIdCurrent, "4", "1", $jb_id, $currentTimePDA, "");
endif;
if ($crIdOrderCurrent != "" && $crIdOrderCurrent != "0" && $crIdOrderCurrent != $crIdCurrent) :
insertPDACommand($jbHqId, $crIdOrderCurrent, "4", "1", $jb_id, $currentTimePDA, "");
endif;
if ($jb_globaljob == 1)
$javascript .= "alert('Auftrag war \"an alle\", ist jetzt aber wieder ein normaler Auftrag');\n";
endif;
$javascript .=
"opener.close();\n" .
"self.close();\n";
// Inhalt des temporären Fensters erzeugen und ausgeben
$output = file_get_contents(GETDATAHTMLTPL);
$output = str_replace("{_javascript_}", $javascript, $output);
echo $output;
?>

127
html/admin/register.php Normal file
View File

@@ -0,0 +1,127 @@
<?
include_once("../include/global.inc.php");
session_start();
// Check HTTP-Parameters
// list ($f_submit, $statusMessage,
// $f_cmp_comp ,$f_cmp_comp2, $f_usr_id, $f_usr_name, $f_usr_firstname,
// $f_usr_phone, $f_usr_phone2, $f_usr_fax, $f_usr_email,
// $f_cmp_iln, $f_cmp_tax_idno, $f_cmp_bank, $f_cmp_bankno, $f_cmp_bankacc,
// $f_cs_discount, $f_usr_account, $f_usr_password, $f_usr_password2,
// $f_ad_street, $f_cmp_hsno, $f_ad_zipcode, $f_ad_city) =
// getHttpVars(array("f_submit", "statusMessage",
// "f_cmp_comp", "f_cmp_comp2", "f_usr_id", "f_usr_name", "f_usr_firstname",
// "f_usr_phone", "f_usr_phone2", "f_usr_fax", "f_usr_email",
// "f_cmp_iln", "f_cmp_tax_idno", "f_cmp_bank", "f_cmp_bankno", "f_cmp_bankacc",
// "f_cs_discount", "f_usr_account", "f_usr_password", "f_usr_password2",
// "f_ad_street", "f_cmp_hsno", "f_ad_zipcode", "f_ad_city"));
getSecHttpVars("1",array("f_submit", "statusMessage",
"f_cmp_comp", "f_cmp_comp2", "f_usr_id", "f_usr_name", "f_usr_firstname",
"f_usr_phone", "f_usr_phone2", "f_usr_fax", "f_usr_email",
"f_cmp_iln", "f_cmp_tax_idno", "f_cmp_bank", "f_cmp_bankno", "f_cmp_bankacc",
"f_cs_discount", "f_usr_account", "f_usr_password", "f_usr_password2",
"f_ad_street", "f_cmp_hsno", "f_ad_zipcode", "f_ad_city"));
if (isset($HTTP_SESSION_VARS['usr_id']) && isset($HTTP_SESSION_VARS['hq_id'])):
// wenn bereits eingeloggt, ist ein Aufruf der Registrierungsseite
// sinnlos, deshalb Redirect auf Start-Seite
header("Location: ../admin/start.php");
else:
if ($f_submit == 'Senden'):
// Submit-Button wurde gedrückt
// -> Eingaben prüfen
checkRegister();
elseif ($f_submit == 'Abbrechen'):
header("Location: ../index.php");
endif;
if ($statusMessage != "" || $f_submit != 'Senden'):
// Wenn Register ok, dann statusMessage leer
$tpl = new IntegratedTemplate();
$tpl->loadTemplatefile("register.tpl.htm", true, true);
$tpl->setCurrentBlock("register");
$tpl->setVariable("statusMessage", $statusMessage);
$tpl->setVariable("f_cmp_comp", $f_cmp_comp);
$tpl->setVariable("f_cmp_comp2", $f_cmp_comp2);
$tpl->setVariable("f_ad_street", $f_ad_street);
$tpl->setVariable("f_cmp_hsno", $f_cmp_hsno);
$tpl->setVariable("f_ad_zipcode", $f_ad_zipcode);
$tpl->setVariable("f_ad_city", $f_ad_city);
$tpl->setVariable("f_usr_name", $f_usr_name);
$tpl->setVariable("f_usr_phone", $f_usr_phone);
$tpl->setVariable("f_usr_fax", $f_usr_fax);
$tpl->setVariable("f_usr_email", $f_usr_email);
$tpl->parseCurrentBlock("register");
$tpl->show();
else:
header("Location: ../index.php");
endif;
endif;
// Login-Formular
function checkRegister()
{
global $db, $f_submit, $statusMessage,
$f_cmp_comp ,$f_cmp_comp2, $f_usr_id, $f_usr_name, $f_usr_firstname,
$f_usr_phone, $f_usr_phone2, $f_usr_fax, $f_usr_email,
$f_cmp_iln, $f_cmp_tax_idno, $f_cmp_bank, $f_cmp_bankno, $f_cmp_bankacc,
$f_cs_discount, $f_usr_account, $f_usr_password, $f_usr_password2,
$f_ad_street, $f_cmp_hsno, $f_ad_zipcode, $f_ad_city;
// $statusMessage = "";
if ($f_cmp_comp != "" && $f_usr_name != "" && $f_usr_firstname != "" &&
$f_usr_phone != "" && $f_usr_email != "" && $f_usr_account != "" &&
$f_ad_street != "" && $f_ad_zipcode != "" && $f_ad_city != "" && $f_cmp_hsno != "") :
$statusMessage = "Bitte alle mit einem * gekennzeichneten Felder ausfüllen!";
elseif ($db->getOne("SELECT cmp_comp FROM company WHERE cmp_comp = '$f_cmp_comp'") == $f_cmp_comp):
$statusMessage = "Der Firmenname ist bereits vorhanden!";
elseif ($db->getOne("SELECT usr_account FROM user WHERE usr_account = '$f_usr_account'") == $f_usr_account):
$statusMessage = "Der Benutzername ist bereits vorhanden!";
elseif (checkPasswordValidation($f_usr_password, $f_usr_password2)):
// if hq enables new customer, the new structure will be added to the system (not here!)
// insertStmt("costcenter", array("csc_name", $f_cmp_comp));
// $csc_id = getLastInsertId();
// $sqlStmtPwd = "INSERT INTO employee (csc_id,emp_rights)" .
// " VALUES ('$csc_id','111111111111111')";
// $res = $db->query($sqlStmtPwd);
// if (DB::isError($res)) : die ("$PHP_SELF: " . $res->getMessage()); endif;
// $emp_id = getLastInsertId();
// Insert company (authentication-flag = 0)
TA("B");
insertStmt("company", array("cmp_comp", $f_cmp_comp, "cmp_comp2", $f_cmp_comp2,
"cmp_hsno", $f_cmp_hsno, "cmp_iln", $f_cmp_iln, "cmp_tax_idno", $f_cmp_tax_idno,
"cmp_bank", $f_cmp_bank, "cmp_bankno", $f_cmp_bankno,
"cmp_bankacc", $f_cmp_bankacc, "cmp_authenticated", "0"));
$cmp_id_new = getLastInsertId();
insertStmt("customer", array("cmp_id", $cmp_id_new, "hq_id", $hq_id,"csc_id", $csc_id_new,
"cs_admin", "0"));
updateStmt("costcenter", "csc_id", $csc_id, array("cs_id", $cs_id));
// insertStmt("address", array("csc_id", "cs_comp", "cs_comp2", "cs_admin"));
list($ad_id, $dummy_hsno, $dummy_comp, $dummy_remark, $dummy_person) =
insertAddress($f_cs_street, $f_cs_zipcode, $f_cs_city, "");
insertStmt("costcenteraddress", array("csc_id", $csc_id, "cscad_comp", $f_cs_comp, "cscad_comp2", $f_cs_comp2, "ad_id", $ad_id, "adt_id", 1, "cscad_hsno", $f_cs_hsno));
insertStmt("costcenteraddress", array("csc_id", $csc_id, "cscad_comp", $f_cs_comp, "cscad_comp2", $f_cs_comp2, "ad_id", $ad_id, "adt_id", 2, "cscad_hsno", $f_cs_hsno));
insertStmt("costcenteraddress", array("csc_id", $csc_id, "cscad_comp", $f_cs_comp, "cscad_comp2", $f_cs_comp2, "ad_id", $ad_id, "adt_id", 3, "cscad_hsno", $f_cs_hsno));
insertStmt("costcenteraddress", array("csc_id", $csc_id, "cscad_comp", $f_cs_comp, "cscad_comp2", $f_cs_comp2, "ad_id", $ad_id, "adt_id", 4, "cscad_hsno", $f_cs_hsno));
TA("C");
TA("E");
endif;
return;
}
?>

151
html/admin/register.tpl.htm Normal file
View File

@@ -0,0 +1,151 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="de">
<head>
<title>REGISTRIERUNG</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="description" content="votian"> <meta name="keywords" content="votian">
<link rel="stylesheet" type="text/css" href="../css/phoenix.css">
<!-- BEGIN register -->
<script type="text/javascript">
<!--
var statusMessage = "{statusMessage}";
function displayStatusMessage() {
if (statusMessage != "") {
alert(statusMessage);
}
};
-->
</script>
<noscript>
<center>
<b><br>JavaScript ist nicht verf&uuml;gbar. Bitte aktivieren Sie JavaScript<br><br>
in Ihrem Browser, damit diese Seite ordnungsgem&auml;&szlig; funktioniert!</b><br><br>
</center>
</noscript>
</head>
<body bgcolor="#FFFFFA" leftmargin="1" topmargin="1" marginwidth="0" marginheight="0" link="#990000" vlink="#990000" alink="#990000" onLoad="displayStatusMessage();">
<table border="0" height=100% width="100%" align="center" cellspacing="0" cellpadding="0" vspace="0" hspace="0">
<tr>
<td width=20%><img src="../images/empty.gif" width="1" height="10" alt=" "></td>
<td width=60% align=center valign=top><img src="../images/thinkwarelogistics.jpg" alt="votian"></td>
<td width=20%><img src="../images/empty.gif" width="1" height="10" alt=" "></td>
</tr>
<tr>
<td width=20%>&nbsp;</td>
<td width=60% align=center>
<table border="0" width=100% height=100% align=center cellspacing=0 cellpadding=0 vspace=0 hspace=0>
<tr>
<td colspan=10 valign="top">
<table border="0" align=center cellspacing="5" cellpadding="5">
<form action="register.php" method="POST">
<tr>
<td colspan=2 align="center">
<img src="../images/spacer.jpg" border="0" height="1" width="100%">
<div class=headline1><b>Registrieren</b></div>
</td>
</tr>
<tr>
<td>
Firma*:
</td>
<td>
<input type="text" size="30" maxlength="50" value="{f_cs_comp}" name="f_cs_comp" class="input">
</td>
</tr>
<tr>
<td>
Noch Firma:
</td>
<td>
<input type="text" size="30" maxlength="50" value="{f_cs_comp2}" name="f_cs_comp2" class="input">
</td>
</tr>
<tr>
<td>
Stra&szlig;e*, Hausnummer*:
</td>
<td>
<input name="f_cs_street" type="text" value="{f_cs_street}" size="38" maxlength="50" class="input">
<input name="f_cs_hsno" type="text" value="{f_cs_hsno}" size="3" maxlength="10" class="input">
</td>
</tr>
<tr>
<td>
Plz*, Ort*:
</td>
<td>
<input name="f_cs_zipcode" type="text" value="{f_cs_zipcode}" size="7" maxlength="10" class="input">
<input name="f_cs_city" type="text" value="{f_cs_city}" size="34" maxlength="50" class="input">
</td>
</tr>
<tr>
<td>
Anmeldename des Hauptbenutzers*:
</td>
<td>
<input type="text" size="30" maxlength="50" value="{f_emp_name}" name="f_emp_name" class="input">
</td>
</tr>
<tr>
<td>
Passwort*:<br>&nbsp;<br>(zur Best&auml;tigung bitte wiederholen)*
</td>
<td>
<input type="password" size="20" maxlength="20" value="" name="f_emp_password" class="input"><br>
<input type="password" size="20" maxlength="20" value="" name="f_emp_password_check" class="input">
</td>
</tr>
<tr>
<td>
Telefon*, Telefax:
</td>
<td>
<input type="text" size="20" maxlength="20" value="{f_emp_phone}" name="f_emp_phone" class="input">
<input type="text" size="20" maxlength="20" value="{f_emp_fax}" name="f_emp_fax" class="input">
</td>
</tr>
<tr>
<td>
E-Mail*:
</td>
<td>
<input type="text" size="30" maxlength="50" value="{f_emp_email}" name="f_emp_email" class="input">
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" title="Abbrechen ALT+a" name="f_submit" value="Abbrechen" accesskey="a">
&nbsp;&nbsp;&nbsp;
<input type="submit" title="Senden ALT+s" name="f_submit" value="Senden" accesskey="s">
<br>
<img src="../images/spacer.jpg" border="0" height="1" width="100%">
<br>
Die Angabe der mit einem * gekennzeichneten Felder ist erforderlich!
</td>
</tr>
<!-- END register -->
</form>
</table>
</td>
</tr>
</form>
</table>
</td>
<td width=20%>&nbsp;</td>
</tr>
<tr>
<td><img src="../images/empty.gif" width="1" height="10" alt=" "></td>
<td><img src="../images/empty.gif" width="1" height="1" alt=" "></td>
<td><img src="../images/empty.gif" width="1" height="10" alt=" "></td>
</tr>
</table>
</body>
</html>

71
html/admin/relogin.php Normal file
View File

@@ -0,0 +1,71 @@
<?php
/*=======================================================================
*
* relogin.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/global.inc.php");
include_once ("../include/auth.inc.php");
// Check HTTP-Parameters
$httpVars = array("statusMessage", "currentNavigationItem", "menuActiveByPageTitel", "deactivateMenu", "currReferer", "currHqSelection");
getSecHttpVars("1", $httpVars);
if ($currReferer != "") :
$currReferer = "../" . urldecode($currReferer);
else :
$currReferer = "../admin/logout.php";
endif;
// Check authentication verifying emmployee an his/her costcenter- and customer-association
$usrAccessArray["hq"] = "1";
if (!authCheckForAccess($hq_id, $usr_id, $emp_id, "", $customerId, $cscIdRoot, $cscIdActual) || $currHqSelection == "" || !is_numeric($currHqSelection)) :
header("Location: ../admin/logout.php");
endif;
// Check for authentication access and granted rights
;
// After check of the current user try to set new session parameters according to the selected user
$empHqList = getParameterValue("0", "HEADQUARTERS_MULTIPLE_ACCESS_EMPLOYEES", "0");
$outHqSelection = "";
if ($empHqList != "") :
$showMultipleHqSelection = isInParameterString($emp_id, $empHqList);
if ($showMultipleHqSelection) :
$usrId = getFieldValueFromId("employee","emp_id",$emp_id,"usr_id");
$hq_mnemonic = getFieldValueFromId("headquarters","hq_id",$currHqSelection,"hq_mnemonic");
if ($hq_mnemonic != "") :
// Return-Wert ist ungleich '', name/pass ist gültig
if (phpversion() < '4.1.0'):
// bis auschl. PHP 4.1.0.
session_register("usr_id","hq_id","emp_id");
$HTTP_SESSION_VARS["hq_id"] = $currHqSelection;
else:
// ab einschl. PHP 4.1.0.
$_SESSION['hq_id'] = $currHqSelection;
endif;
header("Location: " . $currReferer);
exit();
else :
header("Location: ../admin/logout.php");
endif;
else :
header("Location: ../admin/logout.php");
endif;
else :
header("Location: ../admin/logout.php");
endif;
// Referer
header("Location: ../admin/logout.php");
?>

View File

@@ -0,0 +1,266 @@
<?php
/*=======================================================================
*
* selection_list.php
*
* Autor: Marc Vollmann
*
* Generic script to make a selection from a list (tax, branch, etc.)
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act", "generic", "deactivateMenu", "listType", "callOpenerFunction", "orderByFieldNo"));
getLanguage(__FILE__);
$deactivateMenuStatic = "1";
if ($pageTitle == "") : $pageTitel = getLngt("AUSWAHL AUS DER LISTE"); endif;
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
getCurrentScript(__FILE__);
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
if (!(authCheckEmployeeRights($emp_id, "0") || authCheckEmployeeRights($emp_id, "7"))) : gotoReferer("1"); endif;
if (!isset($listType)) : $listType = ""; endif;
$htmlClass01 = "class=\"smaller\""; // input,select
$htmlClass02 = "class=\"f7np1\""; // write
$doCloseWindow = "1";
$returnValueArray = array();
$out = "";
if ($listType != "") :
$doCloseWindow = "0";
$sqlquery = "";
$tableFieldNumOfIdField = 0;
$tableColFinishPageLink = "0"; // The column the finish page link will appear
// Initialize value
if ($generic == "") : $generic = "1111"; endif;
if ($listType == "branch") :
$pageTitel = getLngt("BRANCHEN");
$orderByFieldArray = array("br_key", "br_name");
if ($orderByFieldNo != "0" && $orderByFieldNo != "1") :
$orderByFieldNo = "1";
endif;
// $sqlquery = "SELECT br.br_id, br.br_key, br.br_name, br.br_group FROM branch AS br ORDER BY br." . $orderByFieldArray[$orderByFieldNo];
$sqlquery = "SELECT br.br_id, br.br_key, br.br_name, br.br_group FROM branch AS br WHERE br.br_visible = '1' ORDER BY br." . $orderByFieldArray[$orderByFieldNo];
$tableHeader = " <td align=\"center\">" . "<a href=\"javascript:finishSort('0');\">" . getLngt("Schlüssel") . "</a></td>"
. " <td align=\"center\">" . "<a href=\"javascript:finishSort('1');\">" . getLngt("Branche") . "</a></td>";
$tableFieldArray = array("br_key","br_name");
$tableAlignArray = array("center","left");
// $tableColFinishPageLink = "0";
// $tableFieldNumOfIdField = 0;
$tableFieldFinishPageArray = array("br_id","br_key","br_name");
$returnValueArray = array("g_br_id", "g_br_key", "g_br_name");
elseif ($listType == "tax") :
$pageTitel = getLngt("STEUERSÄTZE");
$orderByFieldArray = array("tx_id", "tx_sign", "tx_value");
if ($orderByFieldNo != "0" && $orderByFieldNo != "1" && $orderByFieldNo != "2") :
$orderByFieldNo = "0";
endif;
$sqlquery = "SELECT tx.tx_id, tx.txt_id, tx.tx_sign, tx.tx_value, tx.tx_remark FROM tax AS tx ORDER BY tx." . $orderByFieldArray[$orderByFieldNo];
$tableHeader = " <td align=\"center\">" . "<a href=\"javascript:finishSort('0');\">" . getLngt("Satz") . "</a></td>"
. " <td align=\"center\">" . "<a href=\"javascript:finishSort('1');\">" . getLngt("Kennzeichen") . "</a></td>";
$tableFieldArray = array("tx_value","tx_sign","tx_remark");
$tableAlignArray = array("right","center","left");
// $tableColFinishPageLink = "0";
// $tableFieldNumOfIdField = 0;
$tableFieldFinishPageArray = array("tx_id","txt_id","tx_sign","tx_value");
$returnValueArray = array("g_tx_id", "g_txt_id", "g_tx_sign", "g_tx_value");
elseif ($listType == "employee" && $userTypeName == "hq") :
$pageTitel = getLngt("MITARBEITER");
$whereClause = "";
if (!authCheckEmployeeRights($emp_id, "3")) : $whereClause = " AND emp.emp_id = '" . $emp_id . "'"; endif;
$sqlquery = "SELECT emp.emp_id, usr.usr_name, usr.usr_firstname, usr.usr_email, usr.usr_phone, usr.usr_phone2, usr.usr_account, hq.hq_mnemonic"
. " FROM user AS usr, employee AS emp, headquarters AS hq"
. " WHERE usr.usr_type = '1' AND emp.usr_id = usr.usr_id AND emp.csc_id = '0' AND usr.hq_id = hq.hq_id AND hq.hq_id = '" . $hq_id . "'" . $whereClause
. " ORDER BY usr.usr_name";
// $tableHeader = "<tr><td align=\"left\">" . getLngt("Name") . "</td><td align=\"left\">" . getLngt("Vorname") . "</td><td align=\"left\">" . getLngt("Niederlassung") . "</td><td align=\"left\">" . getLngt("E-mail") . "</td><td align=\"left\">" . getLngt("Telefon") . "</td><td align=\"left\">" . getLngt("Anmeldename") . "</td></tr>";
$tableHeader = " <td align=\"center\">" . "<a href=\"javascript:finishSort('0');\">" . getLngt("Name") . "</a></td>"
. " <td align=\"center\">" . "<a href=\"javascript:finishSort('1');\">" . getLngt("Vorname") . "</a></td>"
. " <td align=\"center\">" . "<a href=\"javascript:finishSort('2');\">" . getLngt("Niederlassung") . "</a></td>"
. " <td align=\"center\">" . "<a href=\"javascript:finishSort('3');\">" . getLngt("E-Mail") . "</a></td>"
. " <td align=\"center\">" . "<a href=\"javascript:finishSort('4');\">" . getLngt("Telefon") . "</a></td>"
. " <td align=\"center\">" . "<a href=\"javascript:finishSort('5');\">" . getLngt("Anmeldename") . "</a></td>";
$tableFieldArray = array("usr_name","usr_firstname","hq_mnemonic","usr_email","usr_phone","usr_account");
$tableAlignArray = array("left","left","left","left","left","left");
// $tableColFinishPageLink = "0";
// $tableFieldNumOfIdField = 0;
$tableFieldFinishPageArray = array("emp_id","usr_name","usr_firstname");
$returnValueArray = array("g_sales_emp_id", "g_sales_usr_name", "g_sales_usr_firstname");
else :
$doCloseWindow = "1";
endif;
// Generate list from special statement
if ($sqlquery != "") :
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
// Table with header
$numOfRows = 1;
$lineToggler = 0;
$tableFieldArrayLen = count($tableFieldArray);
$tableFieldFinishPageArrayLen = count($tableFieldFinishPageArray);
// Check für additional link coloumns
$genericStrLen = strlen($generic);
// ATTENTION: The length will be checked against "$tableFieldFINISHPAGEArrayLen" but will be added to "$tableFieldArray" (!!!!)
if ($genericStrLen > $tableFieldFinishPageArrayLen) :
for ($j = $tableFieldFinishPageArrayLen; $j < $genericStrLen; $j++) :
// Group link (<=> "2")
if (substr($generic, $j,1) == "2") :
$tableHeader .= " <td align=\"center\">" . getLngt("Gruppen") . "</td>";
array_push($tableFieldArray, "link_group");
array_push($tableAlignArray, "center");
endif;
endfor;
$tableFieldArrayLen = count($tableFieldArray);
endif;
$out .= "<tr>" . $tableHeader . "</tr>";
while ($row = $result->fetch_assoc()):
$numOfRows++;
if ($lineToggler == 0) : $lineToggler = 1; else : $lineToggler = 0; endif;
$cellColor = getListColor($numOfRows, $lineToggler);
$out .= "<tr>";
for ($j = 0; $j < $tableFieldArrayLen; $j++) :
$align = $tableAlignArray[$j];
if ($align == "") : $align = "left"; endif;
if ($tableColFinishPageLink == $j) :
$out .= "<td align=\"" . $align . "\" bgcolor=\"" . $cellColor ."\">&nbsp;<a href=\"javascript:finishPage('";
for ($i = 0; $i < $tableFieldFinishPageArrayLen; $i++) :
$out .= $row[$tableFieldFinishPageArray[$i]];
if ($i < ($tableFieldFinishPageArrayLen - 1)) : $out .= "','"; endif;
endfor;
$out .= "');\">";
$out .= $row[$tableFieldArray[$j]];
$out .= "</a></td>";
else :
// Check for special link (e.g. group link)
if ($tableFieldArray[$j] == "link_group") :
$out .= "<td ".$htmlClass02." align=\"" . $align . "\" bgcolor=\"" . $cellColor ."\">&nbsp;" . "<a href=\"javascript:linkOpenGroups('br','" . ec($row[$tableFieldFinishPageArray[$tableFieldNumOfIdField]]) . "');\">"
. "<img src=\"../images/arrow_right.png\" border=\"0\" height=\"10\" width=\"25\">"
. "</a></td>"
. "</td>";
else :
$out .= "<td align=\"" . $align . "\" bgcolor=\"" . $cellColor ."\">&nbsp;" . $row[$tableFieldArray[$j]] . "</td>";
endif;
endif;
endfor;
$out .= "</tr>";
endwhile;
$result->free();
endif;
endif;
?>
<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 type="text/javascript">
<!--
// NAVIGATION
<?php echo $jsMenuOut; ?>
// GENERIC function
function finishPage(par_00,par_01,par_02,par_03,par_04,par_05,par_06,par_07,par_08,par_09) {
<?php
$returnValueArrayLen = count($returnValueArray);
for ($i = 0; $i < $returnValueArrayLen; $i++) :
if (substr($generic, $i,1) == "1") : echo "opener.document.forms[0]." . $returnValueArray[$i] . ".value = par_" . pad($i, 2, "0") . ";"; endif;
endfor;
// Call opener function
if ($callOpenerFunction != "") :
echo "opener." . $callOpenerFunction . ";";
endif;
?>
self.close();
};
function executeOnLoad () {
// If no type specified or type is unknown then close the window immediately after loading the page
if ('<?php echo $doCloseWindow ?>' == '1') {
self.close();
}
}
function finishSort (sortNo) {
document.forms[0].orderByFieldNo.value = sortNo;
document.forms[0].submit();
}
function linkOpenGroups(itemType, itemId) {
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=" + itemType + "&itemId=" + itemId,"","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
};
-->
</script>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>executeOnLoad();displayStatusMessage();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="maincontent" name="maincontent" id="maincontent">
<form action="../admin/selection_list.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="generic" value="<?php echo $generic ?>">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<input type="hidden" name="callOpenerFunction" value="<?php echo $callOpenerFunction ?>">
<input type="hidden" name="listType" value="<?php echo $listType ?>">
<input type="hidden" name="orderByFieldNo" value="<?php echo $orderByFieldNo ?>">
<?php echo htmlDivLineSpacer("20px"); ?>
<div>
<div class="f12bp1_blue"><?php echo $pageTitle ?></div>
</div>
<?php echo htmlDivLineSpacer("20px"); ?>
<div>
<table class="f8np1" border="0" cellpadding="0">
<?php echo $out ?>
</table>
</div>
<?php echo htmlDivLineSpacer("20px"); ?>
</form>
</div>
</body>
</html>

1112
html/admin/services.php Normal file

File diff suppressed because it is too large Load Diff

750
html/admin/services_plz.php Normal file
View File

@@ -0,0 +1,750 @@
<?php
/*=======================================================================
*
* services_plz.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/global.inc.php");
include_once ("../include/auth.inc.php");
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act","mode","csId","vhtId","opener","orderByServices","statusMessage","zipcodeRow","zipcodeCol",
"f_zipcode2", "f_del_neighbour_id", "f_newneighbourforzipcode", "deactivateMenu", "f_vehicletype",
"pageFirstCall", "f_chkbx_toggle", "f_chkbx_toggle_cr"));
getLanguage(__FILE__);
$pageTitel = getLngt("PLZ-PREISE");
if ($mode == "discount") : $pageTitel = getLngt("PLZ-RABATTE"); endif;
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
getCurrentScript(__FILE__);
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
authCheckEmployeeRights($emp_id, "2", "1");
// Get usr_id of the current employee (session)
$currentSessionUsrId = getFieldValueFromId("employee", "emp_id", $emp_id, "usr_id");
if ($pageFirstCall == "" || ($f_chkbx_toggle == "" && $f_chkbx_toggle_cr == "")) :
$pageFirstCall = 1;
$f_chkbx_toggle = "service";
$f_chkbx_toggle_cr = "";
endif;
$f_chkbx_toggle_checked = "";
$f_chkbx_toggle_cr_checked = "";
if ($f_chkbx_toggle == "service") : $f_chkbx_toggle_checked = "checked"; endif;
if ($f_chkbx_toggle_cr == "service_cr") : $f_chkbx_toggle_cr_checked = "checked"; endif;
// Price-mode or discount-mode
if ($mode == "") : $mode = "price"; endif;
// General price/discount for all customers
if ($csId == "") : $csId = "0"; endif;
// General price/discount for all vehicle types
if ($vhtId == "") : $vhtId = "0"; endif;
if ($f_vehicletype != "" && is_numeric($f_vehicletype)) : $vhtId = $f_vehicletype; endif;
if (!existsEntry("metatype",array("mt_type","vehicletype","mt_sort",$vhtId))) : $vhtId = "0"; endif; // Check for existence in "metatype"
// Check opener ONLY for output in target
$htmlFormTarget = "target=\"\"";
if ($opener == "1") : $htmlFormTarget = ""; endif;
// Get parameters
$parServiceVehicleTypeEnabled = getParameterValue("0", "SERVICE_VEHICLE_TYPE_ENABLED", $hq_id);
// Get mapped vehicle type id if a mapping does exist
$vhtId = getServiceVehicleTypeMappingId($vhtId);
// Init
$areaneighbours = array();
$areaneighbours["id"] = array();
$areaneighbours["name"] = array();
$areaneighbours["sort"] = array();
$cmpComp = "";
$cmpComp2 = "";
if ($csId != "0") :
$cmpId = getFieldValueFromId("customer","cs_id",$csId,"cmp_id");
$tmpFields = getFieldsValueFromId("company","cmp_id",$cmpId,array("cmp_comp","cmp_comp2"));
$cmpComp = $tmpFields[0];
$cmpComp2 = $tmpFields[1];
endif;
$vhtName = "";
if ($vhtId != "0") :
$vhtName = getFieldValueFromClause("metatype","mt_value","mt_type = 'vehicletype' AND mt_sort = '" . $vhtId . "'");
endif;
// Sorting of the services to be displayed
if ($orderByServices == "") : $orderByServices = "srvp.srvp_plz" ; endif;
// Offset for output
$offset = NUM_ROWS_ZIPCODE_MATRIX;
// Selection and display from the starting zipcodes (row and column)
if ($zipcodeRow == "" || $zipcodeCol == "") :
$sqlquery = "SELECT MIN(srvp.srvp_plz) AS plz"
. " FROM serviceplz AS srvp";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
while ($row = $result->fetch_assoc()):
if ($zipcodeRow == "") : $zipcodeRow = $row["plz"]; endif;
if ($zipcodeCol == "") : $zipcodeCol = $row["plz"]; endif;
endwhile;
$result->free();
endif;
// *******************************************************
// * Selection of all plz of the specified submatrix-row *
// *******************************************************
$sqlquery = "SELECT srvp.srvp_id, srvp.srvp_plz"
. " FROM serviceplz AS srvp"
. " WHERE srvp.srvp_plz >= '" . $zipcodeRow . "' AND "
. " srvp.srvp_valid = '1' "
. " ORDER BY " . $orderByServices
. " LIMIT " . $offset;
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
$services = array();
$count = 0;
while ($row = $result->fetch_assoc()):
$count++;
$services["id"][$count] = $row["srvp_id"];
$services["plz"][$count] = $row["srvp_plz"];
endwhile;
$result->free();
// **********************************************************
// * Selection of all plz of the specified submatrix-column *
// **********************************************************
$sqlquery = "SELECT srvp.srvp_id, srvp.srvp_plz"
. " FROM serviceplz AS srvp"
. " WHERE srvp.srvp_plz >= '" . $zipcodeCol . "' AND "
. " srvp.srvp_valid = '1' "
. " ORDER BY " . $orderByServices
. " LIMIT " . $offset;
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
$services2 = array();
$count = 0;
while ($row = $result->fetch_assoc()):
$count++;
$services2["id"][$count] = $row["srvp_id"];
$services2["plz"][$count] = $row["srvp_plz"];
endwhile;
$result->free();
// ******************************************
// * Selection of serviceplzcustomer-values *
// ******************************************
$sqlquery = "SELECT srvpc.srvp_id, srvpc.srvp2_id, srvpc.cs_id, srvpc.srvpc_price, srvpc.srvpc_discount, srvpc.srvpc_cr_price, srvpc.srvpc_cr_discount"
. " FROM serviceplz AS srvp, serviceplz AS srvp2, serviceplzcustomer AS srvpc"
. " WHERE srvpc.srvp_id = srvp.srvp_id"
. " AND srvpc.srvp2_id = srvp2.srvp_id"
. " AND srvpc.cs_id = " . $csId
. " AND srvpc.vht_id = " . $vhtId
. " AND srvpc.hq_id = " . $hq_id
. " ORDER BY " . $orderByServices;
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
$servicePrices = array();
$serviceDiscounts = array();
while ($row = $result->fetch_assoc()):
$servicePrices[$row["srvp_id"]][$row["srvp2_id"]] = $row["srvpc_price"];
$serviceDiscounts[$row["srvp_id"]][$row["srvp2_id"]] = $row["srvpc_discount"];
$serviceCrPrices[$row["srvp_id"]][$row["srvp2_id"]] = $row["srvpc_cr_price"];
$serviceCrDiscounts[$row["srvp_id"]][$row["srvp2_id"]] = $row["srvpc_cr_discount"];
endwhile;
$result->free();
// Number of entries
$lenServices = count($services["id"]);
$lenServices2 = count($services2["id"]);
if ($services["id"][1] == "" || $services2["id"][1] == ""):
$lenServices = 0;
$lenServices2 = 0;
endif;
// If matrix (generated above) is from a special customer ($csId != "0"), the default prices ($csId == "0") have to be shown to compare the prices
// Setup a second request according to the one before with ($csId == "0")
if ($csId != "0") :
$sqlquery = "SELECT srvpc.srvp_id, srvpc.srvp2_id, srvpc.cs_id, srvpc.srvpc_price, srvpc.srvpc_discount, srvpc.srvpc_cr_price, srvpc.srvpc_cr_discount"
. " FROM serviceplz AS srvp, serviceplz AS srvp2, serviceplzcustomer AS srvpc"
. " WHERE srvpc.srvp_id = srvp.srvp_id"
. " AND srvpc.srvp2_id = srvp2.srvp_id"
. " AND srvpc.cs_id = '0'"
. " AND srvpc.vht_id = " . $vhtId
. " AND srvpc.hq_id = " . $hq_id
. " ORDER BY " . $orderByServices;
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
$servicePricesDefault = array();
$serviceDiscountsDefault = array();
while ($row = $result->fetch_assoc()):
$servicePricesDefault[$row["srvp_id"]][$row["srvp2_id"]] = $row["srvpc_price"];
$serviceDiscountsDefault[$row["srvp_id"]][$row["srvp2_id"]] = $row["srvpc_discount"];
$serviceCrPricesDefault[$row["srvp_id"]][$row["srvp2_id"]] = $row["srvpc_cr_price"];
$serviceCrDiscountsDefault[$row["srvp_id"]][$row["srvp2_id"]] = $row["srvpc_cr_discount"];
endwhile;
$result->free();
endif;
// *** Storing-processes ***
// *** BEGIN ***************
// Storing prices and discounts if requested
// Using the results of the statements before!!!
if ($f_act != "" && $f_act == "save") :
// Set the current timestamp to store the data
$currentTime = getDateTime("0");
TA("B");
for ($i = 1; $i <= $lenServices2; $i++) :
for ($j = 1; $j <= $lenServices; $j++) :
// Define current service-plz-ids
$srvPlzCur = $services["id"][$j];
$srvp2PlzCur = $services2["id"][$i];
// Get current input-type-text-field with price-/dicount-value
list ($newValueToBeStored) = getHttpVars(array("service_". $srvPlzCur ."_" . $srvp2PlzCur));
if ($newValueToBeStored == "") : $newValueToBeStored = "0"; endif;
list ($newCrValueToBeStored) = getHttpVars(array("service_cr_". $srvPlzCur ."_" . $srvp2PlzCur));
if ($newCrValueToBeStored == "") : $newCrValueToBeStored = "0"; endif;
// Allow float data with "." and ","
$newValueToBeStored = str_replace (",", ".", $newValueToBeStored);
$newCrValueToBeStored = str_replace (",", ".", $newCrValueToBeStored);
$servicePrices[$srvPlzCur][$srvp2PlzCur] = mcArrMultiDimIsSet($servicePrices[$srvPlzCur], $srvp2PlzCur);
$serviceDiscounts[$srvPlzCur][$srvp2PlzCur] = mcArrMultiDimIsSet($serviceDiscounts[$srvPlzCur], $srvp2PlzCur);
$serviceCrPrices[$srvPlzCur][$srvp2PlzCur] = mcArrMultiDimIsSet($serviceCrPrices[$srvPlzCur], $srvp2PlzCur);
$serviceCrDiscounts[$srvPlzCur][$srvp2PlzCur] = mcArrMultiDimIsSet($serviceCrDiscounts[$srvPlzCur], $srvp2PlzCur);
if ($servicePrices[$srvPlzCur][$srvp2PlzCur] == "") : $servicePrices[$srvPlzCur][$srvp2PlzCur] = "0"; endif;
if ($serviceDiscounts[$srvPlzCur][$srvp2PlzCur] == "") : $serviceDiscounts[$srvPlzCur][$srvp2PlzCur] = "0"; endif;
if ($serviceCrPrices[$srvPlzCur][$srvp2PlzCur] == "") : $serviceCrPrices[$srvPlzCur][$srvp2PlzCur] = "0"; endif;
if ($serviceCrDiscounts[$srvPlzCur][$srvp2PlzCur] == "") : $serviceCrDiscounts[$srvPlzCur][$srvp2PlzCur] = "0"; endif;
if ($mode == "price") :
// Check for necessity to update or insert
if ($servicePrices[$srvPlzCur][$srvp2PlzCur] != $newValueToBeStored || $serviceCrPrices[$srvPlzCur][$srvp2PlzCur] != $newCrValueToBeStored) :
if (existsEntry("serviceplzcustomer",array("srvp_id",$srvPlzCur,"srvp2_id",$srvp2PlzCur,"hq_id",$hq_id,"cs_id",$csId,"vht_id",$vhtId))) :
// Update the new price
$sqlStmt = "UPDATE serviceplzcustomer SET srvpc_price = $newValueToBeStored, srvpc_cr_price = $newCrValueToBeStored"
. " WHERE srvp_id = $srvPlzCur AND srvp2_id = $srvp2PlzCur AND hq_id = $hq_id AND cs_id = $csId AND vht_id = $vhtId";
$res = $db->query($sqlStmt);
if (DB::isError($res)) : die ("$PHP_SELF: " . $res->getMessage()); endif;
else :
if ($newValueToBeStored != "0" || $newCrValueToBeStored != "0") :
// Insert the new price
$tmpFields = array("srvp_id",$srvPlzCur,"srvp2_id",$srvp2PlzCur,"hq_id",$hq_id,"cs_id",$csId,"vht_id",$vhtId,"srvpc_price",$newValueToBeStored,"srvpc_discount",$serviceDiscounts[$srvPlzCur][$srvp2PlzCur],"srvpc_cr_price",$newCrValueToBeStored,"srvpc_cr_discount",$serviceCrDiscounts[$srvPlzCur][$srvp2PlzCur]);
insertStmt("serviceplzcustomer",$tmpFields);
endif;
endif;
// Insert current prices AND (!) discounts into the servicehistory
$tmpFields = array("srvp_id",$srvPlzCur,"srvp2_id",$srvp2PlzCur,"hq_id",$hq_id,"cs_id",$csId,"vht_id",$vhtId,"usr_id",$currentSessionUsrId,"srvph_validfrom",$currentTime,"srvph_price",$newValueToBeStored,"srvph_discount",$serviceDiscounts[$srvPlzCur][$srvp2PlzCur],"srvph_cr_price",$newCrValueToBeStored,"srvph_cr_discount",$serviceCrDiscounts[$srvPlzCur][$srvp2PlzCur]);
insertStmt("serviceplzhistory",$tmpFields);
$servicePrices[$srvPlzCur][$srvp2PlzCur] = $newValueToBeStored;
$serviceCrPrices[$srvPlzCur][$srvp2PlzCur] = $newCrValueToBeStored;
endif;
else :
// Check for necessity to update or insert
if ($serviceDiscounts[$srvPlzCur][$srvp2PlzCur] != $newValueToBeStored || $serviceCrDiscounts[$srvPlzCur][$srvp2PlzCur] != $newCrValueToBeStored) :
if (existsEntry("serviceplzcustomer",array("srvp_id",$srvPlzCur,"srvp2_id",$srvp2PlzCur,"hq_id",$hq_id,"cs_id",$csId,"vht_id",$vhtId))) :
// Update the new discount
$sqlStmt = "UPDATE serviceplzcustomer SET srvpc_discount = $newValueToBeStored, srvpc_cr_discount = $newCrValueToBeStored"
. " WHERE srvp_id = $srvPlzCur AND srvp2_id = $srvp2PlzCur AND hq_id = $hq_id AND cs_id = $csId AND vht_id = $vhtId";
$res = $db->query($sqlStmt);
if (DB::isError($res)) : die ("$PHP_SELF: " . $res->getMessage()); endif;
else :
if ($newValueToBeStored != "0" || $newCrValueToBeStored != "0") :
// Insert the new discount
$tmpFields = array("srvp_id",$srvPlzCur,"srvp2_id",$srvp2PlzCur,"hq_id",$hq_id,"cs_id",$csId,"vht_id",$vhtId,"srvpc_price",$servicePrices[$srvPlzCur][$srvp2PlzCur],"srvpc_discount",$newValueToBeStored,"srvpc_cr_price",$serviceCrPrices[$srvPlzCur][$srvp2PlzCur],"srvpc_cr_discount",$newCrValueToBeStored);
insertStmt("serviceplzcustomer",$tmpFields);
endif;
endif;
// Insert current prices AND (!) discounts into the servicehistory
$tmpFields = array("srvp_id",$srvPlzCur,"srvp2_id",$srvp2PlzCur,"hq_id",$hq_id,"cs_id",$csId,"vht_id",$vhtId,"usr_id",$currentSessionUsrId,"srvph_validfrom",$currentTime,"srvph_price",$servicePrices[$srvPlzCur][$srvp2PlzCur],"srvph_discount",$newValueToBeStored,"srvph_cr_price",$serviceCrPrices[$srvPlzCur][$srvp2PlzCur],"srvph_cr_discount",$newCrValueToBeStored);
insertStmt("serviceplzhistory",$tmpFields);
$serviceDiscounts[$srvPlzCur][$srvp2PlzCur] = $newValueToBeStored;
$serviceCrDiscounts[$srvPlzCur][$srvp2PlzCur] = $newCrValueToBeStored;
endif;
endif;
endfor;
endfor;
TA("C");
TA("E");
endif;
// Store new association between current area and entered neighbour
if ($f_act != "" && $f_act == "save_newneighbourassociation" && $f_zipcode2 != "") :
// Syntax of the zipcode is correct?
if ($f_newneighbourforzipcode != "") :
// Get the internal id of the current zipcode
$srvp_id = getFieldValueFromId("serviceplz","srvp_plz",$f_zipcode2,"srvp_id");
// First make a lookup if neighbour exists and get the internal id of the new neighbour
$srvp2_id = getFieldValueFromId("serviceplz","srvp_plz",$f_newneighbourforzipcode,"srvp_id");
if ($srvp_id != "" && $srvp2_id != "") :
if ($srvp_id != $srvp2_id) :
// The relation of the neighbourhood is symmetric but NOT transitive!
// Therefore ONLY both relations (aRb AND bRa) have to be inserted into the database
TA("B");
$relationOne = existsEntry("serviceplzneighbour",array("hq_id",$hq_id,"srvp_id",$srvp_id,"srvp2_id",$srvp2_id));
$relationTwo = existsEntry("serviceplzneighbour",array("hq_id",$hq_id,"srvp_id",$srvp2_id,"srvp2_id",$srvp_id));
// If neighbour exists then lookup for an existing association between the neighbour and another zipcode
if (!$relationOne) :
// Insert the new association
$tmpFields = array("hq_id",$hq_id,"srvp_id",$srvp_id,"srvp2_id",$srvp2_id);
insertStmt("serviceplzneighbour",$tmpFields);
endif;
if (!$relationTwo) :
// Insert the new reverse association
$tmpFields = array("hq_id",$hq_id,"srvp_id",$srvp2_id,"srvp2_id",$srvp_id);
insertStmt("serviceplzneighbour",$tmpFields);
endif;
if ($relationOne && $relationTwo) :
$statusMessage = "Diese Nachbarschaft besteht bereits!";
endif;
TA("C");
TA("E");
else :
$statusMessage = getLngt("Eine Nachbarschaft identischer PLZn liegt implizit schon vor!");
endif;
else :
$statusMessage = getLngt("Die PLZ ist nicht in der Datenbank verzeichnet!");
endif;
else :
$statusMessage = getLngt("Die PLZ wurde falsch eingegeben!");
endif;
endif;
// Store new association between current area and entered zipcode
if ($f_act != "" && $f_act == "save_removeneighbourassociation") :
// Entries to be deleted?
$fieldsLength = count($f_del_neighbour_id);
if ($fieldsLength > 0 && $f_del_neighbour_id[0] != "") :
TA("B");
// Remove all associations according to the zipcode nested in array $f_del_zipcode_id
for ($i = 0; $i < $fieldsLength; $i++) :
// Get the internal id of the current area
$srvp_id = getFieldValueFromId("serviceplz","srvp_plz",$f_zipcode2,"srvp_id");
deleteStmt("serviceplzneighbour","hq_id = '" . $hq_id . "' AND srvp_id = " . $srvp_id . " AND srvp2_id = " . $f_del_neighbour_id[$i]);
deleteStmt("serviceplzneighbour","hq_id = '" . $hq_id . "' AND srvp_id = " . $f_del_neighbour_id[$i] . " AND srvp2_id = " . $srvp_id);
endfor;
TA("C");
TA("E");
else :
$statusMessage = getLngt("Bitte markieren Sie zu löschenden Nachbar-PLZn durch anklicken der jeweiligen Checkbox hinter der PLZ!");
endif;
endif;
// *** END ***************
// *****************************************************
// * Generation of the price-matrix or discount-matrix *
// *****************************************************
// Table-header
$serviceOutput = "<tr>\n";
$serviceOutput .= "<td>&nbsp;</td>\n"; // because of the following row-names
for ($j = 1; $j <= $lenServices2; $j++) :
$serviceOutput .= "<td>" . $services2["plz"][$j] . "</td>\n";
endfor;
$serviceOutput .= "</tr>\n";
// Table-data
for ($j = 1; $j <= $lenServices; $j++) :
$serviceOutput .= "<tr>\n";
$serviceOutput .= "<td style=\"vertical-align: middle;\">" . $services["plz"][$j] . "</td>\n";
for ($i = 1; $i <= $lenServices2; $i++) :
// Define current plz-ids
$srvPlzCur = $services["id"][$j];
$srvp2PlzCur = $services2["id"][$i];
if ($mode == "price") :
$servicePrices[$srvPlzCur][$srvp2PlzCur] = mcArrMultiDimIsSet($servicePrices[$srvPlzCur], $srvp2PlzCur);
if ($servicePrices[$srvPlzCur][$srvp2PlzCur] == "") : $servicePrices[$srvPlzCur][$srvp2PlzCur] = "0.00"; endif;
$serviceCrPrices[$srvPlzCur][$srvp2PlzCur] = mcArrMultiDimIsSet($serviceCrPrices[$srvPlzCur], $srvp2PlzCur);
if ($serviceCrPrices[$srvPlzCur][$srvp2PlzCur] == "") : $serviceCrPrices[$srvPlzCur][$srvp2PlzCur] = "0.00"; endif;
$serviceOutput .= "<td>";
$serviceOutput .= "<div class=\"service\">";
$serviceOutput .= "<input type=\"text\" class=\"cell_attr\" name=\"service_" . $srvPlzCur . "_" . $srvp2PlzCur . "\" value=\"" . $servicePrices[$srvPlzCur][$srvp2PlzCur] . "\" size=\"7\" align=\"right\">";
if ($csId != "0") :
$servicePricesDefault[$srvPlzCur][$srvp2PlzCur] = mcArrMultiDimIsSet($servicePricesDefault[$srvPlzCur], $srvp2PlzCur);
if ($servicePricesDefault[$srvPlzCur][$srvp2PlzCur] == "") : $servicePricesDefault[$srvPlzCur][$srvp2PlzCur] = "0.00"; endif;
$serviceOutput .= "(" . $servicePricesDefault[$srvPlzCur][$srvp2PlzCur] . ")&nbsp;&nbsp;";
endif;
$serviceOutput .= "</div>\n";
$serviceOutput .= "<div class=\"service_cr\">";
$serviceOutput .= "<input type=\"text\" class=\"cell_attr_cr\" name=\"service_cr_" . $srvPlzCur . "_" . $srvp2PlzCur . "\" value=\"" . $serviceCrPrices[$srvPlzCur][$srvp2PlzCur] . "\" size=\"7\" align=\"right\">";
if ($csId != "0") :
$serviceCrPricesDefault[$srvPlzCur][$srvp2PlzCur] = mcArrMultiDimIsSet($serviceCrPricesDefault[$srvPlzCur], $srvp2PlzCur);
if ($serviceCrPricesDefault[$srvPlzCur][$srvp2PlzCur] == "") : $serviceCrPricesDefault[$srvPlzCur][$srvp2PlzCur] = "0.00"; endif;
$serviceOutput .= "(" . $serviceCrPricesDefault[$srvPlzCur][$srvp2PlzCur] . ")&nbsp;&nbsp;";
endif;
$serviceOutput .= "</div></br>\n";
$serviceOutput .= "</td>\n";
else :
$serviceDiscounts[$srvPlzCur][$srvp2PlzCur] = mcArrMultiDimIsSet($serviceDiscounts[$srvPlzCur], $srvp2PlzCur);
if ($serviceDiscounts[$srvPlzCur][$srvp2PlzCur] == "") : $serviceDiscounts[$srvPlzCur][$srvp2PlzCur] = "0.00"; endif;
$serviceCrDiscounts[$srvPlzCur][$srvp2PlzCur] = mcArrMultiDimIsSet($serviceCrDiscounts[$srvPlzCur], $srvp2PlzCur);
if ($serviceCrDiscounts[$srvPlzCur][$srvp2PlzCur] == "") : $serviceCrDiscounts[$srvPlzCur][$srvp2PlzCur] = "0.00"; endif;
$serviceOutput .= "<td>";
$serviceOutput .= "<div class=\"service\">";
$serviceOutput .= "<input type=\"text\" class=\"cell_attr\" name=\"service_" . $srvPlzCur . "_" . $srvp2PlzCur . "\" value=\"" . $serviceDiscounts[$srvPlzCur][$srvp2PlzCur] . "\" size=\"7\" align=\"right\">";
if ($csId != "0") :
$serviceDiscountsDefault[$srvPlzCur][$srvp2PlzCur] = mcArrMultiDimIsSet($serviceDiscountsDefault[$srvPlzCur], $srvp2PlzCur);
if ($serviceDiscountsDefault[$srvPlzCur][$srvp2PlzCur] == "") : $serviceDiscountsDefault[$srvPlzCur][$srvp2PlzCur] = "0.00"; endif;
$serviceOutput .= "(" . $serviceDiscountsDefault[$srvPlzCur][$srvp2PlzCur] . ")&nbsp;&nbsp;";
endif;
$serviceOutput .= "</div>\n";
$serviceOutput .= "<div class=\"service_cr\">";
$serviceOutput .= "<input type=\"text\" class=\"cell_attr_cr\" name=\"service_cr_" . $srvPlzCur . "_" . $srvp2PlzCur . "\" value=\"" . $serviceCrDiscounts[$srvPlzCur][$srvp2PlzCur] . "\" size=\"7\" align=\"right\">";
if ($csId != "0") :
$serviceCrDiscountsDefault[$srvPlzCur][$srvp2PlzCur] = mcArrMultiDimIsSet($serviceCrDiscountsDefault[$srvPlzCur], $srvp2PlzCur);
if ($serviceCrDiscountsDefault[$srvPlzCur][$srvp2PlzCur] == "") : $serviceCrDiscountsDefault[$srvPlzCur][$srvp2PlzCur] = "0.00"; endif;
$serviceOutput .= "(" . $serviceCrDiscountsDefault[$srvPlzCur][$srvp2PlzCur] . ")&nbsp;&nbsp;";
endif;
$serviceOutput .= "</div></br>\n";
$serviceOutput .= "</td>\n";
endif;
endfor;
$serviceOutput .= "</tr>\n";
endfor;
// Output
if ($mode == "price") :
$title = getLngt("Allgemeine Preise und Frachtvergütungen für PLZ-Bereiche");
else :
$title = getLngt("Allgemeine Rabatte und Frachtvergütungsrabatte für PLZ-Bereiche [in %]");
endif;
if ($csId != "0") :
if ($mode == "price") :
$title = getLngt("PLZ-Bereichspreise/-frachtvergütungen speziell für den Kunden") . " " . $cmpComp . " " . $cmpComp2;
else :
$title = getLngt("PLZ-Bereichsrabatte speziell für den Kunden") . " " . $cmpComp . " " . $cmpComp2;
endif;
endif;
$title2 = getLngt("Verwaltung der Bereichsnachbarschaft");
$title4 = getLngt("Verwaltung der Bereichsaddressen");
// BEGINNING OF ADMINISTRATION OF NEIGHBOURS
if ($f_zipcode2 == "") : $f_zipcode2 = $zipcodeRow; endif;
// **************************************************
// * Get all neighbours for the current zipcodearea *
// **************************************************
$sqlquery = "SELECT srvp2.srvp_id, srvp2.srvp_plz, srvpn.srvpn_sort"
. " FROM serviceplzneighbour AS srvpn, serviceplz AS srvp, serviceplz AS srvp2"
. " WHERE srvp.srvp_plz = '" . $f_zipcode2 . "' AND"
. " srvp.srvp_id = srvpn.srvp_id AND"
. " srvpn.hq_id = '" . $hq_id . "' AND"
. " srvpn.srvp2_id = srvp2.srvp_id"
. " ORDER BY srvpn.srvpn_sort";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
$services2 = "";
$count = 0;
while ($row = $result->fetch_assoc()):
$count++;
$areaneighbours["id"][$count] = $row["srvp_id"];
$areaneighbours["name"][$count] = $row["srvp_plz"];
$areaneighbours["sort"][$count] = $row["srvpn_sort"];
endwhile;
$result->free();
// Length of the array containing the zipcodes according to the current selected area
$lenAreaNeighbours = count($areaneighbours["id"]);
// ***************************************************************
// * Display all neighbours based on the filter set in $areaRow. *
// * It is the same filter like for the matrix above! *
// ***************************************************************
// Select-Box
$serviceOutput3 = "<div><select name=\"f_zipcode2\" onChange=\"document.forms[0].submit();\">\n";
for ($j = 1; $j <= $lenServices; $j++) :
$is_selected = "";
if ($f_zipcode2 == $services["plz"][$j]) : $is_selected = " selected"; endif;
$serviceOutput3 .= "<option value=\"" . $services["plz"][$j] . "\" " . $is_selected . ">" . $services["plz"][$j] . "</option>\n";
endfor;
$serviceOutput3 .= "</select><br><br></div>\n";
// Output of the existing neighbours of the current selected area
for ($j = 1; $j <= $lenAreaNeighbours; $j++) :
$serviceOutput3 .= "<div>\n";
$serviceOutput3 .= $areaneighbours["name"][$j];
$serviceOutput3 .= "<input type=\"checkbox\" name=\"f_del_neighbour_id[]\" value=\"" . $areaneighbours["id"][$j] . "\">";
$serviceOutput3 .= "</div>\n";
endfor;
$serviceOutput3 .= "<br>";
// Button to remove associations between area and zipcode(s). Only show if at least one zipcode is associated to the current area.
if ($lenAreaNeighbours > 0) :
$serviceOutput3 .= defineButtonType10(getLngt("Markierte&nbsp;Nachbar-PLZn&nbsp;entfernen"), "action_remove", "finishPage('save_removeneighbourassociation');", "250");
endif;
?>
<html lang="de">
<head>
<title><?php echo $pageTitel; ?></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 src="../include/lib_global.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
// NAVIGATION
<?php echo $jsMenuOut; ?>
function searchCustomerPopup() {
var widthPopupWin = 800;
var heightPopupWin = 600;
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
var popupWin;
popupWin=window.open("../admin/impressum.html", "","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin);
};
function finishPage(f_act) {
// for(i=0;i<document.forms[0].jb_costcenter_select.length;++i) {
// if (document.forms[0].jb_costcenter_select.options[i].selected == true) {
// document.forms[0].jb_costcenter.value=document.forms[0].jb_costcenter_select.options[i].value;
// }
// };
if (f_act == 'save') {
if (!confirm('<?php echo getLngt("Preisbereichsmatrix speichern?") ?>')) {
return false;
}
}
document.forms[0].f_act.value = f_act;
document.forms[0].submit();
};
function initCells() {
// Show or hide cells
if ('<?php echo $f_chkbx_toggle_checked ?>' == 'checked') { $(".service").show(); } else { $(".service").hide(); };
if ('<?php echo $f_chkbx_toggle_cr_checked ?>' == 'checked') { $(".service_cr").show(); } else { $(".service_cr").hide(); };
// Common checkbox attributes
$(".chkbox_attr").css("display", "inline-block");
$(".chkbox_attr").css("height", "20px");
<?php if ($mode == "discount") : ?>
$(".chkbox_attr").css("width", "200px");
<?php else : ?>
$(".chkbox_attr").css("width", "160px");
<?php endif; ?>
// Special checkbox attributes
$(".chkbox_attr_special").css("background-color", "#FFFFFF");
$(".chkbox_attr_special_cr").css("background-color", "#F7F8E0");
// Special cell attributes
$(".cell_attr").css("background-color", "#FFFFFF");
$(".cell_attr_cr").css("background-color", "#F7F8E0");
}
function toggleCells() {
// Check at least one checkbox has to be set
if (!$('#f_chkbx_toggle').prop('checked') && !$('#f_chkbx_toggle_cr').prop('checked')) {
$('#f_chkbx_toggle').val('service');
$('#f_chkbx_toggle').prop('checked',true);
alert('<?php echo getLngt("Mindestens eine der Checkboxen muss gesetzt sein!") ?>');
}
if ($('#f_chkbx_toggle').prop('checked')) { $(".service").show(); } else { $(".service").hide(); };
if ($('#f_chkbx_toggle_cr').prop('checked')) { $(".service_cr").show(); } else { $(".service_cr").hide(); };
}
-->
</script>
<noscript>
<center>
<b><br>JavaScript ist nicht verf&uuml;gbar. Bitte aktivieren Sie JavaScript<br><br>
in Ihrem Browser, damit diese Seite ordnungsgem&auml;&szlig; funktioniert!</b><br><br>
</center>
</noscript>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>initCells();displayStatusMessage();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="mc_page-header">
<?php echo $title ?>
</div>
<div class="maincontent mc_elem" name="maincontent" id="maincontent">
<form name="services" action="../admin/services_plz.php" method="post" <?php echo $htmlFormTarget ?>>
<input type="hidden" name="f_act" value="">
<input type="hidden" name="mode" value="<?php echo ec($mode) ?>">
<input type="hidden" name="orderByServices" value="<?php echo $orderByServices ?>">
<input type="hidden" name="csId" value="<?php echo ec($csId) ?>">
<input type="hidden" name="opener" value="<?php echo $opener ?>">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<input type="hidden" name="pageFirstCall" value="<?php echo $pageFirstCall ?>">
<?php echo htmlDivLineSpacer("30px"); ?>
<div>
<div <?php echo setStyleHtmlDiv("100px","left"); ?>><?php echo getLngt("Zeile") ?>:</div>
<div>
<input type="text" name="zipcodeRow" value="<?php echo $zipcodeRow ?>" size="6"> <?php echo getLngt("(VON)") ?>
</div>
</div>
<?php echo htmlDivLineSpacer("5px"); ?>
<div>
<div <?php echo setStyleHtmlDiv("100px","left"); ?>><?php echo getLngt("Spalte") ?>:</div>
<div>
<input type="text" name="zipcodeCol" value="<?php echo $zipcodeCol ?>" size="6"> <?php echo getLngt("(NACH)") ?>
</div>
</div>
<?php if ($parServiceVehicleTypeEnabled == "1") : ?>
<?php echo htmlDivLineSpacer("10px"); ?>
<div>
<div <?php echo setStyleHtmlDiv("100px","left"); ?>><?php echo getLngt("Fahrzeugtyp") ?>:</div>
<div>
<select name="f_vehicletype" class="f8np1" onChange="finishPage('');">
<?php
// Check excludes vehicle type IDs
$mask_exclude_vht_ids = getParameterValue("0", "MASK_EXCLUDE_VHT_IDS", $hq_id);
if ($mask_exclude_vht_ids != "") $mask_exclude_vht_ids = " AND NOT mt_sort IN (" . $mask_exclude_vht_ids . ")";
echo addOptionsFromTable("metatype","mt_sort","mt_value","mt_sort","mt_type = 'vehicletype'" . $mask_exclude_vht_ids, $vhtId);
?>
</select>
</div>
</div>
<?php endif; ?>
<?php echo htmlDivLineSpacer("10px", "", "left"); ?>
<?php echo defineButtonType10(getLngt("Tabelle&nbsp;anzeigen"), "action_display", "document.forms[0].submit();", "150","left","3"); ?>
&nbsp;&nbsp;
<span class="chkbox_attr chkbox_attr_special"><input type="checkbox" id="f_chkbx_toggle" name="f_chkbx_toggle" value="service" onChange="toggleCells();" <?php echo $f_chkbx_toggle_checked ?>> <?php echo ($mode == "price" ? getLngt("Preise") : getLngt("Rabatte")); ?></span>
&nbsp;&nbsp;
<span class="chkbox_attr chkbox_attr_special_cr"><input type="checkbox" id="f_chkbx_toggle_cr" name="f_chkbx_toggle_cr" value="service_cr" onChange="toggleCells();" <?php echo $f_chkbx_toggle_cr_checked ?>> <?php echo ($mode == "price" ? getLngt("Frachtvergütungen") : getLngt("Frachtvergütungsrabatte")); ?></span>
<?php echo htmlDivLineSpacer("30px"); ?>
<div>
<table width="100%" align="left" cellspacing="0" cellpadding="0" vspace="0" hspace="0">
<?php echo $serviceOutput ?>
</table>
</div>
<?php echo htmlDivLineSpacer("20px", "", "left"); ?>
<?php echo defineButtonType10(getLngt("Speichern"), "action_save", "finishPage('save');", "100"); ?>
<?php echo htmlDivLineSpacer("50px"); ?>
<!-- Verwaltung der Bereichsadressen -->
<!--
<div class="f10bp1_blue">
<?php echo $title4 ?>:&nbsp;&nbsp;&nbsp;<span class="f10bp1"><a href="../admin/srvpa_list.php" target="_blank"><?php echo getLngt("Zuordnungen bearbeiten") ?></a></span>
</div>
<?php echo htmlDivLineSpacer("40px"); ?>
-->
<!-- Verwaltung der PLZ-Nachbarschaft -->
<div class="f12bp1_blue">
<?php echo $title2 ?>
</div>
<?php echo htmlDivLineSpacer("20px"); ?>
<div>
<?php echo $serviceOutput3 ?>
</div>
<?php echo htmlDivLineSpacer("20px", "", "left"); ?>
<div class="f10bp1_blue">
<div style="float:left">
<?php echo getLngt("PLZ für Nachbarschaftsverknüpfung eingeben") ?>:&nbsp;&nbsp;
<input type="text" name="f_newneighbourforzipcode" value="">&nbsp;&nbsp;&nbsp;
</div>
<?php echo defineButtonType10(getLngt("Nachbar&nbsp;anlegen"), "action_new", "finishPage('save_newneighbourassociation');", "180"); ?>
</div>
<?php echo htmlDivLineSpacer("20px", "", "left"); ?>
</form>
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff

508
html/admin/sort.php Normal file
View File

@@ -0,0 +1,508 @@
<?php
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
include_once ("../include/inc_job.inc.php");
include_once ("../locating/xServer.inc.php");
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act", "objType", "objId", "result", "noMap"));
getLanguage(__FILE__);
$pageTitel = getLngt("SORTIERUNG");
getCurrentScript(__FILE__);
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "7", $customerId, $cscIdRoot, $cscIdActual);
authCheckEmployeeRights($emp_id, "7", "1");
// Generic array for data chunks to be sorted
$debug = false;
$sortArray = array();
$coordArr = array();
$tabText = array();
if ($result != "") :
$result = urldecode($result);
$result = json_decode($result);
endif;
$objHeader = "";
$statusMessage = "";
if ($noMap == "") : $noMap = "0"; endif; // Map will be displayed by default
if ($debug) :
echo "objType = " . $objType . "<br>";
echo "objId = " . $objId . "<br>";
echo "result = " . $result . "<br>";
endif;
// **** SAVE NEW SORT SEQUENCE ****
if ($f_act == "save" && $objId != "" && is_numeric($objId) && $result != "") :
// **** JOB ****
// Store job with new sorting sequence
if ($objType == "jb") :
$trIdArray = array();
$trSort = 1;
foreach($result as $key => $value) {
foreach($value as $innerKey => $innerValue) {
$resultArray = explode(";",$innerValue);
$result[$key][$innerKey] = array(0 => $resultArray[0], 1 => $resultArray[1]);
$trIdArray[$resultArray[0]] = $trSort; // $trIdArray[<tr_id>] = <tr_sort>
$trSort++;
}
}
$trIdArrayLen = count($trIdArray);
if ($trIdArrayLen > 0) :
$trIdKeyArray = array_keys($trIdArray);
// Get jb_status
$jbId = getFieldValueFromId("tour", "tr_id", $trIdKeyArray[0], "jb_id");
if ($jbId == $objId) :
$jbStatus = getFieldValueFromId("job", "jb_id", $jbId, "jb_status");
if ($jbStatus == "9" || $jbStatus == "8" || $jbStatus == "0" || $jbStatus == "1") :
$trIdKeyArrayLen = count($trIdKeyArray);
TA("B");
$doCommit = true;
for ($i = 0; $i < $trIdKeyArrayLen; $i++) :
$trSort = $trIdArray[$trIdKeyArray[$i]];
if ($trSort != "" && is_numeric($trSort)) :
$res = updateStmt("tour","tr_id",$trIdKeyArray[$i],array("tr_sort", $trSort));
$res2 = updateStmt("jobcalculator","tr_id",$trIdKeyArray[$i],array("tr_sort", $trSort));
$res3 = updateStmt("tourarticle","tr_id",$trIdKeyArray[$i],array("tr_sort", $trSort));
else :
$doCommit = false;
break;
endif;
endfor;
if ($doCommit) :
mk_jb_tourdata($jbId);
// Final check for changing state
$jbStatus = getFieldValueFromId("job", "jb_id", $jbId, "jb_status");
if ($jbStatus == "9" || $jbStatus == "8" || $jbStatus == "0" || $jbStatus == "1") :
TA("C"); // OK, TA ended with the same state of the job
else :
TA("R");
$statusMessage = getLngt("Der Status des Auftrags wurde während der Verarbeitung durch einen anderen Prozess geändert! Es erfolgte keine Verarbeitung!");
endif;
else :
TA("R");
endif;
TA("E");
else :
$statusMessage = getLngt("Der Auftrag muss den Zuweisungsstatus aufweisen, absonsten findet keine Verarbeitung statt!");
endif;
else :
$statusMessage = getLngt("Anomalie: Die Station passt nicht zum Auftrag! Es erfolgte keine Verarbeitung!");
endif;
else :
$statusMessage = getLngt("Keine Station vorhanden! Es erfolgte keine Verarbeitung!");
endif;
endif;
// **** COURIERFILTER ****
// Store filter with new sorting sequence
if ($objType == "crf") :
$crfIdArray = array();
$crfSort = 1;
foreach($result as $key => $value) {
foreach($value as $innerKey => $innerValue) {
$resultArray = explode(";",$innerValue);
$result[$key][$innerKey] = array(0 => $resultArray[0], 1 => $resultArray[1]);
$crfIdArray[$resultArray[0]] = $crfSort; // $crfIdArray[<crf_id>] = <crfSort>
$crfSort++;
}
}
$crfIdArrayLen = count($crfIdArray);
if ($crfIdArrayLen > 0) :
$crfIdKeyArray = array_keys($crfIdArray);
$crfIdKeyArrayLen = count($crfIdKeyArray);
TA("B");
$doCommit = true;
for ($i = 0; $i < $crfIdKeyArrayLen; $i++) :
$crfSort = $crfIdArray[$crfIdKeyArray[$i]];
if ($crfSort != "" && is_numeric($crfSort)) :
$res = updateStmt("courierfilter","crf_id",$crfIdKeyArray[$i],array("crf_sort", $crfSort));
else :
$doCommit = false;
break;
endif;
endfor;
/*
if ($doCommit) :
// Final check for changing state
$jbStatus = getFieldValueFromId("job", "jb_id", $jbId, "jb_status");
if ($jbStatus == "9" || $jbStatus == "8" || $jbStatus == "0" || $jbStatus == "1") :
TA("C"); // OK, TA ended with the same state of the job
else :
TA("R");
$statusMessage = getLngt("Der Status des Auftrags wurde während der Verarbeitung durch einen anderen Prozess geändert! Es erfolgte keine Verarbeitung!");
endif;
else :
TA("R");
endif;
*/
TA("E");
else :
$statusMessage = getLngt("Keine Station vorhanden! Es erfolgte keine Verarbeitung!");
endif;
endif;
endif;
// **** GET OBJECT DATA WITH CURRENT/NEW SORTING SEQUENCE ****
if ($objId != "" && is_numeric($objId)) :
// **** JOB ****
if ($objType == "jb" && $objId != "" && is_numeric($objId)) :
$jobData = array();
getDBData("job", $objId);
getDBData("tour", $objId);
// getDBData("tourarticle", $objId);
// getDBData("genericdatacontainer", $objId);
// print_r($jobData); echo "<br><br>";
// $jbStatus = getFieldValueFromId("job", "jb_id", $jbId, "jb_status");
// if (true || $jbStatus == "9") : // !!!!!!!!
if (true) : // !!!!!!!!
$numOfStations = count($jobData["tour"]);
for ($i = 0; $i < $numOfStations; $i++) :
$j = $i +1;
$trId = $jobData["tour"][$j]["tr_id"];
$htmlText = "<table>";
$htmlText .= "<tr><td class=\"f8np1\">" . $jobData["tour"][$j]["tr_comp"] . "</td></tr>";
$htmlText .= "<tr><td class=\"f8np1\">" . $jobData["tour"][$j]["ad_street"] . "&nbsp;" . $jobData["tour"][$j]["tr_hsno"] . "</td></tr>";
$htmlText .= "<tr><td class=\"f8np1\">" . $jobData["tour"][$j]["ad_zipcode"] . "&nbsp;" . $jobData["tour"][$j]["ad_city"] . "</td></tr>";
$htmlText .= "<tr><td class=\"f8np1\">" . $jobData["tour"][$j]["tr_person"] . "</td></tr>";
$htmlText .= "<tr><td class=\"f8np1\">" . $jobData["tour"][$j]["tr_phone"] . "</td></tr>";
/*
$htmlText .= "<tr>";
$htmlText .= "<td class=\"f8np1\" width=\"200\">" . $jobData["tour"][$j]["tr_comp"] . "</td>";
$htmlText .= "<td class=\"f8np1\" width=\"200\">" . $jobData["tour"][$j]["ad_street"] . "&nbsp;" . $jobData["tour"][$j]["tr_hsno"] . "</td>";
$htmlText .= "<td class=\"f8np1\" width=\"200\">" . $jobData["tour"][$j]["ad_zipcode"] . "&nbsp;" . $jobData["tour"][$j]["ad_city"] . "</td>";
$htmlText .= "<td class=\"f8np1\" width=\"100\">" . $jobData["tour"][$j]["tr_person"] . "</td>";
$htmlText .= "<td class=\"f8np1\" width=\"100\">" . $jobData["tour"][$j]["tr_phone"] . "</td>";
$htmlText .= "</tr>";
*/
$htmlText .= "</table>";
/*
$htmlText = $jobData["tour"][$j]["tr_comp"] . "<br>";
$htmlText .= $jobData["tour"][$j]["ad_street"] . "&nbsp;" . $jobData["tour"][$j]["tr_hsno"] . "<br>";
$htmlText .= $jobData["tour"][$j]["ad_zipcode"] . "&nbsp;" . $jobData["tour"][$j]["ad_city"] . "<br>";
$htmlText .= $jobData["tour"][$j]["tr_person"] . "<br>";
$htmlText .= $jobData["tour"][$j]["tr_phone"] . "<br>";
*/
// $htmlText = htmlspecialchars($htmlText);
$urlText = $jobData["tour"][$j]["ad_street"] . " " . $jobData["tour"][$j]["tr_hsno"]. ", " . $jobData["tour"][$j]["ad_zipcode"] . " " . $jobData["tour"][$j]["ad_city"];
$urlText = urlencode(utf8_encode($urlText));
if ($j == 1) :
$urlText = "&saddr=" . $urlText;
elseif ($j == 2) :
$urlText = "&daddr=" . $urlText;
elseif ($j > 2) :
$urlText = "+to:" . $urlText;
endif;
if ($f_act == "optimize") :
$coordPairArr = get_coords($jobData["tour"][$j]["ad_country"], $jobData["tour"][$j]["ad_zipcode"], $jobData["tour"][$j]["ad_city"], $jobData["tour"][$j]["ad_street"], $jobData["tour"][$j]["tr_hsno"], false);
endif;
$sortArray[0][$i] = array($trId, $htmlText, $urlText, $coordPairArr);
$coordArr[$i] = $coordPairArr;
$tabText[$i] = getLngt("Auftrag") . " " . $objId;
endfor;
// Optimization
if ($f_act == "optimize") :
$optArr = get_zone_distance($coordArr, $hq_id, $objId, false, true);
$optRouteArr = $optArr["optimizedRoute"];
if ($debug) :
echo "<br><br>"; print_r($coordArr); echo "<br><br>";
echo "<br><br>"; print_r($optRouteArr); echo "<br><br>";
// echo "<br><br>"; print_r($optArr["legs"]); echo "<br><br>";
echo "<br>sortArray PRE:<br>";print_r($sortArray); echo "</br>";
endif;
$optRouteArrLen = count($optRouteArr);
if ($optRouteArrLen > 0) :
// Iterate stations for renewing optimized vector
$tmpSortArr = $sortArray;
for ($s = 0; $s < $optRouteArrLen; $s++) :
$sortArray[0][($s + 1)] = $tmpSortArr[0][($optRouteArr[$s] + 1)]; // Tricky, because $optRouteArr contains all intermediate stations only !!!! ([0] => 2, [1] => 1, [2] => 0)
endfor;
endif;
if ($debug) :
echo "<br>sortArray POST:<br>";print_r($sortArray); echo "</br>";
endif;
endif;
else :
$statusMessage = getLngt("Der Auftrag muss den Zuweisungsstatus aufweisen, absonsten findet keine Verarbeitung statt!");
endif;
$objHeader = getLngt("Sortierung der Stationsreihenfolge des Auftrags") . " " . $objId;
endif;
// **** COURIERFILTER ****
if ($objType == "crf" && $objId != "" && is_numeric($objId)) :
$crfData = getMatrixFromDbResultByStatement("SELECT " . getDBFields("courierfilter") . " FROM courierfilter AS crf ORDER BY crf.crf_sort");
$crfDataLen = count($crfData);
if ($crfDataLen > 0) : // !!!!!!!!
for ($i = 0; $i < $crfDataLen; $i++) :
// $j = $i + 1;
$j = $i;
$crfId = $crfData[$j]["crf_id"];
$htmlText = "<table>";
$htmlText .= "<tr>";
$htmlText .= "<td class=\"f8np1\" width=\"100\">" . $crfData[$j]["crf_sort"] . "</td>";
$htmlText .= "<td class=\"f8np1\" width=\"200\">" . $crfData[$j]["crf_short"] . "</td>";
$htmlText .= "<td class=\"f8np1\" width=\"100\">" . $crfData[$j]["crf_text"] . "</td>";
$htmlText .= "</tr>";
$htmlText .= "</table>";
// $htmlText = htmlspecialchars($htmlText);
$sortArray[0][$i] = array($crfId, $htmlText, "");
$tabText[$i] = getLngt("Filter");
endfor;
else :
$statusMessage = getLngt("Zur Zeit scheinen keine Filter existent!");
endif;
$objHeader = getLngt("Sortierung der Filter");
endif;
endif;
$sortArrayLength = count($sortArray);
// echo "<br>sortArray:<br>";print_r($sortArray); echo "</br>"; echo "sortArrayLength = " . $sortArrayLength . "</br>";
function drawBoxes($sortArray, $tabText, $noMap = "0") {
if ($noMap == "0") :
$mapUrl = "https://maps.google.com/maps?q=&hl=de&output=embed&source=s_d";
$mapAdArr = array();
endif;
$html_output = "";
foreach ($sortArray as $key => $value) {
$html_output .= ' <div class="divBox" style="margin-left: 10px; margin-top: 10px; float:left;" id="id_reiter' . $key .'">' . "\n";
$html_output .= ' <div class="panel-heading" style="height: 30px; margin-left:15px; margin-top:10px; background-color: #1b12b9;"><font color="white">' . $tabText[$key] . '</font></div>' . "\n";
$html_output .= ' <div id="divBox1" style="float:left;">' . "\n";
$html_output .= ' <ul class="itemContainer" id="original_items' . $key . '">' . "\n";
foreach ($value as $boxValue) {
// echo "<br>boxValue:<br>";print_r($boxValue); echo "</br>";
$html_output .= ' <li class="original_item_content" id="' . $boxValue[0] . ';' . "" . '">' . $boxValue[1] . '</li>' . "\n";
if ($noMap == "0") :
$mapAdArr[] = $boxValue[2];
endif;
}
// echo "<br>";
$html_output .= ' </ul>' . "\n";
$html_output .= ' <ul id="cloned_items' . $key . '"></ul>' . "\n";
$html_output .= ' </div>' . "\n";
$html_output .= ' </div>' . "\n";
if ($noMap == "0") :
$html_output .= ' <div id="divBoxMap" style="min-width:800px; min-height:800px; padding:10px;">' . "\n";
$mapUrl .= implode("/", $mapAdArr);
// echo $mapUrl . "<br>";
$html_output .= ' <iframe class="sort_map" src="' . $mapUrl . '"></iframe>' . "\n";
$html_output .= ' </div>' . "\n";
endif;
}
return $html_output;
}
?>
<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");
$frameworkFile = "../js/jquery.js";
if ($htmlDefaultCharset == "") : $htmlDefaultCharset = "iso-8859-1"; endif;
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" . $htmlDefaultCharset . "\">\n";
// echo "<meta http-equiv=\"Content-Security-Policy\" content=\"child-src=https://www.google.de/\">\n";
// echo "<meta http-equiv=\"Content-Security-Policy\" content=\"child-src=https://maps.google.com/\">\n";
echo '<meta name="referrer" content="origin"/>';
echo '<meta name="referrer" content="origin-when-crossorigin"/>';
echo "<script src=\"" . $frameworkFile . "\"></script>\n";
echo "<script type=\"text/javascript\" src=\"../js/jquery-ui.custom.min.js\"></script>\n";
echo "<link rel=\"stylesheet\" href=\"../css/jquery-ui.custom.min.css\" type=\"text/css\" />\n";
?>
<link href="../css/themes/assec.css" rel="stylesheet" type="text/css"/>
<style>
[id^=original_items] li {
position: relative;
z-index: 5;
}
[id^=original_items], [id^=cloned_items] {
list-style: none;
}
[id^=cloned_items] {
display: none;
}
[id^=cloned_items] li {
position: absolute;
border-radius: 20px;
z-index: 1;
}
li {
cursor: default;
background-color:#CDD9FD;
border-radius: 20px;
text-align: center;
line-height: 130px;
margin-left: 10px;
min-height: 30px;
border: solid;
min-width: 300px;
margin-left: 50px;
margin-right: 50px;
margin-bottom: 10px;
padding: 10px;
}
div {
cursor: default;
}
ul, html, body {
padding:0px;
margin:0px;
}
ul {
margin:0 auto;
}
.reiterBox {
min-height: 800px;
min-width: 800px;
border-radius: 20px;
border: solid 1px;
}
.divBox {
cursor: default;
min-height: 220px;
border: solid 1px;
border-radius: 20px;
background-color: #1b12b9;
overflow-y: scroll;
max-height: 800px;
}
.sort_map {
min-height: 800px;
min-width: 800px;
max-height: 800px;
max-width: 800px;
marginheight: 0px;
marginwidth: 0px;
scrolling: no;
}
</style>
<script type="text/javascript">
$(document).ready(function() {
var arrayLength = <?php echo $sortArrayLength ?>;
makeSortable(arrayLength);
});
function makeSortable(arrayLength) {
for(var i = 0; i < arrayLength; i++) {
$("#original_items" + i + " li").each(function () {
var item = $(this);
var item_clone = item.clone();
item.data("clone", item_clone);
var position = item.position();
item_clone.css("left", position.left);
item_clone.css("top", position.top);
item_clone.css("top", position.top);
$("#cloned_items" + i + "").append(item_clone);
});
$(".original_item_content").disableSelection();
$(".panel-heading").disableSelection();
$(".itemContainer").disableSelection();
$("#original_items"+ i).sortable({
tolerance: "pointer",
cursorAt: {top: 50},
revert: 500,
axis: "y"
});
}
}
function sortFinishPage(f_act = '') {
var textConf = '<?php echo getLngt("Wirklich speichern?") ?>';
if (f_act == 'optimize') {textConf = '<?php echo getLngt("Wirklich optimieren?") ?>';};
if (confirm(textConf)) {
$('#f_act').val(f_act);
var arrayLenght = <?php echo $sortArrayLength ?>;
var resultArray = [];
var newBoxOrder;
for(var j = 0; j < arrayLenght; j++) {
newBoxOrder = ($( "#original_items"+j ).sortable("toArray"));
resultArray[j] = newBoxOrder;
}
$('#result').val(encodeURIComponent(JSON.stringify(resultArray)));
$('#myForm').submit();
};
}
</script>
</head>
<body bgcolor="#CDD9FD">
<div class="f12bp1_blue" style="margin-left: 10px; margin-top: 10px; height:30px;">
<?php echo $objHeader ?>
</div>
<?php if ($statusMessage != "") : ?>
<div class="f10bp1_red" style="margin-left: 10px; margin-top: 10px; height:30px;">
<?php echo $statusMessage ?>
</div>
<?php endif; ?>
<div style="margin-left: 10px; height:40px;">
<input style="margin-top: 5px; width: 150px; height:25px; background-color: #1b12b9; color: white;" id="submit" type="button" value="<?php echo getLngt("Übernehmen") ?>" onclick="sortFinishPage('save')">
<?php
if ($objType == "jb" && $objId != "" && is_numeric($objId)) :
$numOfStations = getCountOfTable("phoenix.tour", "jb_id = '" . $objId . "'");
if (is_numeric($numOfStations) && $numOfStations > 3 && $numOfStations <= 25) :
?>
<input style="margin-top: 5px; width: 150px; height:25px; background-color: #1b12b9; color: white;" id="submit" type="button" value="<?php echo getLngt("Optimieren") ?>" onclick="sortFinishPage('optimize')">
<?php
endif;
endif;
?>
</div>
<form action="../admin/sort.php" method="POST" id="myForm">
<input type="hidden" id="f_act" name="f_act" value="">
<input type="hidden" name="objType" value="<?php echo $objType ?>">
<input type="hidden" name="objId" value="<?php echo $objId ?>">
<input type="hidden" id="result" name="result" value="">
<input type="hidden" name="noMap" value="<?php echo $noMap ?>">
<?php echo drawBoxes($sortArray, $tabText, $noMap); ?>
<div style="clear: both;"></div>
</form>
</body>
</html>

330
html/admin/srvpa_list.php Normal file
View File

@@ -0,0 +1,330 @@
<?php
/*=======================================================================
*
* srvpa_list.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
include_once ("../geo/geocode.inc.php");
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act", "customerId", "cscIdRoot", "cscIdActual",
"f_srvp_plz", "f_ad_street", "f_srvpxa_hsno_from", "f_srvpxa_hsno_to",
"f_ad_zipcode", "f_ad_city", "f_ad_country", "f_srvpxa_mode", "f_del_assoc",
"orderClause", "statusMessage", "tourno", "deactivateMenu"));
$pageTitel = "PLZ-ADRESSEN";
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
authCheckEmployeeRights($emp_id, "2", "1");
$numOfRows = 0;
mcTrim($f_srvp_plz); mcTrim($f_ad_street); mcTrim($f_ad_zipcode); mcTrim($f_ad_city); mcTrim($f_ad_country);
mcTrim($f_srvpxa_hsno_from); mcTrim($f_srvpxa_hsno_to);
if ($f_del_assoc == "") : $f_del_assoc = array(); endif;
$out = "";
// NEW association between zipcode and address
if ($f_act == "newZipcodeAddress") :
// Get the id of the invoice zipcode
$f_srvp_id_inv = getFieldValueFromId("serviceplz","srvp_plz",$f_srvp_plz,"srvp_id");
// Check existence zipcode
$f_srvp_id = getFieldValueFromId("serviceplz","srvp_plz",$f_ad_zipcode,"srvp_id");
// Try to get name of the city if does not exist
if ($f_ad_city == "") :
$sqlStmt = "SELECT st_city FROM phoenix_special.street WHERE st_zipcode = '$f_ad_zipcode'";
$f_ad_city = $db->getOne($sqlStmt);
endif;
// Check ranges of hsno´s
// ... To be done to be beautiful... !!!
if ($f_srvp_id_inv != "" && $f_srvp_id != "" && $f_ad_street != "") :
// Get ad_id of the new address
// insertStmt("address", array("ad_street", $f_ad_street, "ad_zipcode", $f_ad_zipcode, "ad_city", $f_ad_city, "ad_country", $f_ad_country));
// $ad_id_new = getLastInsertID();
// Fill "f_ad_city" with signs because of function call "insertAddress"
if ($f_ad_city == "") : $f_ad_city = "???"; endif;
if ($f_ad_country == "") : $f_ad_country = "DE"; endif;
$tmpArray = insertAddress($f_ad_street, $f_ad_zipcode, $f_ad_city, "", $f_ad_country);
$ad_id_new = $tmpArray[0];
// Insert relation
if ($ad_id_new != "" && $ad_id_new != "0") :
insertStmt("serviceplzaddress", array("hq_id", $hq_id, "srvp_id", $f_srvp_id_inv, "ad_id", $ad_id_new, "srvpxa_hsno_from", $f_srvpxa_hsno_from, "srvpxa_hsno_to", $f_srvpxa_hsno_to, "srvpxa_mode", $f_srvpxa_mode));
else :
$statusMessage = "Es wurde kein Eintrag angelegt!";
endif;
$f_act = "search";
else :
if ($f_srvp_id_inv == "") :
$statusMessage = "Die angegebene Rechnungs-PLZ existiert nicht!";
elseif ($f_srvp_id == "") :
$statusMessage = "Die angegebene PLZ ist nicht gültig!";
elseif ($f_ad_street == "") :
$statusMessage = "Es ist keine Straße angegeben!";
else :
$statusMessage = "Der Datensatz konnte nicht eingestellt werden! Bitte alle Felder vollständig ausfüllen!";
endif;
endif;
endif;
// REMOVE association between zipcode and address
if ($f_act == "removeZipcodeAddress") :
TA("B");
// Entries to be deleted?
$fieldsLength = count($f_del_assoc);
if ($fieldsLength > 0 && $f_del_assoc[0] != "") :
// Remove all associations according to the zipcode nested in array $f_del_zipcode_id
for ($i = 0; $i < $fieldsLength; $i++) :
deleteStmt("serviceplzaddress","srvpxa_id = '" . $f_del_assoc[$i] . "' AND hq_id = '" . $hq_id . "'");
endfor;
$f_act = "search";
else :
$statusMessage = "Bitte markieren Sie zu löschende Beziehungen durch anklicken der jeweiligen Checkbox hinter dem Eintrag!";
endif;
TA("C");
TA("E");
endif;
// Generate search-resultset
// if ($f_act == "search" && $searchValues != "") :
if ($f_act == "search") :
if (strlen($f_srvp_plz) > 0 || strlen($f_ad_street) > 0 || strlen($f_ad_zipcode) > 0 || strlen($f_ad_city) > 0 ||
strlen($f_srvpxa_hsno_from) > 0 || strlen($f_srvpxa_hsno_to) > 0) :
// Get the id of the area
$f_srvp_id_inv = getFieldValueFromId("serviceplz","srvp_plz",$f_srvp_plz,"srvp_id");
// *************************************************
// * Selection of the mappings "address" => "area" *
// *************************************************
$whereClause = "";
if ($f_ad_street != "") : $whereClause .= "ad.ad_street LIKE '" . $f_ad_street . "%'"; endif;
if ($whereClause != "" && $f_ad_zipcode != "") : $whereClause .= " AND "; endif;
if ($f_ad_zipcode != "") : $whereClause .= "ad.ad_zipcode LIKE '" . $f_ad_zipcode . "%'"; endif;
if ($whereClause != "" && $f_ad_city != "") : $whereClause .= " AND "; endif;
if ($f_ad_city != "") : $whereClause .= "ad.ad_city LIKE '" . $f_ad_city . "%'"; endif;
if ($whereClause != "" && $f_ad_country != "") : $whereClause .= " AND "; endif;
if ($f_ad_country != "") : $whereClause .= "ad.ad_country LIKE '" . $f_ad_country . "%'"; endif;
// Only prefix !
if ($whereClause != "" && $f_srvp_id_inv != "") : $whereClause .= " AND "; endif;
if ($f_srvp_id_inv != "") : $whereClause .= "srvp.srvp_id = '" . $f_srvp_id_inv . "'"; endif;
if ($whereClause != "" && $f_srvpxa_hsno_from != "") : $whereClause .= " AND "; endif;
if ($f_srvpxa_hsno_from != "") : $whereClause .= "srvpxa.srvpxa_hsno_from = '" . $f_srvpxa_hsno_from . "'"; endif;
if ($whereClause != "" && $f_srvpxa_hsno_to != "") : $whereClause .= " AND "; endif;
if ($f_srvpxa_hsno_to != "") : $whereClause .= "srvpxa.srvpxa_hsno_to = '" . $f_srvpxa_hsno_to . "'"; endif;
if ($whereClause != "") : $whereClause .= " AND "; endif;
if ($orderClause == "") : $orderClause = "ad.ad_street, srvpxa.srvpxa_hsno_to, ad.ad_zipcode"; endif;
// *********************************************************************
// * Selection of the associations between invoice zipcode and address *
// *********************************************************************
$sqlquery = "SELECT ad.ad_id, ad.ad_street, ad.ad_zipcode, ad.ad_city, ad.ad_country,"
. " srvpxa.srvpxa_id, srvpxa.srvpxa_hsno_from, srvpxa.srvpxa_hsno_to, srvpxa.srvpxa_mode,"
. " srvp.srvp_id, srvp.srvp_plz"
. " FROM address AS ad, serviceplz AS srvp, serviceplzaddress AS srvpxa"
. " WHERE " . $whereClause
. " srvpxa.hq_id = '" . $hq_id . "' AND"
. " ad.ad_id = srvpxa.ad_id AND"
. " srvp.srvp_id = srvpxa.srvp_id"
. " ORDER BY " . $orderClause;
// echo $sqlquery;
$result = $db->dbQ($sqlquery);
while ($row = $result->fetch_assoc()):
$numOfRows++;
$out .= "<tr class=\"f10bp1\">";
$out .= "<td> ". $row["srvp_plz"] . " &nbsp;</td> ";
$out .= "<td> ". $row["ad_street"] . " &nbsp;</td>";
$out .= "<td> ". $row["srvpxa_hsno_from"] . " &nbsp;</td> ";
$out .= "<td> ". $row["srvpxa_hsno_to"] . " &nbsp;</td> ";
if ($row["srvpxa_mode"] == "1") :
$out .= "<td> Nur ungerade &nbsp;</td> ";
elseif ($row["srvpxa_mode"] == "2") :
$out .= "<td> Nur gerade &nbsp;</td> ";
else :
$out .= "<td> &nbsp;</td> ";
endif;
$out .= "<td> ". $row["ad_zipcode"] . " &nbsp;</td> ";
$out .= "<td> ". $row["ad_city"] . " &nbsp;</td> ";
$out .= "<td align=\"center\"><input type=\"checkbox\" name=\"f_del_assoc[]\" value=\"" . $row["srvpxa_id"] . "\"></td>";
$out .= "</tr>\n";
endwhile;
$result->free();
else :
$statusMessage = "Eingabe mind. 1 Zeichen in einem Feld!";
endif;
endif;
?>
<html>
<head>
<title><?php echo $pageTitel ?></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"); ?>
table, th, td {
border: 1px solid var(--primary-color);;
border-collapse: collapse;
padding: 8px;
}
</style>
<?php include_once ("../include/js_framework.inc.php"); ?>
<script type="text/javascript">
<!--
// NAVIGATION
<?php echo $jsMenuOut; ?>
function finishPage(mode) {
if (mode == 'removeZipcodeAddress') {
if (confirm('Möchten Sie die markierten Einträge wirklich löschen?')) {
document.forms[0].f_act.value = mode;
document.forms[0].submit();
}
}
if (mode == 'newZipcodeAddress') {
if (confirm('Möchten Sie die neue Beziehung wirklich einstellen?')) {
document.forms[0].f_act.value = mode;
document.forms[0].submit();
}
}
};
function clearFields() {
document.forms[0].f_srvp_plz.value = '';
document.forms[0].f_ad_street.value = '';
document.forms[0].f_srvpxa_hsno_from.value = '';
document.forms[0].f_srvpxa_hsno_to.value = '';
document.forms[0].f_ad_zipcode.value = '';
document.forms[0].f_ad_city.value = '';
};
-->
</script>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>displayStatusMessage();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="mc_page-header">
<?php echo getLngt("Zuordnung Adressen zu PLZn für die Preisberechnung") ?>
</div>
<div class="maincontent mc_elem" name="maincontent" id="maincontent">
<form action="srvpa_list.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="customerId" value="<?php echo $customerId ?>">
<input type="hidden" name="cscIdRoot" value="<?php echo $cscIdRoot ?>">
<input type="hidden" name="cscIdActual" value="<?php echo $cscIdActual ?>">
<input type="hidden" name="orderClause" value="<?php echo $orderClause ?>">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<?php echo htmlDivLineSpacer("20px"); ?>
<?php echo defineButtonType08(getLngt("Suchen"), "action_search", "javascript:document.forms[0].f_act.value='search';document.forms[0].submit();", "180", "left", "3"); ?>
<?php echo defineButtonType08(getLngt("Felder zurücksetzen"), "action_clear", "javascript:clearFields();", "180", "left", "3"); ?>
<?php echo defineButtonType08(getLngt("Neu"), "action_clear", "javascript:finishPage('newZipcodeAddress');", "180"); ?>
<?php echo htmlDivLineSpacer("10px"); ?>
<div>
<?php if (false) : ?>
<table border="0">
<tr>
<td>
<table border="0">
<tr>
<td>
<?php endif; ?>
<table class="f8np1" cellpadding="0">
<tr>
<td><input type="text" name="f_srvp_plz" value="<?php echo $f_srvp_plz ?>" size="5"></td>
<td><input type="text" name="f_ad_street" value="<?php echo $f_ad_street ?>" size="50"></td>
<td><input type="text" name="f_srvpxa_hsno_from" value="<?php echo $f_srvpxa_hsno_from ?>" size="7"></td>
<td><input type="text" name="f_srvpxa_hsno_to" value="<?php echo $f_srvpxa_hsno_to ?>" size="7"></td>
<td>
<input type="radio" name="f_srvpxa_mode" value="0" <?php if ($f_srvpxa_mode == "0" || $f_srvpxa_mode == "") : echo "checked"; endif; ?>> Alle<br>
<input type="radio" name="f_srvpxa_mode" value="1" <?php if ($f_srvpxa_mode == "1") : echo "checked"; endif; ?>> Ungerade<br>
<input type="radio" name="f_srvpxa_mode" value="2" <?php if ($f_srvpxa_mode == "2") : echo "checked"; endif; ?>> Gerade
</td>
<td><input type="text" name="f_ad_zipcode" value="<?php echo $f_ad_zipcode ?>" size="5"></td>
<td><input type="text" name="f_ad_city" value="<?php echo $f_ad_city ?>" size="30"></td>
<td><?php echo defineButtonType10("Löschen", "action_remove", "finishPage('removeZipcodeAddress');", "80", "left"); ?></td>
</tr>
<tr>
<td><a href="javascript:document.forms[0].orderClause.value='srvp.srvp_plz';document.forms[0].f_act.value='search';document.forms[0].submit();">PLZ</a></td>
<td><a href="javascript:document.forms[0].orderClause.value='ad_street, srvpxa.srvpxa_hsno_from';document.forms[0].f_act.value='search';document.forms[0].submit();">Straße</a></td>
<td><a href="javascript:document.forms[0].orderClause.value='srvpxa.srvpxa_hsno_from';document.forms[0].f_act.value='search';document.forms[0].submit();">Hausnr. von</a></td>
<td><a href="javascript:document.forms[0].orderClause.value='srvpxa.srvpxa_hsno_to';document.forms[0].f_act.value='search';document.forms[0].submit();">Hausnr. bis</a></td>
<td><a href="javascript:document.forms[0].orderClause.value='srvpxa.srvpxa_mode';document.forms[0].f_act.value='search';document.forms[0].submit();">Modus</a></td>
<td><a href="javascript:document.forms[0].orderClause.value='ad.ad_zipcode';document.forms[0].f_act.value='search';document.forms[0].submit();">PLZ</a></td>
<td><a href="javascript:document.forms[0].orderClause.value='ad.ad_city';document.forms[0].f_act.value='search';document.forms[0].submit();">Ort</a></td>
<td>&nbsp;</td>
</tr>
<?php echo $out ?>
</table>
<?php if (false) : ?>
</td>
</tr>
</table>
</td>
</table>
<?php endif; ?>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<div>
Anzahl Einträge: <?php echo $numOfRows ?><?php if ($numOfRows == "0" && $f_act == "search" && $statusMessage == "") : echo " (Keine Einträge gefunden.)"; endif; ?>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
</form>
</div>
</body>
</html>

360
html/admin/srvpaa_list.php Normal file
View File

@@ -0,0 +1,360 @@
<?php
/*=======================================================================
*
* srvpaa_list.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
include_once ("../geo/geocode.inc.php");
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act", "customerId", "cscIdRoot", "cscIdActual",
"f_srvpa_name", "f_ad_street", "f_srvpaa_hsno_from", "f_srvpaa_hsno_to",
"f_ad_zipcode", "f_ad_city", "f_ad_country", "f_srvpaa_mode", "f_del_assoc",
"orderClause", "statusMessage", "tourno", "deactivateMenu"));
$pageTitel = "BEREICHSADRESSEN";
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
authCheckEmployeeRights($emp_id, "2", "1");
$numOfRows = 0;
mcTrim($f_ad_street); mcTrim($f_ad_zipcode); mcTrim($f_ad_city); mcTrim($f_ad_country);
mcTrim($f_srvpa_name); mcTrim($f_srvpaa_hsno_from); mcTrim($f_srvpaa_hsno_to);
if ($f_del_assoc == "") : $f_del_assoc = array(); endif;
$out = "";
$out_remarks = "";
// NEW association between area and address
if ($f_act == "newAreaAddress") :
if (ZIPCODEAREA_PADLENGTH != "" && is_numeric(ZIPCODEAREA_PADLENGTH)) :
$f_srvpa_name = trim($f_srvpa_name);
if ($f_srvpa_name != "") :
$f_srvpa_name = pad($f_srvpa_name,ZIPCODEAREA_PADLENGTH);
endif;
endif;
// Get the id of the area
// $f_srvpa_id = getFieldValueFromId("serviceplzarea","srvpa_name",$f_srvpa_name,"srvpa_id");
$f_srvpa_id = getFieldValueFromClause("serviceplzarea","srvpa_id","srvpa_name = '" . $f_srvpa_name . "' AND hq_id = '" . $hq_id . "'");
// Check existence zipcode
$f_srvp_id = getFieldValueFromId("serviceplz","srvp_plz",$f_ad_zipcode,"srvp_id");
// Try to get name of the city if does not exist
if ($f_ad_city == "") :
$sqlStmt = "SELECT st_city FROM phoenix_special.street WHERE st_zipcode = '$f_ad_zipcode'";
$f_ad_city = $db->getOne($sqlStmt);
endif;
// Check ranges of hsno´s
// ... To be done to be beautiful... !!!
if ($f_srvpa_id != "" && $f_srvp_id != "" && $f_ad_street != "") :
// Get ad_id of the new address
insertStmt("address", array("ad_street", $f_ad_street, "ad_zipcode", $f_ad_zipcode, "ad_city", $f_ad_city, "ad_country", $f_ad_country));
$ad_id_new = getLastInsertID();
// Insert relation
insertStmt("serviceplzareaaddress", array("hq_id", $hq_id, "srvpa_id", $f_srvpa_id, "ad_id", $ad_id_new, "srvpaa_hsno_from", $f_srvpaa_hsno_from, "srvpaa_hsno_to", $f_srvpaa_hsno_to, "srvpaa_mode", $f_srvpaa_mode));
$f_act = "search";
else :
if ($f_srvpa_id == "") :
$statusMessage = "Der angegebene Bereich existiert nicht!";
elseif ($f_srvp_id == "") :
$statusMessage = "Die angegebene PLZ ist nicht gültig!";
elseif ($f_ad_street == "") :
$statusMessage = "Es ist keine Straße angegeben!";
else :
$statusMessage = "Der Datensatz konnte nicht eingestellt werden! Bitte alle Felder vollständig ausfüllen!";
endif;
endif;
endif;
// REMOVE association between area and address
if ($f_act == "removeAreaAddress") :
TA("B");
// Entries to be deleted?
$fieldsLength = count($f_del_assoc);
if ($fieldsLength > 0 && $f_del_assoc[0] != "") :
// Remove all associations according to the zipcode nested in array $f_del_zipcode_id
for ($i = 0; $i < $fieldsLength; $i++) :
deleteStmt("serviceplzareaaddress","srvpaa_id = '" . $f_del_assoc[$i] . "' AND hq_id = '" . $hq_id . "'");
endfor;
$f_act = "search";
else :
$statusMessage = "Bitte markieren Sie zu löschende Beziehungen durch anklicken der jeweiligen Checkbox hinter dem Eintrag!";
endif;
TA("C");
TA("E");
endif;
// Generate search-resultset
// if ($f_act == "search" && $searchValues != "") :
if ($f_act == "search") :
if (strlen($f_srvpa_name) > 0 || strlen($f_ad_street) > 0 || strlen($f_ad_zipcode) > 0 || strlen($f_ad_city) > 0 ||
strlen($f_srvpaa_hsno_from) > 0 || strlen($f_srvpaa_hsno_to) > 0) :
if (ZIPCODEAREA_PADLENGTH != "" && is_numeric(ZIPCODEAREA_PADLENGTH)) :
$f_srvpa_name = trim($f_srvpa_name);
if ($f_srvpa_name != "") :
$f_srvpa_name = pad($f_srvpa_name,ZIPCODEAREA_PADLENGTH);
endif;
endif;
// Get the id of the area
// $f_srvpa_id = getFieldValueFromId("serviceplzarea","srvpa_name",$f_srvpa_name,"srvpa_id");
$f_srvpa_id = getFieldValueFromClause("serviceplzarea","srvpa_id","srvpa_name = '" . $f_srvpa_name . "' AND hq_id = '" . $hq_id . "'");
// *************************************************
// * Selection of the mappings "address" => "area" *
// *************************************************
$whereClause = "";
if ($f_ad_street != "") : $whereClause .= "ad.ad_street LIKE '" . $f_ad_street . "%'"; endif;
if ($whereClause != "" && $f_ad_zipcode != "") : $whereClause .= " AND "; endif;
if ($f_ad_zipcode != "") : $whereClause .= "ad.ad_zipcode LIKE '" . $f_ad_zipcode . "%'"; endif;
if ($whereClause != "" && $f_ad_city != "") : $whereClause .= " AND "; endif;
if ($f_ad_city != "") : $whereClause .= "ad.ad_city LIKE '" . $f_ad_city . "%'"; endif;
if ($whereClause != "" && $f_ad_country != "") : $whereClause .= " AND "; endif;
if ($f_ad_country != "") : $whereClause .= "ad.ad_country LIKE '" . $f_ad_country . "%'"; endif;
// Only prefix !
if ($whereClause != "" && $f_srvpa_id != "") : $whereClause .= " AND "; endif;
if ($f_srvpa_id != "") : $whereClause .= "srvpa.srvpa_id = '" . $f_srvpa_id . "'"; endif;
if ($whereClause != "" && $f_srvpaa_hsno_from != "") : $whereClause .= " AND "; endif;
if ($f_srvpaa_hsno_from != "") : $whereClause .= "srvpaa.srvpaa_hsno_from = '" . $f_srvpaa_hsno_from . "'"; endif;
if ($whereClause != "" && $f_srvpaa_hsno_to != "") : $whereClause .= " AND "; endif;
if ($f_srvpaa_hsno_to != "") : $whereClause .= "srvpaa.srvpaa_hsno_to = '" . $f_srvpaa_hsno_to . "'"; endif;
if ($whereClause != "") : $whereClause .= " AND "; endif;
if ($orderClause == "") : $orderClause = "ad.ad_street, srvpaa.srvpaa_hsno_to, ad.ad_zipcode"; endif;
// **************************************
// * Selection of the invoice addresses *
// **************************************
$sqlquery = "SELECT ad.ad_id, ad.ad_street, ad.ad_zipcode, ad.ad_city, ad.ad_country,"
. " srvpaa.srvpaa_id, srvpaa.srvpaa_hsno_from, srvpaa.srvpaa_hsno_to, srvpaa.srvpaa_mode,"
. " srvpa.srvpa_id, srvpa.srvpa_name, par.par_value"
. " FROM address AS ad, serviceplzarea AS srvpa, serviceplzareaaddress AS srvpaa"
. " LEFT JOIN parameter AS par ON CONCAT('MASK_AREA_ID_FROM_ADDRESS_', srvpaa.srvpaa_id) = par.par_key"
. " WHERE " . $whereClause
. " srvpaa.hq_id = '" . $hq_id . "' AND"
. " ad.ad_id = srvpaa.ad_id AND"
. " srvpa.srvpa_id = srvpaa.srvpa_id AND"
. " srvpa.hq_id = '" . $hq_id . "'"
. " ORDER BY " . $orderClause;
// echo $sqlquery;
$result = $db->dbQ($sqlquery);
while ($row = $result->fetch_assoc()):
$numOfRows++;
$out .= "<tr class=\"f10bp1\">";
$out .= "<td> ". $row["srvpa_name"] . ($row["par_value"] != "" ? "*" : "") . " &nbsp;</td> ";
$out .= "<td> ". $row["ad_street"] . " &nbsp;</td>";
$out .= "<td> ". $row["srvpaa_hsno_from"] . " &nbsp;</td> ";
$out .= "<td> ". $row["srvpaa_hsno_to"] . " &nbsp;</td> ";
if ($row["srvpaa_mode"] == "1") :
$out .= "<td> Nur ungerade &nbsp;</td> ";
elseif ($row["srvpaa_mode"] == "2") :
$out .= "<td> Nur gerade &nbsp;</td> ";
else :
$out .= "<td> &nbsp;</td> ";
endif;
$out .= "<td> ". $row["ad_zipcode"] . " &nbsp;</td> ";
$out .= "<td> ". $row["ad_city"] . " &nbsp;</td> ";
/*
$out .= "<td align=\"center\"><a href=\"../jobs/job_edit.php?csc_id_start=" . ec($row["csc_id"]) . "\" target=\"_blank\">"
. "<img src=\"../images/arrow_right.jpg\" border=\"0\" height=\"10\" width=\"25\">"
. "</a>" . "</td>";
*/
$out .= "<td align=\"center\"><input type=\"checkbox\" name=\"f_del_assoc[]\" value=\"" . $row["srvpaa_id"] . "\"></td>";
$out .= "</tr>\n";
if ($row["par_value"] != ""):
$rowPar_value = "";
$rowPar_valueArr = explode(";", $row["par_value"]);
foreach($rowPar_valueArr as $rowPar_valuePair) {
$rowPar_valuePairArr = explode(",", $rowPar_valuePair);
$rowPar_value .= $rowPar_valuePairArr[0] . " -&gt; " . $db->getOne("SELECT srvpa_name FROM serviceplzarea WHERE srvpa_id = " . $rowPar_valuePairArr[1]) . ", ";
}
$out_remarks .= $row["srvpa_name"] . "&nbsp;" . $row["ad_street"] . ": " . substr($rowPar_value, 0, strlen($rowPar_value) - 2) . "<br>\n";
endif;
endwhile;
if ($out_remarks != ""):
$out_remarks = "<tr><td><b>*) Folgende Hausnummern sind in der Preisberechnung abweichenden Bereichen zugeordnet: <br>\n" . $out_remarks . "</b></td><tr>";
endif;
$result->free();
else :
$statusMessage = "Eingabe mind. 1 Zeichen in einem Feld!";
endif;
endif;
?>
<html>
<head>
<title><?php echo $pageTitel ?></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"); ?>
table, th, td {
border: 1px solid var(--primary-color);;
border-collapse: collapse;
padding: 8px;
}
</style>
<?php include_once ("../include/js_framework.inc.php"); ?>
<script type="text/javascript">
<!--
<!--
// NAVIGATION
<?php echo $jsMenuOut; ?>
function finishPage(mode) {
if (mode == 'removeAreaAddress') {
if (confirm('Möchten Sie die markierten Einträge wirklich löschen?')) {
document.forms[0].f_act.value = mode;
document.forms[0].submit();
}
}
if (mode == 'newAreaAddress') {
if (confirm('Möchten Sie die neue Beziehung wirklich einstellen?')) {
document.forms[0].f_act.value = mode;
document.forms[0].submit();
}
}
};
function clearFields() {
document.forms[0].f_srvpa_name.value = '';
document.forms[0].f_ad_street.value = '';
document.forms[0].f_srvpaa_hsno_from.value = '';
document.forms[0].f_srvpaa_hsno_to.value = '';
document.forms[0].f_ad_zipcode.value = '';
document.forms[0].f_ad_city.value = '';
};
-->
</script>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>displayStatusMessage();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="mc_page-header">
<?php echo getLngt("Zuordnung Adressen zu Bereichen für die Preisberechnung") ?>
</div>
<div class="maincontent mc_elem" name="maincontent" id="maincontent">
<form action="srvpaa_list.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="customerId" value="<?php echo $customerId ?>">
<input type="hidden" name="cscIdRoot" value="<?php echo $cscIdRoot ?>">
<input type="hidden" name="cscIdActual" value="<?php echo $cscIdActual ?>">
<input type="hidden" name="orderClause" value="<?php echo $orderClause ?>">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<?php echo htmlDivLineSpacer("20px"); ?>
<?php echo defineButtonType08(getLngt("Suchen"), "action_search", "javascript:document.forms[0].f_act.value='search';document.forms[0].submit();", "180", "left", "3"); ?>
<?php echo defineButtonType08(getLngt("Felder zurücksetzen"), "action_clear", "javascript:clearFields();", "180", "left", "3"); ?>
<?php echo defineButtonType08(getLngt("Neu"), "action_clear", "javascript:finishPage('newAreaAddress');", "180"); ?>
<?php echo htmlDivLineSpacer("10px"); ?>
<div>
<?php if (false) : ?>
<table border="0">
<tr>
<td>
<table border="0">
<tr>
<td>
<?php endif; ?>
<table class="f8np1" border="1" cellpadding="0">
<tr>
<td><input type="text" name="f_srvpa_name" value="<?php echo $f_srvpa_name ?>" size="5"></td>
<td><input type="text" name="f_ad_street" value="<?php echo $f_ad_street ?>" size="50"></td>
<td><input type="text" name="f_srvpaa_hsno_from" value="<?php echo $f_srvpaa_hsno_from ?>" size="7"></td>
<td><input type="text" name="f_srvpaa_hsno_to" value="<?php echo $f_srvpaa_hsno_to ?>" size="7"></td>
<td>
<input type="radio" name="f_srvpaa_mode" value="0" <?php if ($f_srvpaa_mode == "0" || $f_srvpaa_mode == "") : echo "checked"; endif; ?>> Alle<br>
<input type="radio" name="f_srvpaa_mode" value="1" <?php if ($f_srvpaa_mode == "1") : echo "checked"; endif; ?>> Ungerade<br>
<input type="radio" name="f_srvpaa_mode" value="2" <?php if ($f_srvpaa_mode == "2") : echo "checked"; endif; ?>> Gerade
</td>
<td><input type="text" name="f_ad_zipcode" value="<?php echo $f_ad_zipcode ?>" size="5"></td>
<td><input type="text" name="f_ad_city" value="<?php echo $f_ad_city ?>" size="30"></td>
<td><?php echo defineButtonType10("Löschen", "action_remove", "finishPage('removeAreaAddress');", "80", "left"); ?></td>
</tr>
<tr>
<td><a href="javascript:document.forms[0].orderClause.value='srvpa.srvpa_name';document.forms[0].f_act.value='search';document.forms[0].submit();">Bereich</a></td>
<td><a href="javascript:document.forms[0].orderClause.value='ad_street, srvpaa.srvpaa_hsno_from';document.forms[0].f_act.value='search';document.forms[0].submit();">Straße</a></td>
<td><a href="javascript:document.forms[0].orderClause.value='srvpaa.srvpaa_hsno_from';document.forms[0].f_act.value='search';document.forms[0].submit();">Hausnr. von</a></td>
<td><a href="javascript:document.forms[0].orderClause.value='srvpaa.srvpaa_hsno_to';document.forms[0].f_act.value='search';document.forms[0].submit();">Hausnr. bis</a></td>
<td><a href="javascript:document.forms[0].orderClause.value='srvpaa.srvpaa_mode';document.forms[0].f_act.value='search';document.forms[0].submit();">Modus</a></td>
<td><a href="javascript:document.forms[0].orderClause.value='ad.ad_zipcode';document.forms[0].f_act.value='search';document.forms[0].submit();">PLZ</a></td>
<td><a href="javascript:document.forms[0].orderClause.value='ad.ad_city';document.forms[0].f_act.value='search';document.forms[0].submit();">Ort</a></td>
<td>&nbsp;</td>
</tr>
<?php echo $out ?>
</table>
<?php if (false) : ?>
</td>
</tr>
<?php // echo $out_remarks ?>
</table>
</td>
</table>
<?php endif; ?>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<div>
Anzahl Einträge: <?php echo $numOfRows ?><?php if ($numOfRows == "0" && $f_act == "search" && $statusMessage == "") : echo " (Keine Einträge gefunden.)"; endif; ?>
</div>
<?php echo htmlDivLineSpacer("20px"); ?>
<div>
<?php echo $out_remarks ?>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
</form>
</div>
</body>
</html>

751
html/admin/start.php Normal file
View File

@@ -0,0 +1,751 @@
<?php
/*=======================================================================
*
* start.php
*
=======================================================================*/
include_once("../include/dbconnect.inc.php");
include_once("../include/caglobal.inc.php");
include_once("../include/auth.inc.php");
include_once("../include/inc_user.inc.php");
include_once("../include/grid.inc.php");
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act", "noResetUserStates"));
// Id of the actual employee and the costcenter (individual root-node) logged in
if ($cscIdRoot == ""): $cscIdRoot = getFieldValueFromId("employee","emp_id",$emp_id,"csc_id"); endif;
if ($customerId == ""): $customerId = getFieldValueFromId("costcenter","csc_id",$cscIdRoot,"cs_id"); endif;
if ($cscIdActual == ""): $cscIdActual = $cscIdRoot; endif;
// Reset user states data after login
// Has to be executed before including "menu.php" (!!!!)
if (!isset($noResetUserStates) || $noResetUserStates == "") :
resetUserStates();
$noResetUserStates = "1";
endif;
getLanguage(__FILE__);
$pageTitel = getLngt("STARTSEITE");
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
getCurrentScript(__FILE__);
// GRID
// 1. Parameter: Initial column width
// 2. Parameter: Number of rows and columns
$grid = new Grid("600px", array(4,2));
// All output has to match a special grid container
$gridJsOut = "";
// Grid container sequential number, read from left to right and then row by row from top to button
// E.g. array(3,2) has 6 = 3 x 2 containers ([0][0] = 1)
// Reset the counter (= 0)
$grid->resetContainerPageCounter();
// Returns container page counter values
// $mode: "0" or empty <=> returns the array(row, col) regarding current container ID
// "1" returns the page counter by itself
// "2" returns the ID of the container
// $gridMatrix = $grid->getNextContainerPageCounter();
// Current user data
$sqlquery = "SELECT usr.usr_name, usr.usr_firstname, usr.usr_type"
. " FROM user AS usr"
. " WHERE usr.usr_id = " . $usr_id;
$result = $db->dbQ($sqlquery);
while ($row = $result->fetch_assoc()):
$v_usr_type = $row["usr_type"];
$v_usr_name = $row["usr_name"];
$v_usr_firstname = $row["usr_firstname"];
endwhile;
$result->free();
if ($v_usr_type == "1") :
if (authCheckEmployeeRights($emp_id, "0") && authCheckEmployeeRights($emp_id, "11")) :
include ("../groupware/calendar.php");
endif;
endif;
// Get the emp_id of the root admin, e.g. setting new passwords of employees
$empIdRootAdmin = getEmpIdOfRootAdmin("hq");
// Company-data
$sqlquery = "";
if ($v_usr_type == "3") :
// Courier
$sqlquery = "SELECT cmp.cmp_id, cmp.cmp_comp, cmp.cmp_comp2, cmp.cmp_logo, cmp.cmp_logo_width, cmp.cmp_logo_height"
. " FROM company AS cmp, courier AS cr"
. " WHERE cr.usr_id = " . $usr_id
. " AND cmp.cmp_id = cr.cmp_id";
elseif ($v_usr_type == "2") :
// Customer
$sqlquery = "SELECT cmp.cmp_id, cmp.cmp_comp, cmp.cmp_comp2, cmp.cmp_logo, cmp.cmp_logo_width, cmp.cmp_logo_height"
. " FROM company AS cmp, customer AS cs"
. " WHERE cs.cs_admin = " . $emp_id
. " AND cmp.cmp_id = cs.cmp_id";
elseif ($v_usr_type == "1") :
// Headquarter
$sqlquery = "SELECT cmp.cmp_id, cmp.cmp_comp, cmp.cmp_comp2, cmp.cmp_logo, cmp.cmp_logo_width, cmp.cmp_logo_height"
. " FROM company AS cmp, headquarters AS hq"
. " WHERE hq.hq_id = " . $hq_id
. " AND hq.cmp_id = cmp.cmp_id";
endif;
if ($sqlquery != "") :
$result = $db->dbQ($sqlquery);
while ($row = $result->fetch_assoc()):
$v_cmp_id = $row["cmp_id"];
$v_cmp_comp = $row["cmp_comp"];
$v_cmp_comp2 = $row["cmp_comp2"];
$v_cmp_logo = $row["cmp_logo"];
$v_cmp_logo_width = $row["cmp_logo_width"];
$v_cmp_logo_height = $row["cmp_logo_height"];
endwhile;
$result->free();
endif;
$companyLogo = "";
if (trim($v_cmp_logo) == "") :
$v_cmp_id = getFieldValueFromId("headquarters", "hq_id", $hq_id, "cmp_id");
list ($v_cmp_logo, $v_cmp_logo_width, $v_cmp_logo_height) = getFieldsValueFromId("company","cmp_id",$v_cmp_id,array("cmp_logo","cmp_logo_width","cmp_logo_height"));
endif;
if (trim($v_cmp_logo) != "") :
$companyLogo = "<img src=\"../images/external/" . $v_cmp_logo . "\" border=\"0\" height=\"" . $v_cmp_logo_height . "\" width=\"" . $v_cmp_logo_width . "\">";
endif;
// Container
$gridMatrix = $grid->getNextContainerPageCounter();
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "red"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], $v_cmp_comp . " " . $v_cmp_comp2, "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("font-size", "14pt", "font-weight", "bold"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], "<center>" . $companyLogo . "</br></br>" . getLngt("Hallo") . " " . $v_usr_firstname . " " . $v_usr_name . "</br></br></center>", "bd");
// **********************************************
// *** Birthdays, newsticker and appointments ***
// **********************************************
$currentTime = getDateTime("0");
$birthdateOut = "";
$newstickerOut = "";
$appointmentOut = "";
// FOR HEADQUARTERS ONLY
if ($v_usr_type == "1") :
// Birthday data
/*
$sqlquery = "SELECT DISTINCT hq.hq_mnemonic, usr.usr_name, usr.usr_firstname, usr.usr_type"
. " FROM user AS usr, headquarters AS hq"
. " WHERE usr.hq_id = hq.hq_id AND RIGHT(usr.usr_birthdate, 5) = RIGHT(CURDATE(), 5)"
. " ORDER BY usr.usr_type, usr.usr_name";
$result = $db->dbQ($sqlquery);
$tmpUsrTypeArray = array(0,0,0,0);
while ($row = $result->fetch_assoc()):
if ($tmpUsrTypeArray[$row["usr_type"]] == "0") :
$tmpUsrTypeArray[$row["usr_type"]] = "1";
if ($row["usr_type"] == "1") : $birthdateOut .= "<tr><td colspan=\"2\">" . getLngt("Mitarbeiter") . ":</td></tr>"; endif;
if ($row["usr_type"] == "2") : $birthdateOut .= "<tr><td colspan=\"2\">" . getLngt("Kunden") . ":</td></tr>"; endif;
if ($row["usr_type"] == "3") : $birthdateOut .= "<tr><td colspan=\"2\">" . getLngt("Transporteure") . ":</td></tr>"; endif;
endif;
$birthdateOut .= "<tr>";
$birthdateOut .= "<td>(" . $row["hq_mnemonic"] . ")&nbsp;&nbsp;</td>";
$birthdateOut .= "<td>" . $row["usr_firstname"] . "&nbsp;" . $row["usr_name"] . "</td>";
$birthdateOut .= "</tr>";
endwhile;
$result->free();
*/
$sqlquery = "SELECT DISTINCT hq.hq_mnemonic, usr.usr_name, usr.usr_firstname, usr.usr_type, cr_cmp.cmp_authenticated, cr_cmp.cmp_visible"
. " FROM headquarters AS hq, user AS usr LEFT JOIN courier AS cr ON cr.usr_id = usr.usr_id AND usr.usr_type = '3'"
. " LEFT JOIN company AS cr_cmp ON cr.cmp_id = cr_cmp.cmp_id"
. " WHERE usr.hq_id = hq.hq_id AND RIGHT(usr.usr_birthdate, 5) = RIGHT(CURDATE(), 5)"
. " ORDER BY usr.usr_type, usr.usr_name";
$result = $db->dbQ($sqlquery);
$tmpUsrTypeArray = array(0,0,0,0);
while ($row = $result->fetch_assoc()):
if ($tmpUsrTypeArray[$row["usr_type"]] == "0") :
$tmpUsrTypeArray[$row["usr_type"]] = "1";
if ($row["usr_type"] == "1") : $birthdateOut .= "<tr><td colspan=\"2\"><b>" . getLngt("Mitarbeiter") . ":</b></td></tr>"; endif;
if ($row["usr_type"] == "2") : $birthdateOut .= "<tr><td colspan=\"2\"><b>" . getLngt("Kunden") . ":</b></td></tr>"; endif;
if ($row["usr_type"] == "3") : $birthdateOut .= "<tr><td colspan=\"2\"><b>" . getLngt("Transporteure") . ":</b></td></tr>"; endif;
endif;
if ($row["usr_type"] != "3" || ($row["usr_type"] == "3" && $row["cmp_authenticated"] == "1" && $row["cmp_visible"] == "1")) :
$birthdateOut .= "<tr>";
$birthdateOut .= "<td>(" . $row["hq_mnemonic"] . ")&nbsp;&nbsp;</td>";
$birthdateOut .= "<td>" . $row["usr_firstname"] . "&nbsp;" . $row["usr_name"] . "</td>";
$birthdateOut .= "</tr>";
endif;
endwhile;
$result->free();
// Container birthdays
$gridMatrix = $grid->getNextContainerPageCounter();
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "green"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], getLngt("Wir gratulieren herzlich zum Geburtstag!"), "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("font-size", "14pt", "font-weight", "bold"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], "<center></br>" . "<table>" . $birthdateOut . "</table>" . "</br></center>", "bd");
// DIRECT SEARCH
$bdOut = "<div><center></br><b>" . getLngt("Auftrag, Kunde, Fahrer, Fahrzeug") . ":</b>&nbsp;&nbsp;"
. "<input type=\"text\" id=\"metaSearch\" name=\"metaSearch\" value=\"\" size=\"15\">&nbsp;&nbsp;"
. "<button type=\"button\" class=\"buttonIcon\" onClick=\"metasearchStart();\">" . "&nbsp;" . "</button></br></div>"
. "<div style=\"padding:10px\" id=\"metaSearchResult_01\"></div>"
. "<div style=\"padding:10px\" id=\"metaSearchResult_02\"></div>"
. "<div style=\"padding:10px\" id=\"metaSearchResult_03\"></div>"
. "<div style=\"padding:10px\" id=\"metaSearchResult_04\"></div>";
// Container meta search
$gridMatrix = $grid->getNextContainerPageCounter();
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "green"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], getLngt("DIREKTSUCHE"), "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("font-size", "12pt", "font-weight", "normal"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], $bdOut, "bd");
// SPECIAL RIGHTS FOR reports !!!!!!!!!!!!!!!!!!!!!!!!!!!!
$lastLoginTime = "";
$newCsReportsOut = "";
$newCrReportsOut = "";
$numOfNewCrReports = 0;
$presetDays = 7;
if (authCheckEmployeeRights($emp_id, "0") && authCheckEmployeeRights($emp_id, "16")) :
$numOfNewCsReports = 0;
$listOfLoginsArray = getListOfLogEntries(array('52','53'), array(0,0,0,0,-($presetDays),0), array("log_createtime"), $emp_id, "log_createtime DESC");
$listOfLoginsArrayLen = count($listOfLoginsArray);
if ($listOfLoginsArrayLen > 0) :
$lastLoginTime = $listOfLoginsArray[1][0];
if ($lastLoginTime != "") :
$numOfNewCsReports = getCountOfTable("phoenix_group.report_process", "hq_id = '" . $hq_id . "' AND rp_objtype = 'cs' AND rp_createtime >= '" . $lastLoginTime . "'");
if ($numOfNewCsReports == -1) : $numOfNewCsReports = 0; endif;
$numOfNewCrReports = getCountOfTable("phoenix_group.report_process", "hq_id = '" . $hq_id . "' AND rp_objtype = 'cr' AND rp_createtime >= '" . $lastLoginTime . "'");
if ($numOfNewCrReports == -1) : $numOfNewCrReports = 0; endif;
endif;
endif;
$newCsReportsOut = "<a href=\"../groupware/report.php?currentNavigationItem=vertrieb&rpObjType=cs&day_from=". ec(substr($lastLoginTime,8,2)) . "&month_from=". ec(substr($lastLoginTime,5,2)) . "&year_from=". ec(substr($lastLoginTime,0,4)) . "&day_to=" . ec(getDateTime("day")) . "&month_to=". ec(getDateTime("month")) . "&year_to=". ec(getDateTime("year")) . "\" target=\"_blank\">" . getLngt("[Kundenberichte]") . "</a>";
$newCrReportsOut = "<a href=\"../groupware/report.php?currentNavigationItem=vertrieb&rpObjType=cr&day_from=". ec(substr($lastLoginTime,8,2)) . "&month_from=". ec(substr($lastLoginTime,5,2)) . "&year_from=". ec(substr($lastLoginTime,0,4)) . "&day_to=" . ec(getDateTime("day")) . "&month_to=". ec(getDateTime("month")) . "&year_to=". ec(getDateTime("year")) . "\" target=\"_blank\">" . getLngt("[Transporteursberichte]") . "</a>";
endif; // SPECIAL RIGHTS FOR reports !!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Number of reports
$reportOut = "";
$lastLoginTimestamp = "";
if ($lastLoginTime != "") :
$lastLoginTimestamp = substr($lastLoginTime,8,2) . "." . substr($lastLoginTime,5,2) . "." . substr($lastLoginTime,0,4). "&nbsp;&nbsp;" . substr($lastLoginTime,11,2) . "." . substr($lastLoginTime,14,2) . "." . substr($lastLoginTime,17,2);
endif;
if ($newCsReportsOut != "" || $newCrReportsOut != "") :
$reportOut .= "<div><table>";
$reportOut .= "<tr><td align=\"center\"><b>" . getLngt("BERICHTE seit letztem Login") . "&nbsp;[" . $lastLoginTimestamp . "]&nbsp;" . getLngt("(max. eine Woche)") . "<br><br></td></tr>";
if ($newCsReportsOut != "") :
$reportOut .= "<tr><td align=\"center\">" . $newCsReportsOut . "&nbsp;&nbsp;[" . getLngt("Anzahl") . "&nbsp;" . $numOfNewCsReports . "]<br><br></td></tr>";
endif;
if ($newCrReportsOut != "") :
$reportOut .= "<tr><td align=\"center\">" . $newCrReportsOut . "&nbsp;&nbsp;[" . getLngt("Anzahl") . "&nbsp;" . $numOfNewCrReports . "]<br><br></td></tr>";
endif;
$reportOut .= "</table></div>";
// Container reports
$gridMatrix = $grid->getNextContainerPageCounter();
// $gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "blue"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], getLngt("BERICHTE seit letztem Login") . "&nbsp;[" . $lastLoginTimestamp . "]&nbsp;" . getLngt("(max. eine Woche)"), "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("font-size", "10pt", "font-weight", "normal"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], "<center></br>" . $reportOut . "</center>", "bd");
endif;
// SPECIAL RIGHTS FOR calendar !!!!!!!!!!!!!!!!!!!!!!!!!!!!
if (authCheckEmployeeRights($emp_id, "0") && authCheckEmployeeRights($emp_id, "11")) :
// Appointment data
$f_hq_id = array($hq_id);
$f_selUsrId = $usr_id;
// Monitored appointments
$f_ap_cat_search_4 = "1"; // Get only appointments with activated "alarm"
$tmpApRangeStarttime = getDateTime("date_plus_offset", array(-1,0,0), "Ymd");
$tmpApRangeEndtime = getDateTime("date_plus_offset", array(0,7,0), "Ymd");
$apArray = getAppointmentsFromDB(substr($tmpApRangeStarttime,0,4), substr($tmpApRangeStarttime,4,2) , substr($tmpApRangeStarttime,6,2), substr($tmpApRangeEndtime,0,4), substr($tmpApRangeEndtime,4,2) , substr($tmpApRangeEndtime,6,2));
// Normal appointments
$f_ap_cat_search_4 = "0"; // Get normal appointments
$tmpApRangeStarttime = getDateTime("date_plus_offset", array(0,0,0), "Ymd");
$tmpApRangeEndtime = getDateTime("date_plus_offset", array(0,1,0), "Ymd");
$apArray2 = getAppointmentsFromDB(substr($tmpApRangeStarttime,0,4), substr($tmpApRangeStarttime,4,2) , substr($tmpApRangeStarttime,6,2), substr($tmpApRangeEndtime,0,4), substr($tmpApRangeEndtime,4,2) , substr($tmpApRangeEndtime,6,2));
// Merge arrays
$apArray = array_merge($apArray, $apArray2);
$lenApArray = count($apArray);
$apOut = "";
for ($j = 0; $j < $lenApArray; $j++) :
$tmpId = $apArray[$j][0];
$tmpText = $apArray[$j][1];
$tmpExecDateTime = $apArray[$j][2];
$tmpExecDate = substr($tmpExecDateTime,8,2) . "." . substr($tmpExecDateTime,5,2) . "." . substr($tmpExecDateTime,0,4);
$tmpExecTime = substr($tmpExecDateTime,11,5);
$tmpExecDateYear = substr($apArray[$j][2],0,4);
$tmpExecDateMonth = substr($apArray[$j][2],5,2);
$tmpExecDateDay = substr($apArray[$j][2],8,2);
$tmpCmpId = trim($apArray[$j][3]);
$tmpCmpComp = trim($apArray[$j][4]);
$tmpCmpComp2 = trim($apArray[$j][5]);
$tmpCsId = $apArray[$j][6];
$tmpCsEid = $apArray[$j][7];
$tmpEndDateTime = $apArray[$j][8];
$tmpEndDate = substr($tmpEndDateTime,8,2) . "." . substr($tmpEndDateTime,5,2) . "." . substr($tmpEndDateTime,0,4);
$tmpEndTime = substr($tmpEndDateTime,11,5);
$tmpUsrId = trim($apArray[$j][9]);
$tmpUsrFirstname = trim($apArray[$j][10]);
$tmpUsrName = trim($apArray[$j][11]);
$tmpParticipants = trim($apArray[$j][12]);
$tmpParticipants = substr($tmpParticipants,1,-1); // Remove commata from db-field
$tmpConfirmed = trim($apArray[$j][13]);
$tmpConfirmed = substr($tmpConfirmed,1,-1); // Remove commata from db-field
$tmpPtCmpComp = trim($apArray[$j][14]);
$tmpPtCmpComp2 = trim($apArray[$j][15]);
$tmpPtCsEid = $apArray[$j][16];
$tmpPtId = $apArray[$j][17];
$tmpApCat1 = $apArray[$j][18];
$tmpApCat2 = $apArray[$j][19];
$tmpApCat3 = $apArray[$j][20];
$tmpApCat4 = $apArray[$j][21];
$cellCol = "FFFFFF";
$apOut .= "<tr><td>" . getLngt("Beginn") . "</td><td>" . getLngt("Ende") . "</td><td>" . getLngt("Ersteller") . "</td><td>" . getLngt("Teilnehmer") . "</td><td>" . getLngt("Beschreibung") . "</td><td>" . getLngt("Kunde") . "</td><td>&nbsp;</td></tr>";
$apOut .= "<tr>";
// Dates (From, To)
$apOut .= "<td width=\"90\" align=\"center\" valign=\"center\" bgcolor=\"#" . $cellCol . "\"><b>" . $tmpExecDate . "<br>" . ($tmpApCat4 == "1" ? "<img src=\"../images/ap_clock.png\" width=\"15\" height=\"15\" style=\"border:none;\">" : "") . "<br>" . $tmpExecTime . "</b></td>";
if ($tmpEndTime != "00:00") :
$apOut .= "<td width=\"90\" align=\"center\" valign=\"center\" bgcolor=\"#" . $cellCol . "\"><b>" . $tmpEndDate . "<br><br>" . $tmpEndTime . "</b></td>";
else :
$apOut .= "<td width=\"90\" align=\"left\" valign=\"center\" bgcolor=\"#" . $cellCol . "\">&nbsp;</td>";
endif;
// User
if ($tmpUsrId != "") :
$apOut .= "<td width=\"150\" align=\"left\" valign=\"center\" bgcolor=\"#" . $cellCol . "\">" . $tmpUsrFirstname . "<br>" . $tmpUsrName . "</td>";
else :
$apOut .= "<td width=\"150\" align=\"left\" valign=\"center\" bgcolor=\"#" . $cellCol . "\">&nbsp;</td>";
endif;
// Participants
$apOut .= "<td width=\"150\" align=\"left\" valign=\"center\" bgcolor=\"#" . $cellCol . "\">";
if ($tmpParticipants != "") :
$tmpParticipants = spliti(",", $tmpParticipants); // It has to be an array
$tmpParticipantsLen = count($tmpParticipants);
// Needs array of users confirmed the appointment
$tmpConfirmed = spliti(",", $tmpConfirmed);
for ($k = 0; $k < $tmpParticipantsLen; $k++) :
$participantName = getOneStmt("SELECT CONCAT(usr_name,', ',usr_firstname) AS name FROM user WHERE usr_id = '" . $tmpParticipants[$k] . "'", "name");
$participantConfirmed = "[?]";
$l = array_search($tmpParticipants[$k], $tmpConfirmed);
if (!($l === FALSE)) :
$participantConfirmed = getLngt("[OK]");
else :
if ($tmpParticipants[$k] == $tmpUsrId) :
$participantConfirmed = getLngt("[OK]");
elseif ($tmpParticipants[$k] == $usr_id) : // Only the user has a link to confirm his/her own entry
// $participantConfirmed = "<a href=\"javascript:confirmAppointmentFinishPage('" . $tmpId . "');\">" . getLngt("[Bestätigen]") . "</a>";
$participantConfirmed = getLngt("[Bestätigen]");
endif;
endif;
$apOut .= $participantName . "&nbsp;" . $participantConfirmed . "<br>";
endfor;
else :
$apOut .= "&nbsp;";
endif;
$apOut .= "</td>";
// Text
$apOut .= "<td align=\"left\" valign=\"center\" bgcolor=\"#" . $cellCol . "\">" . my_nl2br($tmpText) . "</td>";
// Potential customer relation (Company name and EID)
if ($tmpCsId != "") :
$apOut .= "<td width=\"205\" align=\"left\" valign=\"center\" bgcolor=\"#" . $cellCol . "\">" . $tmpCmpComp . "<br>" . ($tmpCmpComp2 != "" ? $tmpCmpComp2 . "<br>" : "") . $tmpCsEid . "<br>";
// . "<input type=\"button\" name=\"action\" value=\"Details\" onClick=\"openCustomerSpecial('" . $tmpCmpId . "');\">"
// . "<input type=\"button\" name=\"action\" value=\"Berichte\" onClick=\"getCsHistory('" . $tmpCsEid . "');\">"
// . "<input type=\"button\" name=\"action\" value=\"Statistik\" onClick=\"openCustomerStatistics('" . $tmpCsEid . "');\">"
// . "</td>";
// elseif ($tmpPtId != "") :
// $apOut .= "<td width=\"205\" align=\"left\" valign=\"center\" bgcolor=\"#" . $cellCol . "\">" . $tmpPtCmpComp . "<br>" . ($tmpPtCmpComp2 != "" ? $tmpPtCmpComp2 . "<br>" : "") . $tmpPtCsEid . "<br>"
// . "<input type=\"button\" name=\"action\" value=\"Details\" onClick=\"openProspectSpecial('" . $tmpPtId . "');\">"
// . "<input type=\"button\" name=\"action\" value=\"Berichte\" onClick=\"getPtHistory('','" . $tmpPtCsEid . "');\">"
// . "</td>";
else :
$apOut .= "<td width=\"200\" align=\"left\" valign=\"center\" bgcolor=\"#" . $cellCol . "\">&nbsp;</td>";
endif;
$apOut .= "<td width=\"100\" align=\"left\" valign=\"center\" bgcolor=\"#" . $cellCol . "\">";
$apOut .= "&nbsp;&nbsp;<a href=\"../groupware/appointment.php?currentNavigationItem=vertrieb&f_selUsrId=" . ec($usr_id) . "&viewMode=" . ec(0) . "&selYear=" . ec($tmpExecDateYear) . "&selMonth=" . ec($tmpExecDateMonth) . "&selDay=" . ec($tmpExecDateDay) . "\">" . getLngt("[Zum Termin]") . "</a>";
$apOut .= "</td>";
// if ($j < $lenApArray - 1) : $apOut .= "</tr><tr>"; endif;
$apOut .= "</tr>";
endfor;
if (true || $lenApArray > 0) :
// Container appointments
$gridMatrix = $grid->getNextContainerPageCounter();
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "blue"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], getLngt("AKTUELLE TERMINE") . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button type=\"button\" class=\"buttonMenuUserInfo\" onClick=\"document.location.href = \'../groupware/appointment.php?currentNavigationItem=vertrieb&f_selUsrId=" . ec($usr_id) . "\';\">" . getLngt("Kalender") . "</button>", "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("font-size", "10pt", "font-weight", "normal"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], "<center></br>" . "<table>" . $apOut . "</table>" . "</center>", "bd");
endif;
endif; // SPECIAL RIGHTS FOR calendar !!!!!!!!!!!!!!!!!!!!!!!!!!!!
endif;
// A text, transmitted by ajax from client to server with "encodeURI(escape(content))" in javascript,
// stored - urldecoded in PHP - into the DB and read by PHP from the database again like here for (editable) output
function my_str_check_ajax($aStr, $nl2br_enabled = true)
{
while (strpos($aStr, "\\")) :
$aStr = str_replace("\\n", "\n", $aStr);
$aStr = str_replace("\\r", "\r", $aStr);
endwhile;
if ($nl2br_enabled) :
$aStr = str_replace("\n\r", "</br>", $aStr);
$aStr = str_replace("\r\n", "</br>", $aStr);
$aStr = str_replace("\n", "</br>", $aStr);
$aStr = str_replace("\r", "</br>", $aStr);
endif;
return $aStr;
}
// CUSTOMER NEWS, visible for headquarter and customers, editable by headquarters only regarding access rights
if ($v_usr_type == "1" || $v_usr_type == "2") :
$csGlobalInfoByHq = "";
if (existsEntry("genericdatacontainer",array("gdc_obj_type","hq2cs","gdc_obj_id",$hq_id,"gdc_gen_fieldname","global_cs_info"))) :
$csGlobalInfoByHq = getFieldValueFromClause("genericdatacontainer","gdc_content","gdc_obj_type = 'hq2cs' AND gdc_obj_id = '" . $hq_id . "' AND gdc_gen_fieldname = 'global_cs_info'");
endif;
// Check for access right to edit the text
if ($v_usr_type == "1") :
$outCsGlobalInfoByHqHeadline = getLngt("Aktuelle Infos für die Kunden");
else :
$outCsGlobalInfoByHqHeadline = getLngt("Aktuelle Informationen für Sie");
endif;
if ($v_usr_type == "1" && authCheckEmployeeRights($emp_id, "0") && authCheckEmployeeRights($emp_id, "35")) :
$outCsGlobalInfoByHqHeadline .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . "<button type=\"button\" class=\"buttonMenuUserInfo\" onClick=\"storeGdcValue(\'hq2cs\',\'global_cs_info\');\">" . getLngt("Speichern") . "</button>";
$outCsGlobalInfoByHqBody = "<center><textarea id=\"global_cs_info\" name=\"global_cs_info\" cols=\"65\" rows=\"5\" style=\"resize:vertical;\">" . my_str_check_http($csGlobalInfoByHq) . "</textarea></center>";
else :
$outCsGlobalInfoByHqBody = my_str_check_ajax($csGlobalInfoByHq);
endif;
// Container customer news
$gridMatrix = $grid->getNextContainerPageCounter();
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "green"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], $outCsGlobalInfoByHqHeadline, "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("font-size", "10pt", "font-weight", "normal", "color", "black"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], "</br>" . $outCsGlobalInfoByHqBody, "bd");
endif;
// CUSTOMER EMAIL NEWS, visible for and editable by headquarter only regarding access rights
if ($v_usr_type == "1") :
$csGlobalEmailInfoByHq = "";
if (existsEntry("genericdatacontainer",array("gdc_obj_type","hq2cs","gdc_obj_id",$hq_id,"gdc_gen_fieldname","global_cs_email_info"))) :
$csGlobalEmailInfoByHq = getFieldValueFromClause("genericdatacontainer","gdc_content","gdc_obj_type = 'hq2cs' AND gdc_obj_id = '" . $hq_id . "' AND gdc_gen_fieldname = 'global_cs_email_info'");
endif;
// Check for access right to edit the text
$outCsGlobalEmailInfoByHqHeadline = getLngt("Aktuelle Infos in den Kunden-Emails");
if (authCheckEmployeeRights($emp_id, "0") && authCheckEmployeeRights($emp_id, "35")) :
$outCsGlobalEmailInfoByHqHeadline .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . "<button type=\"button\" class=\"buttonMenuUserInfo\" onClick=\"storeGdcValue(\'hq2cs\',\'global_cs_email_info\');\">" . getLngt("Speichern") . "</button>";
$outCsGlobalEmailInfoByHqBody = "<center><textarea id=\"global_cs_email_info\" name=\"global_cs_email_info\" cols=\"65\" rows=\"5\" style=\"resize:vertical;\">" . my_str_check_http($csGlobalEmailInfoByHq) . "</textarea></center>";
else :
$outCsGlobalEmailInfoByHqBody = my_str_check_ajax($csGlobalEmailInfoByHq);
endif;
// Container customer news
$gridMatrix = $grid->getNextContainerPageCounter();
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "green"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], $outCsGlobalEmailInfoByHqHeadline, "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("font-size", "10pt", "font-weight", "normal", "color", "black"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], "</br>" . $outCsGlobalEmailInfoByHqBody, "bd");
endif;
// 2-FA-Registration
$usrTypeEnabledFor2FA = getParameterValue("0", "USERTYPE_2FA_ENABLED", "0");
$usrNoDeactivationByUserOf2FA = getParameterValue("0", "USER_2FA_NO_DEACTIVATION", "0");
$ut2FAarr = explode(",", $usrTypeEnabledFor2FA);
if ($v_usr_type == "1" && $ut2FAarr[0] || $v_usr_type == "2" && $ut2FAarr[1] || $v_usr_type == "3" && $ut2FAarr[2]) :
// Get current state of 2-FA regarding the user logged in
$usrTotpSecret = getFieldValueFromId("user", "usr_id", $usr_id, "usr_totp_secret");
$usrTotpActivated = getFieldValueFromId("user", "usr_id", $usr_id, "usr_totp_activated");
if ($usrTotpSecret == "" || $usrTotpActivated != "1") :
$outCellBody = "<b><span class=\"f10bp1_red\">" . getLngt("BITTE BEACHTEN:") . "</span></b></br></br>"
. getLngt("Hier können Sie für Ihren Benutzerzugang eine Authenticator-App zur zusätzlichen Bestätigung des Logins einrichten.") . "</br></br>"
. getLngt("Installieren Sie eine Authenticator-App auf Ihrem Smartphone, z.B. die Google Authenticator-App:") . "</br>"
. "[<a href=\"https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2\" target=\"_blank\">" . getLngt("Google Play Store") . "</a>]" . "&nbsp;&nbsp;&nbsp;&nbsp;"
. "[<a href=\"https://apps.apple.com/de/app/google-authenticator/id388497605\" target=\"_blank\">" . getLngt("Apple App Store") . "</a>]" . "</br></br>"
. "[<a href=\"javascript:open2FA();\">" . getLngt("Bitte hier klicken zur Aktivierung der Zwei-Faktor-Authentifikation") . "</a>]</br></br>";
else :
if ($v_usr_type != "1" || $usrNoDeactivationByUserOf2FA != "1") :
$outCellBody = "</br></br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>" . getLngt("Hier bitte deaktivieren:") . "</b>&nbsp;&nbsp;&nbsp;&nbsp;[<a href=\"javascript:deactivate2FA();\">" . getLngt("Deaktivierung") . "</a>]";
else :
$outCellBody = "</br></br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>" . getLngt("Für eine Deaktivierung wenden Sie sich bitte an den zuständigen Mitarbeiter!") . "</b>";
endif;
endif;
// $outCellBody = my_str_check_ajax($outCellBody);
// Check for access right to edit the text
$outCellHeadline = getLngt("Zwei-Faktor-Authentifikation");
// $outCellHeadline = my_str_check_ajax($outCellHeadline);
/*
if (authCheckEmployeeRights($emp_id, "0") && authCheckEmployeeRights($emp_id, "35")) :
$outCsGlobalEmailInfoByHqHeadline .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . "<button type=\"button\" class=\"buttonMenuUserInfo\" onClick=\"storeGdcValue(\'hq2cs\',\'global_cs_email_info\');\">" . getLngt("Speichern") . "</button>";
$outCsGlobalEmailInfoByHqBody = "<center><textarea id=\"global_cs_email_info\" name=\"global_cs_email_info\" cols=\"65\" rows=\"5\" style=\"resize:vertical;\">" . my_str_check_http($csGlobalEmailInfoByHq) . "</textarea></center>";
else :
$outCsGlobalEmailInfoByHqBody = my_str_check_ajax($csGlobalEmailInfoByHq);
endif;
*/
// 2-FA-Registration
$gridMatrix = $grid->getNextContainerPageCounter();
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("background-color", "red"), "hl");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], $outCellHeadline, "hl");
$gridJsOut .= $grid->gridSetCss($gridMatrix[0], $gridMatrix[1], array("font-size", "10pt", "font-weight", "normal", "color", "black"), "bd");
$gridJsOut .= $grid->gridSetHtml($gridMatrix[0], $gridMatrix[1], "</br>" . $outCellBody, "bd");
endif;
// Hide remaining containers without content
$gridJsOut .= $grid->gridHideRemaining();
?>
<html>
<head>
<title><?php echo $pageTitel ?></title>
<script>
//Quelle: https://msdn.microsoft.com/en-us/library/cc197053%28v=vs.85%29.aspx
window.onerror=fnErrorTrap;
function fnErrorTrap(sMsg,sUrl,sLine){
//parent.job_tour.document.tourForm.
//parent.job_options.document.tourOptions.
var tmp_jb_id = "";
if(typeof(jb_id)!='undefined')
tmp_jb_id = jb_id;
var out = '';
// if(typeof(parent.job_options.document.tourOptions) != 'undefined') {
// for (var i = 0; i <= parent.job_options.document.tourOptions.elements.length; i++) {
//// out += i + ": " + parent.job_options.document.tourOptions.elements[i].name + " = " + parent.job_options.document.tourOptions.elements[i].value + "\n";
// out += parent.job_options.document.forms[0].elements[i].value + "\n";
// }
// }
iframe = document.createElement("IFRAME");
iframe.setAttribute("src", "../include/ajaxJsError.php?url="+escape(sUrl) + "&line=" + escape(sLine) + "&message=" + escape(sMsg) + "&user_agent=" + escape(navigator.userAgent) + "&jb_id=" + tmp_jb_id + "&out=" + escape(out));
iframe.width = 1;
iframe.height = 1;
iframe.style.display = 'none';
setTimeout(function(){
document.body.appendChild(iframe);
},10);
return false;
}
//alert('test');
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="description" content="votian"> <meta name="keywords" content="votian">
<link rel="stylesheet" type="text/css" href="../css/phoenix.css">
<style type="text/css">
<?php include_once ("../css/navigation.css.php"); ?>
</style>
<style type="text/css">
<?php
if ($browserOk) :
echo $grid->getGridItemParameter("output_css");
echo "input[type=text] {width:200px; height:25px; background-image: url('../images/loupe.png'); background-repeat:no-repeat; background-position: 4px 4px; background-size: 12px 12px; padding-left: 25px;}";
endif;
?>
.bar1
{ width:100%; height:100px;
font-size:12pt; font-family:Helvetica,Arial; font-style:normal; font-weight:normal;
background:#1b12b9; color:white;
}
.bar2
{ width:100%; height:100px;
font-size:14pt; font-family:Helvetica,Arial; font-style:normal; font-weight:normal;
background:#4e45ec; color:white;
}
.bar3
{ width:100%;
font-size:10pt; font-family:Helvetica,Arial; font-style:normal; font-weight:normal;
background:#4e45ec; color:white;
}
</style>
<?php include_once ("../include/js_framework.inc.php"); ?>
<script src="../include/checkFormTags.js" type="text/javascript"></script>
<script language="JavaScript">
<!--
var searchResult = '';
var d = new Date();
d.setTime(d.getTime() + (10 * 24 * 60 * 60 * 1000));
document.cookie = "deviceIsKnown=1;expires=" + d.toUTCString() + ";path=/";
function checkStartTickerOut () {
myhide('startTickerOut');
if (max > 0) {
tickerActive = true;
myshow('startTickerOut');
ticker('startTickerOut');
}
}
function metasearchStart () {
metasearch();
<?php
if ($v_usr_type == "1") :
// echo "$('#metaSearch').focus();";
endif;
?>
}
function storeGdcValue (gdcType, elem) {
var content = $('#' + elem).val();
ajaxRequestGet('../include/ajaxReqLib.php', 'mode=500&wrap_html=1&value_01=' + gdcType + '&value_02=<?php echo ec($hq_id) ?>&value_03=' + elem + '&value_04=' + encodeURI(escape(content)) + '&value_05=');
}
// Opens a new (popup-)window with specified parameters
function popupSearch (url,title,config) {
var widthPopupWin = screen.width - 80;
var heightPopupWin = screen.height - 180;
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2);
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2);
var popup;
popup = window.open(url,title, "dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
}
function openLinkByObject (objType, objValue) {
// alert(objType + ' ' + objValue);
if (objType == 'jb') {
popupSearch('../admin/jb_detail.php?job_id=' + objValue,'','');
}
if (objType == 'cs') {
popupSearch('../admin/customer_special.php?companyId=' + objValue,'','');
}
if (objType == 'cr') {
popupSearch('../admin/courier_special.php?companyId=' + objValue,'','');
}
if (objType == 'crvh') {
popupSearch('../admin/courier_vehicle.php?courierId=' + objValue,'','');
}
}
function open2FA() {
if (confirm('<?php echo getLngt("Haben Sie Ihre Authentication-App geöffnet zum Scannen des gleich angezeigten Barcodes?") ?>')) {
var widthPopupWin = 500;
var heightPopupWin = 800;
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
var popupWin;
popupWin = window.open("../admin/GA_generateBarcode.php","","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
}
};
function deactivate2FA () {
// Reset 2-FA secret
if (confirm('<?php echo getLngt("Möchten Sie wirklich die Zwei-Faktor-Authentifikation abschalten? Der entsprechende Eintrag in Ihrer Authentication-App wäre dann sofort ungültig und sollte manuell gelöscht werden.") ?>')) {
ajaxRequestGet('../include/ajaxReqLib.php', 'mode=100&db_table=user&db_id_field=usr_id&db_op_field=usr_totp_secret&new_content=&search_value=<?php echo $usr_id ?>');
ajaxRequestGet('../include/ajaxReqLib.php', 'mode=100&db_table=user&db_id_field=usr_id&db_op_field=usr_totp_activated&new_content=0&search_value=<?php echo $usr_id ?>');
document.forms[0].submit();
}
}
function execBodyOnLoad() {
<?php
if ($browserOk) :
echo $gridJsOut;
endif;
?>
// checkStartTickerOut();
<?php
if ($browserOk && $v_usr_type == "1") :
echo "$('#metaSearch').focus();";
endif;
?>
}
<?php if ($browserOk) : ?>
$(document).keypress(function(e) {
if (e.keyCode === 13 && e.target.nodeName == 'INPUT') {
e.preventDefault(); //prevent default if it is INPUT
var focused = $(':focus');
if ($(focused).attr('id') == "metaSearch") {
metasearch();
};
}
});
<?php endif; ?>
// -->
</script>
<noscript>
<center>
<b><br>JavaScript ist nicht verf&uuml;gbar. Bitte aktivieren Sie JavaScript<br><br>
in Ihrem Browser, damit diese Seite ordnungsgem&auml;&szlig; funktioniert!</b><br><br>
</center>
</noscript>
</head>
<body leftmargin="1" topmargin="1" marginwidth="0" marginheight="0" link="#990000" vlink="#990000" alink="#990000" onLoad="<?php echo $phpCurrentNavigationOnLoad ?>execBodyOnLoad();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="maincontent" name="maincontent" id="maincontent">
<?php echo htmlDivLineSpacer("10px"); ?>
<form name="start" action="../admin/start.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="noResetUserStates" value="<?php echo ec($noResetUserStates) ?>">
<div>
<?php
if ($browserOk) :
echo $grid->getGridItemParameter("output_html");
endif;
?>
</div>
</form>
</div>
</body>
</html>

259
html/admin/traveltime.php Normal file
View File

@@ -0,0 +1,259 @@
<?php
/*=======================================================================
*
* traveltime.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/global.inc.php");
include_once ("../include/auth.inc.php");
// Check HTTP-Parameters
getSecHttpVars("1",array("f_act","mode","modeFlag","csId","opener","orderByClause","statusMessage","zipcodeFrom","zipcodeTo", "deactivateMenu"));
$pageTitel = "ANFAHRTSZEITEN";
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
authCheckEmployeeRights($emp_id, "2", "1");
// ****************************************************
// * Selection of all zipcodes in the specified range *
// ****************************************************
function mcIsSetX (&$var, $initVal = "") { if (!isset($var)) { $var = $initVal; }; return $var; };
$zipcodeArray = array();
$travelTimeArray = array();
$serviceOutput = "";
$maxEnitriesToBeDisplayed = "4000";
if ($modeFlag == "") : $modeFlag = "0"; endif; // Switch for "CLASSIC" [= 0] and "BWV" [= 1]
// Check mode for syntax check of the zipcodes
$parMaskZipcodeCheckSyntax = getParameterValue("0", "MASK_ZIP_CHK_SYNTAX_DISABLED", $hq_id);
if ($parMaskZipcodeCheckSyntax == "") :
$parMaskZipcodeCheckSyntax = getParameterValue("0", "MASK_ZIP_CHK_SYNTAX_DISABLED", "0");
endif;
if ($f_act != "" && ($zipcodeFrom == "" || $zipcodeTo == "")) :
$statusMessage = "Bitte geben Sie einen Bereich an!";
else :
if ($parMaskZipcodeCheckSyntax != "1" && $f_act != "" && (!is_numeric($zipcodeFrom) || !is_numeric($zipcodeTo))) :
$statusMessage = "Bitte geben Sie eine gültige PLZ für den Bereich an!";
else :
// Sorting of the services to be displayed
if ($orderByClause == "") : $orderByClause = "srvp.srvp_plz" ; endif;
if ($modeFlag == "1") :
// Use traveltime of table "serviceplz" (BWV mode)
$sqlquery = "SELECT srvp.srvp_id, srvp.srvp_plz, srvp.srvp_traveltime"
. " FROM serviceplz AS srvp"
. " WHERE srvp.srvp_plz >= '" . $zipcodeFrom . "' AND"
. " srvp.srvp_plz <= '" . $zipcodeTo . "' AND"
. " srvp.srvp_valid = '1' "
. " ORDER BY " . $orderByClause
. " LIMIT 0," . $maxEnitriesToBeDisplayed;
else :
// Use traveltime of table "serviceplztraveltime" (CLASSIC mode)
$sqlquery = "SELECT srvp.srvp_id, srvp.srvp_plz, srvpt.srvpt_traveltime AS srvp_traveltime"
. " FROM serviceplz AS srvp LEFT JOIN serviceplztraveltime AS srvpt ON srvp.srvp_id = srvpt.srvp_id AND srvpt.hq_id = '" . $hq_id . "'"
. " WHERE srvp.srvp_plz >= '" . $zipcodeFrom . "' AND"
. " srvp.srvp_plz <= '" . $zipcodeTo . "' AND"
. " srvp.srvp_valid = '1'"
. " ORDER BY " . $orderByClause
. " LIMIT 0," . $maxEnitriesToBeDisplayed;
endif;
// echo $sqlquery; die();
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
while ($row = $result->fetch_assoc()):
$zipcodeArray[] = $row["srvp_plz"];
$travelTimeArray[] = $row["srvp_traveltime"];
endwhile;
$result->free();
endif;
endif;
$lenZipcodeArray = count($zipcodeArray);
// *************************
// *** BEGIN STORING *******
// *************************
// Storing prices and discounts if requested
// Using the results of the statements before!!!
if ($f_act != "" && $f_act == "save") :
if ($zipcodeFrom == "" || $zipcodeTo == "") :
$statusMessage = "Bitte geben Sie einen Bereich an!";
else :
if ($parMaskZipcodeCheckSyntax != "1" && (!is_numeric($zipcodeFrom) || !is_numeric($zipcodeTo))) :
$statusMessage = "Bitte geben Sie eine gültige PLZ für den Bereich an!";
else :
// Set the current timestamp to store the data
// $currentTime = getDateTime("0");
TA("B");
for ($j = 0; $j < $lenZipcodeArray; $j++) :
// Get current input-type-text-field with minutes
list ($newValueToBeStored) = getHttpVars(array("f_". $zipcodeArray[$j]));
// Check the value to be numeric
if ($newValueToBeStored == "" || !is_numeric($newValueToBeStored)) : $newValueToBeStored = "0"; endif;
// Set default traveltime if value equals to 0
if ($newValueToBeStored == "0") : $newValueToBeStored = LATEST_TAKETIME_IN_MINUTES; endif;
// Update traveltime
if ($modeFlag == "1") :
// BWV mode
updateStmt("serviceplz", "srvp_plz", $zipcodeArray[$j], array("srvp_traveltime", $newValueToBeStored));
else :
// CLASSIC mode
$srvpId = getFieldValueFromId("serviceplz", "srvp_plz", $zipcodeArray[$j], "srvp_id");
if (existsEntry("serviceplztraveltime",array("srvp_id",$srvpId, "hq_id", $hq_id))) :
updateStmt("serviceplztraveltime", "srvp_id", $srvpId, array("srvpt_traveltime", $newValueToBeStored), "hq_id = '" . $hq_id . "'");
else :
insertStmt("serviceplztraveltime", array("srvp_id", $srvpId, "hq_id", $hq_id, "srvpt_traveltime", $newValueToBeStored));
endif;
endif;
// Override $travelTimeArray[]
$travelTimeArray[$j] = $newValueToBeStored;
endfor;
TA("C");
TA("E");
endif;
endif;
endif;
// *************************
// *** END STORING *********
// *************************
// Table-header
$serviceOutput = "<tr>\n";
$serviceOutput .= "<td>PLZ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\n";
$serviceOutput .= "<td>Zeit in Minuten</td>\n";
$serviceOutput .= "</tr>\n";
// Table-data
for ($j = 0; $j < $lenZipcodeArray; $j++) :
$serviceOutput .= "<tr>\n";
$serviceOutput .= "<td>" . $zipcodeArray[$j] . "</td>\n";
$serviceOutput .= "<td><input type=\"text\" name=\"f_" . $zipcodeArray[$j] . "\" value=\"" . $travelTimeArray[$j] . "\" size=\"4\" maxlength=\"4\" align=\"right\" onChange=\"checkIsNaN(this.value, 'Achtung: Keine PLZ')\"></td>\n";
$serviceOutput .= "</tr>\n";
endfor;
?>
<html lang="de">
<head>
<title><?php echo $pageTitel ?></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 finishPage(f_act) {
document.forms[0].f_act.value = f_act;
document.forms[0].submit();
};
-->
</script>
<noscript>
<center>
<b><br>JavaScript ist nicht verf&uuml;gbar. Bitte aktivieren Sie JavaScript<br><br>
in Ihrem Browser, damit diese Seite ordnungsgem&auml;&szlig; funktioniert!</b><br><br>
</center>
</noscript>
</head>
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>displayStatusMessage();">
<?php echo $phpMenuOut ?>
<?php echo $phpReducedMenuOut ?>
<?php echo $phpPageTitelOut ?>
<div class="mc_page-header">
<?php echo getLngt("PLZ-Bereich") ?>
</div>
<div class="maincontent mc_elem" name="maincontent" id="maincontent">
<form action="../admin/traveltime.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="mode" value="<?php echo ec($mode) ?>">
<input type="hidden" name="orderByClause" value="<?php echo $orderByClause ?>">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<?php echo htmlDivLineSpacer("20px"); ?>
<div>
<input class="f10np1" type="radio" name="modeFlag" value="0" <?php echo ($modeFlag == "0" ? "checked" : "") ?>> <?php echo getLngt("CLASSIC") ?>
<input class="f10np1" type="radio" name="modeFlag" value="1" <?php echo ($modeFlag == "1" ? "checked" : "") ?>> <?php echo getLngt("BWV") ?>
</div>
<?php echo htmlDivLineSpacer("30px"); ?>
<div>
<div <?php echo setStyleHtmlDiv("100px","left"); ?>>VON:</div>
<div>
<input type="text" name="zipcodeFrom" value="<?php echo $zipcodeFrom ?>" size="6">
</div>
</div>
<?php echo htmlDivLineSpacer("5px"); ?>
<div>
<div <?php echo setStyleHtmlDiv("100px","left"); ?>>BIS:</div>
<div>
<input type="text" name="zipcodeTo" value="<?php echo $zipcodeTo ?>" size="6">
</div>
</div>
<?php echo htmlDivLineSpacer("10px", "", "left"); ?>
<?php echo defineButtonType10("Liste&nbsp;zusammenstellen", "action_list", "finishPage('showlist');", "170", "left", "5"); ?>
<?php echo defineButtonType10("Speichern", "action_list", "finishPage('save');", "100", "left"); ?>
<?php echo htmlDivLineSpacer("30px", "", "left"); ?>
<div>
Anzahl gefundener Bereiche: <?php echo $lenZipcodeArray ?><br><br>(Max. Anzeige z.Z. eingestellt: <?php echo $maxEnitriesToBeDisplayed ?>)
</div>
<?php echo htmlDivLineSpacer("30px"); ?>
<div>
<table align="left" cellspacing="0" cellpadding="0" vspace="0" hspace="0">
<?php echo $serviceOutput ?>
</table>
</div>
</form>
</div>
</body>
</html>

1028
html/admin/user_list.php Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,510 @@
<?php
/*=======================================================================
*
* vehicle_customer.php
*
* Autor: Marc Vollmann
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/auth.inc.php");
// include_once ("../include/html.inc.php");
$httpVarsArray = array("f_act", "crvhId", "orderClause", "statusMessage", "f_crvh_id", "f_csvh_day_times", "csIdUpdate",
"f_relationStatus", "f_del_customer_id", "g_cs_id", "f_csvh_description_new", "deactivateMenu");
getSecHttpVars("1", $httpVarsArray);
getLanguage(__FILE__);
$deactivateMenuStatic = "1";
$pageTitel = getLngt("BEZIEHUNG FAHRZEUG-KUNDE");
include_once ("../admin/menu.php");
include_once ("../include/html.inc.php");
include_once ("../include/inc_vehicle.inc.php");
getCurrentScript(__FILE__);
// Check for authentication access and granted rights
$usrAccessArray["hq"] = "1";
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
authCheckEmployeeRights($emp_id, "1", "1");
// Initializations
if ($f_relationStatus == "") : $f_relationStatus = "0"; endif; // 0 = bad relation between cs and cr (blocked), 1 = good relation (favoured)
$f_csvh_description_new = trim($f_csvh_description_new); // Description related to an association between customer and courier
$f_actText = "";
// Only for output
$htmlClass01 = "class=\"smaller\""; // input,select
$html_td_01 = "valign=\"top\" align=\"left\""; // input
$html_td_02 = "valign=\"top\" align=\"right\""; // input
// Get array of weekdays (default, no mt_objtype and no mt_objid)
$weekDays = getColVectorFromDB2ArrayByClause("metatype", "mt_sort", "mt_type = 'cal_week_days' AND mt_objtype = '' AND mt_objid = '0'", "", "mt_sort", "");
$weekDayNames = getColVectorFromDB2ArrayByClause("metatype", "mt_value", "mt_type = 'cal_week_days' AND mt_objtype = '' AND mt_objid = '0'", "", "mt_sort", "");
$weekDaysLen = count($weekDays);
// Get array of day times (default, no mt_objtype and no mt_objid)
$dayTimes = getColVectorFromDB2ArrayByClause("metatype", "mt_sort", "mt_type = 'day_time' AND mt_objtype = '' AND mt_objid = '0'", "", "mt_sort", "");
$dayTimeNames = getColVectorFromDB2ArrayByClause("metatype", "mt_value", "mt_type = 'day_time' AND mt_objtype = '' AND mt_objid = '0'", "", "mt_sort", "");
$dayTimesLen = count($dayTimes);
// **************************************
// * Operations for the vehiclecustomer *
// **************************************
// Insert new vehiclecustomer
if ($f_act == "newVehicleCustomer" && $crvhId != "" && $g_cs_id != "") :
if (!existsEntry("customervehicle",array("cs_id",$g_cs_id,"crvh_id",$crvhId))) :
TA("B");
// Get max sort value of favoured customers and increment
$maxSortValue = 0;
if ($f_relationStatus == "1") :
$maxSortValue = getMaxOfField("customervehicle", "csvh_sort", "cs_id = '" . $g_cs_id . "' AND csvh_relation = '1' ");
if ($maxSortValue != "" && is_numeric($maxSortValue)) :
$maxSortValue++;
else :
$maxSortValue = 1;
endif;
endif;
// Insert customervehicle
insertStmt("customervehicle", array("cs_id",$g_cs_id,"crvh_id",$crvhId,"csvh_relation",$f_relationStatus,"csvh_sort",$maxSortValue,"csvh_description",$f_csvh_description_new));
// Insert parameter "FDS_CUSTOMER_ENABLED_<CS>" if does not exist
if (!existsEntry("parameter",array("par_key", "FDS_CUSTOMER_ENABLED_CS_" . $g_cs_id))) :
insertStmt("parameter", array("par_key", "FDS_CUSTOMER_ENABLED_CS_" . $g_cs_id, "par_value", "1"));
endif;
// Generate new vehicle in the "Fast Disposition Structure" or update (renew) if it does exist
// generateVehicleFastDispositionStructure($crvhId, "2", $g_cs_id);
// Write logdata into log database
$tmpFields = getFieldsValueFromId("couriervehicle", "crvh_id", $crvhId, array("cr_id","crvh_sid"));
writeToLogDB("126",$hq_id,"",$usr_id,$tmpFields[0],$tmpFields[1],$g_cs_id,"");
TA("C");
TA("E");
// $cmd = "php ../tools/setFDSVehicleAvailability_HTG.php tornado";
// system($cmd . " > /dev/null &");
$cmd = "php ../tools/setFDSVehicleAvailability_HTG.php tornado " . $crvhId . " &";
$cmdOutput = null;
exec($cmd, $cmdOutput);
else :
$statusMessage = getLngt("Es existiert schon ein Eintrag zwischen dem Fahrzeug und diesem Kunden!");
endif;
endif;
// Compute week day and day times string
if ($f_act == "updateVehicleCustomer" && $crvhId != "" && $csIdUpdate != "") :
// Overwrite array of day times if does exist for this special customer
if (existsEntry("metatype",array("mt_type", "day_time", "mt_objtype", "cs", "mt_objid", $csIdUpdate))) :
$dayTimes = getColVectorFromDB2ArrayByClause("metatype", "mt_sort", "mt_type = 'day_time' AND mt_objtype = 'cs' AND mt_objid = '" . $csIdUpdate . "'", "", "mt_sort", "");
$dayTimeNames = getColVectorFromDB2ArrayByClause("metatype", "mt_value", "mt_type = 'day_time' AND mt_objtype = 'cs' AND mt_objid = '" . $csIdUpdate . "'", "", "mt_sort", "");
$dayTimesLen = count($dayTimes);
endif;
/*
// For displaying checkboxes only
$activatedWeekDays = "";
if (is_array($f_csvh_day_times)) :
$f_csvh_day_times_len = count($f_csvh_day_times); // Values from the checkboxes
if ($f_csvh_day_times_len > 0) :
$weekDayArray = array();
for ($i = 0; $i < $f_csvh_day_times_len; $i++) :
$tmpArray = spliti("_", $f_csvh_day_times[$i]); // [0] = cs_id, [1] = weekday, [2] = day time
if ($tmpArray[0] == $csIdUpdate) :
if ($weekDayArray[$tmpArray[1]] == "") :
$weekDayArray[$tmpArray[1]] = $tmpArray[1] . "=" . $tmpArray[2];
else :
$weekDayArray[$tmpArray[1]] .= "," . $tmpArray[2];
endif;
endif;
endfor;
$activatedWeekDays = implode("|", $weekDayArray);
endif;
endif;
*/
$activatedWeekDays = "";
$weekDayArray = array();
for ($k = 0; $k < $dayTimesLen; $k++) :
for ($l = 0; $l < $weekDaysLen; $l++) :
list($selVal) = getSecHttpVars("1", array("f_csvh_day_times_zone_" . $csIdUpdate . "_" . $weekDays[$l] . "_" . $dayTimes[$k]));
if ($selVal != "") :
if ($weekDayArray[$weekDays[$l]] == "") :
$weekDayArray[$weekDays[$l]] = $weekDays[$l] . "=" . $dayTimes[$k] . "-" . $selVal;
else :
$weekDayArray[$weekDays[$l]] .= "," . $dayTimes[$k] . "-" . $selVal;
endif;
endif;
endfor;
endfor;
$activatedWeekDays = implode("|", $weekDayArray);
// Insert customervehicle
updateStmt("customervehicle", "crvh_id", $crvhId, array("csvh_day_times", $activatedWeekDays), "cs_id = '" . $csIdUpdate . "'");
// Insert parameter "FDS_CUSTOMER_ENABLED_<CS>" if does not exist
if (!existsEntry("parameter",array("par_key", "FDS_CUSTOMER_ENABLED_CS_" . $csIdUpdate))) :
insertStmt("parameter", array("par_key", "FDS_CUSTOMER_ENABLED_CS_" . $csIdUpdate, "par_value", "1"));
endif;
// Update vehicle in the "Fast Disposition Structure"
// generateVehicleFastDispositionStructure($crvhId, "2", $csIdUpdate);
// Write logdata into log database
$tmpFields = getFieldsValueFromId("couriervehicle", "crvh_id", $crvhId, array("cr_id","crvh_sid"));
writeToLogDB("128",$hq_id,"",$usr_id,$tmpFields[0],$tmpFields[1],$csIdUpdate,"");
// $cmd = "php ../tools/setFDSVehicleAvailability_HTG.php tornado";
// system($cmd . " > /dev/null &");
$cmd = "php ../tools/setFDSVehicleAvailability_HTG.php tornado " . $crvhId . " &";
$cmdOutput = null;
exec($cmd, $cmdOutput);
endif;
// Remove vehiclecustomer
if ($f_act == "removeVehicleCustomer" && $crvhId != "") :
TA("B");
// Entries to be deleted?
$fieldsLength = count($f_del_customer_id);
if ($fieldsLength > 0 && $f_del_customer_id[0] != "") :
for ($i = 0; $i < $fieldsLength; $i++) :
deleteStmt("customervehicle","crvh_id = " . $crvhId . " AND cs_id = " . $f_del_customer_id[$i]);
// Resort the sort value of the favoured couriers of the customer
$sqlquery = "SELECT cs_id, crvh_id FROM customervehicle WHERE cs_id = " . $f_del_customer_id[$i] . " AND csvh_relation = '1' ORDER BY csvh_sort";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
$sortCounter = 1;
while ($row = $result->fetch_assoc()):
$tmpCsId = $row["cs_id"];
$tmpCrvhId = $row["crvh_id"];
updateStmt("customervehicle", "cs_id", $tmpCsId, array("csvh_sort", $sortCounter),"crvh_id = '" . $tmpCrvhId . "' AND csvh_relation = '1'");
$sortCounter++;
endwhile;
$result->free();
// Remove vehicle from the "Fast Disposition Structure" for a special customer only
generateVehicleFastDispositionStructure($crvhId, "0", $f_del_customer_id[$i]);
// Remove jobs of this vehicle for the selected customer from FDS
$vhdJbIdsToRemoveArray = getColVectorFromDB2ArrayByClause("vehicledisposition AS vhd, job AS jb, costcenter AS csc", "vhd.jb_id", "vhd.crvh_id = '" . $crvhId . "' AND vhd.jb_id = jb.jb_id AND jb.csc_id_related = csc.csc_id AND csc.cs_id = '" . $f_del_customer_id[$i] . "'", "", "", "DISTINCT");
$vhdJbIdsToRemoveArrayLen = count($vhdJbIdsToRemoveArray);
if ($vhdJbIdsToRemoveArrayLen > 0) :
updateStmt("vehicledisposition", "", "", array("jb_id", "0"), "jb_id IN (" . implode(",", $vhdJbIdsToRemoveArray) . ")");
endif;
// Write logdata into log database
$tmpFields = getFieldsValueFromId("couriervehicle", "crvh_id", $crvhId, array("cr_id","crvh_sid"));
writeToLogDB("127",$hq_id,"",$usr_id,$tmpFields[0],$tmpFields[1],$f_del_customer_id[$i],"");
endfor;
else :
$statusMessage = getLngt("Bitte markieren Sie zu löschende Verbindungen durch anklicken der jeweiligen Checkbox hinter dem Eintrag!");
endif;
TA("C");
TA("E");
endif;
// ***************************************************************************
// * Get the vehicle-customer relations of a specified courier for selection *
// ***************************************************************************
$count = 0;
if ($crvhId != "") :
$sqlquery = getStmtCustomerVehicleRelation($crvhId, "");
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
while ($row = $result->fetch_assoc()):
$f_cmp_comp[$count] = $row["cmp_comp"];
$f_cmp_comp2[$count] = $row["cmp_comp2"];
$f_cs_id[$count] = $row["cs_id"];
$f_cs_eid[$count] = $row["cs_eid"];
$f_cs_hq_id[$count] = $row["hq_id"];
$f_csvh_relation[$count] = $row["csvh_relation"];
$f_csvh_day_times[$count] = $row["csvh_day_times"];
$f_csvh_description[$count] = $row["csvh_description"];
$count++;
endwhile;
$result->free();
endif;
// Only for output
$tmpFields = getFieldsValueFromId("couriervehicle", "crvh_id", $crvhId, array("cr_id","crvh_sid"));
$tmp_cr_id = $tmpFields[0];
$tmp_crvh_sid = $tmpFields[1];
$tmp_usr_id = getFieldValueFromId("courier", "cr_id", $tmp_cr_id, "usr_id");
$tmpFields = getFieldsValueFromId("user","usr_id",$tmp_usr_id,array("usr_name","usr_firstname"));
$tmp_usr_name = $tmpFields[0];
$tmp_usr_firstname = $tmpFields[1];
$title = getLngt("Einsatzmodalitäten bei Kunden von Fahrzeug:") . "&nbsp;&nbsp;" . $tmp_crvh_sid . "&nbsp;[" . $tmp_usr_firstname . " " . $tmp_usr_name . "]";
// Output of the existing relations of the current selected area
$customerOutput = "";
for ($j = 0; $j < $count; $j++) :
// Overwrite array of day times if does exist for this special customer
if (existsEntry("metatype",array("mt_type", "day_time", "mt_objtype", "cs", "mt_objid", $f_cs_id[$j]))) :
$dayTimes = getColVectorFromDB2ArrayByClause("metatype", "mt_sort", "mt_type = 'day_time' AND mt_objtype = 'cs' AND mt_objid = '" . $f_cs_id[$j] . "'", "", "mt_sort", "");
$dayTimeNames = getColVectorFromDB2ArrayByClause("metatype", "mt_value", "mt_type = 'day_time' AND mt_objtype = 'cs' AND mt_objid = '" . $f_cs_id[$j] . "'", "", "mt_sort", "");
else :
$dayTimes = getColVectorFromDB2ArrayByClause("metatype", "mt_sort", "mt_type = 'day_time' AND mt_objtype = '' AND mt_objid = '0'", "", "mt_sort", "");
$dayTimeNames = getColVectorFromDB2ArrayByClause("metatype", "mt_value", "mt_type = 'day_time' AND mt_objtype = '' AND mt_objid = '0'", "", "mt_sort", "");
endif;
$dayTimesLen = count($dayTimes);
$customerOutput .= $f_cmp_comp[$j] . "<br>";
if ($f_cmp_comp2[$j] != "") : $customerOutput .= $f_cmp_comp2[$j] . "<br>"; endif;
$customerOutput .= $f_cs_eid[$j] . "&nbsp;&nbsp;";
$imgName = "circle_red.jpg";
if ($f_csvh_relation[$j] == "1") : $imgName = "circle_green.jpg"; endif;
$customerOutput .= "<img src=\"../images/" . $imgName . "\" border=\"0\" height=\"10\" width=\"25\">&nbsp;&nbsp;";
$customerOutput .= "<input type=\"checkbox\" name=\"f_del_customer_id[]\" value=\"" . $f_cs_id[$j] . "\"><br>";
$customerOutput .= $f_csvh_description[$j];
$customerOutput .= "<br>\n";
// Get day time values to be checked for the current customer regarding the current vehicle
$dayTimesArrayOfTheWeek = getKeyValueArrayFromString($f_csvh_day_times[$j], "|", "=");
$customerOutput .= "<table>\n";
// Table header with names of the weekdays
$customerOutput .= "<tr>\n";
$customerOutput .= "<td>" . "&nbsp;" . "</td>\n";
for ($l = 0; $l < $weekDaysLen; $l++) :
$customerOutput .= "<td>" . $weekDayNames[$l] . "</td>\n";
endfor;
// Table body
$customerOutput .= "</tr>\n";
for ($k = 0; $k < $dayTimesLen; $k++) :
$customerOutput .= "<tr>\n";
$customerOutput .= "<td>" . $dayTimeNames[$k] . "</td>\n";
for ($l = 0; $l < $weekDaysLen; $l++) :
$tmpDayTimes = $dayTimesArrayOfTheWeek[$l + 1];
$tmpDayTimesArray = spliti(",", $tmpDayTimes);
/*
// For displaying checkboxes only
$tmpChecked = "";
if (!(array_search($dayTimes[$k], $tmpDayTimesArray) === FALSE)) :
$tmpChecked = "checked";
endif;
$customerOutput .= "<td>" . "<input type=\"checkbox\" name=\"f_csvh_day_times[]\" value=\"" . $f_cs_id[$j] . "_" . $weekDays[$l] . "_" . $dayTimes[$k] . "\" " . $tmpChecked . ">" . "</td>\n";
*/
// Select special zone for each day time of each week day
$tmpSelectedValue = "";
$tmpDayTimesArrayLen = count($tmpDayTimesArray);
for ($m = 0; $m < $tmpDayTimesArrayLen; $m++) :
$tmp2 = spliti("-", $tmpDayTimesArray[$m]);
if ($tmp2[0] == $dayTimes[$k]) :
$tmpSelectedValue = $tmp2[1];
endif;
endfor;
$customerOutput .= "<td>\n";
$customerOutput .= " <select class=\"f7np1\" name=\"f_csvh_day_times_zone_" . $f_cs_id[$j] . "_" . $weekDays[$l] . "_" . $dayTimes[$k] . "\">";
$customerOutput .= " <option value=\"\" " . ($tmpSelectedValue == "" ? "selected" : "") . ">" . getLngt("Alle Zonen") . "</option>";
$customerOutput .= " <option value=\"9999\" " . ($tmpSelectedValue == "9999" ? "selected" : "") . ">" . getLngt("Nicht aktiv") . "</option>";
$customerOutput .= addOptionsFromTable("servicezone", "srvz_no", "srvz_name", "srvz_no", "hq_id = '" . $f_cs_hq_id[$j] . "' AND cs_id = '" . $f_cs_id[$j] . "'", $tmpSelectedValue , "");
$customerOutput .= " </select>";
$customerOutput .= "</td>\n";
endfor;
$customerOutput .= "</tr>\n";
endfor;
$customerOutput .= "</table>\n";
$customerOutput .= defineButtonType08(getLngt("Konfiguration&nbsp;speichern"), "action_update", "finishPage('updateVehicleCustomer', '" . $f_cs_id[$j] . "');", "240");
$customerOutput .= "<br><br>\n";
endfor;
// Button to remove associations between courier and customer(s). Only show if at least one customer is associated to the current area.
if ($count > 0) :
$customerOutput .= "<br>\n";
$customerOutput .= defineButtonType10(getLngt("Markierte&nbsp;Verknüpfungen&nbsp;entfernen"), "action_remove", "finishPage('removeVehicleCustomer', '');", "240");
$customerOutput .= "<br><br>\n";
endif;
if ($customerOutput == "") :
$customerOutput = getLngt("Zur Zeit sind keine Verknüpfungen eingetragen!");
endif;
?>
<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 finishPage(mode, csId) {
var ok = true;
if (mode == 'newVehicleCustomer') {
if (document.forms[0].g_cs_id.value != '') {
document.forms[0].f_act.value = mode;
document.forms[0].submit();
} else {
alert('<?php echo getLngt("Wählen Sie bitte einen Kunden aus!") ?>');
}
}
if (mode == 'removeVehicleCustomer') {
if (confirm('<?php echo getLngt("Möchten Sie die bestehende(n) Beziehung(en) wirklich löschen?") ?>')) {
if (confirm('<?php echo getLngt("ACHTUNG: Alle Aufträge in der Disposition werden vom Fahrzeug entfernt und müssen neu disponiert werden!") ?>')) {
document.forms[0].f_act.value = mode;
document.forms[0].submit();
}
}
}
if (mode == 'updateVehicleCustomer') {
if (confirm('<?php echo getLngt("Möchten Sie die Wochentage und Tageszeiten des Kunden speichern?") ?>')) {
document.forms[0].f_act.value = mode;
document.forms[0].csIdUpdate.value = csId;
document.forms[0].submit();
}
}
};
function searchCsCsc() {
var f_act = 'search';
var widthPopupWin = 950;
var heightPopupWin = 600;
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
var popupWin;
popupWin = window.open("../admin/cs_csc_list.php?f_act=" + f_act + "&generic=100111111000",
"","dependent=yes,width=" + widthPopupWin + ",height=" +
heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin +
",scrollbars=yes");
};
-->
</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="../admin/vehicle_customer.php" method="post">
<input type="hidden" name="f_act" value="">
<input type="hidden" name="crvhId" value="<?php echo ec($crvhId) ?>">
<input type="hidden" name="g_cs_id" value="">
<input type="hidden" name="csIdUpdate" value="">
<?php echo $phpCurrentNavigationInputHidden ?>
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
<?php echo htmlDivLineSpacer("10px"); ?>
<div class="f12bp1_blue">
<?php echo $title ?>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<div class="f10bp1">
<?php echo getLngt("Kunden:") ?>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<div class="f10bp1">
<?php echo $customerOutput; ?>
</div>
<?php echo htmlDivLineSpacer("15px"); ?>
<?php echo defineButtonType10(getLngt("Kunde&nbsp;suchen"), "action_search", "searchCsCsc();", "100"); ?>
<?php echo htmlDivLineSpacer("15px"); ?>
<div>
<div <?php echo setStyleHtmlDiv("100px","left"); ?>><?php echo getLngt("Firma:") ?></div>
<div>
<input type="text" name="g_cscad_comp" value="" size="36" disabled >
</div>
</div>
<?php echo htmlDivLineSpacer("5px"); ?>
<div>
<div <?php echo setStyleHtmlDiv("100px","left"); ?>>&nbsp;</div>
<div>
<input type="text" name="g_cscad_comp2" value="" size="36" disabled >
</div>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<div>
<div <?php echo setStyleHtmlDiv("100px","left"); ?>><?php echo getLngt("Adresse:") ?></div>
<div>
<input type="text" name="g_ad_street" value="" size="30" disabled >&nbsp;
<input type="text" name="g_cscad_hsno" value="" size="5" disabled >
</div>
</div>
<?php echo htmlDivLineSpacer("5px"); ?>
<div>
<div <?php echo setStyleHtmlDiv("100px","left"); ?>>&nbsp;</div>
<div>
<input type="text" name="g_ad_zipcode" value="" size="5" disabled >&nbsp;
<input type="text" name="g_ad_city" value="" size="30" disabled >
</div>
</div>
<?php echo htmlDivLineSpacer("10px"); ?>
<div>
<div <?php echo setStyleHtmlDiv("100px","left"); ?>><?php echo getLngt("Bemerkung:") ?></div>
<div>
<input type="text" name="f_csvh_description_new" value="" size="50" maxlength="255">
</div>
</div>
<?php echo htmlDivLineSpacer("15px"); ?>
<div>
<div>
<input type="radio" <?php echo $htmlClass01 ?> name="f_relationStatus" value="0"> <?php echo getLngt("Gesperrt") ?><br>
<input type="radio" <?php echo $htmlClass01 ?> name="f_relationStatus" value="1" checked> <?php echo getLngt("Freigegeben") ?><br>
<br>
</div>
<?php echo defineButtonType10(getLngt("Kunde&nbsp;dem&nbsp;Fahrzeug&nbsp;zuordnen"), "action_assoc", "document.forms[0].f_act.value='" . ec($f_actText) . "';finishPage('newVehicleCustomer', '');", "230"); ?>
<?php echo htmlDivLineSpacer("50px"); ?>
<?php echo defineButtonType10(getLngt("Schließen"), "action_close", "window.close();", "80", "left", "3"); ?>
</div>
</form>
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff