bericht/api/odt_templates.php
Eduard Wisch 344f884a0f
All checks were successful
Deploy bericht / deploy (push) Successful in 1s
feat: Bericht-Vorlagen + Whisper-Transkription + Cron-Fix
Bericht-Vorlagen (Phase 5.5):
- DB: is_template, template_label in llx_bericht
- Bericht::fetchAllTemplates() und createFromTemplate()
- fetchAllForElement() blendet Vorlagen aus
- ajax/save_as_template.php erzeugt Vorlage aus aktuellem Bericht
- Desktop-Editor: '📋 Als Vorlage' Button im Action-Bereich
- Bericht-Übersicht: Vorlagen-Dropdown beim + Neu Button
- api/templates.php: GET list + POST create_from_template

Schnell-Bericht (Phase 4.a/4.i):
- api/reports.php?action=create POST-Endpoint: Titel, Format,
  Orientation, ODT-Template, optional template_id
- api/odt_templates.php: Liste der Deckblatt-Vorlagen

Whisper-Transkription (Phase 5.7):
- api/transcribe.php: POST mit relpath, nutzt externen Whisper-
  HTTP-Endpoint (whisper.cpp server ODER OpenAI-kompatibel)
- Konfiguration im Admin: BERICHT_WHISPER_URL/MODE/API_KEY/LANG
- Sprache default 'de'

Cron-Fix:
- BerichtUploadToken::cleanupExpired() ist jetzt Instanz-Methode
  (Dolibarr ruft new Klasse($db) bei jobtype=method auf)
- Returnwert für Cron-Success/Failure
- Statische Variante als cleanupExpiredStatic() für direkte Aufrufe
- Damit läuft der tägliche Cron 'Expired Upload-Tokens bereinigen'
  nicht mehr hängend

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
[deploy]
2026-04-09 08:27:45 +02:00

16 lines
441 B
PHP

<?php
/* GET /api/odt_templates.php — Liste der ODT-Deckblatt-Templates */
require_once __DIR__.'/_inc.php';
api_authenticate();
$list = bericht_list_templates();
$out = array();
foreach ($list as $fn) {
$out[] = array(
'filename' => $fn,
'label' => preg_replace('/\.odt$/i', '', $fn),
);
}
$default = getDolGlobalString('BERICHT_DEFAULT_TEMPLATE', '');
api_ok(array('templates' => $out, 'default' => $default));