From d05cd92b3b7e58c87865a67e34e0572fa3326502 Mon Sep 17 00:00:00 2001 From: Xenomporio <> Date: Thu, 18 Aug 2022 21:36:42 +0200 Subject: [PATCH] ticket system migration helper for ticket date from xentral 20 --- www/pages/ticket.php | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/www/pages/ticket.php b/www/pages/ticket.php index 25a22e37..79380298 100644 --- a/www/pages/ticket.php +++ b/www/pages/ticket.php @@ -22,6 +22,7 @@ class Ticket { $this->app->ActionHandler("text", "ticket_text"); // Output text for iframe display $this->app->ActionHandler("text_ausgang", "ticket_text_ausgang"); // Output text for iframe display $this->app->ActionHandler("statusfix", "ticket_statusfix"); // Xentral 20 compatibility set all ticket status to latest ticket_nachricht status + $this->app->ActionHandler("datefix", "ticket_datefix"); // Xentral 20 compatibility set all ticket dates to latest ticket_nachricht date $this->app->DefaultActionHandler("list"); $this->app->ActionHandlerListen($app); } @@ -898,6 +899,38 @@ class Ticket { } } + /* + * After import of Xentral 20 ticket system + * Set all ticket dates to the date of the latest ticket_nachricht + */ + function ticket_datefix() { + + $confirmed = $this->app->Secure->GetGET('confirmed'); + + if ($confirmed == "yes") { + + $sql = "UPDATE ticket set zeit = + (SELECT + MAX(zeit) AS lastzeit + FROM + ticket_nachricht + WHERE ticket.schluessel = ticket_nachricht.ticket AND ticket.schluessel + LIMIT 1 + ) + WHERE ticket.status <> 'abgeschlossen' AND ticket.status <> 'spam'"; + + $this->app->DB->Update($sql); + + $this->app->Tpl->Set('TEXT', "Done."); + $this->app->Tpl->Parse('PAGE','ticket_text.tpl'); + } + else { + $this->app->Tpl->Set('TEXT', "This will replace all open ticket dates with the date of the latest ticket_nachricht. To confirm, press here: "); + $this->app->Tpl->Add('TEXT', 'Confirm'); + $this->app->Tpl->Parse('PAGE','ticket_text.tpl'); + } + + } }