Aktuellen Status mehrerer Aufträge für ElektroPlan liefern (1.1.3, API 1.4.0)

Neue Action auftraege_status&ids=1,2,3 → [{id, status}] in einer Abfrage.
ElektroPlan blendet damit unter Datei → Öffnen Zeichnungen abgeschlossener
und stornierter Aufträge aus. IDs werden einzeln als Zahl gelesen, höchstens
1000, Entity-Prüfung wie bei auftraege_listen.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Eduard Wisch 2026-10-16 17:58:35 +02:00
parent 82d58c8ce4
commit 3f8de88d0d
2 changed files with 28 additions and 2 deletions

View file

@ -10,6 +10,7 @@
* - firma_info → Firmen-Stammdaten + Logo (für Plankopf)
* - auftraege_listen → Liste offener Aufträge (Commande)
* - auftrag_details&id= → Einzelner Auftrag mit Positionen
* - auftraege_status&ids=1,2,3 → aktueller Status mehrerer Aufträge [{id, status}] (API 1.4.0)
* - kunden_suchen&such= → Third-Party-Suche
* - dokument_upload (POST) → Plan-PDF an Auftrag/Kunde anhängen
*/
@ -65,7 +66,7 @@ try {
echo json_encode([
'aktiv' => true,
'modul' => 'eplan',
'version' => '1.3.0',
'version' => '1.4.0',
'dolibarr' => DOL_VERSION,
]);
break;
@ -154,6 +155,31 @@ try {
]);
break;
case 'auftraege_status':
// ElektroPlan „Öffnen": Zeichnungen abgeschlossener/stornierter Aufträge
// ausblenden — dafür der AKTUELLE Status, in einer Abfrage für alle.
$ids = array();
foreach (explode(',', (string) GETPOST('ids', 'alphanohtml')) as $teil) {
$n = (int) trim($teil);
if ($n > 0) $ids[$n] = $n;
}
$ids = array_slice(array_values($ids), 0, 1000);
$liste = [];
if ($ids) {
$sql = "SELECT c.rowid as id, c.fk_statut FROM ".MAIN_DB_PREFIX."commande c
WHERE c.entity IN (".getEntity('commande').")
AND c.rowid IN (".implode(',', array_map('intval', $ids)).")";
$resql = $db->query($sql);
if ($resql) {
while ($obj = $db->fetch_object($resql)) {
$liste[] = ['id' => (int) $obj->id, 'status' => (int) $obj->fk_statut];
}
$db->free($resql);
}
}
echo json_encode($liste);
break;
case 'kunden_suchen':
$such = GETPOST('such', 'alphanohtml');
if (empty($such) || strlen($such) < 2) { echo json_encode([]); break; }

View file

@ -24,7 +24,7 @@ class modEplan extends DolibarrModules
$this->editor_name = 'Alles Watt läuft';
$this->editor_url = '';
$this->version = '1.1.2';
$this->version = '1.1.3';
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
$this->picto = 'fa-drafting-compass';