mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-14 20:17:14 +01:00
Ticket sending works now, attachments tbd
This commit is contained in:
parent
eed061776a
commit
b5caed416a
@ -147,7 +147,7 @@ class TicketImportHelper
|
||||
`status` = 'neu',
|
||||
`zugewiesen` = '0',
|
||||
`inbearbeitung` = '0'
|
||||
WHERE `schluessel` = '".$ticket_number."'";
|
||||
WHERE `schluessel` LIKE '".$ticketNumber."'";
|
||||
$this->db->Update($sql);
|
||||
}
|
||||
|
||||
@ -509,7 +509,7 @@ class TicketImportHelper
|
||||
$subject,
|
||||
$fromname,
|
||||
$from,
|
||||
'Neu', // ?
|
||||
'neu',
|
||||
$fromname,
|
||||
$from
|
||||
);
|
||||
|
@ -18,15 +18,13 @@
|
||||
<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>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<tr><td>{|Betreff|}:</td><td>[BETREFF]</td></tr>
|
||||
<tr><td>{|Zeit|}:</td><td>[ZEIT]</td></tr>
|
||||
<tr><td>{|Von|}:</td><td>[KUNDE] <[MAILADRESSE]></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" value="[TAGS]" size="20"></td></tr>
|
||||
</table>
|
||||
<legend>{|[STATUSICON]<b>Ticket <font color="blue">#[SCHLUESSEL]</font></b>|}</legend>
|
||||
<tr><td>{|Betreff|}:</td><td>[BETREFF]</td></tr>
|
||||
<tr><td>{|Zeit|}:</td><td>[ZEIT]</td></tr>
|
||||
<tr><td>{|Von|}:</td><td>[KUNDE] <[MAILADRESSE]></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" value="[TAGS]" size="20"></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
@ -35,10 +33,10 @@
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<tr><td>{|Status|}:</td><td><input type="text" name="status" value="[STATUS]" size="20"></td></tr>
|
||||
<tr><td>{|Verantwortlich|}:</td><td><input type="text" name="warteschlange" id="warteschlange" value="[WARTESCHLANGE]" size="20"></td></tr>
|
||||
<tr><td>{|Prio|}:</td><td><input type="text" name="prio" value="[PRIO]" size="20"></td></tr>
|
||||
<tr><td>{|Notiz|}:</td><td><textarea name="notiz" id="notiz" rows="6" style="width:100%;">[NOTIZ]</textarea></td></tr>
|
||||
<tr><td>{|Status|}:</td><td><select name="status">[STATUS]</select></td></tr>
|
||||
<tr><td>{|Verantwortlich|}:</td><td><input type="text" name="warteschlange" id="warteschlange" value="[WARTESCHLANGE]" size="20"></td></tr>
|
||||
<tr><td>{|Prio|}:</td><td><input type="text" name="prio" value="[PRIO]" size="20"></td></tr>
|
||||
<tr><td>{|Notiz|}:</td><td><textarea name="notiz" id="notiz" rows="6" style="width:100%;">[NOTIZ]</textarea></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
@ -48,37 +46,24 @@
|
||||
<fieldset>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<legend>{|Aktionen|}</legend>
|
||||
<td><input type="submit" name="submit" value="Speichern" style="float:right"/></td></tr>
|
||||
<td><button name="submit" value="speichern" class="ui-button-icon" style="width:100%;">Speichern</button></td></tr>
|
||||
<td><button name="submit" value="neue_email" class="ui-button-icon" style="width:100%;">Neue E-Mail</button></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
[NEW_MESSAGE]
|
||||
</form>
|
||||
[MESSAGES]
|
||||
</div>
|
||||
<!-- Example for 2nd tab
|
||||
<div id="tabs-2">
|
||||
[MESSAGE]
|
||||
<form action="" method="post">
|
||||
[FORMHANDLEREVENT]
|
||||
<div class="row">
|
||||
<div class="row-height">
|
||||
<div class="col-xs-12 col-md-12 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<legend>{|...|}</legend>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
...
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
|
||||
<form id="respond" action = "index.php">
|
||||
<input type="text" name="module" value="ticket" style="display:none">
|
||||
<input type="text" name="action" value="respond" style="display:none">
|
||||
<input type="text" name="id" value="[ID]" style="display:none">
|
||||
</form>
|
||||
|
||||
|
||||
|
79
www/pages/content/ticket_new_message.tpl
Normal file
79
www/pages/content/ticket_new_message.tpl
Normal file
@ -0,0 +1,79 @@
|
||||
<div class="row">
|
||||
<div class="row-height">
|
||||
<div class="col-xs-12 col-md-12 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>Von:</td>
|
||||
<td><select name="email_sender" style="min-width: 500px;">[EMAIL_SENDER]</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>An:</td>
|
||||
<td><input type="text" name="email_an" id="email_an" value="[EMAIL_AN]" id="an" style="width: 500px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>CC:</td>
|
||||
<td><input type="text" id="email_cc" name="email_cc" value="[EMAIL_CC]" id="cc" style="width: 500px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>BCC:</td>
|
||||
<td><input type="text" id="email_bcc" name="email_bcc" value="[EMAIL_BCC]" id="bcc" style="width: 500px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"><br></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Betreff:</td>
|
||||
<td><input type="text" name="email_betreff" value="[EMAIL_BETREFF]" style="width: 500px;"></td>
|
||||
</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>
|
||||
</tr>
|
||||
[ANHAENGEHERAUFLADEN]
|
||||
<tr>
|
||||
<td colspan="3"><br></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td>Anhänge:</td>
|
||||
<td>
|
||||
<table width="100%" class="mkTable" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<th width="20"></th>
|
||||
<th>Datei</th>
|
||||
<th width=20></th>
|
||||
</tr>
|
||||
[ANHAENGE]
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"><br></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<table width="100%" border="0" cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="bottom">
|
||||
<button name="submit" value="absenden" id="abesenden" class="ui-button-icon">Absenden</button>
|
||||
[DATEIENBUTTON]
|
||||
</td>
|
||||
<td align="right" valign="bottom">
|
||||
<button name="submit" value="abbruch" id="abbruch" class="ui-button-icon">Abbrechen</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -46,7 +46,7 @@ class Ticket {
|
||||
$heading = array('','','Ticket #', 'Datum', 'Adresse', 'Betreff', 'Notiz', 'Tags', 'Verantwortlich', 'Anzahl Nachrichten', 'Status', 'Alter', 'Projekt', 'Menü');
|
||||
$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.nachrichten_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', '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.status', 't.projekt');
|
||||
|
||||
$defaultorder = 1;
|
||||
@ -63,7 +63,7 @@ class Ticket {
|
||||
|
||||
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',t.id,'\" />') AS `auswahl`";
|
||||
|
||||
$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, (SELECT COUNT(n.id) FROM ticket_nachricht n WHERE n.ticket = t.schluessel) as nachrichten_anz, ".ticket_iconssql().", ".$timedifference.", p.abkuerzung, t.id
|
||||
FROM ticket t
|
||||
LEFT JOIN adresse a ON t.adresse = a.id
|
||||
LEFT JOIN warteschlangen w ON t.warteschlange = w.label
|
||||
@ -125,6 +125,7 @@ class Ticket {
|
||||
$id = 'NULL';
|
||||
}
|
||||
|
||||
// Always save
|
||||
if ($submit != '')
|
||||
{
|
||||
|
||||
@ -143,16 +144,14 @@ class Ticket {
|
||||
$fix = "";
|
||||
|
||||
foreach ($input as $key => $value) {
|
||||
|
||||
if ($this->app->DB->ColumnExists('ticket',$key)) {
|
||||
$columns = $columns.$fix.$key;
|
||||
$values = $values.$fix."'".$value."'";
|
||||
$update = $update.$fix.$key." = '$value'";
|
||||
|
||||
$fix = ", ";
|
||||
}
|
||||
|
||||
// echo($columns."<br>");
|
||||
// echo($values."<br>");
|
||||
// echo($update."<br>");
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO ticket (".$columns.") VALUES (".$values.") ON DUPLICATE KEY UPDATE ".$update;
|
||||
|
||||
@ -162,40 +161,112 @@ class Ticket {
|
||||
$msg = $this->app->erp->base64_url_encode("<div class=\"success\">Das Element wurde erfolgreich angelegt.</div>");
|
||||
header("Location: index.php?module=ticket&action=list&msg=$msg");
|
||||
} else {
|
||||
$this->app->Tpl->Set('MESSAGE', "<div class=\"success\">Die Einstellungen wurden erfolgreich übernommen.</div>");
|
||||
$msg = "<div class=\"success\">Die Einstellungen wurden erfolgreich übernommen.</div>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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, 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) {
|
||||
$this->app->Tpl->Set(strtoupper($key), $value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Add displayed items later
|
||||
*
|
||||
|
||||
$this->app->Tpl->Add('KURZUEBERSCHRIFT2', $email);
|
||||
$this->app->Tpl->Add('EMAIL', $email);
|
||||
$this->app->Tpl->Add('ANGEZEIGTERNAME', $angezeigtername);
|
||||
*/
|
||||
|
||||
$this->app->Tpl->Set('STATUSICON', $this->ticket_status_icon($result[0]['status'])." ");
|
||||
$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);
|
||||
$this->app->YUI->AutoComplete("status","ticketstatus",1);
|
||||
|
||||
$this->app->Tpl->Set('STATUS', $this->app->erp->GetStatusTicketSelect($result[0]['status']));
|
||||
$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
|
||||
|
||||
// Get messsages
|
||||
$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");
|
||||
|
||||
switch ($submit) {
|
||||
case 'neue_email':
|
||||
// Show new message dialog?
|
||||
$msg = ""; // Suppress save message
|
||||
|
||||
$recv_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." AND n.versendet != 1 ORDER BY n.zeit DESC");
|
||||
$this->app->Tpl->Set('EMAIL_AN', $recv_messages[0]['mail']);
|
||||
|
||||
$this->app->Tpl->Set('EMAIL_BETREFF', "RE: ".$messages[0]['betreff']);
|
||||
$this->app->Tpl->Set('EMAIL_SENDER', $this->app->erp->GetSelectEmailMitName($dokument['von']));
|
||||
|
||||
$anschreiben = $this->app->DB->Select("SELECT anschreiben FROM adresse WHERE id='".$result[0]['adresse']."' LIMIT 1");
|
||||
|
||||
if($anschreiben=="")
|
||||
{
|
||||
$anschreiben = $this->app->erp->Beschriftung("dokument_anschreiben");
|
||||
}
|
||||
|
||||
$this->app->Tpl->Set('EMAIL_TEXT',$anschreiben.",\n".$this->app->erp->Grussformel($projekt,$sprache));;
|
||||
|
||||
$this->app->YUI->AutoComplete("email_an","emailname");
|
||||
$this->app->YUI->AutoComplete("email_cc","emailname");
|
||||
$this->app->YUI->AutoComplete("email_bcc","emailname");
|
||||
$this->app->YUI->CkEditor("email_text","internal", null, 'JQUERY');
|
||||
$this->app->Tpl->Parse('NEW_MESSAGE', "ticket_new_message.tpl");
|
||||
break;
|
||||
case 'absenden':
|
||||
|
||||
$senderName = $this->app->User->GetName()." (".$this->app->erp->GetFirmaAbsender().")";
|
||||
$senderAddress = $this->app->erp->GetFirmaMail();
|
||||
|
||||
// Enforce Ticket #
|
||||
if (!preg_match("/Ticket #[0-9]{12}/i", $input['email_betreff'])) {
|
||||
$input['email_betreff'].= " Ticket #".$result[0]['schluessel'];
|
||||
}
|
||||
|
||||
|
||||
if (
|
||||
$this->app->erp->MailSend(
|
||||
$senderAddress,
|
||||
$senderName,
|
||||
$input['email_an'],
|
||||
$input['email_an'],
|
||||
$input['email_betreff'],
|
||||
$input['email_text'],
|
||||
'',0,false,'','',
|
||||
true
|
||||
) != 0
|
||||
) {
|
||||
$msg = '<div class="info">Die E-Mail wurde erfolgreich versendet an '.$input['email_an'].'. '.$this->app->erp->mail_error.'</div>';
|
||||
|
||||
// Put message into ticket_nachricht
|
||||
$sql = "INSERT INTO `ticket_nachricht` (
|
||||
`ticket`, `zeit`, `text`, `betreff`, `medium`, `versendet`,
|
||||
`verfasser`, `mail`,`status`, `verfasser_replyto`, `mail_replyto`
|
||||
) VALUES (
|
||||
'".$result[0]['schluessel']."',
|
||||
NOW(),
|
||||
'".$input['email_text']."',
|
||||
'".$input['email_betreff']."',
|
||||
'".'email'."',
|
||||
'1',
|
||||
'".$senderName."',
|
||||
'".$senderAddress."',
|
||||
'gesendet',
|
||||
'".$senderName."',
|
||||
'".$senderAddress."');";
|
||||
|
||||
$this->app->DB->Insert($sql);
|
||||
|
||||
}
|
||||
else {
|
||||
$msg = '<div class="error">Fehler beim Versenden der E-Mail: '.$this->app->erp->mail_error.'</div>';
|
||||
}
|
||||
|
||||
// Get messsages again
|
||||
$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");
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// Add Messages now
|
||||
foreach ($messages as $message) {
|
||||
$this->app->Tpl->Set("NACHRICHT_BETREFF",$message['betreff']);
|
||||
$this->app->Tpl->Set("NACHRICHT_ZEIT",$message['zeit']);
|
||||
@ -212,6 +283,7 @@ class Ticket {
|
||||
$this->app->Tpl->Parse('MESSAGES', "ticket_nachricht.tpl");
|
||||
}
|
||||
|
||||
$this->app->Tpl->Set('MESSAGE', $msg);
|
||||
$this->app->Tpl->Parse('PAGE', "ticket_edit.tpl");
|
||||
}
|
||||
|
||||
@ -229,6 +301,14 @@ class Ticket {
|
||||
$input['prio'] = $this->app->Secure->GetPOST('prio');
|
||||
$input['notiz'] = $this->app->Secure->GetPOST('notiz');
|
||||
$input['tags'] = $this->app->Secure->GetPOST('tags');
|
||||
|
||||
$input['email_sender'] = $this->app->Secure->GetPOST('email_sender');
|
||||
$input['email_an'] = $this->app->Secure->GetPOST('email_an');
|
||||
$input['email_cc'] = $this->app->Secure->GetPOST('email_cc');
|
||||
$input['email_bcc'] = $this->app->Secure->GetPOST('email_bcc');
|
||||
$input['email_betreff'] = $this->app->Secure->GetPOST('email_betreff');
|
||||
$input['email_text'] = $this->app->Secure->GetPOST('email_text');
|
||||
|
||||
return $input;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user