summaryrefslogtreecommitdiff
path: root/pers.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 /pers.php
stipcrmHEADmain
Diffstat (limited to 'pers.php')
-rw-r--r--pers.php177
1 files changed, 177 insertions, 0 deletions
diff --git a/pers.php b/pers.php
new file mode 100644
index 0000000..0b36f46
--- /dev/null
+++ b/pers.php
@@ -0,0 +1,177 @@
+<?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";
+
+session_write_close();
+
+require_once __DIR__ . "/lookup.php";
+require_once __DIR__ . "/lookup_more.php";
+
+$persID = $_GET['id'];
+include_once __DIR__ . "/fotolink.php";
+
+(function () use ($mysqli, $_title, $persID, $fotolink, &$email) {
+ $sql = "
+ SELECT Personen.*, DATE(Geburtsdatum) AS Geburtsdatum, Personen_Prefs.salutation, IF(UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(appprofiles.lastnot) < (60*60*24), 1, 0) AS AppNotifications, appprofiles.id AS AppProfileID, SUM(SpendenTOT.Betrag) AS `Gesamtsumme`, (SELECT SUM(Spenden.Betrag) FROM Spenden WHERE Spenden.Person = ? AND Spenden.SuperID IS NULL AND DATE_SUB(CURDATE(), INTERVAL 365 DAY) <= Spenden.Geldeingang) AS `Summe letzte 365 Tage`
+ FROM Personen
+ LEFT JOIN Personen_Prefs ON Personen.ID = Personen_Prefs.persid AND Personen_Prefs.userid = ?
+ LEFT JOIN appprofiles ON Personen.ID = appprofiles.persid
+ LEFT JOIN Spenden AS SpendenTOT ON Personen.ID = SpendenTOT.Person AND SpendenTOT.SuperID IS NULL
+ WHERE Personen.ID=?
+ ";
+ $stmt = $mysqli->prepare($sql);
+ $stmt->bind_param('iii', $persID, $_SESSION['auth_userid'], $persID);
+ $stmt->execute();
+ $r = $stmt->get_result();
+ $l = $r->fetch_object();
+ $l->Foto = $fotolink;
+ $email = $l->Email;
+
+ $_title = '<span class="pii">' . $l->Nachname . ', ' . $l->Vorname . '</span> (ID ' . $persID . ')';
+ include_once __DIR__ . "/header.php";
+
+ $id = "persview";
+ $pdf_sql = $email_sql = "SELECT *, DATE(Geburtsdatum), CONCAT('', Personen.ID, 'person') AS uid FROM Personen WHERE Personen.ID IN ";
+ include __DIR__ . '/autoemail.php';
+ include __DIR__ . '/autopdf.php';
+?>
+
+<h1 style="display: inline-block;"><?=$_title?></h1>
+&nbsp;<button class="small" onclick="return doEmail_persview(<?=$persID?>);"><i class="fas fa-envelope"></i> E-Mail senden</button>
+&nbsp;<button class="small" onclick="return doPDF_persview(<?=$persID?>);"><i class="fas fa-file-pdf"></i> PDF generieren</button>
+&nbsp;<button class="small" onclick="showNewStipDialog();"><i class="fas fa-money-check-alt"></i> Stipendium anlegen</button>
+&nbsp;<button class="small" onclick="showNewNoteDialog({'persid': <?=$persID?>});"><i class="fas fa-sticky-note"></i> Notiz anlegen</button>
+&nbsp;<button class="small" onclick="showNewOrgaPersonDialog(<?=$persID?>);"><i class="fas fa-project-diagram"></i></sup> zu Orga hinzuf&uuml;gen</button>
+&nbsp;<button class="small" onclick="showAddEventDialog(<?=$persID?>);"><i class="fas fa-glass-cheers"></i></sup> zu Event hinzuf&uuml;gen</button>
+&nbsp;<button class="small" style="background-color: red;" onclick="location.href='/db/main/delperson.php?id=<?=$persID?>';"><i class="fas fa-trash-alt"></i></sup> Datensatz löschen</button>
+
+<div style="display: none;" id="new_stip" title="Neues Stipendium">
+ <form action="/db/main/newstip.php" method="post">
+ <label for="persid">PersonenID*</label><br />
+ <input type="text" readonly name="persid" value="<?=$persID?>"><br />
+ <label for="jahr">Jahr*</label><br />
+ <input type="text" name="jahr"><br />
+ <label for="foerderart">F&ouml;rderart</label><br />
+ <select name="foerderart">
+ <option></option>
+<?
+ (function () {
+ global $foerderarten;
+ foreach ($foerderarten as $k => $v) {
+?>
+ <option value="<?=$k?>"><?=$v?></option>
+<?
+ }
+ })();
+?>
+ </select>
+
+ <br /><br />
+ <input type="submit" value="Anlegen">
+ </form>
+</div>
+
+<script>
+<? minStart(); ?>
+
+function showNewStipDialog() {
+ $('#new_stip').dialog({
+ minWidth: 330,
+ minHeight: 240,
+ });
+ setTimeout(function () {
+ $('#new_stip input[name=jahr]').focus().select();
+ }, 100);
+}
+
+<? minEnd(); ?>
+</script>
+
+<?
+ $id = "pers";
+ $entrytable = "Personen";
+ $def = [
+ "Stammdaten",
+ [11, '=2Geschlecht', '=3Anrede', '=3anrede_briefkopf~Anrede Briefkopf', '_^w~w <i class="fas fa-venus"></i>', '_^m~m <i class="fas fa-mars"></i>', '_^d~div'],
+ ['informale Ansprache', 'Ansprache', 'Titel', 'salutation|salutations~Individ. autom. Ansprache <small>(' . $_SESSION['auth_user'] . ')</small>'],
+ ['Vorname', 'Nachname', 'Geburtsname', 'user'],
+ ['!Foto', 'Geburtsdatum#isodate', 'Geburtsort', 'Staatsangehörigkeit|laenderByID'],
+ "Kontaktdaten",
+ ['Straße', 'Adresszusatz'],
+ ['PLZ', 'Ort', 'Land|laenderByID'],
+ ['Email#email', 'Email-Privat#email', 'Email-Geschäftlich#email'],
+ ['Telefon', 'Handy', 'Fax', 'Homepage'],
+ "Spenderinformationen",
+ ['+Liste Privatspender', '+Ewige Liste Privatspender', '_Gesamtsumme', '_Summe letzte 365 Tage'],
+ "Sonstiges",
+ [6, '_Newsletter|threeWay~Anmeldung Newsletter', '+wuenscht_keine_Emails~wünscht keine Emails', '+stellenangebote~Erhalt Stellenangebote', '+ideellesfp~Ideelles Förderprogramm', '+infos~Erhalt Infos', '+community~Studienfonds Community']
+ ];
+
+ if (in_array($persID, [1, 2, 3])) {
+ $def[] = ['*signature~Signatur'];
+ }
+
+ $bottom = <<<EOD
+ <script>
+ $('#persForm button.btn_w').click(function () {
+ $('#persForm input[name=Geschlecht]').val('weiblich').trigger('change');
+ $('#persForm input[name=Anrede]').val('Frau').trigger('change');
+ $('#persForm input[name=anrede_briefkopf]').val('Frau').trigger('change');
+ $('#persForm input[name="informale Ansprache"]').val('Liebe').trigger('change');
+ $('#persForm input[name=Ansprache]').val('Sehr geehrte Frau').trigger('change');
+ return false;
+ });
+
+ $('#persForm button.btn_m').click(function () {
+ $('#persForm input[name=Geschlecht]').val('männlich').trigger('change');
+ $('#persForm input[name=Anrede]').val('Herr').trigger('change');
+ $('#persForm input[name=anrede_briefkopf]').val('Herrn').trigger('change');
+ $('#persForm input[name="informale Ansprache"]').val('Lieber').trigger('change');
+ $('#persForm input[name=Ansprache]').val('Sehr geehrter Herr').trigger('change');
+ return false;
+ });
+
+ $('#persForm button.btn_d').click(function () {
+ $('#persForm input[name=Geschlecht]').val('divers').trigger('change');
+ $('#persForm input[name=Anrede]').val('').trigger('change');
+ $('#persForm input[name=anrede_briefkopf]').val('').trigger('change');
+ $('#persForm input[name="informale Ansprache"]').val('Hallo').trigger('change');
+ $('#persForm input[name=Ansprache]').val('Guten Tag').trigger('change');
+ return false;
+ });
+ </script>
+EOD;
+
+ include __DIR__ . '/autoform.php';
+ $stmt->reset();
+})();
+
+(function () use ($persID) {
+ $globstring = "{*-" . $persID . "person*," . $persID . "person*}_";
+ require_once __DIR__ . "/doc.php";
+})();
+
+include_once __DIR__ . '/notesXpers.php';
+include_once __DIR__ . '/emailsXpers.php';
+include_once __DIR__ . '/stipsXpers.php';
+include_once __DIR__ . '/eventsXpers.php';
+include_once __DIR__ . '/donationsXpers.php';
+include_once __DIR__ . '/orgaXpers.php';
+
+require_once __DIR__ . "/jumper.php";
+require_once __DIR__ . "/footer.php";