Initialer Commit: Kundenverwaltung (PHP/Smarty)

Bestehende Codebasis als Ausgangsstand aufgenommen.

- .gitignore: Kundendaten (uploads_*), Smarty-Compile-Cache
  (templates_c), Laufzeit-Temp und Datenbank-Dumps ausgeschlossen;
  Verzeichnisstruktur ueber .gitkeep erhalten
- .gitattributes: Zeilenenden normalisiert (LF im Repo),
  Binaerformate markiert
- db-backup.php: MySQL-Zugangsdaten kommen jetzt wie im Rest der
  Anwendung aus der externen Konfiguration statt hartkodiert aus der
  Datei; Passwort wird ueber eine temporaere Optionsdatei statt per
  Kommandozeile uebergeben, Fehler von mysqldump/gzip werden gemeldet,
  Aufraeumen aelterer Backups berechnet Jahr und Monat konsistent

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-28 16:41:18 +02:00
co-authored by Claude Opus 5
commit e6eb55bc4b
2225 changed files with 1070301 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
<?php
require_once("./connectmysql.php");
if(!$err)
{
if($_GET["term"])
{
$qry = mysqli_query($dbconn,"SELECT MAX(artikel.id) AS id FROM artikel
JOIN artikeltyp ON typ_id = artikeltyp.id
WHERE artikel.bezeichn LIKE '".$_GET["term"]."%' AND dropdown = 1 AND YEAR(artikel.datetime) >= YEAR(NOW())-1 GROUP BY artikel.bezeichn") or die(mysqli_error($dbconn));
if($tmpres=mysqli_fetch_array($qry))
{
$innerqry = mysqli_query($dbconn,"SELECT artikel.bezeichn, artikel.typ_id, artikel.einheit_id, artikel.id, artikel_rechn.preis, artikel_rechn.rech_id, artikel_rechn.posnr FROM artikel
JOIN artikeltyp ON typ_id = artikeltyp.id
JOIN artikel_rechn ON artikel.id = art_id
WHERE artikel.id = ".$tmpres["id"]." ORDER BY artikel_rechn.art_id DESC LIMIT 1") or die(mysqli_error($dbconn));
$res = mysqli_fetch_array($innerqry);
echo "[ ";
echo '{"value": "'.$res[0].'","typ": "'.$res[1].'","einh": "'.$res[2].'","preis": "'.number_format($res[4],2,",","").'","eig":[';
$qry2 = mysqli_query($dbconn,"SELECT bezeichn, wert, einheit_id FROM eigensch
JOIN artikel_eigensch ON eig_id = eigensch.id
WHERE art_id='".$res[3]."' AND rech_id='".$res[5]."' AND artposnr = '".$res[6]."' ORDER BY posnr ASC");
if($res2 = mysqli_fetch_array($qry2))
echo '{"des":"'.$res2[0].'","val":"'.$res2[1].'", "einh":"'.$res2[2].'"}';
while($res2=mysqli_fetch_array($qry2))
echo ',{"des":"'.$res2[0].'","val":"'.$res2[1].'", "einh":"'.$res2[2].'"}';
echo ']}';
while($tmpres=mysqli_fetch_array($qry))
{
$innerqry = mysqli_query($dbconn,"SELECT artikel.bezeichn, artikel.typ_id, artikel.einheit_id, artikel.id, artikel_rechn.preis, artikel_rechn.rech_id, artikel_rechn.posnr FROM artikel
JOIN artikeltyp ON typ_id = artikeltyp.id
JOIN artikel_rechn ON artikel.id = art_id
WHERE artikel.id = ".$tmpres["id"]." ORDER BY artikel_rechn.art_id DESC LIMIT 1") or die(mysqli_error($dbconn));
$res = mysqli_fetch_array($innerqry);
echo ',{"value": "'.$res[0].'","typ": "'.$res[1].'","einh": "'.$res[2].'","preis": "'.number_format($res[4],2,",","").'","eig":[';
$qry2 = mysqli_query($dbconn,"SELECT bezeichn, wert, einheit_id FROM eigensch
JOIN artikel_eigensch ON eig_id = eigensch.id
WHERE art_id='".$res[0]."' AND rech_id='".$res[5]."' AND artposnr = '".$res[6]."' ORDER BY posnr ASC");
if($res2 = mysqli_fetch_array($qry2))
echo '{"des":"'.$res2[0].'","val":"'.$res2[1].'", "einh":"'.$res2[2].'"}';
while($res2=mysqli_fetch_array($qry2))
echo ',{"des":"'.$res2[0].'","val":"'.$res2[1].'", "einh":"'.$res2[2].'"}';
echo ']}';
}
echo "]";
}
}
}
?>
+22
View File
@@ -0,0 +1,22 @@
<?php
require_once("./connectmysql.php");
if(!$err)
{
if($_GET["term"])
{
$qry = mysqli_query($dbconn,"SELECT bank,blz FROM bank WHERE bank LIKE '".mysql_escape_string($_GET["term"])."%' GROUP BY bank ORDER BY bank ASC") or die(mysqli_error($dbconn));
if($res=mysqli_fetch_array($qry))
{
echo "[ ";
echo '{"value": "'.$res[0].'","blz":"'.$res[1].'"}';
while($res=mysqli_fetch_array($qry))
{
echo ',{"value":"'.$res[0].'","blz":"'.$res[1].'"}';
}
echo "]";
}
}
}
?>
+20
View File
@@ -0,0 +1,20 @@
<?php
require_once("./connectmysql.php");
if(!$err)
{
if($_GET["term"])
{
$qry = mysqli_query($dbconn,"SELECT blz,bank FROM bank WHERE blz LIKE '".mysql_escape_string($_GET["term"])."%' GROUP BY blz ORDER BY blz ASC") or die(mysqli_error($dbconn));
if($res=mysqli_fetch_array($qry))
{
echo "[ ";
echo '{"value": "'.$res[0].'","bank":"'.$res[1].'"}';
while($res=mysqli_fetch_array($qry))
{
echo ',{"value":"'.$res[0].'","bank":"'.$res[1].'"}';
}
echo "]";
}
}
}
?>
+15
View File
@@ -0,0 +1,15 @@
<?php
require_once("../../incs/constants.php");
session_name(SESSION_NAME);
session_start();
require_once("../../incs/settings.php");
$settings=readsettings();
if($settings == "valid")
{
$dbconn = mysqli_connect($mysql_server, $mysql_user, $mysql_pw);
mysqli_select_db($dbconn,$mysql_db);
}
else
$err = 1;
?>
+22
View File
@@ -0,0 +1,22 @@
<?php
require_once("./connectmysql.php");
if(!$err)
{
if($_GET["term"])
{
$qry = mysqli_query($dbconn,"SELECT land FROM land WHERE land LIKE '".mysql_escape_string($_GET["term"])."%' ORDER BY land ASC") or die(mysqli_error($dbconn));
if($res=mysqli_fetch_array($qry))
{
echo "[ ";
echo '{"value": "'.$res[0].'"}';
while($res=mysqli_fetch_array($qry))
{
echo ',{"value":"'.$res[0].'"}';
}
echo "]";
}
}
}
?>
+22
View File
@@ -0,0 +1,22 @@
<?php
require_once("./connectmysql.php");
if(!$err)
{
if($_GET["term"])
{
$qry = mysqli_query($dbconn,"SELECT ort, plz, land, vwahl FROM ort JOIN land ON land.id = ort.land_id WHERE ort LIKE '".mysql_escape_string($_GET["term"])."%' GROUP BY ort ORDER BY ort ASC") or die(mysqli_error($dbconn));
if($res=mysqli_fetch_array($qry))
{
echo "[ ";
echo '{"value": "'.$res[0].'","plz":"'.$res[1].'","lnd":"'.$res[2].'","vwl":"'.$res[3].'"}';
while($res=mysqli_fetch_array($qry))
{
echo ',{"value":"'.$res[0].'","plz":"'.$res[1].'","lnd":"'.$res[2].'","vwl":"'.$res[3].'"}';
}
echo "]";
}
}
}
?>
+23
View File
@@ -0,0 +1,23 @@
<?php
require_once("./connectmysql.php");
if(!$err)
{
if($_GET["term"])
{
$qry = mysqli_query($dbconn,"SELECT ortsteil, plz, ort, land, vwahl FROM ort JOIN land ON land.id = ort.land_id WHERE ortsteil LIKE '".mysql_escape_string($_GET["term"])."%' GROUP BY ortsteil ORDER BY ort ASC") or die(mysqli_error($dbconn));
if($res=mysqli_fetch_array($qry))
{
echo "[ ";
echo '{"value": "'.$res[0].'","plz":"'.$res[1].'","ort":"'.$res[2].',"lnd":"'.$res[3].'","vwl":"'.$res[3].'"}';
while($res=mysqli_fetch_array($qry))
{
echo ',{"value":"'.$res[0].'","plz":"'.$res[1].'","ort":"'.$res[2].',"lnd":"'.$res[3].'","vwl":"'.$res[3].'"}';
}
echo "]";
}
}
}
?>
+23
View File
@@ -0,0 +1,23 @@
<?php
require_once("./connectmysql.php");
if(!$err)
{
if($_GET["term"])
{
$qry = mysqli_query($dbconn,"SELECT plz, ort, land FROM ort JOIN land ON land.id = ort.land_id WHERE plz LIKE '".mysql_escape_string($_GET["term"])."%' GROUP BY plz ORDER BY plz ASC") or die(mysqli_error($dbconn));
if($res=mysqli_fetch_array($qry))
{
echo "[ ";
echo '{"value": "'.$res[0].'","ort":"'.$res[1].'","lnd":"'.$res[2].'","vwl":"'.$res[3].'"}';
while($res=mysqli_fetch_array($qry))
{
echo ',{"value":"'.$res[0].'","ort":"'.$res[1].'","lnd":"'.$res[2].'","vwl":"'.$res[3].'"}';
}
echo "]";
}
}
}
?>
+23
View File
@@ -0,0 +1,23 @@
<?php
require_once("./connectmysql.php");
if(!$err)
{
if($_GET["term"])
{
$qry = mysqli_query($dbconn,"SELECT str, plz, ort, land FROM strasse JOIN ort ON ort.id = strasse.ort_id JOIN land ON land.id = ort.land_id WHERE str LIKE '".mysql_escape_string($_GET["term"])."%' GROUP BY str ORDER BY str ASC") or die(mysqli_error($dbconn));
if($res=mysqli_fetch_array($qry))
{
echo "[ ";
echo '{"value": "'.$res[0].'","plz":"'.$res[1].'","ort":"'.$res[2].'","lnd":"'.$res[3].'"}';
while($res=mysqli_fetch_array($qry))
{
echo ',{"value": "'.$res[0].'","plz":"'.$res[1].'","ort":"'.$res[2].'","lnd":"'.$res[3].'"}';
}
echo "]";
}
}
}
?>
+22
View File
@@ -0,0 +1,22 @@
<?php
require_once("./connectmysql.php");
if(!$err)
{
if($_GET["term"])
{
$qry = mysqli_query($dbconn,"SELECT vwahl, plz, ort, ortsteil, land FROM ort JOIN land ON land.id = ort.land_id WHERE vwahl LIKE '".mysql_escape_string($_GET["term"])."%' GROUP BY vwahl ORDER BY vwahl ASC") or die(mysqli_error($dbconn));
if($res=mysqli_fetch_array($qry))
{
echo "[ ";
echo '{"value": "'.$res[0].'","plz":"'.$res[1].'","ort":"'.$res[2].'","otl":"'.$res[3].'","lnd":"'.$res[4].'"}';
while($res=mysqli_fetch_array($qry))
{
echo ',{"value": "'.$res[0].'","plz":"'.$res[1].'","ort":"'.$res[2].'","otl":"'.$res[3].'","lnd":"'.$res[4].'"}';
}
echo "]";
}
}
}
?>