mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-12-24 13:40:29 +01:00
Ticket system rework of the recipients, cc organisation, mail display and more
This commit is contained in:
parent
6e7e27d289
commit
3238206446
@ -527,6 +527,9 @@ class TicketImportHelper
|
||||
SET ticketnachricht='$ticketnachricht'
|
||||
WHERE id='$id' LIMIT 1"
|
||||
);
|
||||
|
||||
|
||||
// Add all the ccs to the header table
|
||||
if (is_array($cc_recv)) {
|
||||
foreach ($cc_recv as $mail) {
|
||||
if ($mail['name'] != '') {
|
||||
@ -548,6 +551,22 @@ class TicketImportHelper
|
||||
}
|
||||
$cc_recv = [];
|
||||
}
|
||||
|
||||
|
||||
// Add all the recipients to the header table
|
||||
if (count($message->getRecipients()) > 1) {
|
||||
|
||||
foreach ($message->getRecipients() as $recipient) {
|
||||
$recipient_address = $this->db->real_escape_string($recipient->getEmail());
|
||||
if ($recipient_address != '') {
|
||||
$sql = "INSERT INTO ticket_header
|
||||
(`id`,`ticket_nachricht`,`type`,`value`)
|
||||
VALUES
|
||||
('', '$ticketnachricht', 'to', '" . $recipient_address . "')";
|
||||
$this->db->InsertWithoutLog($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Prüfen ob Ordner vorhanden ansonsten anlegen
|
||||
|
@ -14,14 +14,14 @@
|
||||
[FORMHANDLEREVENT]
|
||||
<div class="row">
|
||||
<div class="row-height">
|
||||
<div class="col-xs-13 col-md-6 col-md-height">
|
||||
<div class="col-xs-14 col-md-6 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<legend>{|[STATUSICON]<b>Ticket <font color="blue">#[SCHLUESSEL]</font></b>|}</legend>
|
||||
<tr><td>{|Betreff|}:</td><td><input type="text" name="betreff" id="betreff" value="[BETREFF]" size="20"></td></tr>
|
||||
<tr><td>{|Letzte Aktion|}:</td><td>[ZEIT]</td></tr>
|
||||
<tr><td>{|Von|}:</td><td>[KUNDE] [MAILADRESSE]</td></tr>
|
||||
<tr><td>{|Von|}:</td><td>[MAILADRESSE] ([KUNDE])</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" id="adresse" value="[ADRESSE]" size="20"></td></tr>
|
||||
<tr><td>{|Tags|}:</td><td><input type="text" name="tags" id="tags" value="[TAGS]" size="20"></td></tr>
|
||||
@ -29,7 +29,7 @@
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-13 col-md-6 col-md-height">
|
||||
<div class="col-xs-14 col-md-6 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
@ -42,7 +42,7 @@
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-13 col-md-1 col-md-height">
|
||||
<div class="col-xs-14 col-md-2 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
|
@ -30,15 +30,15 @@
|
||||
<input type="checkbox" id="geschlossene">
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
<label for="geschlossene">{|+Geschlossene|}</label>
|
||||
<label for="geschlossene">{|Zzgl. abgeschlossen|}</label>
|
||||
</li>
|
||||
<li class="filter-item">
|
||||
<label for="archiv" class="switch">
|
||||
<input type="checkbox" id="archiv">
|
||||
<label for="spam" class="switch">
|
||||
<input type="checkbox" id="spam">
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
<label for="archiv">{|+Älter als 1 Jahr|}</label>
|
||||
</li>
|
||||
<label for="spam">{|Zzgl. Papierkorb|}</label>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -6,7 +6,9 @@
|
||||
<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] <[NACHRICHT_EMAILADRESSE]></td></tr>
|
||||
<tr><td>{|Von|}:</td><td>[NACHRICHT_SENDER]</td></tr>
|
||||
<tr><td>{|An|}:</td><td>[NACHRICHT_RECIPIENTS]</td></tr>
|
||||
<tr><td>{|CC|}:</td><td>[NACHRICHT_CC_RECIPIENTS]</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>
|
||||
<tr><td colspan=2><div id="body" style="overflow:scroll; max-height:400px;">[NACHRICHT_ANHANG]</div></td></tr>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<div class="row">
|
||||
<div class="row-height">
|
||||
<div class="col-xs-12 col-md-12 col-md-height">
|
||||
<div class="col-xs-14 col-md-12 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<legend>{|Neue E-Mail|}</legend>
|
||||
@ -12,6 +12,7 @@
|
||||
<tr>
|
||||
<td>An:</td>
|
||||
<td><input type="text" name="email_an" id="email_an" value="[EMAIL_AN]" id="an" style="width: 500px;"></td>
|
||||
<td align="right" valign="bottom">
|
||||
</tr>
|
||||
<tr>
|
||||
<td>CC:</td>
|
||||
@ -26,7 +27,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Text:</td>
|
||||
<td><textarea name="email_text" id="email_text" style="min-height: 180px;">[EMAIL_TEXT]</textarea><br><i>(Signatur für E-Mail wird automatisch angehängt)</i></td>
|
||||
<td colspan=2><textarea name="email_text" id="email_text" style="min-height: 180px;">[EMAIL_TEXT]</textarea><br><i>(Signatur für E-Mail wird automatisch angehängt)</i></td>
|
||||
</tr>
|
||||
[ANHAENGEHERAUFLADEN]
|
||||
<tr>
|
||||
@ -39,11 +40,12 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td><input type="file" name="upload[]" id="file" multiple/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" valign="bottom">
|
||||
<button name="submit" value="addfile" id="addfile" class="ui-button-icon">Hinzufügen</button>
|
||||
<button name="submit" value="addfile" id="addfile" class="ui-button-icon" style="display:none">Hinzufügen</button>
|
||||
</td>
|
||||
<script type="text/javascript">
|
||||
document.getElementById("file").onchange = function(e) {
|
||||
@ -51,19 +53,34 @@
|
||||
}
|
||||
</script>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-14 col-md-2 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<legend>{|Neue E-Mail|}</legend>
|
||||
<input type="hidden" name="type" value="email">
|
||||
<input type="hidden" name="eintragId" value="[EINTRAGID]">
|
||||
<div style="position: absolute; margin-top:27em; margin-left:30%; min-width: 90px; background: url(./themes/new/images/loading.gif) no-repeat; background-position: 50% 0px; background-size: 150px; padding-top: 90px; display:none; " id="mailworking">
|
||||
</div>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<table width="100%" border="0" cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="bottom">
|
||||
<button name="submit" value="entwurfloeschen" id="entwurfloeschen" class="ui-button-icon">Entwurf löschen</button>
|
||||
[DATEIENBUTTON]
|
||||
</td>
|
||||
<td align="right" valign="bottom">
|
||||
<button name="submit" value="absenden" id="absenden" class="ui-button-icon">Absenden</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<td align="right" valign="bottom">
|
||||
<button name="submit" value="entwurfloeschen" id="entwurfloeschen" class="ui-button-icon" style="width:100%;">Entwurf löschen</button>
|
||||
[DATEIENBUTTON]
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" ><button name="submit" value="zitat" id="zitat" class="ui-button-icon" style="width:100%;">Original-Nachricht einfügen</button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"><br></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" valign="bottom">
|
||||
<button name="submit" value="absenden" id="absenden" class="ui-button-icon" style="width:100%;">Absenden</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -94,7 +94,7 @@ class Ticket {
|
||||
$this->app->Tpl->Add('JQUERYREADY', "$('#meinetickets').click( function() { fnFilterColumn1( 0 ); } );");
|
||||
$this->app->Tpl->Add('JQUERYREADY', "$('#prio').click( function() { fnFilterColumn2( 0 ); } );");
|
||||
$this->app->Tpl->Add('JQUERYREADY', "$('#geschlossene').click( function() { fnFilterColumn3( 0 ); } );");
|
||||
$this->app->Tpl->Add('JQUERYREADY', "$('#archiv').click( function() { fnFilterColumn4( 0 ); } );");
|
||||
$this->app->Tpl->Add('JQUERYREADY', "$('#spam').click( function() { fnFilterColumn4( 0 ); } );");
|
||||
|
||||
for ($r = 1;$r <= 4;$r++) {
|
||||
$this->app->Tpl->Add('JAVASCRIPT', '
|
||||
@ -132,14 +132,14 @@ class Ticket {
|
||||
if ($more_data3 == 1) {
|
||||
}
|
||||
else {
|
||||
$where .= " AND (t.status <> 'abgeschlossen' AND t.status <> 'spam')"; // Exclude papierkorb and geschlossen
|
||||
$where .= " AND (t.status <> 'abgeschlossen')"; // Exclude and geschlossen
|
||||
}
|
||||
|
||||
$more_data4 = $this->app->Secure->GetGET("more_data4");
|
||||
if ($more_data4 == 1) {
|
||||
}
|
||||
else {
|
||||
$where .= " AND timestampdiff(DAY,t.zeit,NOW()) < 365";
|
||||
$where .= " AND (t.status <> 'spam')";
|
||||
}
|
||||
// END Toggle filters
|
||||
|
||||
@ -216,8 +216,24 @@ class Ticket {
|
||||
$limitsql = "";
|
||||
}
|
||||
|
||||
$sql = "SELECT n.id, n.betreff, n.verfasser, n.mail, n.mail_cc, n.zeit, n.zeitausgang, n.versendet, n.text, n.verfasser_replyto, mail_replyto FROM ticket_nachricht n INNER JOIN ticket t ON t.schluessel = n.ticket WHERE (".$where.") AND t.id = ".$ticket_id." ORDER BY n.zeit DESC ".$limitsql;
|
||||
|
||||
// $sql = "SELECT n.id, n.betreff, n.verfasser, n.mail, n.mail_cc, n.zeit, n.zeitausgang, n.versendet, n.text, n.verfasser_replyto, mail_replyto, (SELECT GROUP_CONCAT(value SEPARATOR ', ' FROM ticket_header th WHERE th.ticket_nachricht = n.id AND th.type = 'cc') value from) as cc FROM ticket_nachricht n INNER JOIN ticket t ON t.schluessel = n.ticket WHERE (".$where.") AND t.id = ".$ticket_id." ORDER BY n.zeit DESC ".$limitsql;
|
||||
|
||||
$sql = "SELECT n.id,
|
||||
n.betreff,
|
||||
n.verfasser,
|
||||
n.mail,
|
||||
n.zeit,
|
||||
n.zeitausgang,
|
||||
n.versendet,
|
||||
n.text,
|
||||
n.verfasser_replyto,
|
||||
n.mail_replyto,
|
||||
n.mail_cc,
|
||||
(SELECT GROUP_CONCAT(value SEPARATOR ', ') FROM ticket_header th WHERE th.ticket_nachricht = n.id AND th.type = 'cc') as mail_cc_recipients,
|
||||
(SELECT GROUP_CONCAT(value SEPARATOR ', ') FROM ticket_header th WHERE th.ticket_nachricht = n.id AND th.type = 'to') as mail_recipients
|
||||
FROM ticket_nachricht n INNER JOIN ticket t ON t.schluessel = n.ticket
|
||||
WHERE (".$where.") AND t.id = ".$ticket_id." ORDER BY n.zeit DESC ".$limitsql;
|
||||
|
||||
return $this->app->DB->SelectArr($sql);
|
||||
}
|
||||
|
||||
@ -264,19 +280,21 @@ class Ticket {
|
||||
}
|
||||
$this->app->Tpl->Set("NACHRICHT_BETREFF",$message['betreff']." (Entwurf)");
|
||||
}
|
||||
|
||||
$this->app->Tpl->Set("NACHRICHT_RICHTUNG","An");
|
||||
$this->app->Tpl->Set("NACHRICHT_SENDER",$message['mail_replyto']." (".$message['verfasser'].")");
|
||||
$this->app->Tpl->Set("NACHRICHT_RECIPIENTS",$message['mail']);
|
||||
$this->app->Tpl->Set("NACHRICHT_CC_RECIPIENTS",$message['mail_cc']);
|
||||
$this->app->Tpl->Set("NACHRICHT_FLOAT","right");
|
||||
$this->app->Tpl->Set("NACHRICHT_ZEIT",$message['zeitausgang']);
|
||||
$this->app->Tpl->Set("NACHRICHT_NAME",$message['verfasser']);
|
||||
} else {
|
||||
$this->app->Tpl->Set("NACHRICHT_SENDER",$message['mail']." (".$message['verfasser'].")");
|
||||
$this->app->Tpl->Set("NACHRICHT_RECIPIENTS",$message['mail_recipients']);
|
||||
$this->app->Tpl->Set("NACHRICHT_CC_RECIPIENTS",$message['mail_cc_recipients']);
|
||||
$this->app->Tpl->Set("NACHRICHT_BETREFF",$message['betreff']);
|
||||
$this->app->Tpl->Set("NACHRICHT_RICHTUNG","Von");
|
||||
$this->app->Tpl->Set("NACHRICHT_FLOAT","left");
|
||||
$this->app->Tpl->Set("NACHRICHT_ZEIT",$message['zeit']);
|
||||
}
|
||||
|
||||
$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->Set('NACHRICHT_ANHANG',"");
|
||||
@ -519,6 +537,7 @@ class Ticket {
|
||||
|
||||
// Get all messsages
|
||||
$messages = $this->get_messages_of_ticket($id, 1, NULL);
|
||||
$recv_messages = $this->get_messages_of_ticket($id,"n.versendet != 1",NULL);
|
||||
|
||||
switch ($submit) {
|
||||
case 'neue_email':
|
||||
@ -526,8 +545,13 @@ class Ticket {
|
||||
if (empty($drafted_messages)) {
|
||||
// Create new message and save it for editing
|
||||
|
||||
$recv_messages = $this->get_messages_of_ticket($id,"n.versendet != 1",NULL);
|
||||
$this->app->Tpl->Set('EMAIL_AN', $recv_messages[0]['mail']);
|
||||
|
||||
$senderName = $this->app->User->GetName()." (".$this->app->erp->GetFirmaAbsender().")";
|
||||
$senderAddress = $this->app->erp->GetFirmaMail();
|
||||
|
||||
$to = $recv_messages[0]['mail'];
|
||||
$cc = "";
|
||||
|
||||
if (!empty($recv_messages)) {
|
||||
if (!str_starts_with(strtoupper($recv_messages[0]['betreff']),"RE:")) {
|
||||
@ -536,6 +560,11 @@ class Ticket {
|
||||
else {
|
||||
$betreff = $recv_messages[0]['betreff'];
|
||||
}
|
||||
|
||||
$sql = "SELECT GROUP_CONCAT(DISTINCT `value` ORDER BY `value` SEPARATOR ', ') FROM ticket_header th WHERE th.ticket_nachricht = ".$recv_messages[0]['id']." AND `value` <> '".$senderAddress."' AND type='to'";
|
||||
$to .= ", ".$this->app->DB->Select($sql);
|
||||
$sql = "SELECT GROUP_CONCAT(DISTINCT `value` ORDER BY `value` SEPARATOR ', ') FROM ticket_header th WHERE th.ticket_nachricht = ".$recv_messages[0]['id']." AND `value` <> '".$senderAddress."' AND type='cc'";
|
||||
$cc = $this->app->DB->Select($sql);
|
||||
}
|
||||
else {
|
||||
$betreff = $result[0]['betreff'];
|
||||
@ -547,20 +576,17 @@ class Ticket {
|
||||
$anschreiben = $this->app->erp->Beschriftung("dokument_anschreiben").",\n".$this->app->erp->Grussformel($projekt,$sprache);
|
||||
}
|
||||
|
||||
$senderName = $this->app->User->GetName()." (".$this->app->erp->GetFirmaAbsender().")";
|
||||
$senderAddress = $this->app->erp->GetFirmaMail();
|
||||
|
||||
$sql = "INSERT INTO `ticket_nachricht` (
|
||||
`ticket`, `zeit`, `text`, `betreff`, `medium`, `versendet`,
|
||||
`verfasser`, `mail`,`status`, `verfasser_replyto`, `mail_replyto`
|
||||
) VALUES ('".$result[0]['schluessel']."',NOW(),'".$anschreiben."','".$betreff."','email','1','','".$recv_messages[0]['mail']."','neu','".$senderName."','".$senderAddress."');";
|
||||
`verfasser`, `mail`,`status`, `verfasser_replyto`, `mail_replyto`,`mail_cc`
|
||||
) VALUES ('".$result[0]['schluessel']."',NOW(),'".$anschreiben."','".$betreff."','email','1','".$senderName."','".$to."','neu','".$senderName."','".$senderAddress."','".$cc."');";
|
||||
|
||||
$this->app->DB->Insert($sql);
|
||||
// Show new message dialog
|
||||
header("Location: index.php?module=ticket&action=edit&id=$id");
|
||||
$this->app->ExitXentral();
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case 'entwurfloeschen':
|
||||
if (!empty($drafted_messages)) {
|
||||
$sql = "UPDATE ticket_nachricht SET ticket = '' WHERE id=".$drafted_messages[0]['id'];
|
||||
@ -570,12 +596,22 @@ class Ticket {
|
||||
$this->app->ExitXentral();
|
||||
}
|
||||
break;
|
||||
case 'zitat':
|
||||
if (!empty($drafted_messages) && !empty($recv_messages)) {
|
||||
$sql = "UPDATE ticket_nachricht SET text='".$drafted_messages[0]['text']."--------------------<br />".$recv_messages[0]['verfasser']." <".$recv_messages[0]['mail']."> (".$recv_messages[0]['zeit']."): <br />".$recv_messages[0]['text']."' WHERE id=".$drafted_messages[0]['id'];
|
||||
$this->app->DB->Update($sql);
|
||||
header("Location: index.php?module=ticket&action=edit&id=$id");
|
||||
$this->app->ExitXentral();
|
||||
}
|
||||
break;
|
||||
case 'absenden':
|
||||
|
||||
if (empty($drafted_messages)) {
|
||||
break;
|
||||
}
|
||||
|
||||
$msg = "";
|
||||
|
||||
// Enforce Ticket #
|
||||
if (!preg_match("/Ticket #[0-9]{12}/i", $drafted_messages[0]['betreff'])) {
|
||||
$drafted_messages[0]['betreff'].= " Ticket #".$result[0]['schluessel'];
|
||||
@ -587,6 +623,8 @@ class Ticket {
|
||||
foreach ($files as $file) {
|
||||
$msg .= $file."<br>";
|
||||
}
|
||||
|
||||
$cc = explode(',',$drafted_messages[0]['mail_cc']);
|
||||
|
||||
if (
|
||||
$this->app->erp->MailSend(
|
||||
@ -597,7 +635,9 @@ class Ticket {
|
||||
$drafted_messages[0]['betreff'],
|
||||
$drafted_messages[0]['text'],
|
||||
$files,
|
||||
0,false,'','',
|
||||
0,false,
|
||||
$cc,
|
||||
'',
|
||||
true
|
||||
) != 0
|
||||
) {
|
||||
@ -606,7 +646,14 @@ class Ticket {
|
||||
$sql = "UPDATE `ticket_nachricht` SET `zeitausgang` = NOW(), `betreff` = '".$drafted_messages[0]['betreff']."' WHERE id = ".$drafted_messages[0]['id'];
|
||||
$this->app->DB->Insert($sql);
|
||||
|
||||
$msg .= '<div class="info">Die E-Mail wurde erfolgreich versendet an '.$input['email_an'].'. '.$this->app->erp->mail_error.'</div>';
|
||||
$msg .= '<div class="info">Die E-Mail wurde erfolgreich versendet an '.$input['email_an'].'.';
|
||||
|
||||
if ($drafted_messages[0]['mail_cc'] != '') {
|
||||
$msg .= ' (CC: '.$drafted_messages[0]['mail_cc'].')</div>';
|
||||
}
|
||||
else {
|
||||
$msg .= '</div>';
|
||||
}
|
||||
header("Location: index.php?module=ticket&action=edit&id=".$id."&msg=".$this->app->erp->base64_url_encode($msg));
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user