Add zeitraum_id to warteliste and update related queries; enhance impfWorkflow functions
This commit is contained in:
+45
-8
@@ -172,11 +172,12 @@ function workflowAddWartelisteEntry(
|
|||||||
$hash = md5('admin-warte-' . $personId . '-' . microtime(true) . '-' . random_int(1000, 9999));
|
$hash = md5('admin-warte-' . $personId . '-' . microtime(true) . '-' . random_int(1000, 9999));
|
||||||
$checkedValue = ($checked === 0) ? 0 : 1;
|
$checkedValue = ($checked === 0) ? 0 : 1;
|
||||||
$letzteValue = ($impfart === 1) ? null : ($letzteImpfung ?: null);
|
$letzteValue = ($impfart === 1) ? null : ($letzteImpfung ?: null);
|
||||||
|
$zeitraumIdValue = ($planId > 0) ? $planId : null;
|
||||||
|
|
||||||
$stInsert = $pdo->prepare("INSERT INTO warteliste
|
$stInsert = $pdo->prepare("INSERT INTO warteliste
|
||||||
(userid, checked, hash, impfenangebot, impfstoff, Patientenart, Impfaufklaerung, WeitereFragen, impfart, impfenmit, letzteimpfung, impfenzeitraum, date_created)
|
(userid, checked, hash, impfenangebot, impfstoff, Patientenart, Impfaufklaerung, WeitereFragen, impfart, impfenmit, letzteimpfung, impfenzeitraum, zeitraum_id, date_created)
|
||||||
VALUES
|
VALUES
|
||||||
(:userid, :checked, :hash, 1, :impfstoff, :patientenart, 0, 0, :impfart, '', :letzteimpfung, :impfenzeitraum, NOW())");
|
(:userid, :checked, :hash, 1, :impfstoff, :patientenart, 0, 0, :impfart, '', :letzteimpfung, :impfenzeitraum, :zeitraum_id, NOW())");
|
||||||
$stInsert->execute([
|
$stInsert->execute([
|
||||||
'userid' => $personId,
|
'userid' => $personId,
|
||||||
'checked' => $checkedValue,
|
'checked' => $checkedValue,
|
||||||
@@ -186,6 +187,7 @@ function workflowAddWartelisteEntry(
|
|||||||
'impfart' => $impfart,
|
'impfart' => $impfart,
|
||||||
'letzteimpfung' => $letzteValue,
|
'letzteimpfung' => $letzteValue,
|
||||||
'impfenzeitraum' => $zeitraum,
|
'impfenzeitraum' => $zeitraum,
|
||||||
|
'zeitraum_id' => $zeitraumIdValue,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$personName = trim((string)$person['vorname'] . ' ' . (string)$person['nachname']);
|
$personName = trim((string)$person['vorname'] . ' ' . (string)$person['nachname']);
|
||||||
@@ -233,15 +235,35 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
} else {
|
} else {
|
||||||
$dosen = (int)$rule['dosen_pro_flasche'];
|
$dosen = (int)$rule['dosen_pro_flasche'];
|
||||||
|
|
||||||
$stCount = $pdo->prepare("SELECT COUNT(*) FROM warteliste WHERE checked = 1 AND (impfstoff = :iid OR impfstoff = 0)");
|
$stCount = $pdo->prepare("SELECT COUNT(*)
|
||||||
$stCount->execute(['iid' => $impfstoffId]);
|
FROM warteliste
|
||||||
|
WHERE checked = 1
|
||||||
|
AND (impfstoff = :iid OR impfstoff = 0)
|
||||||
|
AND (zeitraum_id = :zid OR zeitraum_id IS NULL)");
|
||||||
|
$stCount->execute([
|
||||||
|
'iid' => $impfstoffId,
|
||||||
|
'zid' => $planId,
|
||||||
|
]);
|
||||||
$wartende = (int)$stCount->fetchColumn();
|
$wartende = (int)$stCount->fetchColumn();
|
||||||
|
|
||||||
if ($wartende < $dosen) {
|
if ($wartende < $dosen) {
|
||||||
$error = "Nicht genug bestätigte Warteteilnehmer: {$wartende} von {$dosen}.";
|
$error = "Nicht genug bestätigte Warteteilnehmer: {$wartende} von {$dosen}.";
|
||||||
} else {
|
} else {
|
||||||
$stDup = $pdo->prepare("SELECT timeid FROM timeslots WHERE date = :date AND start = :start AND impfstoff = :iid LIMIT 1");
|
$stDup = $pdo->prepare("SELECT timeid
|
||||||
$stDup->execute(['date' => $datum, 'start' => $plan['start'], 'iid' => $impfstoffId]);
|
FROM timeslots
|
||||||
|
WHERE date = :date
|
||||||
|
AND start = :start
|
||||||
|
AND ende = :ende
|
||||||
|
AND impfortid = :oid
|
||||||
|
AND impfstoff = :iid
|
||||||
|
LIMIT 1");
|
||||||
|
$stDup->execute([
|
||||||
|
'date' => $datum,
|
||||||
|
'start' => $plan['start'],
|
||||||
|
'ende' => $plan['ende'],
|
||||||
|
'oid' => (int)$plan['impfortid'],
|
||||||
|
'iid' => $impfstoffId,
|
||||||
|
]);
|
||||||
|
|
||||||
if ($stDup->fetch()) {
|
if ($stDup->fetch()) {
|
||||||
$error = "Für diesen Impfstoff existiert am gewählten Datum/Zeit bereits ein Event.";
|
$error = "Für diesen Impfstoff existiert am gewählten Datum/Zeit bereits ein Event.";
|
||||||
@@ -266,10 +288,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
|
|
||||||
$stW = $pdo->prepare("SELECT warteid, userid, hash, impfart, Impfaufklaerung, WeitereFragen, letzteimpfung
|
$stW = $pdo->prepare("SELECT warteid, userid, hash, impfart, Impfaufklaerung, WeitereFragen, letzteimpfung
|
||||||
FROM warteliste
|
FROM warteliste
|
||||||
WHERE checked = 1 AND (impfstoff = :iid OR impfstoff = 0)
|
WHERE checked = 1
|
||||||
|
AND (impfstoff = :iid OR impfstoff = 0)
|
||||||
|
AND (zeitraum_id = :zid OR zeitraum_id IS NULL)
|
||||||
ORDER BY date_created ASC, warteid ASC
|
ORDER BY date_created ASC, warteid ASC
|
||||||
LIMIT :lim");
|
LIMIT :lim");
|
||||||
$stW->bindValue(':iid', $impfstoffId, PDO::PARAM_INT);
|
$stW->bindValue(':iid', $impfstoffId, PDO::PARAM_INT);
|
||||||
|
$stW->bindValue(':zid', $planId, PDO::PARAM_INT);
|
||||||
$stW->bindValue(':lim', $dosen, PDO::PARAM_INT);
|
$stW->bindValue(':lim', $dosen, PDO::PARAM_INT);
|
||||||
$stW->execute();
|
$stW->execute();
|
||||||
$warteRows = $stW->fetchAll(PDO::FETCH_ASSOC);
|
$warteRows = $stW->fetchAll(PDO::FETCH_ASSOC);
|
||||||
@@ -518,6 +543,7 @@ try {
|
|||||||
COALESCE((SELECT COUNT(*) FROM warteliste w WHERE w.checked = 1 AND (w.impfstoff = r.impfstoff_id OR w.impfstoff = 0)),0) AS wartende
|
COALESCE((SELECT COUNT(*) FROM warteliste w WHERE w.checked = 1 AND (w.impfstoff = r.impfstoff_id OR w.impfstoff = 0)),0) AS wartende
|
||||||
FROM impfstoff_workflow r
|
FROM impfstoff_workflow r
|
||||||
INNER JOIN impfstoff i ON i.impfid = r.impfstoff_id
|
INNER JOIN impfstoff i ON i.impfid = r.impfstoff_id
|
||||||
|
WHERE (i.aktiv = 1 OR i.aktivwarteliste = 1 OR i.aktivtermin = 1 OR i.aktivgrippe = 1)
|
||||||
ORDER BY i.impfname");
|
ORDER BY i.impfname");
|
||||||
$stRules->execute();
|
$stRules->execute();
|
||||||
$rules = $stRules->fetchAll(PDO::FETCH_ASSOC);
|
$rules = $stRules->fetchAll(PDO::FETCH_ASSOC);
|
||||||
@@ -561,7 +587,7 @@ try {
|
|||||||
$personResults = $stPersons->fetchAll(PDO::FETCH_ASSOC);
|
$personResults = $stPersons->fetchAll(PDO::FETCH_ASSOC);
|
||||||
}
|
}
|
||||||
|
|
||||||
$stWait = $pdo->prepare("SELECT w.warteid, w.userid, w.checked, w.impfstoff, w.impfart, w.impfenzeitraum, w.letzteimpfung, w.date_created,
|
$stWait = $pdo->prepare("SELECT w.warteid, w.userid, w.checked, w.impfstoff, w.impfart, w.impfenzeitraum, w.zeitraum_id, w.letzteimpfung, w.date_created,
|
||||||
p.vorname, p.nachname, p.geburtstag, p.email, p.tele,
|
p.vorname, p.nachname, p.geburtstag, p.email, p.tele,
|
||||||
i.impfname
|
i.impfname
|
||||||
FROM warteliste w
|
FROM warteliste w
|
||||||
@@ -573,6 +599,17 @@ try {
|
|||||||
$stWait->execute();
|
$stWait->execute();
|
||||||
$waitRows = $stWait->fetchAll(PDO::FETCH_ASSOC);
|
$waitRows = $stWait->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
foreach ($waitRows as &$waitRow) {
|
||||||
|
$zeitraumId = (int)($waitRow['zeitraum_id'] ?? 0);
|
||||||
|
if ($zeitraumId > 0) {
|
||||||
|
$zeitraum = impfLoadZeitraumById($pdo, $zeitraumId, true);
|
||||||
|
if ($zeitraum) {
|
||||||
|
$waitRow['impfenzeitraum'] = $zeitraum['label'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($waitRow);
|
||||||
|
|
||||||
$stUpcoming = $pdo->prepare("SELECT ts.timeid, ts.date, ts.start, ts.ende, ts.impfdosen,
|
$stUpcoming = $pdo->prepare("SELECT ts.timeid, ts.date, ts.start, ts.ende, ts.impfdosen,
|
||||||
i.impfname, o.anzeigename, o.adresse,
|
i.impfname, o.anzeigename, o.adresse,
|
||||||
it.terminid, it.checked, it.behandelt, it.impfart,
|
it.terminid, it.checked, it.behandelt, it.impfart,
|
||||||
|
|||||||
@@ -296,32 +296,37 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
|
|
||||||
if ($wochentag < 1 || $wochentag > 7 || $start === '' || $ende === '' || $impfortId <= 0) {
|
if ($wochentag < 1 || $wochentag > 7 || $start === '' || $ende === '' || $impfortId <= 0) {
|
||||||
$error = "Bitte Zeitraum vollstaendig ausfuellen.";
|
$error = "Bitte Zeitraum vollstaendig ausfuellen.";
|
||||||
|
} elseif ($ende <= $start) {
|
||||||
|
$error = "Die Endzeit muss nach der Startzeit liegen.";
|
||||||
} else {
|
} else {
|
||||||
$startSql = $start . ':00';
|
$startSql = $start . ':00';
|
||||||
$endeSql = $ende . ':00';
|
$endeSql = $ende . ':00';
|
||||||
|
|
||||||
$stExisting = $pdo->prepare("SELECT zeitraum_id
|
$stExisting = $pdo->prepare("SELECT zeitraum_id, bezeichnung
|
||||||
FROM impf_zeitraum
|
FROM impf_zeitraum
|
||||||
WHERE bezeichnung = :bezeichnung
|
WHERE wochentag = :wochentag
|
||||||
AND wochentag = :wochentag
|
|
||||||
AND start = :start
|
AND start = :start
|
||||||
AND ende = :ende
|
AND ende = :ende
|
||||||
AND impfortid = :impfortid
|
AND impfortid = :impfortid
|
||||||
LIMIT 1");
|
LIMIT 1");
|
||||||
$stExisting->execute([
|
$stExisting->execute([
|
||||||
'bezeichnung' => $bezeichnung,
|
|
||||||
'wochentag' => $wochentag,
|
'wochentag' => $wochentag,
|
||||||
'start' => $startSql,
|
'start' => $startSql,
|
||||||
'ende' => $endeSql,
|
'ende' => $endeSql,
|
||||||
'impfortid' => $impfortId,
|
'impfortid' => $impfortId,
|
||||||
]);
|
]);
|
||||||
$existingId = (int)($stExisting->fetchColumn() ?: 0);
|
$existingRow = $stExisting->fetch(PDO::FETCH_ASSOC) ?: null;
|
||||||
|
$existingId = (int)($existingRow['zeitraum_id'] ?? 0);
|
||||||
|
|
||||||
if ($existingId > 0) {
|
if ($existingId > 0) {
|
||||||
$stUpdate = $pdo->prepare("UPDATE impf_zeitraum
|
$stUpdate = $pdo->prepare("UPDATE impf_zeitraum
|
||||||
SET aktiv = 1
|
SET bezeichnung = :bezeichnung,
|
||||||
|
aktiv = 1
|
||||||
WHERE zeitraum_id = :zid");
|
WHERE zeitraum_id = :zid");
|
||||||
$stUpdate->execute(['zid' => $existingId]);
|
$stUpdate->execute([
|
||||||
|
'bezeichnung' => $bezeichnung,
|
||||||
|
'zid' => $existingId,
|
||||||
|
]);
|
||||||
$message = "Zeitraum wurde reaktiviert.";
|
$message = "Zeitraum wurde reaktiviert.";
|
||||||
} else {
|
} else {
|
||||||
$st = $pdo->prepare("INSERT INTO impf_zeitraum (bezeichnung, wochentag, start, ende, impfortid, aktiv)
|
$st = $pdo->prepare("INSERT INTO impf_zeitraum (bezeichnung, wochentag, start, ende, impfortid, aktiv)
|
||||||
|
|||||||
+10
-2
@@ -76,6 +76,13 @@ if(isset($_POST["id"]) || isset($_GET["id"])){
|
|||||||
$checked = $rowimpf["checked"];
|
$checked = $rowimpf["checked"];
|
||||||
$warteid = $rowimpf["warteid"];
|
$warteid = $rowimpf["warteid"];
|
||||||
$impfenzeitraum = $rowimpf["impfenzeitraum"];
|
$impfenzeitraum = $rowimpf["impfenzeitraum"];
|
||||||
|
$zeitraumId = (int)($rowimpf["zeitraum_id"] ?? 0);
|
||||||
|
if ($zeitraumId > 0 && isset($pdo) && $pdo instanceof PDO) {
|
||||||
|
$zeitraumAktuell = impfLoadZeitraumById($pdo, $zeitraumId, true);
|
||||||
|
if ($zeitraumAktuell) {
|
||||||
|
$impfenzeitraum = $zeitraumAktuell['label'];
|
||||||
|
}
|
||||||
|
}
|
||||||
//echo $userid;
|
//echo $userid;
|
||||||
$queryuser = mysqli_query($con, "SELECT * FROM persons WHERE person_id='" . $userid . "'");
|
$queryuser = mysqli_query($con, "SELECT * FROM persons WHERE person_id='" . $userid . "'");
|
||||||
$rowuser = $queryuser->fetch_assoc();
|
$rowuser = $queryuser->fetch_assoc();
|
||||||
@@ -326,7 +333,7 @@ if(isset($_POST["id"]) || isset($_GET["id"])){
|
|||||||
$letzteimpfungSql = ($letzteimpfung !== "") ? ("'" . mysqli_real_escape_string($con, $letzteimpfung) . "'") : "NULL";
|
$letzteimpfungSql = ($letzteimpfung !== "") ? ("'" . mysqli_real_escape_string($con, $letzteimpfung) . "'") : "NULL";
|
||||||
$query = mysqli_query($con, "SELECT * FROM warteliste WHERE userid='" . (int)$userid . "'");
|
$query = mysqli_query($con, "SELECT * FROM warteliste WHERE userid='" . (int)$userid . "'");
|
||||||
if($query && $query->num_rows == 0){
|
if($query && $query->num_rows == 0){
|
||||||
$query = mysqli_query($con, "INSERT INTO warteliste (userid, hash, impfenangebot, impfstoff, Patientenart,Impfaufklaerung, WeitereFragen, date_created, impfenmit, impfenzeitraum, impfart, letzteimpfung, checked) VALUES ('". (int)$userid ."', '".$hash."', '".$impfenangebot."', '".$impfstoff."', '".$Patientenart."', '".$Impfaufklaerung."', '".$WeitereFragen."', now(), '".$impfenmit."', '".$impfenzeitraum."', '".$impfart."', ".$letzteimpfungSql.", '0')");
|
$query = mysqli_query($con, "INSERT INTO warteliste (userid, hash, impfenangebot, impfstoff, Patientenart,Impfaufklaerung, WeitereFragen, date_created, impfenmit, impfenzeitraum, zeitraum_id, impfart, letzteimpfung, checked) VALUES ('". (int)$userid ."', '".$hash."', '".$impfenangebot."', '".$impfstoff."', '".$Patientenart."', '".$Impfaufklaerung."', '".$WeitereFragen."', now(), '".$impfenmit."', '".$impfenzeitraum."', '". (int)$impfenzeitraumId ."', '".$impfart."', ".$letzteimpfungSql.", '0')");
|
||||||
if($query){
|
if($query){
|
||||||
$warteid = mysqli_insert_id($con);
|
$warteid = mysqli_insert_id($con);
|
||||||
SendMailMessageVorlage($pdo, "2", $warteid , "8" );
|
SendMailMessageVorlage($pdo, "2", $warteid , "8" );
|
||||||
@@ -486,7 +493,8 @@ if(isset($_POST["id"]) || isset($_GET["id"])){
|
|||||||
$stImpfstoffe = $pdo->prepare("SELECT r.impfstoff_id, i.impfname
|
$stImpfstoffe = $pdo->prepare("SELECT r.impfstoff_id, i.impfname
|
||||||
FROM impfstoff_workflow r
|
FROM impfstoff_workflow r
|
||||||
INNER JOIN impfstoff i ON i.impfid = r.impfstoff_id
|
INNER JOIN impfstoff i ON i.impfid = r.impfstoff_id
|
||||||
WHERE r.dosen_pro_flasche > 0
|
WHERE (i.aktiv = 1 OR i.aktivwarteliste = 1 OR i.aktivtermin = 1 OR i.aktivgrippe = 1)
|
||||||
|
AND r.dosen_pro_flasche > 0
|
||||||
ORDER BY i.impfname");
|
ORDER BY i.impfname");
|
||||||
$stImpfstoffe->execute();
|
$stImpfstoffe->execute();
|
||||||
foreach ($stImpfstoffe->fetchAll(PDO::FETCH_ASSOC) as $impfstoffRow) {
|
foreach ($stImpfstoffe->fetchAll(PDO::FETCH_ASSOC) as $impfstoffRow) {
|
||||||
|
|||||||
@@ -26,6 +26,15 @@ if (!function_exists('impfTableHasColumn')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!function_exists('impfTableHasIndex')) {
|
||||||
|
function impfTableHasIndex(PDO $pdo, string $table, string $index): bool
|
||||||
|
{
|
||||||
|
$st = $pdo->prepare("SHOW INDEX FROM `" . $table . "` WHERE Key_name = :index_name");
|
||||||
|
$st->execute(['index_name' => $index]);
|
||||||
|
return (bool)$st->fetch(PDO::FETCH_ASSOC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!function_exists('impfWeekdayName')) {
|
if (!function_exists('impfWeekdayName')) {
|
||||||
function impfWeekdayName(int $day): string
|
function impfWeekdayName(int $day): string
|
||||||
{
|
{
|
||||||
@@ -46,6 +55,13 @@ if (!function_exists('impfWeekdayName')) {
|
|||||||
if (!function_exists('impfWorkflowEnsureTables')) {
|
if (!function_exists('impfWorkflowEnsureTables')) {
|
||||||
function impfWorkflowEnsureTables(PDO $pdo): void
|
function impfWorkflowEnsureTables(PDO $pdo): void
|
||||||
{
|
{
|
||||||
|
$pdo->exec("CREATE TABLE IF NOT EXISTS impf_workflow_meta (
|
||||||
|
meta_key VARCHAR(100) NOT NULL,
|
||||||
|
meta_value VARCHAR(255) NOT NULL DEFAULT '',
|
||||||
|
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
PRIMARY KEY (meta_key)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3");
|
||||||
|
|
||||||
$pdo->exec("CREATE TABLE IF NOT EXISTS impfstoff_workflow (
|
$pdo->exec("CREATE TABLE IF NOT EXISTS impfstoff_workflow (
|
||||||
impfstoff_id INT NOT NULL,
|
impfstoff_id INT NOT NULL,
|
||||||
dosen_pro_flasche INT NOT NULL,
|
dosen_pro_flasche INT NOT NULL,
|
||||||
@@ -93,13 +109,50 @@ if (!function_exists('impfWorkflowEnsureTables')) {
|
|||||||
INDEX idx_impf_zeitraum_impfstoff_impfstoff (impfstoff_id)
|
INDEX idx_impf_zeitraum_impfstoff_impfstoff (impfstoff_id)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3");
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3");
|
||||||
|
|
||||||
|
if (impfTableExists($pdo, 'warteliste') && !impfTableHasColumn($pdo, 'warteliste', 'zeitraum_id')) {
|
||||||
|
$pdo->exec("ALTER TABLE warteliste ADD COLUMN zeitraum_id INT NULL AFTER impfenzeitraum");
|
||||||
|
}
|
||||||
|
if (impfTableExists($pdo, 'warteliste') && !impfTableHasIndex($pdo, 'warteliste', 'idx_warteliste_zeitraum')) {
|
||||||
|
$pdo->exec("ALTER TABLE warteliste ADD INDEX idx_warteliste_zeitraum (zeitraum_id)");
|
||||||
|
}
|
||||||
|
|
||||||
impfWorkflowMigrateLegacyPlans($pdo);
|
impfWorkflowMigrateLegacyPlans($pdo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!function_exists('impfWorkflowGetMeta')) {
|
||||||
|
function impfWorkflowGetMeta(PDO $pdo, string $key): ?string
|
||||||
|
{
|
||||||
|
$st = $pdo->prepare("SELECT meta_value
|
||||||
|
FROM impf_workflow_meta
|
||||||
|
WHERE meta_key = :meta_key
|
||||||
|
LIMIT 1");
|
||||||
|
$st->execute(['meta_key' => $key]);
|
||||||
|
$value = $st->fetchColumn();
|
||||||
|
return ($value === false) ? null : (string)$value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('impfWorkflowSetMeta')) {
|
||||||
|
function impfWorkflowSetMeta(PDO $pdo, string $key, string $value): void
|
||||||
|
{
|
||||||
|
$st = $pdo->prepare("INSERT INTO impf_workflow_meta (meta_key, meta_value)
|
||||||
|
VALUES (:meta_key, :meta_value)
|
||||||
|
ON DUPLICATE KEY UPDATE meta_value = VALUES(meta_value)");
|
||||||
|
$st->execute([
|
||||||
|
'meta_key' => $key,
|
||||||
|
'meta_value' => $value,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!function_exists('impfWorkflowMigrateLegacyPlans')) {
|
if (!function_exists('impfWorkflowMigrateLegacyPlans')) {
|
||||||
function impfWorkflowMigrateLegacyPlans(PDO $pdo): void
|
function impfWorkflowMigrateLegacyPlans(PDO $pdo): void
|
||||||
{
|
{
|
||||||
|
if (impfWorkflowGetMeta($pdo, 'legacy_wochenplan_migrated') === '1') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!impfTableExists($pdo, 'impfstoff_wochenplan')) {
|
if (!impfTableExists($pdo, 'impfstoff_wochenplan')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -108,6 +161,7 @@ if (!function_exists('impfWorkflowMigrateLegacyPlans')) {
|
|||||||
FROM impfstoff_wochenplan");
|
FROM impfstoff_wochenplan");
|
||||||
$legacyRows = $stLegacy ? $stLegacy->fetchAll(PDO::FETCH_ASSOC) : [];
|
$legacyRows = $stLegacy ? $stLegacy->fetchAll(PDO::FETCH_ASSOC) : [];
|
||||||
if (empty($legacyRows)) {
|
if (empty($legacyRows)) {
|
||||||
|
impfWorkflowSetMeta($pdo, 'legacy_wochenplan_migrated', '1');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,6 +213,8 @@ if (!function_exists('impfWorkflowMigrateLegacyPlans')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impfWorkflowSetMeta($pdo, 'legacy_wochenplan_migrated', '1');
|
||||||
|
|
||||||
if ($manageTransaction) {
|
if ($manageTransaction) {
|
||||||
$pdo->commit();
|
$pdo->commit();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user