mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-14 20:17:14 +01:00
Compare commits
3 Commits
2ffee66e00
...
49c934ede4
Author | SHA1 | Date | |
---|---|---|---|
|
49c934ede4 | ||
|
61047af440 | ||
|
cb8b2487d7 |
@ -17,6 +17,8 @@
|
||||
* PLACEHOLDER_GET_INPUT
|
||||
* PLACEHOLDER_SET_INPUT
|
||||
* PLACEHOLDER_COLUMNS
|
||||
* PLACEHOLDER_ID_COLUMN
|
||||
* PLACEHOLDER_HEADERS
|
||||
* PLACEHOLDER_SET_TPL
|
||||
*/
|
||||
|
||||
@ -164,6 +166,7 @@ if ($argc >= 2) {
|
||||
// Create php file
|
||||
|
||||
$list_of_columns = implode(', ', $columns);
|
||||
$list_of_columns_headers_in_quotes = "'" . implode('\', \'', array_map('ucfirst',$columns)) . "'";
|
||||
$list_of_columns_in_quotes = "'" . implode('\', \'', $columns) . "'";
|
||||
$sql_list_of_columns = implode(', ', $sql_columns);
|
||||
$sql_list_of_columns_in_quotes = "'" . implode('\', \'', $sql_columns) . "'";
|
||||
@ -194,6 +197,8 @@ if ($argc >= 2) {
|
||||
$php_file_contents = str_replace('PLACEHOLDER_GET_INPUT', $get_input, $php_file_contents);
|
||||
$php_file_contents = str_replace('PLACEHOLDER_SET_INPUT', $set_input, $php_file_contents);
|
||||
$php_file_contents = str_replace('PLACEHOLDER_COLUMNS', $list_of_columns_in_quotes, $php_file_contents);
|
||||
$php_file_contents = str_replace('PLACEHOLDER_ID_COLUMN', $table_short_name.".id", $php_file_contents);
|
||||
$php_file_contents = str_replace('PLACEHOLDER_HEADERS', $list_of_columns_headers_in_quotes, $php_file_contents);
|
||||
$php_file_contents = str_replace('PLACEHOLDER_SQL_COLUMNS', $sql_list_of_columns_in_quotes, $php_file_contents);
|
||||
|
||||
$php_file = fopen($target_php_folder . $php_file_name, "w");
|
||||
|
@ -30,13 +30,13 @@ class PLACEHOLDER_MODULECLASSNAME {
|
||||
switch ($name) {
|
||||
case "PLACEHOLDER_LIST":
|
||||
$allowed['PLACEHOLDER_LIST'] = array('list');
|
||||
$heading = array('','',PLACEHOLDER_COLUMNS, 'Menü');
|
||||
$heading = array('','',PLACEHOLDER_HEADERS, 'Menü');
|
||||
$width = array('1%','1%','10%'); // Fill out manually later
|
||||
|
||||
// columns that are aligned right (numbers etc)
|
||||
// $alignright = array(4,5,6,7,8);
|
||||
|
||||
$findcols = array(PLACEHOLDER_SQL_COLUMNS);
|
||||
$findcols = array('PLACEHOLDER_ID_COLUMN','PLACEHOLDER_ID_COLUMN',PLACEHOLDER_SQL_COLUMNS);
|
||||
$searchsql = array(PLACEHOLDER_SQL_COLUMNS);
|
||||
|
||||
$defaultorder = 1;
|
||||
|
32
www/pages/content/kontorahmen_edit.tpl
Normal file
32
www/pages/content/kontorahmen_edit.tpl
Normal file
@ -0,0 +1,32 @@
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li><a href="#tabs-1"></a></li>
|
||||
</ul>
|
||||
<div id="tabs-1">
|
||||
[MESSAGE]
|
||||
<form action="" method="post">
|
||||
[FORMHANDLEREVENT]
|
||||
<div class="row">
|
||||
<div class="row-height">
|
||||
<div class="col-xs-12 col-md-12 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<legend>{|<!--Legend for this form area goes here>-->kontorahmen|}</legend>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<tr><td>{|Sachkonto|}:</td><td><input type="text" name="sachkonto" id="sachkonto" value="[SACHKONTO]" size="20"></td></tr>
|
||||
<tr><td>{|Beschriftung|}:</td><td><input type="text" name="beschriftung" id="beschriftung" value="[BESCHRIFTUNG]" size="20"></td></tr>
|
||||
<tr><td>{|Bemerkung|}:</td><td><input type="text" name="bemerkung" id="bemerkung" value="[BEMERKUNG]" size="20"></td></tr>
|
||||
<tr><td>{|Ausblenden|}:</td><td><input type="checkbox" name="ausblenden" id="ausblenden" value="1" [AUSBLENDEN] size="20"></td></tr>
|
||||
<tr><td>{|Art|}:</td><td><select name="art">[ART]</select></td></tr>
|
||||
<tr><td>{|Projekt|}:</td><td><input type="text" name="projekt" id="projekt" value="[PROJEKT]" size="20"></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="submit" name="submit" value="Speichern" style="float:right"/>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
77
www/pages/content/zolltarifnummer_edit.tpl
Normal file
77
www/pages/content/zolltarifnummer_edit.tpl
Normal file
@ -0,0 +1,77 @@
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li><a href="#tabs-1"></a></li>
|
||||
</ul>
|
||||
<!-- Example for multiple tabs
|
||||
<ul hidden">
|
||||
<li><a href="#tabs-1">First Tab</a></li>
|
||||
<li><a href="#tabs-2">Second Tab</a></li>
|
||||
</ul>
|
||||
-->
|
||||
<div id="tabs-1">
|
||||
[MESSAGE]
|
||||
<form action="" method="post">
|
||||
[FORMHANDLEREVENT]
|
||||
<div class="row">
|
||||
<div class="row-height">
|
||||
<div class="col-xs-12 col-md-12 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<legend>{|<!--Legend for this form area goes here>-->Zolltarifnummer|}</legend>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<tr><td>{|Nummer|}:</td><td><input type="text" name="nummer" id="nummer" value="[NUMMER]" size="20"></td></tr>
|
||||
<tr><td>{|Beschreibung|}:</td><td><input type="text" name="beschreibung" id="beschreibung" value="[BESCHREIBUNG]" size="20"></td></tr>
|
||||
<tr><td>{|Interne Bemerkung|}:</td><td><input type="text" name="internebemerkung" id="internebemerkung" value="[INTERNEBEMERKUNG]" size="20"></td></tr>
|
||||
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Example for 2nd row
|
||||
<div class="row">
|
||||
<div class="row-height">
|
||||
<div class="col-xs-12 col-md-12 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<legend>{|Another legend|}</legend>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<tr><td>{|Nummer|}:</td><td><input type="text" name="nummer" id="nummer" value="[NUMMER]" size="20"></td></tr>
|
||||
<tr><td>{|Beschreibung|}:</td><td><input type="text" name="beschreibung" id="beschreibung" value="[BESCHREIBUNG]" size="20"></td></tr>
|
||||
<tr><td>{|Internebemerkung|}:</td><td><input type="text" name="internebemerkung" id="internebemerkung" value="[INTERNEBEMERKUNG]" size="20"></td></tr>
|
||||
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<input type="submit" name="submit" value="Speichern" style="float:right"/>
|
||||
</form>
|
||||
</div>
|
||||
<!-- Example for 2nd tab
|
||||
<div id="tabs-2">
|
||||
[MESSAGE]
|
||||
<form action="" method="post">
|
||||
[FORMHANDLEREVENT]
|
||||
<div class="row">
|
||||
<div class="row-height">
|
||||
<div class="col-xs-12 col-md-12 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<legend>{|...|}</legend>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
...
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="submit" name="submit" value="Speichern" style="float:right"/>
|
||||
</form>
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
|
10
www/pages/content/zolltarifnummer_list.tpl
Normal file
10
www/pages/content/zolltarifnummer_list.tpl
Normal file
@ -0,0 +1,10 @@
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li><a href="#tabs-1">[TABTEXT1]</a></li>
|
||||
</ul>
|
||||
<div id="tabs-1">
|
||||
[MESSAGE]
|
||||
[TAB1]
|
||||
[TAB1NEXT]
|
||||
</div>
|
||||
</div>
|
257
www/pages/kontorahmen.php
Normal file
257
www/pages/kontorahmen.php
Normal file
@ -0,0 +1,257 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (c) 2022 OpenXE project
|
||||
*/
|
||||
|
||||
use Xentral\Components\Database\Exception\QueryFailureException;
|
||||
|
||||
class Kontorahmen {
|
||||
|
||||
function __construct($app, $intern = false) {
|
||||
$this->app = $app;
|
||||
if ($intern)
|
||||
return;
|
||||
|
||||
$this->app->ActionHandlerInit($this);
|
||||
$this->app->ActionHandler("list", "kontorahmen_list");
|
||||
$this->app->ActionHandler("create", "kontorahmen_edit"); // This automatically adds a "New" button
|
||||
$this->app->ActionHandler("edit", "kontorahmen_edit");
|
||||
$this->app->ActionHandler("delete", "kontorahmen_delete");
|
||||
$this->app->DefaultActionHandler("list");
|
||||
$this->app->ActionHandlerListen($app);
|
||||
}
|
||||
|
||||
public function Install() {
|
||||
/* Fill out manually later */
|
||||
}
|
||||
|
||||
static function TableSearch(&$app, $name, $erlaubtevars) {
|
||||
switch ($name) {
|
||||
case "kontorahmen_list":
|
||||
$allowed['kontorahmen_list'] = array('list');
|
||||
$heading = array('', 'Sachkonto', 'Beschriftung', 'Art', 'Bemerkung', 'Projekt', 'Ausblenden', 'Menü');
|
||||
$width = array( '1%','2%' , '10%', '2%', '10%', '2%', '1%', '1%'); // Fill out manually later
|
||||
|
||||
// columns that are aligned right (numbers etc)
|
||||
// $alignright = array(4,5,6,7,8);
|
||||
|
||||
$art = "CASE
|
||||
WHEN k.art = 1 THEN 'Aufwendungen'
|
||||
WHEN k.art = 2 THEN 'Erlöse'
|
||||
WHEN k.art = 3 THEN 'Geldtransit'
|
||||
WHEN k.art = 9 THEN 'Saldo'
|
||||
ELSE ''
|
||||
END";
|
||||
|
||||
$findcols = array('','k.sachkonto', 'k.beschriftung', "($art)",'k.bemerkung', '(SELECT abkuerzung FROM projekt WHERE projekt.id = k.projekt LIMIT 1)', 'k.ausblenden');
|
||||
$searchsql = array('k.sachkonto', 'k.beschriftung', 'k.bemerkung', 'k.art', 'k.projekt');
|
||||
|
||||
$defaultorder = 1;
|
||||
$defaultorderdesc = 0;
|
||||
|
||||
$dropnbox = "CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',k.id,'\" />') AS `auswahl`";
|
||||
|
||||
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=kontorahmen&action=edit&id=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a> <a href=\"#\" onclick=DeleteDialog(\"index.php?module=kontorahmen&action=delete&id=%value%\");>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>" . "</td></tr></table>";
|
||||
|
||||
$sql = "SELECT SQL_CALC_FOUND_ROWS
|
||||
k.id,
|
||||
$dropnbox,
|
||||
if(k.ausblenden,CONCAT('<strike>', k.sachkonto,'</strike>'),k.sachkonto) AS sachkonto,
|
||||
k.beschriftung,
|
||||
$art
|
||||
AS art,
|
||||
k.bemerkung,
|
||||
(SELECT abkuerzung FROM projekt WHERE projekt.id = k.projekt LIMIT 1),
|
||||
k.ausblenden,
|
||||
k.id
|
||||
FROM kontorahmen k";
|
||||
|
||||
$where = "1";
|
||||
$count = "SELECT count(DISTINCT id) FROM kontorahmen WHERE $where";
|
||||
// $groupby = "";
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
$erg = false;
|
||||
|
||||
foreach ($erlaubtevars as $k => $v) {
|
||||
if (isset($$v)) {
|
||||
$erg[$v] = $$v;
|
||||
}
|
||||
}
|
||||
return $erg;
|
||||
}
|
||||
|
||||
function kontorahmen_list() {
|
||||
|
||||
// Process multi action
|
||||
$auswahl = $this->app->Secure->GetPOST('auswahl');
|
||||
$selectedIds = [];
|
||||
if(!empty($auswahl)) {
|
||||
foreach($auswahl as $selectedId) {
|
||||
$selectedId = (int)$selectedId;
|
||||
if($selectedId > 0) {
|
||||
$selectedIds[] = $selectedId;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM kontorahmen";
|
||||
$sql .= " WHERE id IN (".implode(",",$selectedIds).")";
|
||||
$this->app->DB->Update($sql);
|
||||
}
|
||||
|
||||
$this->app->erp->MenuEintrag("index.php?module=kontorahmen&action=list", "Übersicht");
|
||||
$this->app->erp->MenuEintrag("index.php?module=kontorahmen&action=create", "Neu anlegen");
|
||||
|
||||
$this->app->erp->MenuEintrag("index.php", "Zurück");
|
||||
|
||||
$this->app->YUI->TableSearch('TAB1', 'kontorahmen_list', "show", "", "", basename(__FILE__), __CLASS__);
|
||||
$this->app->Tpl->Parse('PAGE', "kontorahmen_list.tpl");
|
||||
}
|
||||
|
||||
public function kontorahmen_delete() {
|
||||
$id = (int) $this->app->Secure->GetGET('id');
|
||||
|
||||
$this->app->DB->Delete("DELETE FROM `kontorahmen` WHERE `id` = '{$id}'");
|
||||
$this->app->Tpl->Set('MESSAGE', "<div class=\"error\">Der Eintrag wurde gelöscht.</div>");
|
||||
|
||||
$this->kontorahmen_list();
|
||||
}
|
||||
|
||||
/*
|
||||
* Edit kontorahmen item
|
||||
* If id is empty, create a new one
|
||||
*/
|
||||
|
||||
function kontorahmen_edit() {
|
||||
$id = $this->app->Secure->GetGET('id');
|
||||
|
||||
// Check if other users are editing this id
|
||||
if($this->app->erp->DisableModul('artikel',$id))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$this->app->Tpl->Set('ID', $id);
|
||||
|
||||
$this->app->erp->MenuEintrag("index.php?module=kontorahmen&action=edit&id=$id", "Details");
|
||||
$this->app->erp->MenuEintrag("index.php?module=kontorahmen&action=list", "Zurück zur Übersicht");
|
||||
$id = $this->app->Secure->GetGET('id');
|
||||
$input = $this->GetInput();
|
||||
$submit = $this->app->Secure->GetPOST('submit');
|
||||
|
||||
if (empty($id)) {
|
||||
// New item
|
||||
$id = 'NULL';
|
||||
}
|
||||
|
||||
if ($submit != '')
|
||||
{
|
||||
|
||||
// Write to database
|
||||
|
||||
// Add checks here
|
||||
$input['projekt'] = $this->app->erp->ReplaceProjekt(true,$input['projekt'],true); // Parameters: Target db?, value, from form?
|
||||
|
||||
$columns = "id, ";
|
||||
$values = "$id, ";
|
||||
$update = "";
|
||||
|
||||
$fix = "";
|
||||
|
||||
foreach ($input as $key => $value) {
|
||||
$columns = $columns.$fix.$key;
|
||||
$values = $values.$fix."'".$value."'";
|
||||
$update = $update.$fix.$key." = '$value'";
|
||||
|
||||
$fix = ", ";
|
||||
}
|
||||
|
||||
// echo($columns."<br>");
|
||||
// echo($values."<br>");
|
||||
// echo($update."<br>");
|
||||
|
||||
$sql = "INSERT INTO kontorahmen (".$columns.") VALUES (".$values.") ON DUPLICATE KEY UPDATE ".$update;
|
||||
|
||||
// echo($sql);
|
||||
|
||||
$this->app->DB->Update($sql);
|
||||
|
||||
if ($id == 'NULL') {
|
||||
$msg = $this->app->erp->base64_url_encode("<div class=\"success\">Das Element wurde erfolgreich angelegt.</div>");
|
||||
header("Location: index.php?module=kontorahmen&action=list&msg=$msg");
|
||||
} else {
|
||||
$this->app->Tpl->Set('MESSAGE', "<div class=\"success\">Die Einstellungen wurden erfolgreich übernommen.</div>");
|
||||
}
|
||||
}
|
||||
|
||||
// Load values again from database
|
||||
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',k.id,'\" />') AS `auswahl`";
|
||||
$result = $this->app->DB->SelectArr("SELECT SQL_CALC_FOUND_ROWS k.id, $dropnbox, k.sachkonto, k.beschriftung, k.bemerkung, k.ausblenden, k.art, k.projekt, k.id FROM kontorahmen k"." WHERE id=$id");
|
||||
|
||||
$result[0]['projekt'] = $this->app->erp->ReplaceProjekt(false,$result[0]['projekt'],false); // Parameters: Target db?, value, from form?
|
||||
|
||||
foreach ($result[0] as $key => $value) {
|
||||
$this->app->Tpl->Set(strtoupper($key), $value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Add displayed items later
|
||||
*
|
||||
|
||||
$this->app->Tpl->Add('KURZUEBERSCHRIFT2', $email);
|
||||
$this->app->Tpl->Add('EMAIL', $email);
|
||||
$this->app->Tpl->Add('ANGEZEIGTERNAME', $angezeigtername);
|
||||
*/
|
||||
|
||||
|
||||
$this->app->Tpl->Set('AUSBLENDEN', $result[0]['ausblenden']==1?"checked":"");
|
||||
$this->app->YUI->AutoComplete("projekt","projektname",1);
|
||||
|
||||
$art_array = array(
|
||||
'1' => 'Aufwendungen',
|
||||
'2' => 'Erlöse',
|
||||
'3' => 'Geldtransit',
|
||||
'9' => 'Saldo'
|
||||
);
|
||||
$this->app->Tpl->Set('ART', $this->app->erp->GetSelectAsso($art_array,$result[0]['art']));
|
||||
|
||||
// $this->SetInput($input);
|
||||
$this->app->Tpl->Parse('PAGE', "kontorahmen_edit.tpl");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all paramters from html form and save into $input
|
||||
*/
|
||||
public function GetInput(): array {
|
||||
$input = array();
|
||||
//$input['EMAIL'] = $this->app->Secure->GetPOST('email');
|
||||
|
||||
$input['sachkonto'] = $this->app->Secure->GetPOST('sachkonto');
|
||||
$input['beschriftung'] = $this->app->Secure->GetPOST('beschriftung');
|
||||
$input['bemerkung'] = $this->app->Secure->GetPOST('bemerkung');
|
||||
$input['ausblenden'] = !empty($this->app->Secure->GetPOST('ausblenden'))?"1":"0";
|
||||
$input['art'] = $this->app->Secure->GetPOST('art');
|
||||
$input['projekt'] = $this->app->Secure->GetPOST('projekt');
|
||||
|
||||
return $input;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set all fields in the page corresponding to $input
|
||||
*/
|
||||
function SetInput($input) {
|
||||
// $this->app->Tpl->Set('EMAIL', $input['email']);
|
||||
|
||||
$this->app->Tpl->Set('SACHKONTO', $input['sachkonto']);
|
||||
$this->app->Tpl->Set('BESCHRIFTUNG', $input['beschriftung']);
|
||||
$this->app->Tpl->Set('BEMERKUNG', $input['bemerkung']);
|
||||
$this->app->Tpl->Set('AUSBLENDEN', $input['ausblenden']);
|
||||
$this->app->Tpl->Set('ART', $input['art']);
|
||||
$this->app->Tpl->Set('PROJEKT', $input['projekt']);
|
||||
|
||||
}
|
||||
|
||||
}
|
202
www/pages/zolltarifnummer.php
Normal file
202
www/pages/zolltarifnummer.php
Normal file
@ -0,0 +1,202 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (c) 2022 OpenXE project
|
||||
*/
|
||||
|
||||
use Xentral\Components\Database\Exception\QueryFailureException;
|
||||
|
||||
class Zolltarifnummer {
|
||||
|
||||
function __construct($app, $intern = false) {
|
||||
$this->app = $app;
|
||||
if ($intern)
|
||||
return;
|
||||
|
||||
$this->app->ActionHandlerInit($this);
|
||||
$this->app->ActionHandler("list", "zolltarifnummer_list");
|
||||
$this->app->ActionHandler("create", "zolltarifnummer_edit"); // This automatically adds a "New" button
|
||||
$this->app->ActionHandler("edit", "zolltarifnummer_edit");
|
||||
$this->app->ActionHandler("delete", "zolltarifnummer_delete");
|
||||
$this->app->DefaultActionHandler("list");
|
||||
$this->app->ActionHandlerListen($app);
|
||||
}
|
||||
|
||||
public function Install() {
|
||||
/* Fill out manually later */
|
||||
}
|
||||
|
||||
static function TableSearch(&$app, $name, $erlaubtevars) {
|
||||
switch ($name) {
|
||||
case "zolltarifnummer_list":
|
||||
$allowed['zolltarifnummer_list'] = array('list');
|
||||
$heading = array('','','Nummer', 'Beschreibung', 'Interne Bemerkung', 'Menü');
|
||||
$width = array('1%','1%','30%','30%','30%','1%'); // Fill out manually later
|
||||
|
||||
// columns that are aligned right (numbers etc)
|
||||
// $alignright = array(4,5,6,7,8);
|
||||
|
||||
$findcols = array('z.id','z.id','z.nummer', 'z.beschreibung', 'z.internebemerkung');
|
||||
$searchsql = array('z.nummer', 'z.beschreibung', 'z.internebemerkung');
|
||||
|
||||
$defaultorder = 1;
|
||||
$defaultorderdesc = 0;
|
||||
|
||||
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',z.id,'\" />') AS `auswahl`";
|
||||
|
||||
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=zolltarifnummer&action=edit&id=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a> <a href=\"#\" onclick=DeleteDialog(\"index.php?module=zolltarifnummer&action=delete&id=%value%\");>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>" . "</td></tr></table>";
|
||||
|
||||
$sql = "SELECT SQL_CALC_FOUND_ROWS z.id, $dropnbox, z.nummer, z.beschreibung, z.internebemerkung, z.id FROM zolltarifnummer z";
|
||||
|
||||
$where = "1";
|
||||
$count = "SELECT count(DISTINCT id) FROM zolltarifnummer WHERE $where";
|
||||
// $groupby = "";
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
$erg = false;
|
||||
|
||||
foreach ($erlaubtevars as $k => $v) {
|
||||
if (isset($$v)) {
|
||||
$erg[$v] = $$v;
|
||||
}
|
||||
}
|
||||
return $erg;
|
||||
}
|
||||
|
||||
function zolltarifnummer_list() {
|
||||
$this->app->erp->MenuEintrag("index.php?module=zolltarifnummer&action=list", "Übersicht");
|
||||
$this->app->erp->MenuEintrag("index.php?module=zolltarifnummer&action=create", "Neu anlegen");
|
||||
|
||||
$this->app->erp->MenuEintrag("index.php", "Zurück");
|
||||
|
||||
$this->app->YUI->TableSearch('TAB1', 'zolltarifnummer_list', "show", "", "", basename(__FILE__), __CLASS__);
|
||||
$this->app->Tpl->Parse('PAGE', "zolltarifnummer_list.tpl");
|
||||
}
|
||||
|
||||
public function zolltarifnummer_delete() {
|
||||
$id = (int) $this->app->Secure->GetGET('id');
|
||||
|
||||
$this->app->DB->Delete("DELETE FROM `zolltarifnummer` WHERE `id` = '{$id}'");
|
||||
$this->app->Tpl->Set('MESSAGE', "<div class=\"error\">Der Eintrag wurde gelöscht.</div>");
|
||||
|
||||
$this->zolltarifnummer_list();
|
||||
}
|
||||
|
||||
/*
|
||||
* Edit zolltarifnummer item
|
||||
* If id is empty, create a new one
|
||||
*/
|
||||
|
||||
function zolltarifnummer_edit() {
|
||||
$id = $this->app->Secure->GetGET('id');
|
||||
|
||||
// Check if other users are editing this id
|
||||
if($this->app->erp->DisableModul('artikel',$id))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$this->app->Tpl->Set('ID', $id);
|
||||
|
||||
$this->app->erp->MenuEintrag("index.php?module=zolltarifnummer&action=edit&id=$id", "Details");
|
||||
$this->app->erp->MenuEintrag("index.php?module=zolltarifnummer&action=list", "Zurück zur Übersicht");
|
||||
$id = $this->app->Secure->GetGET('id');
|
||||
$input = $this->GetInput();
|
||||
$submit = $this->app->Secure->GetPOST('submit');
|
||||
|
||||
if (empty($id)) {
|
||||
// New item
|
||||
$id = 'NULL';
|
||||
}
|
||||
|
||||
if ($submit != '')
|
||||
{
|
||||
|
||||
// Write to database
|
||||
|
||||
// Add checks here
|
||||
|
||||
$columns = "id, ";
|
||||
$values = "$id, ";
|
||||
$update = "";
|
||||
|
||||
$fix = "";
|
||||
|
||||
foreach ($input as $key => $value) {
|
||||
$columns = $columns.$fix.$key;
|
||||
$values = $values.$fix."'".$value."'";
|
||||
$update = $update.$fix.$key." = '$value'";
|
||||
|
||||
$fix = ", ";
|
||||
}
|
||||
|
||||
// echo($columns."<br>");
|
||||
// echo($values."<br>");
|
||||
// echo($update."<br>");
|
||||
|
||||
$sql = "INSERT INTO zolltarifnummer (".$columns.") VALUES (".$values.") ON DUPLICATE KEY UPDATE ".$update;
|
||||
|
||||
// echo($sql);
|
||||
|
||||
$this->app->DB->Update($sql);
|
||||
|
||||
if ($id == 'NULL') {
|
||||
$msg = $this->app->erp->base64_url_encode("<div class=\"success\">Das Element wurde erfolgreich angelegt.</div>");
|
||||
header("Location: index.php?module=zolltarifnummer&action=list&msg=$msg");
|
||||
} else {
|
||||
$this->app->Tpl->Set('MESSAGE', "<div class=\"success\">Die Einstellungen wurden erfolgreich übernommen.</div>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Load values again from database
|
||||
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',z.id,'\" />') AS `auswahl`";
|
||||
$result = $this->app->DB->SelectArr("SELECT SQL_CALC_FOUND_ROWS z.id, $dropnbox, z.nummer, z.beschreibung, z.internebemerkung, z.id FROM zolltarifnummer z"." WHERE id=$id");
|
||||
|
||||
foreach ($result[0] as $key => $value) {
|
||||
$this->app->Tpl->Set(strtoupper($key), $value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Add displayed items later
|
||||
*
|
||||
|
||||
$this->app->Tpl->Add('KURZUEBERSCHRIFT2', $email);
|
||||
$this->app->Tpl->Add('EMAIL', $email);
|
||||
$this->app->Tpl->Add('ANGEZEIGTERNAME', $angezeigtername);
|
||||
*/
|
||||
|
||||
// $this->SetInput($input);
|
||||
$this->app->Tpl->Parse('PAGE', "zolltarifnummer_edit.tpl");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all paramters from html form and save into $input
|
||||
*/
|
||||
public function GetInput(): array {
|
||||
$input = array();
|
||||
//$input['EMAIL'] = $this->app->Secure->GetPOST('email');
|
||||
|
||||
$input['nummer'] = $this->app->Secure->GetPOST('nummer');
|
||||
$input['beschreibung'] = $this->app->Secure->GetPOST('beschreibung');
|
||||
$input['internebemerkung'] = $this->app->Secure->GetPOST('internebemerkung');
|
||||
|
||||
|
||||
return $input;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set all fields in the page corresponding to $input
|
||||
*/
|
||||
function SetInput($input) {
|
||||
// $this->app->Tpl->Set('EMAIL', $input['email']);
|
||||
|
||||
$this->app->Tpl->Set('NUMMER', $input['nummer']);
|
||||
$this->app->Tpl->Set('BESCHREIBUNG', $input['beschreibung']);
|
||||
$this->app->Tpl->Set('INTERNEBEMERKUNG', $input['internebemerkung']);
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user