feat: firma_info-Action — Firmen-Stammdaten + Logo für ElektroPlan-Plankopf [deploy]
All checks were successful
Deploy Eplan / deploy (push) Successful in 9s

Neue NOLOGIN-Action firma_info: liefert MAIN_INFO_SOCIETE_* (Name, Adresse,
PLZ/Ort, Telefon, Mail, Web, SIRET) + Firmenlogo als Base64-Daten-URL.
Wird von ElektroPlan (Einstellungen → „Aus Dolibarr laden") genutzt.
Version 1.2.0 → 1.3.0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Eduard Wisch 2026-05-29 21:23:05 +02:00
parent 8930d7804a
commit dae8a2d823

View file

@ -6,7 +6,8 @@
* Auth: Header "X-Eplan-Token: <secret>" gegen Const EPLAN_PWA_SECRET (hash_equals). * Auth: Header "X-Eplan-Token: <secret>" gegen Const EPLAN_PWA_SECRET (hash_equals).
* *
* Actions (?action=...): * Actions (?action=...):
* - ping {aktiv: true, version: "1.1.0"} * - ping {aktiv: true, version: "1.3.0"}
* - firma_info Firmen-Stammdaten + Logo (für Plankopf)
* - auftraege_listen Liste offener Aufträge (Commande) * - auftraege_listen Liste offener Aufträge (Commande)
* - auftrag_details&id= Einzelner Auftrag mit Positionen * - auftrag_details&id= Einzelner Auftrag mit Positionen
* - kunden_suchen&such= Third-Party-Suche * - kunden_suchen&such= Third-Party-Suche
@ -64,11 +65,41 @@ try {
echo json_encode([ echo json_encode([
'aktiv' => true, 'aktiv' => true,
'modul' => 'eplan', 'modul' => 'eplan',
'version' => '1.2.0', 'version' => '1.3.0',
'dolibarr' => DOL_VERSION, 'dolibarr' => DOL_VERSION,
]); ]);
break; break;
case 'firma_info':
// Firmen-Stammdaten (MAIN_INFO_SOCIETE_*) + Logo für den Plankopf
$zip = getDolGlobalString('MAIN_INFO_SOCIETE_ZIP');
$town = getDolGlobalString('MAIN_INFO_SOCIETE_TOWN');
$logoUrl = null;
$logo = getDolGlobalString('MAIN_INFO_SOCIETE_LOGO');
if (!empty($logo)) {
$logofile = $conf->mycompany->dir_output.'/logos/'.$logo;
if (is_readable($logofile) && filesize($logofile) <= 400 * 1024) {
$ext = strtolower(pathinfo($logofile, PATHINFO_EXTENSION));
$mime = $ext === 'png' ? 'image/png'
: (($ext === 'jpg' || $ext === 'jpeg') ? 'image/jpeg'
: ($ext === 'svg' ? 'image/svg+xml' : ''));
if ($mime) {
$logoUrl = 'data:'.$mime.';base64,'.base64_encode(file_get_contents($logofile));
}
}
}
echo json_encode([
'name' => getDolGlobalString('MAIN_INFO_SOCIETE_NOM'),
'strasse' => getDolGlobalString('MAIN_INFO_SOCIETE_ADDRESS'),
'plzOrt' => trim($zip.' '.$town),
'telefon' => getDolGlobalString('MAIN_INFO_SOCIETE_PHONE'),
'mail' => getDolGlobalString('MAIN_INFO_SOCIETE_MAIL'),
'web' => getDolGlobalString('MAIN_INFO_SOCIETE_WEB'),
'nummer' => getDolGlobalString('MAIN_INFO_SIRET'),
'logoUrl' => $logoUrl,
]);
break;
case 'auftraege_listen': case 'auftraege_listen':
$such = GETPOST('such', 'alphanohtml'); $such = GETPOST('such', 'alphanohtml');
$limit = max(1, min(200, (int) GETPOST('limit', 'int') ?: 50)); $limit = max(1, min(200, (int) GETPOST('limit', 'int') ?: 50));