Upload via GUI (452 Dateien)
This commit is contained in:
@@ -25,7 +25,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$cfg = report_clean_config($pdo, $cfgIn);
|
||||
$now = db_now();
|
||||
$pdo->prepare('INSERT INTO saved_reports (staff_id, name, config, is_shared, created_at, updated_at) VALUES (?,?,?,?,?,?)')
|
||||
->execute([$staff['id'], mb_substr($name, 0, 120), json_encode($cfg, JSON_UNESCAPED_UNICODE), !empty($_POST['shared']) ? 1 : 0, $now, $now]);
|
||||
->execute([$staff['id'], mb_substr($name, 0, 120), json_encode($cfg, JSON_UNESCAPED_UNICODE), (!empty($_POST['shared']) && has_permission($staff, 'share_views')) ? 1 : 0, $now, $now]);
|
||||
flash('success', 'Bericht gespeichert.');
|
||||
}
|
||||
redirect('/staff/report_builder.php?' . ltrim((string) ($_POST['return_query'] ?? ''), '?'));
|
||||
@@ -46,7 +46,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$own->execute([$sid]);
|
||||
$sch = $own->fetch();
|
||||
$mine = $sch && ((int) $sch['staff_id'] === (int) $staff['id'] || $staff['role'] === 'admin');
|
||||
if ($action === 'schedule_add') {
|
||||
if (in_array($action, ['schedule_add'], true) && !has_permission($staff, 'schedule_reports')) {
|
||||
flash('error', 'Für Berichte per E-Mail fehlt die erforderliche Berechtigung.');
|
||||
} elseif ($action === 'schedule_add') {
|
||||
$err = report_schedule_create($pdo, $staff, $_POST);
|
||||
$err ? flash('error', $err) : flash('success', 'Zeitplan angelegt. Der Bericht wird zum nächsten Termin per E-Mail gesendet.');
|
||||
} elseif (!$mine) {
|
||||
@@ -208,7 +210,7 @@ require __DIR__ . '/_header.php';
|
||||
<input type="hidden" name="return_query" value="<?= e($queryOf($cfg)) ?>">
|
||||
<label for="report_name" style="margin-top:0">Name</label>
|
||||
<input type="text" id="report_name" name="report_name" maxlength="120" placeholder="z. B. Monatsbericht Support" required>
|
||||
<label style="display:flex;align-items:center;gap:8px;font-weight:400;margin-top:10px"><input type="checkbox" name="shared" value="1" style="width:auto"> Für alle Mitarbeiter sichtbar</label>
|
||||
<label style="display:<?= has_permission($staff, 'share_views') ? 'flex' : 'none' ?>;align-items:center;gap:8px;font-weight:400;margin-top:10px"><input type="checkbox" name="shared" value="1" style="width:auto"> Für alle Mitarbeiter sichtbar</label>
|
||||
<div class="btn-row"><button type="submit" class="btn">Speichern</button></div>
|
||||
</form>
|
||||
</details>
|
||||
|
||||
Reference in New Issue
Block a user