ticket system migration helper for ticket date from xentral 20

This commit is contained in:
Xenomporio 2022-08-18 21:36:42 +02:00
parent 3f75bfad7d
commit d05cd92b3b

View File

@ -22,6 +22,7 @@ class Ticket {
$this->app->ActionHandler("text", "ticket_text"); // Output text for iframe display $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("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("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->DefaultActionHandler("list");
$this->app->ActionHandlerListen($app); $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', '<a href="index.php?module=ticket&action=datefix&confirmed=yes">Confirm</a>');
$this->app->Tpl->Parse('PAGE','ticket_text.tpl');
}
}
} }