Ticketsystem reading of mails and import

Todo frontend details and sending. Also there is a no timestamp error at import on some mails (error returns e.g.)
This commit is contained in:
Xenomporio 2022-07-24 21:10:33 +02:00
parent 9b9e6d13c5
commit a5be988a43
6 changed files with 158 additions and 120 deletions

View File

@ -292,7 +292,6 @@ class TicketImportHelper
{ {
// $this->db->beginTransaction(); // $this->db->beginTransaction();
try { try {
$this->markTicketMessagesCompleted($ticketNumber);
$sql = "INSERT INTO `ticket_nachricht` ( $sql = "INSERT INTO `ticket_nachricht` (
`ticket`, `zeit`, `text`, `betreff`, `medium`, `ticket`, `zeit`, `text`, `betreff`, `medium`,
`verfasser`, `mail`,`status`, `verfasser_replyto`, `mail_replyto` `verfasser`, `mail`,`status`, `verfasser_replyto`, `mail_replyto`
@ -325,6 +324,7 @@ class TicketImportHelper
$this->logger->error('Failed to insert ticket message into db', ['exception' => $e]); $this->logger->error('Failed to insert ticket message into db', ['exception' => $e]);
} }
$this->markTicketMessagesCompleted($ticketNumber);
} }
/* End TicketService */ /* End TicketService */
@ -403,8 +403,13 @@ class TicketImportHelper
//check if email exists in database //check if email exists in database
$date = $message->getDate(); $date = $message->getDate();
$timestamp = $date->getTimestamp(); if (is_null($date)) { // This should not be happening -> Todo check getDate function
$frommd5 = md5($from . $subject . $timestamp); $this->logger->debug('Null date',['subject' => $message->getSubject()]);
$frommd5 = md5($from . $subject);
} else {
$timestamp = $date->getTimestamp();
$frommd5 = md5($from . $subject . $timestamp);
}
$empfang = $date->format('Y-m-d H:i:s'); $empfang = $date->format('Y-m-d H:i:s');
$sql = "SELECT COUNT(id) $sql = "SELECT COUNT(id)
FROM `emailbackup_mails` FROM `emailbackup_mails`
@ -492,13 +497,13 @@ class TicketImportHelper
$from $from
); );
} else {
$this->logger->debug('Add message to existing ticket',['ticketnummer' => $schluessel]);
} }
$this->logger->debug('Add message to ticket',['']);
// Add message to new or existing ticket // Add message to new or existing ticket
$ticketnachricht = $this->addTicketMessage( $ticketnachricht = $this->addTicketMessage(
(string) $ticketNumber, (string) $schluessel,
$timestamp, $timestamp,
$action_html, //? $action_html, //?
$subject, $subject,

View File

@ -14355,16 +14355,16 @@ CREATE TABLE IF NOT EXISTS `ticket_nachricht` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`ticket` varchar(255) NOT NULL, `ticket` varchar(255) NOT NULL,
`verfasser` varchar(255) NOT NULL, `verfasser` varchar(255) NOT NULL,
`bearbeiter` varchar(255) NOT NULL, `bearbeiter` varchar(255) NOT NULL DEFAULT '',
`mail` varchar(255) NOT NULL, `mail` varchar(255) NOT NULL,
`zeit` datetime NOT NULL, `zeit` datetime NOT NULL,
`zeitausgang` datetime NOT NULL, `zeitausgang` datetime NULL,
`text` longtext NOT NULL, `text` longtext NOT NULL,
`textausgang` longtext NOT NULL, `textausgang` longtext NOT NULL DEFAULT '',
`betreff` varchar(255) NOT NULL, `betreff` varchar(255) NOT NULL,
`bemerkung` text NOT NULL, `bemerkung` text NOT NULL DEFAULT '',
`medium` varchar(255) NOT NULL, `medium` varchar(255) NOT NULL,
`versendet` varchar(255) NOT NULL, `versendet` varchar(255) NOT NULL DEFAULT '',
`status` varchar(64) NOT NULL, `status` varchar(64) NOT NULL,
`mail_cc` varchar(128) NOT NULL DEFAULT '', `mail_cc` varchar(128) NOT NULL DEFAULT '',
`verfasser_replyto` varchar(255) NOT NULL, `verfasser_replyto` varchar(255) NOT NULL,

View File

@ -1287,7 +1287,14 @@ class Ajax {
for($i = 0; $i < $carr; $i++) { for($i = 0; $i < $carr; $i++) {
$newarr[] = "{$arr[$i]['name2']}"; $newarr[] = "{$arr[$i]['name2']}";
} }
break; break;
case 'warteschlangename':
$arr = $this->app->DB->SelectArr("SELECT CONCAT(label, ' ', warteschlange) as result from warteschlangen");
$carr = !empty($arr)?count($arr):0;
for($i = 0; $i < $carr; $i++) {
$newarr[] = "{$arr[$i]['result']}";
}
break;
/* /*
select a.kundennummer, (SELECT name FROM adresse a2 WHERE a2.kundennummer = a.kundennummer order by a2.projekt = 13 DESC, a2.projekt = 0 DESC, projekt LIMIT 1) as name FROM adresse a WHERE a.kundennummer like '10500' group by a.kundennummer select a.kundennummer, (SELECT name FROM adresse a2 WHERE a2.kundennummer = a.kundennummer order by a2.projekt = 13 DESC, a2.projekt = 0 DESC, projekt LIMIT 1) as name FROM adresse a WHERE a.kundennummer like '10500' group by a.kundennummer

View File

@ -14,84 +14,50 @@
[FORMHANDLEREVENT] [FORMHANDLEREVENT]
<div class="row"> <div class="row">
<div class="row-height"> <div class="row-height">
<div class="col-xs-12 col-md-12 col-md-height"> <div class="col-xs-13 col-md-6 col-md-height">
<div class="inside inside-full-height"> <div class="inside inside-full-height">
<fieldset> <fieldset>
<legend>{|<!--Legend for this form area goes here>-->ticket|}</legend><i>Info like this.</i>
<table width="100%" border="0" class="mkTableFormular"> <table width="100%" border="0" class="mkTableFormular">
<tr><td>{|Schluessel|}:</td><td><input type="text" name="schluessel" value="[SCHLUESSEL]" size="40"></td></tr> <legend>{|[STATUSICON]<b>Ticket <font color="blue">#[SCHLUESSEL]</font></b>|}</legend>
<tr><td>{|Zeit|}:</td><td><input type="text" name="zeit" value="[ZEIT]" size="40"></td></tr> <table width="100%" border="0" class="mkTableFormular">
<tr><td>{|Projekt|}:</td><td><input type="text" name="projekt" value="[PROJEKT]" size="40"></td></tr> <tr><td>{|Betreff|}:</td><td>[BETREFF]</td></tr>
<tr><td>{|Bearbeiter|}:</td><td><input type="text" name="bearbeiter" value="[BEARBEITER]" size="40"></td></tr> <tr><td>{|Zeit|}:</td><td>[ZEIT]</td></tr>
<tr><td>{|Quelle|}:</td><td><input type="text" name="quelle" value="[QUELLE]" size="40"></td></tr> <tr><td>{|Von|}:</td><td>[KUNDE] &lt;[MAILADRESSE]&gt;</td></tr>
<tr><td>{|Status|}:</td><td><input type="text" name="status" value="[STATUS]" size="40"></td></tr> <tr><td>{|Projekt|}:</td><td><input type="text" name="projekt" id="projekt" value="[PROJEKT]" size="20"></td></tr>
<tr><td>{|Adresse|}:</td><td><input type="text" name="adresse" value="[ADRESSE]" size="40"></td></tr> <tr><td>{|Adresse|}:</td><td><input type="text" name="adresse" id="adresse" value="[ADRESSE]" size="20"></td></tr>
<tr><td>{|Kunde|}:</td><td><input type="text" name="kunde" value="[KUNDE]" size="40"></td></tr> <tr><td>{|Tags|}:</td><td><input type="text" name="tags" value="[TAGS]" size="20"></td></tr>
<tr><td>{|Warteschlange|}:</td><td><input type="text" name="warteschlange" value="[WARTESCHLANGE]" size="40"></td></tr> </table>
<tr><td>{|Mailadresse|}:</td><td><input type="text" name="mailadresse" value="[MAILADRESSE]" size="40"></td></tr> </table>
<tr><td>{|Prio|}:</td><td><input type="text" name="prio" value="[PRIO]" size="40"></td></tr> </fieldset>
<tr><td>{|Betreff|}:</td><td><input type="text" name="betreff" value="[BETREFF]" size="40"></td></tr> </div>
<tr><td>{|Zugewiesen|}:</td><td><input type="text" name="zugewiesen" value="[ZUGEWIESEN]" size="40"></td></tr> </div>
<tr><td>{|Inbearbeitung|}:</td><td><input type="text" name="inbearbeitung" value="[INBEARBEITUNG]" size="40"></td></tr> <div class="col-xs-13 col-md-6 col-md-height">
<tr><td>{|Inbearbeitung_user|}:</td><td><input type="text" name="inbearbeitung_user" value="[INBEARBEITUNG_USER]" size="40"></td></tr> <div class="inside inside-full-height">
<tr><td>{|Firma|}:</td><td><input type="text" name="firma" value="[FIRMA]" size="40"></td></tr> <fieldset>
<tr><td>{|Notiz|}:</td><td><input type="text" name="notiz" value="[NOTIZ]" size="40"></td></tr> <table width="100%" border="0" class="mkTableFormular">
<tr><td>{|Bitteantworten|}:</td><td><input type="text" name="bitteantworten" value="[BITTEANTWORTEN]" size="40"></td></tr> <tr><td>{|Status|}:</td><td><input type="text" name="status" value="[STATUS]" size="20"></td></tr>
<tr><td>{|Service|}:</td><td><input type="text" name="service" value="[SERVICE]" size="40"></td></tr> <tr><td>{|Verantwortlich|}:</td><td><input type="text" name="warteschlange" id="warteschlange" value="[WARTESCHLANGE]" size="20"></td></tr>
<tr><td>{|Kommentar|}:</td><td><input type="text" name="kommentar" value="[KOMMENTAR]" size="40"></td></tr> <tr><td>{|Prio|}:</td><td><input type="text" name="prio" value="[PRIO]" size="20"></td></tr>
<tr><td>{|Privat|}:</td><td><input type="text" name="privat" value="[PRIVAT]" size="40"></td></tr> <tr><td>{|Notiz|}:</td><td><textarea name="notiz" id="notiz" rows="6" style="width:100%;">[NOTIZ]</textarea></td></tr>
<tr><td>{|Dsgvo|}:</td><td><input type="text" name="dsgvo" value="[DSGVO]" size="40"></td></tr> </table>
<tr><td>{|Tags|}:</td><td><input type="text" name="tags" value="[TAGS]" size="40"></td></tr> </fieldset>
<tr><td>{|Nachrichten_anz|}:</td><td><input type="text" name="nachrichten_anz" value="[NACHRICHTEN_ANZ]" size="40"></td></tr> </div>
</div>
<div class="col-xs-13 col-md-1 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<table width="100%" border="0" class="mkTableFormular">
<legend>{|Aktionen|}</legend>
<td><input type="submit" name="submit" value="Speichern" style="float:right"/></td></tr>
</table> </table>
</fieldset> </fieldset>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- Example for 2nd row </form>
<div class="row"> [MESSAGES]
<div class="row-height"> </div>
<div class="col-xs-12 col-md-12 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|Another legend|}</legend>
<table width="100%" border="0" class="mkTableFormular">
<tr><td>{|Schluessel|}:</td><td><input type="text" name="schluessel" value="[SCHLUESSEL]" size="40"></td></tr>
<tr><td>{|Zeit|}:</td><td><input type="text" name="zeit" value="[ZEIT]" size="40"></td></tr>
<tr><td>{|Projekt|}:</td><td><input type="text" name="projekt" value="[PROJEKT]" size="40"></td></tr>
<tr><td>{|Bearbeiter|}:</td><td><input type="text" name="bearbeiter" value="[BEARBEITER]" size="40"></td></tr>
<tr><td>{|Quelle|}:</td><td><input type="text" name="quelle" value="[QUELLE]" size="40"></td></tr>
<tr><td>{|Status|}:</td><td><input type="text" name="status" value="[STATUS]" size="40"></td></tr>
<tr><td>{|Adresse|}:</td><td><input type="text" name="adresse" value="[ADRESSE]" size="40"></td></tr>
<tr><td>{|Kunde|}:</td><td><input type="text" name="kunde" value="[KUNDE]" size="40"></td></tr>
<tr><td>{|Warteschlange|}:</td><td><input type="text" name="warteschlange" value="[WARTESCHLANGE]" size="40"></td></tr>
<tr><td>{|Mailadresse|}:</td><td><input type="text" name="mailadresse" value="[MAILADRESSE]" size="40"></td></tr>
<tr><td>{|Prio|}:</td><td><input type="text" name="prio" value="[PRIO]" size="40"></td></tr>
<tr><td>{|Betreff|}:</td><td><input type="text" name="betreff" value="[BETREFF]" size="40"></td></tr>
<tr><td>{|Zugewiesen|}:</td><td><input type="text" name="zugewiesen" value="[ZUGEWIESEN]" size="40"></td></tr>
<tr><td>{|Inbearbeitung|}:</td><td><input type="text" name="inbearbeitung" value="[INBEARBEITUNG]" size="40"></td></tr>
<tr><td>{|Inbearbeitung_user|}:</td><td><input type="text" name="inbearbeitung_user" value="[INBEARBEITUNG_USER]" size="40"></td></tr>
<tr><td>{|Firma|}:</td><td><input type="text" name="firma" value="[FIRMA]" size="40"></td></tr>
<tr><td>{|Notiz|}:</td><td><input type="text" name="notiz" value="[NOTIZ]" size="40"></td></tr>
<tr><td>{|Bitteantworten|}:</td><td><input type="text" name="bitteantworten" value="[BITTEANTWORTEN]" size="40"></td></tr>
<tr><td>{|Service|}:</td><td><input type="text" name="service" value="[SERVICE]" size="40"></td></tr>
<tr><td>{|Kommentar|}:</td><td><input type="text" name="kommentar" value="[KOMMENTAR]" size="40"></td></tr>
<tr><td>{|Privat|}:</td><td><input type="text" name="privat" value="[PRIVAT]" size="40"></td></tr>
<tr><td>{|Dsgvo|}:</td><td><input type="text" name="dsgvo" value="[DSGVO]" size="40"></td></tr>
<tr><td>{|Tags|}:</td><td><input type="text" name="tags" value="[TAGS]" size="40"></td></tr>
<tr><td>{|Nachrichten_anz|}:</td><td><input type="text" name="nachrichten_anz" value="[NACHRICHTEN_ANZ]" size="40"></td></tr>
</table>
</fieldset>
</div>
</div>
</div>
</div> -->
<input type="submit" name="submit" value="Speichern" style="float:right"/>
</form>
</div>
<!-- Example for 2nd tab <!-- Example for 2nd tab
<div id="tabs-2"> <div id="tabs-2">
[MESSAGE] [MESSAGE]
@ -111,7 +77,6 @@
</div> </div>
</div> </div>
</div> </div>
<input type="submit" name="submit" value="Speichern" style="float:right"/>
</form> </form>
</div> </div>
--> -->

View File

@ -0,0 +1,18 @@
<div class="row">
<div class="row-height">
<div class="col-xs-12 col-md-10 col-md-height" style="float:[NACHRICHT_FLOAT];">
<div class="inside inside-full-height" style= "border:1px solid black;">
<fieldset>
<legend>{|<b>[NACHRICHT_BETREFF]</b>|}</legend>
<table width="100%" border="0" class="mkTableFormular">
<tr><td>{|Zeit|}:</td><td>[NACHRICHT_ZEIT]</td></tr>
<tr><td>{|[NACHRICHT_RICHTUNG]|}:</td><td>[NACHRICHT_NAME] &lt;[NACHRICHT_EMAILADRESSE]&gt;</td></tr>
<tr><td colspan=2><hr style="border-style:solid; border-width:1px"></td></tr>
<tr><td colspan=2><div id="body" style="overflow:scroll; max-height:400px;">[NACHRICHT_TEXT]</div></td></tr>
</table>
</fieldset>
</div>
</div>
</div>
</div>

View File

@ -17,6 +17,7 @@ class Ticket {
$this->app->ActionHandler("list", "ticket_list"); $this->app->ActionHandler("list", "ticket_list");
$this->app->ActionHandler("create", "ticket_edit"); // This automatically adds a "New" button $this->app->ActionHandler("create", "ticket_edit"); // This automatically adds a "New" button
$this->app->ActionHandler("edit", "ticket_edit"); $this->app->ActionHandler("edit", "ticket_edit");
$this->app->ActionHandler("edit_raw", "ticket_edit_raw");
$this->app->ActionHandler("delete", "ticket_delete"); $this->app->ActionHandler("delete", "ticket_delete");
$this->app->DefaultActionHandler("list"); $this->app->DefaultActionHandler("list");
$this->app->ActionHandlerListen($app); $this->app->ActionHandlerListen($app);
@ -26,6 +27,10 @@ class Ticket {
/* Fill out manually later */ /* Fill out manually later */
} }
function ticket_status_icon(string $status) {
return('<img src="./themes/new/images/status_'.$status.'.png" style="margin-right:1px" title="'.$status.'" border="0">');
}
static function TableSearch(&$app, $name, $erlaubtevars) { static function TableSearch(&$app, $name, $erlaubtevars) {
@ -34,14 +39,15 @@ class Ticket {
return "CONCAT('<img src=\"./themes/new/images/status_',`t`.`status`,'.png\" style=\"margin-right:1px\" title=\"',`t`.`status`,'\" border=\"0\">')"; return "CONCAT('<img src=\"./themes/new/images/status_',`t`.`status`,'.png\" style=\"margin-right:1px\" title=\"',`t`.`status`,'\" border=\"0\">')";
} }
switch ($name) { switch ($name) {
case "ticket_list": case "ticket_list":
$allowed['ticket_list'] = array('list'); $allowed['ticket_list'] = array('list');
$heading = array('','','Ticket #', 'Datum', 'Adresse', 'Betreff', 'Notiz', 'Tags', 'Verantwortlich', 'Anzahl Nachrichten', 'Status', 'Alter', 'Projekt', 'Men&uuml;'); $heading = array('','','Ticket #', 'Datum', 'Adresse', 'Betreff', 'Notiz', 'Tags', 'Verantwortlich', 'Anzahl Nachrichten', 'Status', 'Alter', 'Projekt', 'Men&uuml;');
$width = array('1%','1%','5%', '5%', '5%', '20%', '20%', '5%', '5%', '1%', '1%', '5%', '5%', '5%'); $width = array('1%','1%','5%', '5%', '5%', '20%', '20%', '5%', '5%', '1%', '1%', '5%', '5%', '5%');
$findcols = array('t.id','t.id','t.schluessel', 't.zeit', 't.bearbeiter', 'a.name', 't.betreff', 't.notiz', 't.tags', 'w.warteschlange', 't.nachichten_anz', 't.status', 't.projekt'); $findcols = array('t.id','t.id','t.schluessel', 't.zeit', 't.bearbeiter', 'a.name', 't.betreff', 't.notiz', 't.tags', 'w.warteschlange', 't.nachrichten_anz', 't.status', 't.projekt');
$searchsql = array('t.schluessel', 't.zeit', 't.bearbeiter', 'a.name', 't.betreff', 't.notiz', 't.tags', 'w.warteschlange', 't.nachichten_anz', 't.status', 't.projekt'); $searchsql = array('t.schluessel', 't.zeit', 't.bearbeiter', 'a.name', 't.betreff', 't.notiz', 't.tags', 'w.warteschlange', 't.status', 't.projekt');
$defaultorder = 1; $defaultorder = 1;
$defaultorderdesc = 0; $defaultorderdesc = 0;
@ -60,7 +66,7 @@ class Ticket {
$sql = "SELECT t.id,".$dropnbox.", t.schluessel, t.zeit, a.name, t.betreff, t.notiz, t.tags, w.warteschlange, t.nachrichten_anz, ".ticket_iconssql().", ".$timedifference.", p.abkuerzung, t.id $sql = "SELECT t.id,".$dropnbox.", t.schluessel, t.zeit, a.name, t.betreff, t.notiz, t.tags, w.warteschlange, t.nachrichten_anz, ".ticket_iconssql().", ".$timedifference.", p.abkuerzung, t.id
FROM ticket t FROM ticket t
LEFT JOIN adresse a ON t.adresse = a.id LEFT JOIN adresse a ON t.adresse = a.id
LEFT JOIN warteschlangen w ON t.warteschlange = w.id LEFT JOIN warteschlangen w ON t.warteschlange = w.label
LEFT JOIN projekt p on t.projekt = p.id"; LEFT JOIN projekt p on t.projekt = p.id";
$where = "1"; $where = "1";
@ -103,11 +109,6 @@ class Ticket {
$this->ticket_list(); $this->ticket_list();
} }
/*
* Edit ticket item
* If id is empty, create a new one
*/
function ticket_edit() { function ticket_edit() {
$id = $this->app->Secure->GetGET('id'); $id = $this->app->Secure->GetGET('id');
@ -131,6 +132,10 @@ class Ticket {
// Add checks here // Add checks here
$input['projekt'] = $this->app->erp->ReplaceProjekt(true,$input['projekt'],true); // Parameters: Target db?, value, from form?
$input['adresse'] = $this->app->erp->ReplaceAdresse(true,$input['adresse'],true); // Parameters: Target db?, value, from form?
$input['warteschlange'] = explode(" ",$input['warteschlange'])[0]; // Just the label
$columns = "id, "; $columns = "id, ";
$values = "$id, "; $values = "$id, ";
$update = ""; $update = "";
@ -151,8 +156,6 @@ class Ticket {
$sql = "INSERT INTO ticket (".$columns.") VALUES (".$values.") ON DUPLICATE KEY UPDATE ".$update; $sql = "INSERT INTO ticket (".$columns.") VALUES (".$values.") ON DUPLICATE KEY UPDATE ".$update;
// echo($sql);
$this->app->DB->Update($sql); $this->app->DB->Update($sql);
if ($id == 'NULL') { if ($id == 'NULL') {
@ -165,7 +168,9 @@ class Ticket {
// Load values again from database // Load values again from database
$result = $this->app->DB->SelectArr("SELECT t.id, t.schluessel, t.zeit, t.projekt, t.bearbeiter, t.quelle, t.status, t.adresse, t.kunde, t.warteschlange, t.mailadresse, t.prio, t.betreff, t.zugewiesen, t.inbearbeitung, t.inbearbeitung_user, t.firma, t.notiz, t.bitteantworten, t.service, t.kommentar, t.privat, t.dsgvo, t.tags, t.nachrichten_anz, t.id FROM ticket t"." WHERE id=$id"); // $result = $this->app->DB->SelectArr("SELECT t.id, t.schluessel, t.zeit, t.projekt, t.bearbeiter, t.quelle, t.status, t.adresse, t.kunde, t.warteschlange, t.mailadresse, t.prio, t.betreff, t.zugewiesen, t.inbearbeitung, t.inbearbeitung_user, t.firma, t.notiz, t.bitteantworten, t.service, t.kommentar, t.privat, t.dsgvo, t.tags, t.nachrichten_anz, t.id FROM ticket t"." WHERE id=$id");
$result = $this->app->DB->SelectArr("SELECT t.id, t.schluessel, t.zeit, p.abkuerzung as projekt, t.bearbeiter, t.quelle, t.status, t.adresse, t.kunde, CONCAT(w.label,' ',w.warteschlange) as warteschlange, t.mailadresse, t.prio, t.betreff, t.zugewiesen, t.inbearbeitung, t.inbearbeitung_user, t.firma, t.notiz, t.bitteantworten, t.service, t.kommentar, t.privat, t.dsgvo, t.tags, t.nachrichten_anz, t.id FROM ticket t LEFT JOIN adresse a ON t.adresse = a.id LEFT JOIN projekt p on t.projekt = p.id LEFT JOIN warteschlangen w on t.warteschlange = w.label WHERE t.id=$id");
foreach ($result[0] as $key => $value) { foreach ($result[0] as $key => $value) {
$this->app->Tpl->Set(strtoupper($key), $value); $this->app->Tpl->Set(strtoupper($key), $value);
@ -180,7 +185,33 @@ class Ticket {
$this->app->Tpl->Add('ANGEZEIGTERNAME', $angezeigtername); $this->app->Tpl->Add('ANGEZEIGTERNAME', $angezeigtername);
*/ */
// $this->SetInput($input); $this->app->Tpl->Set('STATUSICON', $this->ticket_status_icon($result[0]['status'])."&nbsp;");
$this->app->YUI->AutoComplete("adresse","adresse");
$this->app->Tpl->Set('ADRESSE', $this->app->erp->ReplaceAdresse(false,$result[0]['adresse'],false)); // Convert ID to form display
$this->app->YUI->AutoComplete("projekt","projektname",1);
$input['projekt'] = $this->app->erp->ReplaceProjekt(false,$input['projekt'],false); // Parameters: Target db?, value, from form?
$this->app->YUI->AutoComplete("warteschlange","warteschlangename");
// Add Messages now
$messages = $this->app->DB->SelectArr("SELECT n.betreff, n.verfasser, n.mail, n.zeit, n.versendet, n.text FROM ticket_nachricht n INNER JOIN ticket t ON t.schluessel = n.ticket WHERE t.id = ".$id." ORDER BY n.zeit DESC");
foreach ($messages as $message) {
$this->app->Tpl->Set("NACHRICHT_BETREFF",$message['betreff']);
$this->app->Tpl->Set("NACHRICHT_ZEIT",$message['zeit']);
if ($message['versendet'] == '1') {
$this->app->Tpl->Set("NACHRICHT_RICHTUNG","An");
$this->app->Tpl->Set("NACHRICHT_FLOAT","right");
} else {
$this->app->Tpl->Set("NACHRICHT_RICHTUNG","Von");
$this->app->Tpl->Set("NACHRICHT_FLOAT","left");
}
$this->app->Tpl->Set("NACHRICHT_NAME",$message['verfasser']);
$this->app->Tpl->Set("NACHRICHT_EMAILADRESSE",$message['mail']);
$this->app->Tpl->Set("NACHRICHT_TEXT",$message['text']);
$this->app->Tpl->Parse('MESSAGES', "ticket_nachricht.tpl");
}
$this->app->Tpl->Parse('PAGE', "ticket_edit.tpl"); $this->app->Tpl->Parse('PAGE', "ticket_edit.tpl");
} }
@ -191,32 +222,44 @@ class Ticket {
$input = array(); $input = array();
//$input['EMAIL'] = $this->app->Secure->GetPOST('email'); //$input['EMAIL'] = $this->app->Secure->GetPOST('email');
$input['projekt'] = $this->app->Secure->GetPOST('projekt');
$input['status'] = $this->app->Secure->GetPOST('status');
$input['adresse'] = $this->app->Secure->GetPOST('adresse');
$input['warteschlange'] = $this->app->Secure->GetPOST('warteschlange');
$input['prio'] = $this->app->Secure->GetPOST('prio');
$input['notiz'] = $this->app->Secure->GetPOST('notiz');
$input['tags'] = $this->app->Secure->GetPOST('tags');
return $input;
}
public function GetInput_raw(): array {
$input = array();
//$input['EMAIL'] = $this->app->Secure->GetPOST('email');
$input['schluessel'] = $this->app->Secure->GetPOST('schluessel'); $input['schluessel'] = $this->app->Secure->GetPOST('schluessel');
$input['zeit'] = $this->app->Secure->GetPOST('zeit'); $input['zeit'] = $this->app->Secure->GetPOST('zeit');
$input['projekt'] = $this->app->Secure->GetPOST('projekt'); $input['projekt'] = $this->app->Secure->GetPOST('projekt');
$input['bearbeiter'] = $this->app->Secure->GetPOST('bearbeiter'); $input['bearbeiter'] = $this->app->Secure->GetPOST('bearbeiter');
$input['quelle'] = $this->app->Secure->GetPOST('quelle'); $input['quelle'] = $this->app->Secure->GetPOST('quelle');
$input['status'] = $this->app->Secure->GetPOST('status'); $input['status'] = $this->app->Secure->GetPOST('status');
$input['adresse'] = $this->app->Secure->GetPOST('adresse'); $input['adresse'] = $this->app->Secure->GetPOST('adresse');
$input['kunde'] = $this->app->Secure->GetPOST('kunde'); $input['kunde'] = $this->app->Secure->GetPOST('kunde');
$input['warteschlange'] = $this->app->Secure->GetPOST('warteschlange'); $input['warteschlange'] = $this->app->Secure->GetPOST('warteschlange');
$input['mailadresse'] = $this->app->Secure->GetPOST('mailadresse'); $input['mailadresse'] = $this->app->Secure->GetPOST('mailadresse');
$input['prio'] = $this->app->Secure->GetPOST('prio'); $input['prio'] = $this->app->Secure->GetPOST('prio');
$input['betreff'] = $this->app->Secure->GetPOST('betreff'); $input['betreff'] = $this->app->Secure->GetPOST('betreff');
$input['zugewiesen'] = $this->app->Secure->GetPOST('zugewiesen'); $input['zugewiesen'] = $this->app->Secure->GetPOST('zugewiesen');
$input['inbearbeitung'] = $this->app->Secure->GetPOST('inbearbeitung'); $input['inbearbeitung'] = $this->app->Secure->GetPOST('inbearbeitung');
$input['inbearbeitung_user'] = $this->app->Secure->GetPOST('inbearbeitung_user'); $input['inbearbeitung_user'] = $this->app->Secure->GetPOST('inbearbeitung_user');
$input['firma'] = $this->app->Secure->GetPOST('firma'); $input['firma'] = $this->app->Secure->GetPOST('firma');
$input['notiz'] = $this->app->Secure->GetPOST('notiz'); $input['notiz'] = $this->app->Secure->GetPOST('notiz');
$input['bitteantworten'] = $this->app->Secure->GetPOST('bitteantworten'); $input['bitteantworten'] = $this->app->Secure->GetPOST('bitteantworten');
$input['service'] = $this->app->Secure->GetPOST('service'); $input['service'] = $this->app->Secure->GetPOST('service');
$input['kommentar'] = $this->app->Secure->GetPOST('kommentar'); $input['kommentar'] = $this->app->Secure->GetPOST('kommentar');
$input['privat'] = $this->app->Secure->GetPOST('privat'); $input['privat'] = $this->app->Secure->GetPOST('privat');
$input['dsgvo'] = $this->app->Secure->GetPOST('dsgvo'); $input['dsgvo'] = $this->app->Secure->GetPOST('dsgvo');
$input['tags'] = $this->app->Secure->GetPOST('tags'); $input['tags'] = $this->app->Secure->GetPOST('tags');
$input['nachrichten_anz'] = $this->app->Secure->GetPOST('nachrichten_anz'); $input['nachrichten_anz'] = $this->app->Secure->GetPOST('nachrichten_anz');
return $input; return $input;
} }