Impfworkflow + Patientensuche repariert
This commit is contained in:
+79
-1
@@ -92,6 +92,23 @@ function workflowDeleteWaitlistEntry(PDO $pdo, int $warteid): void
|
|||||||
$stDelete->execute(['wid' => $warteid]);
|
$stDelete->execute(['wid' => $warteid]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function workflowLoadWaitlistEntry(PDO $pdo, int $warteid): ?array
|
||||||
|
{
|
||||||
|
if ($warteid <= 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$stWait = $pdo->prepare("SELECT w.warteid, w.userid, w.checked, p.vorname, p.nachname
|
||||||
|
FROM warteliste w
|
||||||
|
LEFT JOIN persons p ON p.person_id = w.userid
|
||||||
|
WHERE w.warteid = :wid
|
||||||
|
LIMIT 1");
|
||||||
|
$stWait->execute(['wid' => $warteid]);
|
||||||
|
$row = $stWait->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
return $row ?: null;
|
||||||
|
}
|
||||||
|
|
||||||
function workflowCountWaitersForPlan(PDO $pdo, int $impfstoffId, int $planId): int
|
function workflowCountWaitersForPlan(PDO $pdo, int $impfstoffId, int $planId): int
|
||||||
{
|
{
|
||||||
return impfWorkflowNotificationCountWaitersForPlan($pdo, $impfstoffId, $planId);
|
return impfWorkflowNotificationCountWaitersForPlan($pdo, $impfstoffId, $planId);
|
||||||
@@ -583,6 +600,55 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
$error = "Wartelisten-Eintrag nicht gefunden.";
|
$error = "Wartelisten-Eintrag nicht gefunden.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} elseif ($aktion === 'confirm_waitlist') {
|
||||||
|
$warteid = (int)($_POST['warteid'] ?? 0);
|
||||||
|
if ($warteid <= 0) {
|
||||||
|
$error = "Ungültiger Wartelisten-Eintrag.";
|
||||||
|
} else {
|
||||||
|
$waitRow = workflowLoadWaitlistEntry($pdo, $warteid);
|
||||||
|
if (!$waitRow) {
|
||||||
|
$error = "Wartelisten-Eintrag nicht gefunden.";
|
||||||
|
} elseif ((int)$waitRow['checked'] >= 1) {
|
||||||
|
$error = "Der Wartelisten-Eintrag ist bereits bestätigt.";
|
||||||
|
} else {
|
||||||
|
$stUpdate = $pdo->prepare("UPDATE warteliste
|
||||||
|
SET checked = 1
|
||||||
|
WHERE warteid = :wid
|
||||||
|
AND checked < 1");
|
||||||
|
$stUpdate->execute(['wid' => $warteid]);
|
||||||
|
|
||||||
|
if ($stUpdate->rowCount() < 1) {
|
||||||
|
$error = "Wartelisten-Eintrag konnte nicht bestätigt werden.";
|
||||||
|
} else {
|
||||||
|
SendMailMessageVorlage($pdo, '2', $warteid, '9');
|
||||||
|
$notificationEvents = impfWorkflowNotificationProcess($pdo);
|
||||||
|
$personName = trim((string)($waitRow['vorname'] ?? '') . ' ' . (string)($waitRow['nachname'] ?? ''));
|
||||||
|
$message = "Wartelisten-Eintrag für " . trim($personName) . " wurde bestätigt.";
|
||||||
|
if (!empty($notificationEvents)) {
|
||||||
|
$message .= ' ' . count($notificationEvents) . " Impfworkflow-Benachrichtigung(en) wurden versendet.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} elseif ($aktion === 'cancel_waitlist') {
|
||||||
|
$warteid = (int)($_POST['warteid'] ?? 0);
|
||||||
|
if ($warteid <= 0) {
|
||||||
|
$error = "Ungültiger Wartelisten-Eintrag.";
|
||||||
|
} else {
|
||||||
|
$waitRow = workflowLoadWaitlistEntry($pdo, $warteid);
|
||||||
|
if (!$waitRow) {
|
||||||
|
$error = "Wartelisten-Eintrag nicht gefunden.";
|
||||||
|
} else {
|
||||||
|
SendMailMessageVorlage($pdo, '2', $warteid, '10');
|
||||||
|
workflowDeleteWaitlistEntry($pdo, $warteid);
|
||||||
|
$notificationEvents = impfWorkflowNotificationProcess($pdo);
|
||||||
|
$personName = trim((string)($waitRow['vorname'] ?? '') . ' ' . (string)($waitRow['nachname'] ?? ''));
|
||||||
|
$message = "Wartelisten-Eintrag für " . trim($personName) . " wurde abgesagt.";
|
||||||
|
if (!empty($notificationEvents)) {
|
||||||
|
$message .= ' ' . count($notificationEvents) . " Impfworkflow-Benachrichtigung(en) wurden versendet.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -809,7 +875,19 @@ try {
|
|||||||
<td><?php echo esc(workflowWarteStatus((int)$w['checked'])); ?></td>
|
<td><?php echo esc(workflowWarteStatus((int)$w['checked'])); ?></td>
|
||||||
<td><?php echo esc((string)$w['date_created']); ?></td>
|
<td><?php echo esc((string)$w['date_created']); ?></td>
|
||||||
<td>
|
<td>
|
||||||
<form method="post" onsubmit="return confirm('Eintrag wirklich löschen?');">
|
<?php if ((int)$w['checked'] === 0): ?>
|
||||||
|
<form method="post" style="display:inline-block; margin-right:6px;" onsubmit="return confirm('Eintrag wirklich als bestätigt markieren?');">
|
||||||
|
<input type="hidden" name="aktion" value="confirm_waitlist">
|
||||||
|
<input type="hidden" name="warteid" value="<?php echo (int)$w['warteid']; ?>">
|
||||||
|
<button class="btn btn-success btn-xs" type="submit">Bestätigen</button>
|
||||||
|
</form>
|
||||||
|
<?php endif; ?>
|
||||||
|
<form method="post" style="display:inline-block; margin-right:6px;" onsubmit="return confirm('Wartelisten-Eintrag wirklich absagen?');">
|
||||||
|
<input type="hidden" name="aktion" value="cancel_waitlist">
|
||||||
|
<input type="hidden" name="warteid" value="<?php echo (int)$w['warteid']; ?>">
|
||||||
|
<button class="btn btn-warning btn-xs" type="submit">Absagen</button>
|
||||||
|
</form>
|
||||||
|
<form method="post" style="display:inline-block;" onsubmit="return confirm('Eintrag wirklich löschen?');">
|
||||||
<input type="hidden" name="aktion" value="delete_waitlist">
|
<input type="hidden" name="aktion" value="delete_waitlist">
|
||||||
<input type="hidden" name="warteid" value="<?php echo (int)$w['warteid']; ?>">
|
<input type="hidden" name="warteid" value="<?php echo (int)$w['warteid']; ?>">
|
||||||
<button class="btn btn-danger btn-xs" type="submit">Löschen</button>
|
<button class="btn btn-danger btn-xs" type="submit">Löschen</button>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
$("#user_input").autocomplete({
|
$("#user_input").autocomplete({
|
||||||
source: "inc/suchepatient.php",
|
source: "../inc/suchepatient.php",
|
||||||
minLength: 3,
|
minLength: 3,
|
||||||
select: function( event, ui ) {
|
select: function( event, ui ) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
$("#user_input").autocomplete({
|
$("#user_input").autocomplete({
|
||||||
source: "inc/suchepatient.php",
|
source: "../inc/suchepatient.php",
|
||||||
minLength: 3,
|
minLength: 3,
|
||||||
select: function( event, ui ) {
|
select: function( event, ui ) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|||||||
Reference in New Issue
Block a user