PWA (neue Dateien): - Vollständige Progressive Web App mit Token-basierter Auth - 4 Swipe-Panels: Alle STZ, Stundenzettel, Produktliste, Lieferauflistung - Kundensuche, Leistungen-Accordion, Mehraufwand-Sektion - Produkt-Übernahme aus Auftrag + Mehraufwand in STZ - Service Worker, Manifest, App-Icons für Installation Desktop-Änderungen: - Produktliste: Checkboxen immer sichtbar (außer bereits auf STZ) - Lieferauflistung: Vereinfachte Ansicht (nur Verbaut-Spalte) - Admin: PWA-Link in Einstellungen - Sprachdatei: PWA-Übersetzungen Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
61 lines
2 KiB
PHP
Executable file
61 lines
2 KiB
PHP
Executable file
<?php
|
|
/* Copyright (C) 2026 Eduard Wisch <data@data-it-solution.de>
|
|
*
|
|
* AJAX: Leistung hinzufügen
|
|
*/
|
|
|
|
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
|
|
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
|
|
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
|
|
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
|
|
|
// Load Dolibarr environment
|
|
$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");
|
|
|
|
dol_include_once('/stundenzettel/class/stundenzettel.class.php');
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
// Security check
|
|
if (!$user->hasRight('stundenzettel', 'write')) {
|
|
echo json_encode(array('success' => false, 'error' => 'Permission denied'));
|
|
exit;
|
|
}
|
|
|
|
$stundenzettel_id = GETPOST('stundenzettel_id', 'int');
|
|
$date = GETPOST('date', 'alpha');
|
|
$time_start = GETPOST('time_start', 'alpha');
|
|
$time_end = GETPOST('time_end', 'alpha');
|
|
$description = GETPOST('description', 'restricthtml');
|
|
|
|
if (empty($stundenzettel_id)) {
|
|
echo json_encode(array('success' => false, 'error' => 'Missing stundenzettel_id'));
|
|
exit;
|
|
}
|
|
|
|
$stundenzettel = new Stundenzettel($db);
|
|
if ($stundenzettel->fetch($stundenzettel_id) <= 0) {
|
|
echo json_encode(array('success' => false, 'error' => 'Stundenzettel not found'));
|
|
exit;
|
|
}
|
|
|
|
// Nur im Entwurf bearbeitbar
|
|
if ($stundenzettel->status != Stundenzettel::STATUS_DRAFT) {
|
|
echo json_encode(array('success' => false, 'error' => 'Stundenzettel is not in draft status'));
|
|
exit;
|
|
}
|
|
|
|
$result = $stundenzettel->addLeistung($user, $date, $time_start, $time_end, $description);
|
|
|
|
if ($result > 0) {
|
|
echo json_encode(array(
|
|
'success' => true,
|
|
'leistung_id' => $result
|
|
));
|
|
} else {
|
|
echo json_encode(array('success' => false, 'error' => 'Failed to add leistung'));
|
|
}
|