Neues separates Feature: Stromlaufplan in aufgelöster Darstellung als PDF.
- WiringDiagramAnalyzer: PHP-Port der JS Phase-Map-Logik, Strompfad-Tracing
- WiringDiagramRenderer: TCPDF-Zeichnung mit VDE-Symbolen (LS, FI/RCD)
- PDF enthält: Schaltplan, Abgangsverzeichnis pro Hutschiene, Legende
- Abgangsnummern im Format R{Reihe}.{Position}
- Grüner Button in Schaltplan-Editor (Kunden + Kontakte)
- CLAUDE.md: Dateistruktur komplett überarbeitet, neue Features dokumentiert
- Version 9.7
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
60 lines
1.9 KiB
PHP
60 lines
1.9 KiB
PHP
<?php
|
|
/* Copyright (C) 2026 Alles Watt lauft
|
|
*
|
|
* Leitungslaufplan PDF-Export (Stromlaufplan in aufgelöster Darstellung)
|
|
* Separater Endpoint - kann ohne Auswirkungen entfernt werden.
|
|
*/
|
|
|
|
$res = 0;
|
|
if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php";
|
|
if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
|
|
if (!$res && file_exists("../../../../main.inc.php")) $res = @include "../../../../main.inc.php";
|
|
if (!$res) die("Include of main fails");
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
|
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
|
dol_include_once('/kundenkarte/class/anlage.class.php');
|
|
dol_include_once('/kundenkarte/lib/wiring_diagram.lib.php');
|
|
|
|
$langs->loadLangs(array('companies', 'kundenkarte@kundenkarte'));
|
|
|
|
// Parameter
|
|
$anlageId = GETPOSTINT('anlage_id');
|
|
$format = GETPOST('format', 'alpha') ?: 'A3';
|
|
$orientation = GETPOST('orientation', 'alpha') ?: 'L';
|
|
|
|
// Rechte-Check
|
|
if (!$user->hasRight('kundenkarte', 'read')) {
|
|
accessforbidden();
|
|
}
|
|
|
|
// Anlage laden
|
|
$anlage = new Anlage($db);
|
|
if ($anlage->fetch($anlageId) <= 0) {
|
|
die('Anlage nicht gefunden');
|
|
}
|
|
|
|
// Kunde laden
|
|
$societe = new Societe($db);
|
|
$societe->fetch($anlage->fk_soc);
|
|
|
|
// Analyse
|
|
$analyzer = new WiringDiagramAnalyzer($db, $anlageId);
|
|
$analyzer->loadData();
|
|
$analyzer->analyze();
|
|
|
|
// PDF erstellen
|
|
$pdf = pdf_getInstance();
|
|
$pdf->SetCreator('Dolibarr - KundenKarte Leitungslaufplan');
|
|
$pdf->SetAuthor($user->getFullName($langs));
|
|
$pdf->SetTitle('Leitungslaufplan - '.$anlage->label);
|
|
|
|
// Renderer
|
|
$renderer = new WiringDiagramRenderer($pdf, $analyzer, $anlage, $societe, $user, $format, $orientation);
|
|
$renderer->render();
|
|
$renderer->renderAbgangTabelle();
|
|
$renderer->renderLegende();
|
|
|
|
// PDF ausgeben
|
|
$filename = 'Leitungslaufplan_'.dol_sanitizeFileName($anlage->label).'_'.date('Y-m-d').'.pdf';
|
|
$pdf->Output($filename, 'D');
|