Ticket system filters, notiz adding, time of last action

This commit is contained in:
Xenomporio 2022-07-31 18:23:43 +02:00
parent 3c540cf48a
commit 11f9e7e24e
4 changed files with 128 additions and 18 deletions

View File

@ -147,7 +147,8 @@ class TicketImportHelper
$sql = "UPDATE `ticket` SET
`status` = 'neu',
`zugewiesen` = '0',
`inbearbeitung` = '0'
`inbearbeitung` = '0',
`zeit` = now()
WHERE `schluessel` LIKE '".$ticketNumber."'";
$this->db->Update($sql);
}

View File

@ -20,7 +20,7 @@
<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>{|Zeit|}:</td><td>[ZEIT]</td></tr>
<tr><td>{|Letzte Aktion|}:</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>
@ -36,7 +36,8 @@
<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="checkbox" name="prio" id="prio" value="1" [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>{|Neue Notiz|}:</td><td><textarea name="neue_notiz" id="neue_notiz" rows="1" style="width:100%;"></textarea></td></tr>
<tr><td>{|Notizen|}:</td><td><textarea name="notiz" id="notiz" rows="6" style="width:100%;">[NOTIZ]</textarea></td></tr>
</table>
</fieldset>
</div>

View File

@ -1,5 +1,49 @@
<div id="tabs-1">
[MESSAGE]
[TAB1]
[TAB1NEXT]
<div id="tabs">
<ul>
<li><a href="#tabs-1">[TABTEXT1]</a></li>
[VORTABS2UEBERSCHRIFT]<li><a href="#tabs-2">[TABTEXT2]</a></li>[NACHTABS2UEBERSCHRIFT]
</ul>
<div id="tabs-1">
[MESSAGE]
<form action="#tabs-1" id="frmauto" name="frmauto" method="post">
<div class="filter-box filter-usersave">
<div class="filter-block filter-inline">
<div class="filter-title">{|Filter|}</div>
<ul class="filter-list">
[STATUSFILTER]
<li class="filter-item">
<label for="meinetickets" class="switch">
<input type="checkbox" id="meinetickets">
<span class="slider round"></span>
</label>
<label for="meinetickets">{|Meine|}</label>
</li>
<li class="filter-item">
<label for="prio" class="switch">
<input type="checkbox" id="prio">
<span class="slider round"></span>
</label>
<label for="prio">{|Prio|}</label>
</li>
<li class="filter-item">
<label for="geschlossene" class="switch">
<input type="checkbox" id="geschlossene">
<span class="slider round"></span>
</label>
<label for="geschlossene">{|+Geschlossene|}</label>
</li>
<li class="filter-item">
<label for="archiv" class="switch">
<input type="checkbox" id="archiv">
<span class="slider round"></span>
</label>
<label for="archiv">{|+&Auml;lter als 1 Jahr|}</label>
</li>
</ul>
</div>
</div>
</form>
[TAB1]
[TAB1NEXT]
</div>
</div>

View File

@ -32,7 +32,7 @@ class Ticket {
}
static function TableSearch(&$app, $name, $erlaubtevars) {
public function TableSearch(&$app, $name, $erlaubtevars) {
function ticket_iconssql() {
@ -43,7 +43,7 @@ class Ticket {
switch ($name) {
case "ticket_list":
$allowed['ticket_list'] = array('list');
$heading = array('','','Ticket #', 'Datum', 'Adresse', 'Betreff', 'Notiz', 'Tags', 'Verantwortlich', 'Nachr.', 'Status', 'Alter', 'Projekt', 'Men&uuml;');
$heading = array('','','Ticket #', 'Letzte Aktion', 'Adresse', 'Betreff', 'Notizen', 'Tags', 'Verantwortlich', 'Nachr.', 'Status', 'Alter', 'Projekt', 'Men&uuml;');
$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', 'nachrichten_anz', 't.status', 't.projekt');
@ -56,10 +56,9 @@ class Ticket {
$timedifference = "if (
TIMESTAMPDIFF(hour, t.zeit, curdate()) < 24,
CONCAT(TIMESTAMPDIFF(hour, t.zeit, curdate()), 'h '),
CONCAT(
TIMESTAMPDIFF(day, t.zeit, curdate()), 'd ',MOD(TIMESTAMPDIFF(hour, t.zeit, curdate()), 24), 'h'))";
TIMESTAMPDIFF(hour, t.zeit, NOW()) < 24,
CONCAT(TIMESTAMPDIFF(hour, t.zeit, NOW()),'h'),
CONCAT(TIMESTAMPDIFF(day, t.zeit, NOW()), 'd ',MOD(TIMESTAMPDIFF(hour, t.zeit, NOW()),24),'h'))";
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',t.id,'\" />') AS `auswahl`";
@ -67,7 +66,7 @@ class Ticket {
$anzahlnachrichten = "(SELECT COUNT(n.id) FROM ticket_nachricht n WHERE n.ticket = t.schluessel)";
$sql = "SELECT t.id,".$dropnbox.", t.schluessel, t.zeit, a.name, ".$priobetreff.", t.notiz, t.tags, w.warteschlange, ".$anzahlnachrichten." as nachrichten_anz, ".ticket_iconssql().", ".$timedifference.", p.abkuerzung, t.id
$sql = "SELECT t.id,".$dropnbox.", t.schluessel, t.zeit, a.name, ".$priobetreff.", replace(substring(t.notiz,1,500),'\n','<br/>'), t.tags, w.warteschlange, ".$anzahlnachrichten." 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
@ -75,10 +74,66 @@ class Ticket {
$where = "1";
// Toggle filters
$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 ); } );");
for ($r = 1;$r <= 4;$r++) {
$this->app->Tpl->Add('JAVASCRIPT', '
function fnFilterColumn' . $r . ' ( i )
{
if(oMoreData' . $r . $name . '==1)
oMoreData' . $r . $name . ' = 0;
else
oMoreData' . $r . $name . ' = 1;
$(\'#' . $name . '\').dataTable().fnFilter(
\'\',
i,
0,0
);
}
');
}
$more_data1 = $this->app->Secure->GetGET("more_data1");
if ($more_data1 == 1) {
$where .= " AND t.warteschlange IN (SELECT w.label FROM warteschlangen w WHERE adresse=".$this->app->User->GetAdresse().")"; // Queues of user
} else {
}
$more_data2 = $this->app->Secure->GetGET("more_data2");
if ($more_data2 == 1) {
$where .= " AND t.prio = '1'";
}
else {
}
$more_data3 = $this->app->Secure->GetGET("more_data3");
if ($more_data3 == 1) {
}
else {
$where .= " AND (t.status <> 'abgeschlossen' AND t.status <> 'spam')"; // Exclude papierkorb and geschlossen
}
$more_data4 = $this->app->Secure->GetGET("more_data4");
if ($more_data4 == 1) {
}
else {
$where .= " AND timestampdiff(DAY,t.zeit,NOW()) < 365";
}
// END Toggle filters
$moreinfo = true; // Allow drop down details
$menucol = 13; // For moredata
$count = "SELECT count(DISTINCT id) FROM ticket WHERE $where";
$count = "SELECT count(DISTINCT id) FROM ticket t WHERE $where";
// echo(htmlentities($sql." ".$where));
// $groupby = "";
break;
@ -215,9 +270,14 @@ class Ticket {
$id = 'NULL';
}
if ($input['betreff'] == '') {
$input['betreff'] = "...";
}
$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
$input['zeit'] = date('Y-m-d H:i:s', time());
$columns = "id, ";
$values = "$id, ";
@ -277,9 +337,8 @@ class Ticket {
if ($submit != '') {
$input['schluessel'] = $this->generateRandomTicketNumber();
$input['zeit'] = date('Y-m-d H:i:s', time());
$input['kunde'] = $this->app->User->GetName();
$id = $this->ticket_save_to_db($id, $input);
header("Location: index.php?module=ticket&action=edit&id=$id");
@ -312,6 +371,10 @@ class Ticket {
$submit = $this->app->Secure->GetPOST('submit');
$msg = $this->app->erp->base64_url_decode($this->app->Secure->GetGET('msg'));
if ($input['neue_notiz'] != '') {
$input['notiz'] = $this->app->User->GetName()." ".date("d.m.Y H:i").": ".$input['neue_notiz']."\r\n".$input['notiz'];
}
// Always save
if ($submit != '')
{
@ -502,7 +565,7 @@ class Ticket {
}
// Get messsages again
$messages = $this->get_messages_of_ticket($id,1);
$messages = $this->get_messages_of_ticket($id,1,NULL);
break;
}
@ -525,6 +588,7 @@ class Ticket {
$input['adresse'] = $this->app->Secure->GetPOST('adresse');
$input['warteschlange'] = $this->app->Secure->GetPOST('warteschlange');
$input['prio'] = !empty($this->app->Secure->GetPOST('prio'))?"1":"0";
$input['neue_notiz'] = $this->app->Secure->GetPOST('neue_notiz');
$input['notiz'] = $this->app->Secure->GetPOST('notiz');
$input['tags'] = $this->app->Secure->GetPOST('tags');
$input['betreff'] = $this->app->Secure->GetPOST('betreff');