Pārlūkot izejas kodu

Versuch mit Tickets Basti

gc-server1 1 gadu atpakaļ
vecāks
revīzija
af7f1e9e6b
4 mainītis faili ar 50 papildinājumiem un 50 dzēšanām
  1. 13 3
      app/ImportController.php
  2. 29 30
      app/db.php
  3. 4 14
      app/views/overview.html
  4. 4 3
      app/views/tickets.html

+ 13 - 3
app/ImportController.php

@@ -107,6 +107,10 @@ class ImportController
 			$this->currentErrorCount = 0;
 			$header = imap_headerinfo($this->imap['connect'], $m);
 			$rec = explode(";", $header->Subject);
+			
+			if ($rec[0] == "=?iso-8859-1?Q?L=B3ckenotto") {
+				$rec[0] = "Lueckenotto";
+			}
 
 			if (count($rec) < 5) continue;
 			if (count($rec) < 6) {
@@ -134,9 +138,15 @@ class ImportController
 			}
 
 
-			if (!isset($customers[$rec[0]])) {
-				$this->dbh->query("INSERT INTO kunden (kunde, start_soll, ende_soll, erster_status, system) VALUES ('{$rec[0]}', '{$rec[1]}', '{$rec[2]}', '{$rec[3]}', '?')");
-				$customers[$rec[0]] = array();
+			if (!isset($this->customers[$rec[0]])) {
+				$this->dbh->query("INSERT INTO kunden (kunde) VALUES ('{$rec[0]}')");
+				$this->customers[$rec[0]] = array();
+			}
+
+			if (substr($rec[5], -4) == ".bat" && !isset($this->customers[$rec[0]][$rec[5]])) {
+				$this->dbh->query("INSERT INTO kunden_aufgabe (kunde,aufgabe,start_soll,ende_soll,erster_status) 
+											VALUES ('{$rec[0]}', '{$rec[5]}', '{$rec[1]}', '{$rec[2]}', '{$rec[3]}')");
+				$this->customers[$rec[0]][$rec[5]]['whitelist'] = false;
 			}
 
 			$ver = "";

+ 29 - 30
app/db.php

@@ -17,36 +17,33 @@ switch ($_REQUEST['a']) {
 		$datum = $_REQUEST['datum'];
 		$start = ($_REQUEST['start'] == "null") ? '00:00:00' : $_REQUEST['start'];
 
-		if (count($data) > 0) {
+		$q = $dbh->query("SELECT sm.*, k.whitelist FROM status_meldung sm
+						  INNER JOIN kunden k USING (kunde)
+						  WHERE sm.datum = '{$datum}' AND sm.kunde = '{$kunde}' AND sm.start = '{$start}' LIMIT 1");
+		$result = $q->fetch(PDO::FETCH_ASSOC);
+		if ($result) {
+			$result['fehlerbericht'] = str_replace("\r\`", "`", str_replace("\r\"", "\"", str_replace("\r\n", "", $result['fehlerbericht'])));
+			$fehlerbericht = json_decode($result['fehlerbericht'], true);
+			if ($fehlerbericht != "") {
+				$result['fehlerbericht'] = $fehlerbericht;
+			}
 
+			$result['whitelist'] = (isset($result['whitelist'])) ? json_decode(stripslashes($result['whitelist']), true) : null;
 		} else {
-			$q = $dbh->query("SELECT sm.*, k.whitelist FROM status_meldung sm
-			 				  INNER JOIN kunden k USING (kunde)
-							  WHERE sm.datum = '{$datum}' AND sm.kunde = '{$kunde}' AND sm.start = '{$start}' LIMIT 1");
-			$result = $q->fetch(PDO::FETCH_ASSOC);
-			if ($result) {
-				$result['fehlerbericht'] = str_replace("\r\`", "`", str_replace("\r\"", "\"", str_replace("\r\n", "", $result['fehlerbericht'])));
-				$fehlerbericht = json_decode($result['fehlerbericht'], true);
-				if ($fehlerbericht) {
-					$result['fehlerbericht'] = $fehlerbericht;
-				}
-
-				$result['whitelist'] = (isset($result['whitelist'])) ? json_decode(stripslashes($result['whitelist']), true) : null;
-			} else {
-				$result = array();
-			}
-			if (isset($result['kommentar_id']) && $result['kommentar_id'] > 0) {
-				$q = $dbh->query("SELECT sk.* FROM status_kommentar sk
-							      WHERE sk.id = '{$result['kommentar_id']}' ");
-				$comment = $q->fetch(PDO::FETCH_ASSOC);	
-			} else {
-				$q = $dbh->query("SELECT sk.* FROM status_kommentar sk
-							      WHERE sk.datum = '{$datum}' AND sk.kunde = '{$kunde}' AND sk.start = '{$start}' 
-								  ORDER BY cdate DESC LIMIT 1");
-				$comment = $q->fetch(PDO::FETCH_ASSOC);
-			}
-			$result['kommentar'] = ($comment) ? $comment : array();
+			$result = array();
 		}
+		if (isset($result['kommentar_id']) && $result['kommentar_id'] > 0) {
+			$q = $dbh->query("SELECT sk.* FROM status_kommentar sk
+							  WHERE sk.id = '{$result['kommentar_id']}' ");
+			$comment = $q->fetch(PDO::FETCH_ASSOC);	
+		} else {
+			$q = $dbh->query("SELECT sk.* FROM status_kommentar sk
+							  WHERE sk.datum = '{$datum}' AND sk.kunde = '{$kunde}' AND sk.start = '{$start}' 
+							  ORDER BY cdate DESC LIMIT 1");
+			$comment = $q->fetch(PDO::FETCH_ASSOC);
+		}
+		$result['kommentar'] = ($comment) ? $comment : array();
+
 		break;
 
 	case 'zeit':
@@ -119,7 +116,7 @@ switch ($_REQUEST['a']) {
 
 		break;
 	case 'kunden':
-		if (count($data) > 0) {
+		if ($data != null && count($data) > 0) {
 			foreach ($data as $kunde) {
 				if (isset($kunde['kunde'])) {
 					$q = $dbh->exec("UPDATE kunden SET system = '{$kunde['system']}', start_soll = '{$kunde['start_soll']}', ende_soll = '{$kunde['ende_soll']}',
@@ -137,7 +134,7 @@ switch ($_REQUEST['a']) {
 		break;
 
 	case 'tickets':
-		if (count($data) > 0) {
+		if ($data != null && count($data) > 0) {
 			if ($data['id'] == '') {
 				$q = $dbh->exec("INSERT INTO tickets (datum, benutzer, kunde, kontakt, beschreibung, termin, dauer, status, prioritaet, fortschritt, kategorie, programm, kommentar)
 									VALUES ('{$data['datum']}', '{$data['benutzer']}', '{$data['kunde']}', '{$data['kontakt']}', '{$data['beschreibung']}', '{$data['termin']}', '{$data['dauer']}',
@@ -152,6 +149,7 @@ switch ($_REQUEST['a']) {
 		}
 		$q = $dbh->query("SELECT * FROM tickets");
 		$result = $q->fetchAll(PDO::FETCH_ASSOC);
+		//print_r($result);
 		break;
 
 	case 'config':
@@ -180,7 +178,7 @@ switch ($_REQUEST['a']) {
 	case 'kommentar':
 		$id = (isset($_REQUEST['id']) && $_REQUEST['id'] != "undefined") ? $_REQUEST['id'] : '';
 
-		if (count($data) > 0) {
+		if ($data != null && count($data) > 0) {
 			if ($id == '') {
 				$now = date('Y-m-d H:i:s');
 				$q = $dbh->exec("INSERT INTO status_kommentar (kunde, datum, start, benutzer, fehler, status, kommentar, cdate)
@@ -257,4 +255,5 @@ switch ($_REQUEST['a']) {
 		}
 }
 echo json_encode($result); 
+// print_r($result);
 // echo json_last_error();

+ 4 - 14
app/views/overview.html

@@ -42,8 +42,8 @@
         <th>Kommentar</th>
     </tr>
     <tr>
-        <td>
-        </td>
+        <td></td>
+		<td></td>
         <td>
             <div class="dropdown">
                 <a class="btn dropdown-toggle" role="button" data-toggle="dropdown">{{Filter.system||'alle'}}&nbsp;<b class="caret"></b></a>
@@ -55,7 +55,6 @@
             </div>
         </td>
         <td></td>
-        <td></td>
         <td>
             <div class="dropdown">
                 <a class="btn dropdown-toggle" role="button" data-toggle="dropdown">{{domain.fehlend[Filter.fehlend]||'alle'}}&nbsp;<b class="caret"></b></a>
@@ -91,18 +90,9 @@
 
     <tr ng-repeat="zeile in overview | filter:DatumFilter.datum | filter:Filter | orderBy:Predicate:Reverse" ng-class="{'danger':zeile.fehlend==1}">
         <td>{{dateFormat(zeile.datum)}}</td>
-        <td><span class="label label-danger label-{{zeile.system}}">{{left(zeile.system, 1)}}</span> <a ng-href="#/overview/{{zeile.kunde}}/all/all">{{zeile.kunde}}</a> {{zeile.aufgabe}}</td>
+        <td><a ng-href="#/overview/{{zeile.kunde}}/all/all">{{zeile.kunde}}</a> {{zeile.aufgabe}}</td>
         <td>
-            <a href="file:///v:/Kunden/{{zeile.kunde}}/" target="_blank">
-                <button type="button" class="btn btn-default" title="Verzeichnis">
-                    <span class="glyphicon glyphicon-folder-open"></span>
-                </button>
-            </a>
-            <a href="file:///v:/Kunden/{{zeile.kunde}}/Dokumente/Installationsdaten_{{zeile.kunde}}.xlsx" target="_blank">
-                <button type="button" class="btn btn-default" title="Installationsdaten">
-                    <span class="glyphicon glyphicon-wrench"></span>
-                </button>
-            </a>
+            <span class="label label-danger label-{{zeile.system}}">{{zeile.system}}</span>
         </td>
         <td>{{zeile.start_soll}}<br/>{{zeile.ende_soll}}</td>
         <td>

+ 4 - 3
app/views/tickets.html

@@ -12,7 +12,8 @@
         <th style="width: 250px;">Kommentar</th>
         <th style="width: 150px;">Dauer/ Fortschritt</th>
     </tr>
-    <!--
+
+	<!--
     <tr>
         <td><input ng-model="Filter.kunde"/></td>
         <td>
@@ -62,8 +63,8 @@
         <td></td>
         <td></td>
     </tr>
--->
-    <tr ng-repeat="zeile in tickets | filter:Filter">
+	-->
+    <tr ng-repeat="zeile in tickets"> <!-- | filter:Filter">-->
         <td><span class="glyphicon {{domain.statusicon[zeile.status]}}"></span>&nbsp; {{domain.status[zeile.status]}}</td>
         <td><span class="glyphicon {{domain.prioritaeticon[zeile.prioritaet]}}"></span>&nbsp; {{domain.prioritaet[zeile.prioritaet]}}</td>
         <td>{{zeile.benutzer}}</td>