220 lines
7.7 KiB
PHP
220 lines
7.7 KiB
PHP
<?php
|
|
/*=======================================================================
|
|
*
|
|
* atg_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", "f_atg_key", "f_atg_name", "f_hq_visibility", "deactivateMenu"));
|
|
|
|
getLanguage(__FILE__);
|
|
|
|
$deactivateMenuStatic = "1";
|
|
$pageTitel = "SPEZIELLE ARTIKELGRUPPE";
|
|
include_once ("../admin/menu.php");
|
|
include_once ("../include/html.inc.php");
|
|
getCurrentScript(__FILE__);
|
|
|
|
$usrAccessArray["hq"] = "1";
|
|
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
|
|
if (!(authCheckEmployeeRights($emp_id, "14") || authCheckEmployeeRights($emp_id, "7"))) : gotoReferer("1"); endif;
|
|
|
|
|
|
// Initialize value
|
|
if ($generic == "") : $generic = "1111"; endif;
|
|
$f_atg_key = trim($f_atg_key);
|
|
$f_atg_name = trim($f_atg_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 ($f_act == "saveAtGroupNew") :
|
|
if ($f_atg_key != "" && $f_atg_name != "") :
|
|
if (!existsEntry("articlegroup",array("md_id", $md_id, "atg_key", $f_atg_key))) :
|
|
|
|
insertStmt("articlegroup", array("md_id", $md_id, "atg_key", $f_atg_key, "atg_name", $f_atg_name, "hq_id", $hqIdToBeStored));
|
|
|
|
$f_atg_key = "";
|
|
$f_atg_name = "";
|
|
else :
|
|
$statusMessage = getLngt("Der eingegebene Schlüssel existiert schon!");
|
|
endif;
|
|
else :
|
|
$statusMessage = getLngt("Geben Sie bitte einen Schlüssel und eine Artikelbezeichnung ein!");
|
|
endif;
|
|
endif;
|
|
if ($f_act == "saveAtGroupModified") :
|
|
if ($f_atg_key != "" && $f_atg_name != "") :
|
|
if (existsEntry("articlegroup",array("md_id", $md_id, "atg_key", $f_atg_key))) :
|
|
|
|
updateStmt("articlegroup", "atg_key", $f_atg_key, array("atg_name", $f_atg_name, "hq_id", $hqIdToBeStored), "md_id = '" . $md_id . "'");
|
|
|
|
$f_atg_key = "";
|
|
$f_atg_name = "";
|
|
else :
|
|
$statusMessage = getLngt("Der eingegebene Schlüssel existiert nicht!");
|
|
endif;
|
|
else :
|
|
$statusMessage = getLngt("Geben Sie bitte einen Schlüssel und eine Artikelbezeichnung ein!");
|
|
endif;
|
|
endif;
|
|
|
|
|
|
// Statement for article groups
|
|
$sqlquery = "SELECT atg.atg_id, atg.hq_id, hq.hq_mnemonic, atg.atg_key, atg.atg_name"
|
|
. " FROM articlegroup AS atg LEFT JOIN headquarters AS hq ON atg.hq_id = hq.hq_id"
|
|
. " WHERE atg.md_id = '" . $md_id . "' AND (atg.hq_id = '0' OR atg.hq_id = '" . $hq_id . "')"
|
|
. " ORDER BY atg.hq_id, atg.atg_key";
|
|
|
|
$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("Zentrale") . "</td><td align=\"center\">" . getLngt("Schlüssel") . "</td><td align=\"center\">" . getLngt("Artikelgruppe") . "</td><td align=\"center\">" . getLngt("Bearbeiten") . "</td></tr>";
|
|
while ($row = $result->fetch_assoc()):
|
|
$numOfRows++;
|
|
|
|
if ($lineToggler == 0) : $lineToggler = 1; else : $lineToggler = 0; endif;
|
|
$cellColor = getListColor($numOfRows, $lineToggler);
|
|
|
|
$tableOfRows .= "<tr>";
|
|
if ($row["hq_id"] == "0") :
|
|
$tableOfRows .= "<td align=\"left\" bgcolor=\"" . $cellColor ."\"> " . getLngt("Alle") . "</td>";
|
|
else :
|
|
$tableOfRows .= "<td align=\"left\" bgcolor=\"" . $cellColor ."\"> " . $row["hq_mnemonic"] . "</td>";
|
|
endif;
|
|
$tableOfRows .= "<td align=\"center\" bgcolor=\"" . $cellColor ."\"> <a href=\"javascript:finishPage('" . $row["atg_id"] . "','" . $row["atg_key"] . "','" . $row["atg_name"] . "');\">" . $row["atg_key"] . "</a></td>";
|
|
$tableOfRows .= "<td align=\"left\" bgcolor=\"" . $cellColor ."\"> " . $row["atg_name"] . "</td>";
|
|
$tableOfRows .= "<td align=\"center\" bgcolor=\"" . $cellColor ."\"> <a href=\"javascript:editAtg('" . $row["atg_key"] . "','" . $row["atg_name"] . "','" . $row["hq_id"] . "');\"><img src=\"../images/arrow_right.png\" border=\"0\" height=\"10\" width=\"25\"></a></td>";
|
|
$tableOfRows .= "</tr>";
|
|
endwhile;
|
|
$result->free();
|
|
|
|
?>
|
|
|
|
<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(atg_id,atg_key,atg_name) {
|
|
|
|
<?php if (substr($generic, 0,1) == "1") : ?> opener.document.forms[0].g_atg_id.value = atg_id; <?php endif; ?>
|
|
<?php if (substr($generic, 1,1) == "1") : ?> opener.document.forms[0].g_atg_key.value = atg_key; <?php endif; ?>
|
|
<?php if (substr($generic, 2,1) == "1") : ?> opener.document.forms[0].g_atg_name.value = atg_name; <?php endif; ?>
|
|
self.close();
|
|
};
|
|
|
|
function finishPage2(f_act) {
|
|
document.forms[0].f_act.value = f_act;
|
|
document.forms[0].submit();
|
|
};
|
|
|
|
function editAtg(atg_key, atg_name, hq_id) {
|
|
document.forms[0].f_atg_key.value = atg_key;
|
|
document.forms[0].f_atg_name.value = atg_name;
|
|
if (hq_id == '0') {
|
|
document.getElementsByName('f_hq_visibility[]')[0].checked = true;
|
|
} else {
|
|
document.getElementsByName('f_hq_visibility[]')[0].checked = false;
|
|
}
|
|
};
|
|
-->
|
|
</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="../stock/atg_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) ?>">
|
|
|
|
<?php echo htmlDivLineSpacer("10px"); ?>
|
|
|
|
<div class="f10bp1_blue">
|
|
<?php echo $pageTitel ?>
|
|
</div>
|
|
<?php echo htmlDivLineSpacer("20px"); ?>
|
|
|
|
<div>
|
|
<table class="f8np1" border="0" cellpadding="0">
|
|
<?php echo $tableOfRows ?>
|
|
</table>
|
|
</div>
|
|
<?php echo htmlDivLineSpacer("20px"); ?>
|
|
|
|
<div>
|
|
<?php echo getLngt("(Neue) Artikelgruppe:") ?>
|
|
</div>
|
|
<?php echo htmlDivLineSpacer("10px"); ?>
|
|
|
|
<div>
|
|
<div <?php echo setStyleHtmlDiv("200px","left"); ?>><?php echo getLngt("Schlüssel:") ?></div>
|
|
<div>
|
|
<input type="text" name="f_atg_key" value="<?php echo $f_atg_key ?>" maxlength="10" size="10">
|
|
</div>
|
|
</div>
|
|
<?php echo htmlDivLineSpacer("5px"); ?>
|
|
<div>
|
|
<div <?php echo setStyleHtmlDiv("200px","left"); ?>><?php echo getLngt("Bezeichnung:") ?></div>
|
|
<div>
|
|
<input type="text" name="f_atg_name" value="<?php echo $f_atg_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 defineButtonType08(getLngt("Hinzufügen"), "action_new", "finishPage2('saveAtGroupNew');", "90", "left", "3"); ?>
|
|
<?php echo defineButtonType08(getLngt("Überschreiben"), "action_reset", "finishPage2('saveAtGroupModified');", "90", "left", "3"); ?>
|
|
<?php echo defineButtonType08(getLngt("Schließen"), "action_close", "window.close();", "90", "left", "3"); ?>
|
|
</div>
|
|
|
|
</form>
|
|
</div>
|
|
</body>
|
|
|
|
</html>
|