summaryrefslogtreecommitdiff
path: root/delstip.php
diff options
context:
space:
mode:
authorNiklas Olmes <niklas@olmes.de>2026-04-24 19:30:00 +0200
committerNiklas Olmes <niklas@olmes.de>2026-04-24 19:30:00 +0200
commitcdea8caa5617f0cb77bcbc9803759abd2df50644 (patch)
tree2f7f1bd3af3b2396baf5403ad1a7ad00bcb7fae9 /delstip.php
stipcrmHEADmain
Diffstat (limited to 'delstip.php')
-rw-r--r--delstip.php133
1 files changed, 133 insertions, 0 deletions
diff --git a/delstip.php b/delstip.php
new file mode 100644
index 0000000..fd644a8
--- /dev/null
+++ b/delstip.php
@@ -0,0 +1,133 @@
+<?php
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+?>
+<?
+/* vim: set ts=4 sw=4 et : */
+
+require_once __DIR__ . "/check_auth.php";
+require_once __DIR__ . "/../includes/common.php";
+
+$stipID = $_GET['id'];
+$prohibit = false;
+
+(function () use ($mysqli, $_title, $stipID) {
+ $sql = "SELECT Personen.*, Stipendien.Jahr FROM Stipendien LEFT JOIN Personen ON Stipendien.Person = Personen.ID WHERE Stipendien.ID=?;";
+ $stmt = $mysqli->prepare($sql);
+ $stmt->bind_param('i', $stipID);
+ $stmt->execute();
+ $r = $stmt->get_result();
+ $l = $r->fetch_object();
+
+ $_title = '<span class="pii">' . $l->Nachname . ', ' . $l->Vorname . ' (' . $l->Jahr . ')</span> (ID ' . $stipID . ')';
+ include_once __DIR__ . "/header.php";
+?>
+ <h1 style="display: inline-block;"><span style="color: red; font-weight: bold;">Stipendiendatensatz löschen:</span> <?=$_title?></h1>
+<?
+ if ($l->ID < 1) {
+?>
+ <p><b>Kein Datensatz mit dieser ID gefunden!</b></p>
+ <p>Wenn Sie gerade gelöscht haben, war das Löschen erfolgreich.</p>
+
+<? if (isset($_GET['autodel']) && $_GET['autodel'] == 1) { ?>
+ <script>
+ window.close();
+ </script>
+<? }
+ exit(0);
+ }
+
+ $def = [
+ "Auszug",
+ [6, '_=2Vorname', '_=2Nachname', '_Jahr'],
+ ];
+ include __DIR__ . '/autoform.php';
+ $stmt->reset();
+})();
+
+(function () use ($stipID) {
+ $globstring = "{" . $stipID . "stip}_";
+ require_once __DIR__ . "/doc.php";
+})();
+
+(function () use ($stipID) {
+ $globstring = $stipID . "_";
+ require_once __DIR__ . "/doc.php";
+})();
+
+(function () use ($mysqli, $stipID, &$num_rows) {
+ $title = "Notizen";
+ $nochosen = $nofilter = true;
+ $sql = "
+SELECT
+ id AS NotizID,
+ title AS Titel,
+ solved AS erledigt,
+ changets AS `Letzte Änderung`
+FROM notes
+WHERE stipid=?
+";
+ $stmt = $mysqli->prepare($sql);
+ $stmt->bind_param("i", $stipID);
+ $stmt->execute();
+ $r = $stmt->get_result();
+ include __DIR__ . '/autotable.php';
+ $stmt->reset();
+})();
+if ($num_rows) {
+ $prohibit = true;
+?>
+ <p class="warning"><i class="fas fa-exclamation-triangle"></i> Es existieren <?=$num_rows?> Notizendatensätze, die mit diesem Personendatensatz verknüpft sind. Löschen daher nicht möglich.</p>
+<?
+}
+?>
+
+<hr>
+<?
+if (!$prohibit) {
+?>
+ <button class="medium" onclick="return delStip();" style="background: red;"><i class="far fa-trash-alt"></i> Stipendiendatensatz unwiderruflich löschen</button>
+<?
+} else {
+?>
+<p>Löschen derzeit nicht möglich. Zunächst Datensätze umwidmen bzw. Verknüpfungen entfernen.<p>
+<?
+}
+?>
+<script>
+<? minStart(); ?>
+function doSth(what) {
+ $.ajaxSetup({async:false});
+ $.post('/db/main/delstipdo.php', {
+ 'id': <?=$stipID?>,
+ 'what': what
+ });
+ window.location.reload();
+}
+
+function delStip() {
+ doSth('stip');
+}
+<? minEnd(); ?>
+</script>
+
+<?
+if (!$prohibit && isset($_GET['autodel']) && $_GET['autodel'] == 1) {
+?>
+<script>
+ delStip();
+</script>
+<?
+}
+
+require_once __DIR__ . "/jumper.php";
+exit(0);