Passed
Push — master ( 1680cc...8dd1b9 )
by Saepul
02:16
created
ticketlist.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@  discard block
 block discarded – undo
3 3
 $general->logged_out_protect();
4 4
 $user = $users->userdata($_SESSION['loginid']);
5 5
 if ($user['level'] == 'Admin' || $user['level'] == 'Manager') {
6
-    $akses = true;
6
+	$akses = true;
7 7
 } else {
8
-    $akses = false;
8
+	$akses = false;
9 9
 }
10 10
 if ($akses = false) {
11
-    exit("You don't have permission to access this page!");
11
+	exit("You don't have permission to access this page!");
12 12
 }
13 13
 $ticket_list = $tickets->get_tickets();
14 14
 $tickets_count = count($ticket_list);
@@ -70,35 +70,35 @@  discard block
 block discarded – undo
70 70
     </thead>
71 71
     <tbody>
72 72
 		<?php 
73
-        foreach ($ticket_list as $ticket) {
74
-            $sla = $slas->sla_data($ticket['sla']);
75
-            $documenteddate = $ticket['documenteddate'];
76
-            $resolutiontime = $sla['resolutiontime'];
77
-            $slawarning = $sla['slawarning'];
78
-            $slagoaltime = strtotime("+$resolutiontime hours", $documenteddate);
79
-            $slawarningtime = strtotime("+$slawarning hours", $documenteddate);
80
-            if ($currenttime > $slagoaltime) {
81
-                $slabgcolor = '#FF0000';
82
-                $slatxtcolor = '#ffffff';
83
-            } elseif ($currenttime >= $slawarningtime) {
84
-                $slabgcolor = '#FFFF00';
85
-                $slatxtcolor = '#000000';
86
-            } else {
87
-                $slabgcolor = '#00FF00';
88
-                $slatxtcolor = '#000000';
89
-            }
90
-            $user = $users->userdata($ticket['assignee']);
91
-            echo '<tr><td><a href=ticketedit.php?id='.$ticket['id'].'>'.$ticket['ticketnumber'].'</a></td>'.
92
-                 '<td style="background-color:'.$slabgcolor.';color:'.$slatxtcolor.';">'.$sla['namasla'].'</td>'.
93
-                 '<td>'.date('d-M-Y H:i:s', $slagoaltime).'</td>'.
94
-                 '<td>'.date('d-M-Y H:i:s', $ticket['reporteddate']).'</td>'.
95
-                 '<td>'.date('d-M-Y H:i:s', $ticket['documenteddate']).'</td>'.
96
-                 '<td>'.$ticket['problemsummary'].'</td>'.
97
-                 '<td>'.$ticket['ticketstatus'].'</td>'.
98
-                 '<td>'.$user['fullname'].'</td>'.
99
-                 '<td><a href=ticketdel.php?id='.$ticket['id'].' onclick="return delete_confirm();">del</a></td></tr>';
100
-        }
101
-        ?>
73
+		foreach ($ticket_list as $ticket) {
74
+			$sla = $slas->sla_data($ticket['sla']);
75
+			$documenteddate = $ticket['documenteddate'];
76
+			$resolutiontime = $sla['resolutiontime'];
77
+			$slawarning = $sla['slawarning'];
78
+			$slagoaltime = strtotime("+$resolutiontime hours", $documenteddate);
79
+			$slawarningtime = strtotime("+$slawarning hours", $documenteddate);
80
+			if ($currenttime > $slagoaltime) {
81
+				$slabgcolor = '#FF0000';
82
+				$slatxtcolor = '#ffffff';
83
+			} elseif ($currenttime >= $slawarningtime) {
84
+				$slabgcolor = '#FFFF00';
85
+				$slatxtcolor = '#000000';
86
+			} else {
87
+				$slabgcolor = '#00FF00';
88
+				$slatxtcolor = '#000000';
89
+			}
90
+			$user = $users->userdata($ticket['assignee']);
91
+			echo '<tr><td><a href=ticketedit.php?id='.$ticket['id'].'>'.$ticket['ticketnumber'].'</a></td>'.
92
+				 '<td style="background-color:'.$slabgcolor.';color:'.$slatxtcolor.';">'.$sla['namasla'].'</td>'.
93
+				 '<td>'.date('d-M-Y H:i:s', $slagoaltime).'</td>'.
94
+				 '<td>'.date('d-M-Y H:i:s', $ticket['reporteddate']).'</td>'.
95
+				 '<td>'.date('d-M-Y H:i:s', $ticket['documenteddate']).'</td>'.
96
+				 '<td>'.$ticket['problemsummary'].'</td>'.
97
+				 '<td>'.$ticket['ticketstatus'].'</td>'.
98
+				 '<td>'.$user['fullname'].'</td>'.
99
+				 '<td><a href=ticketdel.php?id='.$ticket['id'].' onclick="return delete_confirm();">del</a></td></tr>';
100
+		}
101
+		?>
102 102
     </tbody>
103 103
 	</table>
104 104
 	<p>&nbsp;</p>
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 $user = $users->userdata($_SESSION['loginid']);
6 6
 if ($user['level'] == 'Admin' || $user['level'] == 'Manager') {
7 7
     $akses = true;
8
-} else {
8
+}else {
9 9
     $akses = false;
10 10
 }
11 11
 if ($akses = false) {
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
             } elseif ($currenttime >= $slawarningtime) {
78 78
                 $slabgcolor = '#FFFF00';
79 79
                 $slatxtcolor = '#000000';
80
-            } else {
80
+            }else {
81 81
                 $slabgcolor = '#00FF00';
82 82
                 $slatxtcolor = '#000000';
83 83
             }
Please login to merge, or discard this patch.
core/classes/Tickets.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
         try {
33 33
             $query->execute();
34
-        } catch (PDOException $e) {
34
+        }catch (PDOException $e) {
35 35
             die($e->getMessage());
36 36
         }
37 37
     }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
         try {
63 63
             $query->execute();
64
-        } catch (PDOException $e) {
64
+        }catch (PDOException $e) {
65 65
             die($e->getMessage());
66 66
         }
67 67
     }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
         try {
76 76
             $query->execute();
77
-        } catch (PDOException $e) {
77
+        }catch (PDOException $e) {
78 78
             die($e->getMessage());
79 79
         }
80 80
     }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
             $query->execute();
89 89
 
90 90
             return $query->fetch();
91
-        } catch (PDOException $e) {
91
+        }catch (PDOException $e) {
92 92
             die($e->getMessage());
93 93
         }
94 94
     }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 
100 100
         try {
101 101
             $query->execute();
102
-        } catch (PDOException $e) {
102
+        }catch (PDOException $e) {
103 103
             die($e->getMessage());
104 104
         }
105 105
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
         try {
114 114
             $query->execute();
115
-        } catch (PDOException $e) {
115
+        }catch (PDOException $e) {
116 116
             die($e->getMessage());
117 117
         }
118 118
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
         try {
127 127
             $query->execute();
128
-        } catch (PDOException $e) {
128
+        }catch (PDOException $e) {
129 129
             die($e->getMessage());
130 130
         }
131 131
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 
140 140
         try {
141 141
             $query->execute();
142
-        } catch (PDOException $e) {
142
+        }catch (PDOException $e) {
143 143
             die($e->getMessage());
144 144
         }
145 145
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 
154 154
         try {
155 155
             $query->execute();
156
-        } catch (PDOException $e) {
156
+        }catch (PDOException $e) {
157 157
             die($e->getMessage());
158 158
         }
159 159
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 
168 168
         try {
169 169
             $query->execute();
170
-        } catch (PDOException $e) {
170
+        }catch (PDOException $e) {
171 171
             die($e->getMessage());
172 172
         }
173 173
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 
183 183
         try {
184 184
             $query->execute();
185
-        } catch (PDOException $e) {
185
+        }catch (PDOException $e) {
186 186
             die($e->getMessage());
187 187
         }
188 188
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 
197 197
         try {
198 198
             $query->execute();
199
-        } catch (PDOException $e) {
199
+        }catch (PDOException $e) {
200 200
             die($e->getMessage());
201 201
         }
202 202
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 
212 212
         try {
213 213
             $query->execute();
214
-        } catch (PDOException $e) {
214
+        }catch (PDOException $e) {
215 215
             die($e->getMessage());
216 216
         }
217 217
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 
225 225
         try {
226 226
             $query->execute();
227
-        } catch (PDOException $e) {
227
+        }catch (PDOException $e) {
228 228
             die($e->getMessage());
229 229
         }
230 230
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 
239 239
         try {
240 240
             $query->execute();
241
-        } catch (PDOException $e) {
241
+        }catch (PDOException $e) {
242 242
             die($e->getMessage());
243 243
         }
244 244
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 
253 253
         try {
254 254
             $query->execute();
255
-        } catch (PDOException $e) {
255
+        }catch (PDOException $e) {
256 256
             die($e->getMessage());
257 257
         }
258 258
 
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
             $query->execute();
268 268
 
269 269
             return $query->fetch();
270
-        } catch (PDOException $e) {
270
+        }catch (PDOException $e) {
271 271
             die($e->getMessage());
272 272
         }
273 273
     }
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 
316 316
         try {
317 317
             $query->execute();
318
-        } catch (PDOException $e) {
318
+        }catch (PDOException $e) {
319 319
             die($e->getMessage());
320 320
         }
321 321
     }
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 
328 328
         try {
329 329
             $query->execute();
330
-        } catch (PDOException $e) {
330
+        }catch (PDOException $e) {
331 331
             die($e->getMessage());
332 332
         }
333 333
 
Please login to merge, or discard this patch.
Indentation   +323 added lines, -323 removed lines patch added patch discarded remove patch
@@ -3,279 +3,279 @@  discard block
 block discarded – undo
3 3
 date_default_timezone_set('Asia/Jakarta');
4 4
 class Tickets
5 5
 {
6
-    private $db;
7
-
8
-    public function __construct($database)
9
-    {
10
-        $this->db = $database;
11
-    }
12
-
13
-    public function add_ticket($ticketnumber, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $documentedby, $pro)
14
-    {
15
-        $current = time();
16
-        $querystring = 'INSERT INTO `tickets` (`ticketnumber`,`sla`,`reporteddate`, `reportedby`, `telp`, `email`, `problemsummary`,`problemdetail`,`ticketstatus`,`assignee`,`documentedby`,`documenteddate`,`pro`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
17
-        $query = $this->db->prepare($querystring);
18
-        $query->bindValue(1, $ticketnumber);
19
-        $query->bindValue(2, $sla);
20
-        $query->bindValue(3, $reporteddate);
21
-        $query->bindValue(4, $reportedby);
22
-        $query->bindValue(5, $telp);
23
-        $query->bindValue(6, $email);
24
-        $query->bindValue(7, $problemsummary);
25
-        $query->bindValue(8, $problemdetail);
26
-        $query->bindValue(9, $ticketstatus);
27
-        $query->bindValue(10, $assignee);
28
-        $query->bindValue(11, $documentedby);
29
-        $query->bindValue(12, $current);
30
-        $query->bindValue(13, $pro);
31
-
32
-        try {
33
-            $query->execute();
34
-        } catch (PDOException $e) {
35
-            die($e->getMessage());
36
-        }
37
-    }
38
-
39
-    public function update_ticket($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate, $processby, $processdate, $comment)
40
-    {
41
-        $querystring = 'UPDATE `tickets` SET `sla` = ? , `reporteddate` = ? , `reportedby` = ? , `telp` = ? ,`email` = ? , `problemsummary` = ? , `problemdetail` = ? ,`ticketstatus` = ?, `assignee` = ? , `assigneddate` = ?, `pendingby` = ?,`pendingdate` = ?, `resolution` = ? ,`resolvedby` = ?,`resolveddate` = ?,`closedby` = ?,`closeddate` = ?, `processby` = ?, `processdate` = ?, `comment` = ? WHERE `id` = ?';
42
-        $query = $this->db->prepare($querystring);
43
-        $query->bindValue(1, $sla);
44
-        $query->bindValue(2, $reporteddate);
45
-        $query->bindValue(3, $reportedby);
46
-        $query->bindValue(4, $telp);
47
-        $query->bindValue(5, $email);
48
-        $query->bindValue(6, $problemsummary);
49
-        $query->bindValue(7, $problemdetail);
50
-        $query->bindValue(8, $ticketstatus);
51
-        $query->bindValue(9, $assignee);
52
-        $query->bindValue(10, $assigneddate);
53
-        $query->bindValue(11, $pendingby);
54
-        $query->bindValue(12, $pendingdate);
55
-        $query->bindValue(13, $resolution);
56
-        $query->bindValue(14, $resolvedby);
57
-        $query->bindValue(15, $resolveddate);
58
-        $query->bindValue(16, $closedby);
59
-        $query->bindValue(17, $closeddate);
60
-        $query->bindValue(18, $processby);
61
-        $query->bindValue(19, $processdate);
62
-        $query->bindValue(20, $comment);
63
-        $query->bindValue(21, $id);
64
-
65
-        try {
66
-            $query->execute();
67
-        } catch (PDOException $e) {
68
-            die($e->getMessage());
69
-        }
70
-    }
71
-
72
-    public function delete($id)
73
-    {
74
-        $sql = 'DELETE FROM `tickets` WHERE `id` = ?';
75
-        $query = $this->db->prepare($sql);
76
-        $query->bindValue(1, $id);
77
-
78
-        try {
79
-            $query->execute();
80
-        } catch (PDOException $e) {
81
-            die($e->getMessage());
82
-        }
83
-    }
84
-
85
-    public function ticket_data($id)
86
-    {
87
-        $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `id`= ?');
88
-        $query->bindValue(1, $id);
89
-
90
-        try {
91
-            $query->execute();
92
-
93
-            return $query->fetch();
94
-        } catch (PDOException $e) {
95
-            die($e->getMessage());
96
-        }
97
-    }
98
-
99
-    public function get_tickets()
100
-    {
101
-        $query = $this->db->prepare('SELECT * FROM `tickets` ORDER BY `ticketnumber` DESC');
102
-
103
-        try {
104
-            $query->execute();
105
-        } catch (PDOException $e) {
106
-            die($e->getMessage());
107
-        }
108
-
109
-        return $query->fetchAll();
110
-    }
111
-
112
-    public function get_pro()
113
-    {
114
-        $query = $this->db->prepare('SELECT pro FROM `tickets`');
115
-
116
-        try {
117
-            $query->execute();
118
-        } catch (PDOException $e) {
119
-            die($e->getMessage());
120
-        }
121
-
122
-        return $query->fetchAll();
123
-    }
124
-
125
-    public function get_opened_tickets()
126
-    {
127
-        $query = $this->db->prepare("SELECT * FROM `tickets` WHERE `ticketstatus` <> 'Closed' ORDER BY `ticketnumber` DESC");
128
-
129
-        try {
130
-            $query->execute();
131
-        } catch (PDOException $e) {
132
-            die($e->getMessage());
133
-        }
134
-
135
-        return $query->fetchAll();
136
-    }
137
-
138
-    public function get_tickets_by_requester($userid)
139
-    {
140
-        $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `documentedby`= ? ORDER BY `ticketnumber` DESC');
141
-        $query->bindValue(1, $userid);
142
-
143
-        try {
144
-            $query->execute();
145
-        } catch (PDOException $e) {
146
-            die($e->getMessage());
147
-        }
148
-
149
-        return $query->fetchAll();
150
-    }
151
-
152
-    public function get_tickets_by_assignee($userid)
153
-    {
154
-        $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `assignee`= ? ORDER BY `ticketnumber` DESC');
155
-        $query->bindValue(1, $userid);
156
-
157
-        try {
158
-            $query->execute();
159
-        } catch (PDOException $e) {
160
-            die($e->getMessage());
161
-        }
162
-
163
-        return $query->fetchAll();
164
-    }
165
-
166
-    public function get_tickets_by_resolver($username)
167
-    {
168
-        $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `resolvedby`= ? ORDER BY `ticketnumber` DESC');
169
-        $query->bindValue(1, $username);
170
-
171
-        try {
172
-            $query->execute();
173
-        } catch (PDOException $e) {
174
-            die($e->getMessage());
175
-        }
176
-
177
-        return $query->fetchAll();
178
-    }
179
-
180
-    public function get_tickets_by_resolver_not_closed($username)
181
-    {
182
-        $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `resolvedby`=? and `ticketstatus` <> ? ORDER BY `ticketnumber` DESC');
183
-        $query->bindValue(1, $username);
184
-        $query->bindValue(2, 'Closed');
185
-
186
-        try {
187
-            $query->execute();
188
-        } catch (PDOException $e) {
189
-            die($e->getMessage());
190
-        }
191
-
192
-        return $query->fetchAll();
193
-    }
194
-
195
-    public function get_tickets_by_status($ticketstatus)
196
-    {
197
-        $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `ticketstatus`=? ORDER BY `ticketnumber` DESC');
198
-        $query->bindValue(1, $ticketstatus);
199
-
200
-        try {
201
-            $query->execute();
202
-        } catch (PDOException $e) {
203
-            die($e->getMessage());
204
-        }
205
-
206
-        return $query->fetchAll();
207
-    }
208
-
209
-    public function search_closed_ticket($fromperiod, $toperiod)
210
-    {
211
-        $query = $this->db->prepare("SELECT * FROM `tickets` WHERE `documenteddate` >= ? AND `documenteddate` <= ? AND `ticketstatus` = 'Closed' ORDER BY `documenteddate` DESC");
212
-        $query->bindValue(1, $fromperiod);
213
-        $query->bindValue(2, $toperiod);
214
-
215
-        try {
216
-            $query->execute();
217
-        } catch (PDOException $e) {
218
-            die($e->getMessage());
219
-        }
220
-
221
-        return $query->fetchAll();
222
-    }
223
-
224
-    public function count_tickets_by_status()
225
-    {
226
-        $query = $this->db->prepare('SELECT ticketstatus, count(*) as total FROM `tickets` GROUP BY ticketstatus');
227
-
228
-        try {
229
-            $query->execute();
230
-        } catch (PDOException $e) {
231
-            die($e->getMessage());
232
-        }
233
-
234
-        return $query->fetchAll();
235
-    }
236
-
237
-    public function count_resolved_tickets_by_month()
238
-    {
239
-        $sql = "SELECT Month(FROM_UNIXTIME(`documenteddate`)) as Bulan, Count(*) as Total FROM `tickets` WHERE (`ticketstatus`='Resolved' OR `ticketstatus`='Closed') AND FROM_UNIXTIME(`documenteddate`) >= CURDATE() - INTERVAL 1 YEAR GROUP BY Month(FROM_UNIXTIME(`documenteddate`))";
240
-        $query = $this->db->prepare($sql);
241
-
242
-        try {
243
-            $query->execute();
244
-        } catch (PDOException $e) {
245
-            die($e->getMessage());
246
-        }
247
-
248
-        return $query->fetchAll();
249
-    }
250
-
251
-    public function count_inprogress_tickets_by_month()
252
-    {
253
-        $sql = "SELECT Month(FROM_UNIXTIME(`documenteddate`)) as Bulan, Count(*) as Total FROM `tickets` WHERE (`ticketstatus`='Assigned' OR `ticketstatus`='Pending') AND FROM_UNIXTIME(`documenteddate`) >= CURDATE() - INTERVAL 1 YEAR GROUP BY Month(FROM_UNIXTIME(`documenteddate`))";
254
-        $query = $this->db->prepare($sql);
255
-
256
-        try {
257
-            $query->execute();
258
-        } catch (PDOException $e) {
259
-            die($e->getMessage());
260
-        }
261
-
262
-        return $query->fetchAll();
263
-    }
264
-
265
-    public function get_last_ticket()
266
-    {
267
-        $query = $this->db->prepare('SELECT * FROM `tickets` ORDER BY id DESC LIMIT 1');
268
-
269
-        try {
270
-            $query->execute();
271
-
272
-            return $query->fetch();
273
-        } catch (PDOException $e) {
274
-            die($e->getMessage());
275
-        }
276
-    }
277
-
278
-    /*
6
+	private $db;
7
+
8
+	public function __construct($database)
9
+	{
10
+		$this->db = $database;
11
+	}
12
+
13
+	public function add_ticket($ticketnumber, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $documentedby, $pro)
14
+	{
15
+		$current = time();
16
+		$querystring = 'INSERT INTO `tickets` (`ticketnumber`,`sla`,`reporteddate`, `reportedby`, `telp`, `email`, `problemsummary`,`problemdetail`,`ticketstatus`,`assignee`,`documentedby`,`documenteddate`,`pro`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
17
+		$query = $this->db->prepare($querystring);
18
+		$query->bindValue(1, $ticketnumber);
19
+		$query->bindValue(2, $sla);
20
+		$query->bindValue(3, $reporteddate);
21
+		$query->bindValue(4, $reportedby);
22
+		$query->bindValue(5, $telp);
23
+		$query->bindValue(6, $email);
24
+		$query->bindValue(7, $problemsummary);
25
+		$query->bindValue(8, $problemdetail);
26
+		$query->bindValue(9, $ticketstatus);
27
+		$query->bindValue(10, $assignee);
28
+		$query->bindValue(11, $documentedby);
29
+		$query->bindValue(12, $current);
30
+		$query->bindValue(13, $pro);
31
+
32
+		try {
33
+			$query->execute();
34
+		} catch (PDOException $e) {
35
+			die($e->getMessage());
36
+		}
37
+	}
38
+
39
+	public function update_ticket($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate, $processby, $processdate, $comment)
40
+	{
41
+		$querystring = 'UPDATE `tickets` SET `sla` = ? , `reporteddate` = ? , `reportedby` = ? , `telp` = ? ,`email` = ? , `problemsummary` = ? , `problemdetail` = ? ,`ticketstatus` = ?, `assignee` = ? , `assigneddate` = ?, `pendingby` = ?,`pendingdate` = ?, `resolution` = ? ,`resolvedby` = ?,`resolveddate` = ?,`closedby` = ?,`closeddate` = ?, `processby` = ?, `processdate` = ?, `comment` = ? WHERE `id` = ?';
42
+		$query = $this->db->prepare($querystring);
43
+		$query->bindValue(1, $sla);
44
+		$query->bindValue(2, $reporteddate);
45
+		$query->bindValue(3, $reportedby);
46
+		$query->bindValue(4, $telp);
47
+		$query->bindValue(5, $email);
48
+		$query->bindValue(6, $problemsummary);
49
+		$query->bindValue(7, $problemdetail);
50
+		$query->bindValue(8, $ticketstatus);
51
+		$query->bindValue(9, $assignee);
52
+		$query->bindValue(10, $assigneddate);
53
+		$query->bindValue(11, $pendingby);
54
+		$query->bindValue(12, $pendingdate);
55
+		$query->bindValue(13, $resolution);
56
+		$query->bindValue(14, $resolvedby);
57
+		$query->bindValue(15, $resolveddate);
58
+		$query->bindValue(16, $closedby);
59
+		$query->bindValue(17, $closeddate);
60
+		$query->bindValue(18, $processby);
61
+		$query->bindValue(19, $processdate);
62
+		$query->bindValue(20, $comment);
63
+		$query->bindValue(21, $id);
64
+
65
+		try {
66
+			$query->execute();
67
+		} catch (PDOException $e) {
68
+			die($e->getMessage());
69
+		}
70
+	}
71
+
72
+	public function delete($id)
73
+	{
74
+		$sql = 'DELETE FROM `tickets` WHERE `id` = ?';
75
+		$query = $this->db->prepare($sql);
76
+		$query->bindValue(1, $id);
77
+
78
+		try {
79
+			$query->execute();
80
+		} catch (PDOException $e) {
81
+			die($e->getMessage());
82
+		}
83
+	}
84
+
85
+	public function ticket_data($id)
86
+	{
87
+		$query = $this->db->prepare('SELECT * FROM `tickets` WHERE `id`= ?');
88
+		$query->bindValue(1, $id);
89
+
90
+		try {
91
+			$query->execute();
92
+
93
+			return $query->fetch();
94
+		} catch (PDOException $e) {
95
+			die($e->getMessage());
96
+		}
97
+	}
98
+
99
+	public function get_tickets()
100
+	{
101
+		$query = $this->db->prepare('SELECT * FROM `tickets` ORDER BY `ticketnumber` DESC');
102
+
103
+		try {
104
+			$query->execute();
105
+		} catch (PDOException $e) {
106
+			die($e->getMessage());
107
+		}
108
+
109
+		return $query->fetchAll();
110
+	}
111
+
112
+	public function get_pro()
113
+	{
114
+		$query = $this->db->prepare('SELECT pro FROM `tickets`');
115
+
116
+		try {
117
+			$query->execute();
118
+		} catch (PDOException $e) {
119
+			die($e->getMessage());
120
+		}
121
+
122
+		return $query->fetchAll();
123
+	}
124
+
125
+	public function get_opened_tickets()
126
+	{
127
+		$query = $this->db->prepare("SELECT * FROM `tickets` WHERE `ticketstatus` <> 'Closed' ORDER BY `ticketnumber` DESC");
128
+
129
+		try {
130
+			$query->execute();
131
+		} catch (PDOException $e) {
132
+			die($e->getMessage());
133
+		}
134
+
135
+		return $query->fetchAll();
136
+	}
137
+
138
+	public function get_tickets_by_requester($userid)
139
+	{
140
+		$query = $this->db->prepare('SELECT * FROM `tickets` WHERE `documentedby`= ? ORDER BY `ticketnumber` DESC');
141
+		$query->bindValue(1, $userid);
142
+
143
+		try {
144
+			$query->execute();
145
+		} catch (PDOException $e) {
146
+			die($e->getMessage());
147
+		}
148
+
149
+		return $query->fetchAll();
150
+	}
151
+
152
+	public function get_tickets_by_assignee($userid)
153
+	{
154
+		$query = $this->db->prepare('SELECT * FROM `tickets` WHERE `assignee`= ? ORDER BY `ticketnumber` DESC');
155
+		$query->bindValue(1, $userid);
156
+
157
+		try {
158
+			$query->execute();
159
+		} catch (PDOException $e) {
160
+			die($e->getMessage());
161
+		}
162
+
163
+		return $query->fetchAll();
164
+	}
165
+
166
+	public function get_tickets_by_resolver($username)
167
+	{
168
+		$query = $this->db->prepare('SELECT * FROM `tickets` WHERE `resolvedby`= ? ORDER BY `ticketnumber` DESC');
169
+		$query->bindValue(1, $username);
170
+
171
+		try {
172
+			$query->execute();
173
+		} catch (PDOException $e) {
174
+			die($e->getMessage());
175
+		}
176
+
177
+		return $query->fetchAll();
178
+	}
179
+
180
+	public function get_tickets_by_resolver_not_closed($username)
181
+	{
182
+		$query = $this->db->prepare('SELECT * FROM `tickets` WHERE `resolvedby`=? and `ticketstatus` <> ? ORDER BY `ticketnumber` DESC');
183
+		$query->bindValue(1, $username);
184
+		$query->bindValue(2, 'Closed');
185
+
186
+		try {
187
+			$query->execute();
188
+		} catch (PDOException $e) {
189
+			die($e->getMessage());
190
+		}
191
+
192
+		return $query->fetchAll();
193
+	}
194
+
195
+	public function get_tickets_by_status($ticketstatus)
196
+	{
197
+		$query = $this->db->prepare('SELECT * FROM `tickets` WHERE `ticketstatus`=? ORDER BY `ticketnumber` DESC');
198
+		$query->bindValue(1, $ticketstatus);
199
+
200
+		try {
201
+			$query->execute();
202
+		} catch (PDOException $e) {
203
+			die($e->getMessage());
204
+		}
205
+
206
+		return $query->fetchAll();
207
+	}
208
+
209
+	public function search_closed_ticket($fromperiod, $toperiod)
210
+	{
211
+		$query = $this->db->prepare("SELECT * FROM `tickets` WHERE `documenteddate` >= ? AND `documenteddate` <= ? AND `ticketstatus` = 'Closed' ORDER BY `documenteddate` DESC");
212
+		$query->bindValue(1, $fromperiod);
213
+		$query->bindValue(2, $toperiod);
214
+
215
+		try {
216
+			$query->execute();
217
+		} catch (PDOException $e) {
218
+			die($e->getMessage());
219
+		}
220
+
221
+		return $query->fetchAll();
222
+	}
223
+
224
+	public function count_tickets_by_status()
225
+	{
226
+		$query = $this->db->prepare('SELECT ticketstatus, count(*) as total FROM `tickets` GROUP BY ticketstatus');
227
+
228
+		try {
229
+			$query->execute();
230
+		} catch (PDOException $e) {
231
+			die($e->getMessage());
232
+		}
233
+
234
+		return $query->fetchAll();
235
+	}
236
+
237
+	public function count_resolved_tickets_by_month()
238
+	{
239
+		$sql = "SELECT Month(FROM_UNIXTIME(`documenteddate`)) as Bulan, Count(*) as Total FROM `tickets` WHERE (`ticketstatus`='Resolved' OR `ticketstatus`='Closed') AND FROM_UNIXTIME(`documenteddate`) >= CURDATE() - INTERVAL 1 YEAR GROUP BY Month(FROM_UNIXTIME(`documenteddate`))";
240
+		$query = $this->db->prepare($sql);
241
+
242
+		try {
243
+			$query->execute();
244
+		} catch (PDOException $e) {
245
+			die($e->getMessage());
246
+		}
247
+
248
+		return $query->fetchAll();
249
+	}
250
+
251
+	public function count_inprogress_tickets_by_month()
252
+	{
253
+		$sql = "SELECT Month(FROM_UNIXTIME(`documenteddate`)) as Bulan, Count(*) as Total FROM `tickets` WHERE (`ticketstatus`='Assigned' OR `ticketstatus`='Pending') AND FROM_UNIXTIME(`documenteddate`) >= CURDATE() - INTERVAL 1 YEAR GROUP BY Month(FROM_UNIXTIME(`documenteddate`))";
254
+		$query = $this->db->prepare($sql);
255
+
256
+		try {
257
+			$query->execute();
258
+		} catch (PDOException $e) {
259
+			die($e->getMessage());
260
+		}
261
+
262
+		return $query->fetchAll();
263
+	}
264
+
265
+	public function get_last_ticket()
266
+	{
267
+		$query = $this->db->prepare('SELECT * FROM `tickets` ORDER BY id DESC LIMIT 1');
268
+
269
+		try {
270
+			$query->execute();
271
+
272
+			return $query->fetch();
273
+		} catch (PDOException $e) {
274
+			die($e->getMessage());
275
+		}
276
+	}
277
+
278
+	/*
279 279
         public function notify_assignee($id,$ticketnumber,$email_assignee)
280 280
         {	if (substr(php_uname(), 0, 7) == "Windows"){
281 281
                 $cmd = "D:\mowes_portable\www\helpdesk\batch\sendemail.bat";
@@ -289,54 +289,54 @@  discard block
 block discarded – undo
289 289
             }
290 290
         }*/
291 291
 
292
-    public function log_tickets($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate, $changes, $changeby, $processby, $processdate, $comment)
293
-    {
294
-        $changedate = time();
295
-        $querystring = 'INSERT INTO `log_tickets` (`id`,`sla`,`reporteddate`, `reportedby`, `telp`, `email`, `problemsummary`,`problemdetail`,`ticketstatus`,`assignee`,`assigneddate`,`pendingby`,`pendingdate`,`resolution`,`resolvedby`,`resolveddate`,`closedby`,`closeddate`,`changes`,`changeby`,`changedate`,`processby`,`processdate`,`comment`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
296
-        $query = $this->db->prepare($querystring);
297
-        $query->bindValue(1, $id);
298
-        $query->bindValue(2, $sla);
299
-        $query->bindValue(3, $reporteddate);
300
-        $query->bindValue(4, $reportedby);
301
-        $query->bindValue(5, $telp);
302
-        $query->bindValue(6, $email);
303
-        $query->bindValue(7, $problemsummary);
304
-        $query->bindValue(8, $problemdetail);
305
-        $query->bindValue(9, $ticketstatus);
306
-        $query->bindValue(10, $assignee);
307
-        $query->bindValue(11, $assigneddate);
308
-        $query->bindValue(12, $pendingby);
309
-        $query->bindValue(13, $pendingdate);
310
-        $query->bindValue(14, $resolution);
311
-        $query->bindValue(15, $resolvedby);
312
-        $query->bindValue(16, $resolveddate);
313
-        $query->bindValue(17, $closedby);
314
-        $query->bindValue(18, $closeddate);
315
-        $query->bindValue(19, $changes);
316
-        $query->bindValue(20, $changeby);
317
-        $query->bindValue(21, $changedate);
318
-        $query->bindValue(22, $processby);
319
-        $query->bindValue(23, $processdate);
320
-        $query->bindValue(24, $comment);
321
-
322
-        try {
323
-            $query->execute();
324
-        } catch (PDOException $e) {
325
-            die($e->getMessage());
326
-        }
327
-    }
328
-
329
-    public function get_audit_trail($id)
330
-    {
331
-        $query = $this->db->prepare('SELECT * FROM `log_tickets` WHERE `id`= ? ORDER BY `changedate` DESC');
332
-        $query->bindValue(1, $id);
333
-
334
-        try {
335
-            $query->execute();
336
-        } catch (PDOException $e) {
337
-            die($e->getMessage());
338
-        }
339
-
340
-        return $query->fetchAll();
341
-    }
292
+	public function log_tickets($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate, $changes, $changeby, $processby, $processdate, $comment)
293
+	{
294
+		$changedate = time();
295
+		$querystring = 'INSERT INTO `log_tickets` (`id`,`sla`,`reporteddate`, `reportedby`, `telp`, `email`, `problemsummary`,`problemdetail`,`ticketstatus`,`assignee`,`assigneddate`,`pendingby`,`pendingdate`,`resolution`,`resolvedby`,`resolveddate`,`closedby`,`closeddate`,`changes`,`changeby`,`changedate`,`processby`,`processdate`,`comment`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
296
+		$query = $this->db->prepare($querystring);
297
+		$query->bindValue(1, $id);
298
+		$query->bindValue(2, $sla);
299
+		$query->bindValue(3, $reporteddate);
300
+		$query->bindValue(4, $reportedby);
301
+		$query->bindValue(5, $telp);
302
+		$query->bindValue(6, $email);
303
+		$query->bindValue(7, $problemsummary);
304
+		$query->bindValue(8, $problemdetail);
305
+		$query->bindValue(9, $ticketstatus);
306
+		$query->bindValue(10, $assignee);
307
+		$query->bindValue(11, $assigneddate);
308
+		$query->bindValue(12, $pendingby);
309
+		$query->bindValue(13, $pendingdate);
310
+		$query->bindValue(14, $resolution);
311
+		$query->bindValue(15, $resolvedby);
312
+		$query->bindValue(16, $resolveddate);
313
+		$query->bindValue(17, $closedby);
314
+		$query->bindValue(18, $closeddate);
315
+		$query->bindValue(19, $changes);
316
+		$query->bindValue(20, $changeby);
317
+		$query->bindValue(21, $changedate);
318
+		$query->bindValue(22, $processby);
319
+		$query->bindValue(23, $processdate);
320
+		$query->bindValue(24, $comment);
321
+
322
+		try {
323
+			$query->execute();
324
+		} catch (PDOException $e) {
325
+			die($e->getMessage());
326
+		}
327
+	}
328
+
329
+	public function get_audit_trail($id)
330
+	{
331
+		$query = $this->db->prepare('SELECT * FROM `log_tickets` WHERE `id`= ? ORDER BY `changedate` DESC');
332
+		$query->bindValue(1, $id);
333
+
334
+		try {
335
+			$query->execute();
336
+		} catch (PDOException $e) {
337
+			die($e->getMessage());
338
+		}
339
+
340
+		return $query->fetchAll();
341
+	}
342 342
 }
Please login to merge, or discard this patch.
core/init.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -5,16 +5,16 @@
 block discarded – undo
5 5
 require_once 'connect/database.php';
6 6
 function my_autoload($class)
7 7
 {
8
-    $filename = 'classes/'.$class.'.php';
9
-    include_once $filename;
8
+	$filename = 'classes/'.$class.'.php';
9
+	include_once $filename;
10 10
 }
11 11
 spl_autoload_register('my_autoload');
12 12
 
13 13
 try {
14
-    $general = new General();
15
-    $users = new Users($db);
16
-    $tickets = new Tickets($db);
17
-    $slas = new SLA($db);
14
+	$general = new General();
15
+	$users = new Users($db);
16
+	$tickets = new Tickets($db);
17
+	$slas = new SLA($db);
18 18
 } catch (Exception $e) {
19
-    echo 'Caught exception: ',  $e->getMessage(), "\n";
19
+	echo 'Caught exception: ',  $e->getMessage(), "\n";
20 20
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,6 +15,6 @@
 block discarded – undo
15 15
     $users = new Users($db);
16 16
     $tickets = new Tickets($db);
17 17
     $slas = new SLA($db);
18
-} catch (Exception $e) {
19
-    echo 'Caught exception: ',  $e->getMessage(), "\n";
18
+}catch (Exception $e) {
19
+    echo 'Caught exception: ', $e->getMessage(), "\n";
20 20
 }
Please login to merge, or discard this patch.
content.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
 			echo "<li><p>Jumlah tiket yang ditugaskan untuk Anda: $tickets_assigned tickets.</p></li> ";
35 35
 			echo "<li><p>Anda telah menyelesaikan $tickets_resolved tickets.</p></li>";
36 36
 		}
37
-        ?>
37
+		?>
38 38
 		</ol><br/>
39 39
 		</td>
40 40
 	</tr>
Please login to merge, or discard this patch.
myticketwaitforclosed.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -50,18 +50,18 @@
 block discarded – undo
50 50
     </thead>
51 51
     <tbody>
52 52
 		<?php 
53
-        foreach ($tickets as $ticket) {
54
-            $sla = $slas->sla_data($ticket['sla']);
55
-            $user = $users->userdata($ticket['assignee']);
56
-            echo '<tr><td><a href=ticketedit.php?id='.$ticket['id'].'>'.$ticket['ticketnumber'].'</a></td>'.
57
-                 '<td>'.$sla['namasla'].'</td>'.
58
-                 '<td>'.date('d-M-Y', $ticket['reporteddate']).'</td>'.
59
-                 '<td>'.$ticket['reportedby'].'</td>'.
60
-                 '<td>'.$ticket['problemsummary'].'</td>'.
61
-                 '<td>'.$ticket['ticketstatus'].'</td>'.
62
-                 '<td>'.$user['fullname'].'</td></tr>';
63
-        }
64
-        ?>
53
+		foreach ($tickets as $ticket) {
54
+			$sla = $slas->sla_data($ticket['sla']);
55
+			$user = $users->userdata($ticket['assignee']);
56
+			echo '<tr><td><a href=ticketedit.php?id='.$ticket['id'].'>'.$ticket['ticketnumber'].'</a></td>'.
57
+				 '<td>'.$sla['namasla'].'</td>'.
58
+				 '<td>'.date('d-M-Y', $ticket['reporteddate']).'</td>'.
59
+				 '<td>'.$ticket['reportedby'].'</td>'.
60
+				 '<td>'.$ticket['problemsummary'].'</td>'.
61
+				 '<td>'.$ticket['ticketstatus'].'</td>'.
62
+				 '<td>'.$user['fullname'].'</td></tr>';
63
+		}
64
+		?>
65 65
     </tbody>
66 66
 	</table>
67 67
 	<p>&nbsp;</p>
Please login to merge, or discard this patch.
report_all_tickets.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 $general->logged_out_protect();
4 4
 $user = $users->userdata($_SESSION['loginid']);
5 5
 if ($user['level'] != 'Admin') {
6
-    exit("You don't have permission to access this page!");
6
+	exit("You don't have permission to access this page!");
7 7
 }
8 8
 $logs = $users->get_users_log();
9 9
 ?>
Please login to merge, or discard this patch.
report_all_tickets_print.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@  discard block
 block discarded – undo
3 3
 $general->logged_out_protect();
4 4
 $user = $users->userdata($_SESSION['loginid']);
5 5
 if ($user['level'] == 'Admin' || $user['level'] == 'Manager') {
6
-    $akses = true;
6
+	$akses = true;
7 7
 } else {
8
-    $akses = false;
8
+	$akses = false;
9 9
 }
10 10
 if ($akses = false) {
11
-    exit("You don't have permission to access this page!");
11
+	exit("You don't have permission to access this page!");
12 12
 }
13 13
 $ticket_list = $tickets->get_tickets();
14 14
 $tickets_count = count($ticket_list);
@@ -180,14 +180,14 @@  discard block
 block discarded – undo
180 180
         </thead>
181 181
         <tbody>
182 182
             <?php foreach ($ticket_list as $ticket) :
183
-                $sla = $slas->sla_data($ticket['sla']);
184
-                $documenteddate = $ticket['documenteddate'];
185
-                $resolutiontime = $sla['resolutiontime'];
186
-                $slawarning = $sla['slawarning'];
187
-                $slagoaltime = strtotime("+$resolutiontime hours", $documenteddate);
188
-                $slawarningtime = strtotime("+$slawarning hours", $documenteddate);
189
-                $user = $users->userdata($ticket['assignee']);
190
-            ?>
183
+				$sla = $slas->sla_data($ticket['sla']);
184
+				$documenteddate = $ticket['documenteddate'];
185
+				$resolutiontime = $sla['resolutiontime'];
186
+				$slawarning = $sla['slawarning'];
187
+				$slagoaltime = strtotime("+$resolutiontime hours", $documenteddate);
188
+				$slawarningtime = strtotime("+$slawarning hours", $documenteddate);
189
+				$user = $users->userdata($ticket['assignee']);
190
+			?>
191 191
                 <tr>
192 192
                     <td>
193 193
                         <?php echo $ticket['ticketnumber'];?>
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 $user = $users->userdata($_SESSION['loginid']);
5 5
 if ($user['level'] == 'Admin' || $user['level'] == 'Manager') {
6 6
     $akses = true;
7
-} else {
7
+}else {
8 8
     $akses = false;
9 9
 }
10 10
 if ($akses = false) {
@@ -190,31 +190,31 @@  discard block
 block discarded – undo
190 190
             ?>
191 191
                 <tr>
192 192
                     <td>
193
-                        <?php echo $ticket['ticketnumber'];?>
193
+                        <?php echo $ticket['ticketnumber']; ?>
194 194
                     </td>
195 195
                     <td>
196
-                        <?php echo $sla['namasla'];?>
196
+                        <?php echo $sla['namasla']; ?>
197 197
                     </td>
198 198
                     <td>
199
-                        <?php echo date('d-M-Y H:i:s', $slagoaltime);?>
199
+                        <?php echo date('d-M-Y H:i:s', $slagoaltime); ?>
200 200
                     </td>
201 201
                     <td>
202
-                        <?php echo date('d-M-Y H:i:s', $ticket['reporteddate']);?>
202
+                        <?php echo date('d-M-Y H:i:s', $ticket['reporteddate']); ?>
203 203
                     </td>
204 204
                     <td>
205
-                        <?php echo date('d-M-Y H:i:s', $ticket['documenteddate']);?>
205
+                        <?php echo date('d-M-Y H:i:s', $ticket['documenteddate']); ?>
206 206
                     </td>
207 207
                     <td>
208
-                        <?php echo $ticket['problemsummary'];?>
208
+                        <?php echo $ticket['problemsummary']; ?>
209 209
                     </td>
210 210
                     <td>
211
-                        <?php echo $ticket['ticketstatus'];?>
211
+                        <?php echo $ticket['ticketstatus']; ?>
212 212
                     </td>
213 213
                     <td>
214
-                        <?php echo $user['fullname'];?>
214
+                        <?php echo $user['fullname']; ?>
215 215
                     </td>
216 216
                 </tr>
217
-            <?php endforeach;?>
217
+            <?php endforeach; ?>
218 218
         </tbody>
219 219
     </table>
220 220
 
Please login to merge, or discard this patch.
ticketedituser.php 2 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -6,58 +6,58 @@  discard block
 block discarded – undo
6 6
 $id = $_GET['id'];
7 7
 $ticket = $tickets->ticket_data($id);
8 8
 if ($ticket['ticketstatus'] == 'Closed') {
9
-    header("Location: ticketread.php?id=$id");
10
-    exit();
9
+	header("Location: ticketread.php?id=$id");
10
+	exit();
11 11
 }
12 12
 if (isset($_POST['submit'])) {
13
-    $sla = $_POST['sla'];
14
-    $reporteddate = $_POST['reporteddate'];
15
-    $reportedmonth = $_POST['reportedmonth'];
16
-    $reportedyear = $_POST['reportedyear'];
17
-    $datetimeStr = $reportedyear.'-'.$reportedmonth.'-'.$reporteddate;
18
-    $reporteddate = strtotime($datetimeStr);
13
+	$sla = $_POST['sla'];
14
+	$reporteddate = $_POST['reporteddate'];
15
+	$reportedmonth = $_POST['reportedmonth'];
16
+	$reportedyear = $_POST['reportedyear'];
17
+	$datetimeStr = $reportedyear.'-'.$reportedmonth.'-'.$reporteddate;
18
+	$reporteddate = strtotime($datetimeStr);
19 19
 
20
-    $reportedby = $_POST['reportedby'];
21
-    $telp = $_POST['telp'];
22
-    $email = $_POST['email'];
23
-    $problemsummary = $_POST['problemsummary'];
24
-    $problemdetail = $_POST['problemdetail'];
25
-    $assignee = $_POST['idassignee'];
26
-    $ticketstatus = $_POST['ticketstatus'];
27
-    $resolution = $_POST['resolution'];
28
-    $comment = $_POST['comment'];
29
-    $processby = $_POST['processby'];
30
-    $processdate = $_POST['processdate'];
31
-    $pendingby = $_POST['pendingby'];
32
-    $pendingdate = $_POST['pendingdate'];
33
-    $resolvedby = $_POST['resolvedby'];
34
-    $resolveddate = $_POST['resolveddate'];
35
-    $closedby = $_POST['closedby'];
36
-    $closeddate = $_POST['closeddate'];
20
+	$reportedby = $_POST['reportedby'];
21
+	$telp = $_POST['telp'];
22
+	$email = $_POST['email'];
23
+	$problemsummary = $_POST['problemsummary'];
24
+	$problemdetail = $_POST['problemdetail'];
25
+	$assignee = $_POST['idassignee'];
26
+	$ticketstatus = $_POST['ticketstatus'];
27
+	$resolution = $_POST['resolution'];
28
+	$comment = $_POST['comment'];
29
+	$processby = $_POST['processby'];
30
+	$processdate = $_POST['processdate'];
31
+	$pendingby = $_POST['pendingby'];
32
+	$pendingdate = $_POST['pendingdate'];
33
+	$resolvedby = $_POST['resolvedby'];
34
+	$resolveddate = $_POST['resolveddate'];
35
+	$closedby = $_POST['closedby'];
36
+	$closeddate = $_POST['closeddate'];
37 37
 	$changes = 'Re-assigned the ticket.';
38 38
 	if ($ticketstatus == 'Process') {
39 39
 		$processby = $user['username'];
40 40
 		$processdate = strtotime(now);
41 41
 		$changes = 'Change Status to Process';
42 42
 	}
43
-    if ($ticketstatus == 'Pending') {
44
-        $pendingby = $user['username'];
45
-        $pendingdate = strtotime(now);
46
-        $changes = 'Change Status to Pending.';
47
-    }
48
-    if ($ticketstatus == 'Resolved') {
49
-        $resolvedby = $user['username'];
50
-        $resolveddate = strtotime(now);
51
-        $changes = 'Change Status to Resolved.';
52
-    }
53
-    if ($ticketstatus == 'Closed') {
54
-        $closedby = $user['username'];
55
-        $closeddate = strtotime(now);
56
-        $changes = 'Change Status to Closed.';
57
-    }
58
-    $tickets->update_ticket($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate, $processby, $processdate, $comment);
59
-    $tickets->log_tickets($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate, $changes, $changeby, $processby, $processdate, $comment);
60
-    header('Location: ticketlistuser.php');
43
+	if ($ticketstatus == 'Pending') {
44
+		$pendingby = $user['username'];
45
+		$pendingdate = strtotime(now);
46
+		$changes = 'Change Status to Pending.';
47
+	}
48
+	if ($ticketstatus == 'Resolved') {
49
+		$resolvedby = $user['username'];
50
+		$resolveddate = strtotime(now);
51
+		$changes = 'Change Status to Resolved.';
52
+	}
53
+	if ($ticketstatus == 'Closed') {
54
+		$closedby = $user['username'];
55
+		$closeddate = strtotime(now);
56
+		$changes = 'Change Status to Closed.';
57
+	}
58
+	$tickets->update_ticket($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate, $processby, $processdate, $comment);
59
+	$tickets->log_tickets($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate, $changes, $changeby, $processby, $processdate, $comment);
60
+	header('Location: ticketlistuser.php');
61 61
 }
62 62
 ?>
63 63
 <!DOCTYPE HTML>
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
 			<td> <input type="hidden" name="oldticketstatus" value="<?php echo $ticket['ticketstatus']; ?>"> 
147 147
 			<select name="ticketstatus">
148 148
 				<?php
149
-                    echo '<option value='.$ticket['ticketstatus'].' selected="selected">'.$ticket['ticketstatus'].'</option>';
150
-                ?>
149
+					echo '<option value='.$ticket['ticketstatus'].' selected="selected">'.$ticket['ticketstatus'].'</option>';
150
+				?>
151 151
 				<option value="Assigned"> Assigned </option>
152 152
 				<option value="Resolved"> Resolved </option>
153 153
 				<option value="Pending"> Pending </option>
@@ -189,14 +189,14 @@  discard block
 block discarded – undo
189 189
 	<table class="formtable">
190 190
 	<tr bgcolor="#e0e0e0" ><td width="150">Updated On</td><td width="150">Updated By</td><td>Description</td></tr>
191 191
 	<?php
192
-        $list_log_tickets = $tickets->get_audit_trail($id);
193
-        foreach ($list_log_tickets as $log_ticket) {
194
-            $changed_by = $users->userdata($log_ticket['changeby']);
195
-            echo '<tr><td>'.date('d-M-Y H:i:s', $log_ticket['changedate']).'</td>'.
196
-                 '<td>'.$changed_by['fullname'].'</td>'.
197
-                 '<td>'.$log_ticket['changes'].'</td></tr>';
198
-        }
199
-    ?>
192
+		$list_log_tickets = $tickets->get_audit_trail($id);
193
+		foreach ($list_log_tickets as $log_ticket) {
194
+			$changed_by = $users->userdata($log_ticket['changeby']);
195
+			echo '<tr><td>'.date('d-M-Y H:i:s', $log_ticket['changedate']).'</td>'.
196
+				 '<td>'.$changed_by['fullname'].'</td>'.
197
+				 '<td>'.$log_ticket['changes'].'</td></tr>';
198
+		}
199
+	?>
200 200
 	</table>
201 201
 	</fieldset>
202 202
 	<br/><br/>
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -157,11 +157,11 @@
 block discarded – undo
157 157
 		</tr>
158 158
 		<tr valign="top">
159 159
 			<td> Resolution* </td><td> : </td>
160
-			<td> <textarea name="resolution" rows="3" cols="38" <?php echo ($user['level'] == 'User') ? 'readonly="readonly"' : '';?>><?php echo $ticket['resolution']; ?></textarea> </td>
160
+			<td> <textarea name="resolution" rows="3" cols="38" <?php echo ($user['level'] == 'User') ? 'readonly="readonly"' : ''; ?>><?php echo $ticket['resolution']; ?></textarea> </td>
161 161
 		</tr>
162 162
 		<tr valign="top">
163 163
 			<td> Comment* </td><td> : </td>
164
-			<td> <textarea name="comment" rows="3" cols="38" <?php echo ($user['level'] != 'User') ? 'readonly="readonly"' : '';?>><?php echo $ticket['comment']; ?></textarea> </td>
164
+			<td> <textarea name="comment" rows="3" cols="38" <?php echo ($user['level'] != 'User') ? 'readonly="readonly"' : ''; ?>><?php echo $ticket['comment']; ?></textarea> </td>
165 165
 		</tr>
166 166
 		<tr>
167 167
 			<td> </td><td> </td>
Please login to merge, or discard this patch.
ticketedit.php 2 patches
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -6,58 +6,58 @@  discard block
 block discarded – undo
6 6
 $id = $_GET['id'];
7 7
 $ticket = $tickets->ticket_data($id);
8 8
 if ($ticket['ticketstatus'] == 'Closed') {
9
-    header("Location: ticketread.php?id=$id");
10
-    exit();
9
+	header("Location: ticketread.php?id=$id");
10
+	exit();
11 11
 }
12 12
 if (isset($_POST['submit'])) {
13
-    $sla = $_POST['sla'];
14
-    $reporteddate = strtotime($_POST['reporteddate']);
15
-    $reportedby = $_POST['reportedby'];
16
-    $telp = $_POST['telp'];
17
-    $email = $_POST['email'];
18
-    $problemsummary = $_POST['problemsummary'];
19
-    $problemdetail = $_POST['problemdetail'];
20
-    $assignee = $_POST['idassignee'];
21
-    $type = $_POST['pro'];
22
-    $ticketstatus = $_POST['ticketstatus'];
23
-    $resolution = $_POST['resolution'];
24
-    $comment = $_POST['comment'];
25
-    $processby = $_POST['processby'];
26
-    $processdate = $_POST['processdate'];
27
-    $pendingby = $_POST['pendingby'];
28
-    $pendingdate = $_POST['pendingdate'];
29
-    $resolvedby = $_POST['resolvedby'];
30
-    $resolveddate = $_POST['resolveddate'];
31
-    $closedby = $_POST['closedby'];
32
-    $closeddate = $_POST['closeddate'];
33
-    $changes = 'Re-assigned the ticket.';
13
+	$sla = $_POST['sla'];
14
+	$reporteddate = strtotime($_POST['reporteddate']);
15
+	$reportedby = $_POST['reportedby'];
16
+	$telp = $_POST['telp'];
17
+	$email = $_POST['email'];
18
+	$problemsummary = $_POST['problemsummary'];
19
+	$problemdetail = $_POST['problemdetail'];
20
+	$assignee = $_POST['idassignee'];
21
+	$type = $_POST['pro'];
22
+	$ticketstatus = $_POST['ticketstatus'];
23
+	$resolution = $_POST['resolution'];
24
+	$comment = $_POST['comment'];
25
+	$processby = $_POST['processby'];
26
+	$processdate = $_POST['processdate'];
27
+	$pendingby = $_POST['pendingby'];
28
+	$pendingdate = $_POST['pendingdate'];
29
+	$resolvedby = $_POST['resolvedby'];
30
+	$resolveddate = $_POST['resolveddate'];
31
+	$closedby = $_POST['closedby'];
32
+	$closeddate = $_POST['closeddate'];
33
+	$changes = 'Re-assigned the ticket.';
34 34
 	if ($ticketstatus == 'Process') {
35 35
 		$processby = $user['username'];
36 36
 		$processdate = strtotime(now);
37 37
 		$changes = 'Change Status to Process';
38 38
 	}
39 39
 	if ($ticketstatus == 'Pending') {
40
-        $pendingby = $user['username'];
41
-        $pendingdate = strtotime(now);
42
-        $changes = 'Change Status to Pending.';
43
-    }
44
-    if ($ticketstatus == 'Resolved') {
45
-        $resolvedby = $user['username'];
46
-        $resolveddate = strtotime(now);
47
-        $changes = 'Change Status to Resolved.';
48
-    }
49
-    if ($ticketstatus == 'Closed') {
50
-        $closedby = $user['username'];
51
-        $closeddate = strtotime(now);
52
-        $changes = 'Change Status to Closed.';
53
-    }
54
-    $tickets->update_ticket($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate, $processby, $processdate, $comment);
55
-    $tickets->log_tickets($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate, $changes, $changeby, $processby, $processdate, $comment);
56
-    if ($user['level'] == 'Admin') {
57
-        header('Location: ticketlist.php');
58
-    } else {
59
-        header('Location: myticketbyassignee.php');
60
-    }
40
+		$pendingby = $user['username'];
41
+		$pendingdate = strtotime(now);
42
+		$changes = 'Change Status to Pending.';
43
+	}
44
+	if ($ticketstatus == 'Resolved') {
45
+		$resolvedby = $user['username'];
46
+		$resolveddate = strtotime(now);
47
+		$changes = 'Change Status to Resolved.';
48
+	}
49
+	if ($ticketstatus == 'Closed') {
50
+		$closedby = $user['username'];
51
+		$closeddate = strtotime(now);
52
+		$changes = 'Change Status to Closed.';
53
+	}
54
+	$tickets->update_ticket($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate, $processby, $processdate, $comment);
55
+	$tickets->log_tickets($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate, $changes, $changeby, $processby, $processdate, $comment);
56
+	if ($user['level'] == 'Admin') {
57
+		header('Location: ticketlist.php');
58
+	} else {
59
+		header('Location: myticketbyassignee.php');
60
+	}
61 61
 }
62 62
 ?>
63 63
 <!DOCTYPE HTML>
@@ -142,13 +142,13 @@  discard block
 block discarded – undo
142 142
 			<td> Urgency (SLA)*</td><td> : </td>
143 143
 			<td><select name="sla">
144 144
 				<?php 
145
-                    $sladata = $slas->sla_data($ticket['sla']);
146
-                    echo '<option value="'.$ticket['sla'].'" selected="selected">'.$sladata['namasla'].'</option>';
147
-                    $sla = $slas->get_sla();
148
-                    foreach ($sla as $slaval) {
149
-                        echo '<option value="'.$slaval['slaid'].'">'.$slaval['namasla'].'</option>';
150
-                    }
151
-                ?>
145
+					$sladata = $slas->sla_data($ticket['sla']);
146
+					echo '<option value="'.$ticket['sla'].'" selected="selected">'.$sladata['namasla'].'</option>';
147
+					$sla = $slas->get_sla();
148
+					foreach ($sla as $slaval) {
149
+						echo '<option value="'.$slaval['slaid'].'">'.$slaval['namasla'].'</option>';
150
+					}
151
+				?>
152 152
 				</select>
153 153
 			</td>
154 154
 		</tr>
@@ -156,10 +156,10 @@  discard block
 block discarded – undo
156 156
 			<td> Type</td><td> : </td>
157 157
 			<td>
158 158
 				<?php 
159
-                    //$pro = $slas->get_sla();
160
-                    echo $ticket['pro'];
159
+					//$pro = $slas->get_sla();
160
+					echo $ticket['pro'];
161 161
 
162
-                ?>
162
+				?>
163 163
 				
164 164
 			</td>
165 165
 		</tr>
@@ -179,13 +179,13 @@  discard block
 block discarded – undo
179 179
 			<td width="120"> Assign to* </td><td> : </td>
180 180
 			<td> <select name="idassignee">
181 181
 			<?php
182
-                $userassignee = $users->userdata($ticket['assignee']);
183
-                echo '<option value='.$ticket['assignee'].' selected="selected">'.$userassignee['fullname'].'</option>';
184
-                $listusers = $users->get_users();
185
-                foreach ($listusers as $user) {
186
-                    echo '<option value='.$user['id'].'>'.$user['fullname'].'</option>';
187
-                }
188
-            ?>
182
+				$userassignee = $users->userdata($ticket['assignee']);
183
+				echo '<option value='.$ticket['assignee'].' selected="selected">'.$userassignee['fullname'].'</option>';
184
+				$listusers = $users->get_users();
185
+				foreach ($listusers as $user) {
186
+					echo '<option value='.$user['id'].'>'.$user['fullname'].'</option>';
187
+				}
188
+			?>
189 189
 			</select> </td>
190 190
 		</tr>
191 191
 		<tr>
@@ -234,14 +234,14 @@  discard block
 block discarded – undo
234 234
 	<table class="formtable">
235 235
 	<tr bgcolor="#e0e0e0" ><td width="150">Updated On</td><td width="150">Updated By</td><td>Description</td></tr>
236 236
 	<?php
237
-        $list_log_tickets = $tickets->get_audit_trail($id);
238
-        foreach ($list_log_tickets as $log_ticket) {
239
-            $changed_by = $users->userdata($log_ticket['changeby']);
240
-            echo '<tr><td>'.date('d-M-Y H:i:s', $log_ticket['changedate']).'</td>'.
241
-                 '<td>'.$changed_by['fullname'].'</td>'.
242
-                 '<td>'.$log_ticket['changes'].'</td></tr>';
243
-        }
244
-    ?>
237
+		$list_log_tickets = $tickets->get_audit_trail($id);
238
+		foreach ($list_log_tickets as $log_ticket) {
239
+			$changed_by = $users->userdata($log_ticket['changeby']);
240
+			echo '<tr><td>'.date('d-M-Y H:i:s', $log_ticket['changedate']).'</td>'.
241
+				 '<td>'.$changed_by['fullname'].'</td>'.
242
+				 '<td>'.$log_ticket['changes'].'</td></tr>';
243
+		}
244
+	?>
245 245
 	</table>
246 246
 	</fieldset>
247 247
 	<br/><br/>
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     $tickets->log_tickets($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate, $changes, $changeby, $processby, $processdate, $comment);
56 56
     if ($user['level'] == 'Admin') {
57 57
         header('Location: ticketlist.php');
58
-    } else {
58
+    }else {
59 59
         header('Location: myticketbyassignee.php');
60 60
     }
61 61
 }
@@ -192,21 +192,21 @@  discard block
 block discarded – undo
192 192
 			<td> Status* </td><td> : </td>
193 193
 			<td> <input type="hidden" name="oldticketstatus" value="<?php echo $ticket['ticketstatus']; ?>"> 
194 194
 			<select name="ticketstatus">
195
-				<option value="Assigned" <?php echo ($ticket['ticketstatus'] == 'Assigned') ? 'selected="selected"' : '';?>>Assigned</option>
196
-				<option value="Process" <?php echo ($ticket['ticketstatus'] == 'Process') ? 'selected="selected"' : '';?>>Process</option>
197
-				<option value="Resolved" <?php echo ($ticket['ticketstatus'] == 'Resolved') ? 'selected="selected"' : '';?>>Resolved</option>
198
-				<option value="Pending" <?php echo ($ticket['ticketstatus'] == 'Pending') ? 'selected="selected"' : '';?>>Pending</option>
199
-				<option value="Closed" <?php echo ($ticket['ticketstatus'] == 'Closed') ? 'selected="selected"' : '';?>>Closed</option>
195
+				<option value="Assigned" <?php echo ($ticket['ticketstatus'] == 'Assigned') ? 'selected="selected"' : ''; ?>>Assigned</option>
196
+				<option value="Process" <?php echo ($ticket['ticketstatus'] == 'Process') ? 'selected="selected"' : ''; ?>>Process</option>
197
+				<option value="Resolved" <?php echo ($ticket['ticketstatus'] == 'Resolved') ? 'selected="selected"' : ''; ?>>Resolved</option>
198
+				<option value="Pending" <?php echo ($ticket['ticketstatus'] == 'Pending') ? 'selected="selected"' : ''; ?>>Pending</option>
199
+				<option value="Closed" <?php echo ($ticket['ticketstatus'] == 'Closed') ? 'selected="selected"' : ''; ?>>Closed</option>
200 200
 			</select> 
201 201
 			</td>
202 202
 		</tr>
203 203
 		<tr valign="top">
204 204
 			<td> Resolution* </td><td> : </td>
205
-			<td> <textarea name="resolution" rows="3" cols="38" <?php echo ($user['level'] == 'User') ? 'readonly="readonly"' : '';?>><?php echo $ticket['resolution']; ?></textarea> </td>
205
+			<td> <textarea name="resolution" rows="3" cols="38" <?php echo ($user['level'] == 'User') ? 'readonly="readonly"' : ''; ?>><?php echo $ticket['resolution']; ?></textarea> </td>
206 206
 		</tr>
207 207
 		<tr valign="top">
208 208
 			<td> Comment* </td><td> : </td>
209
-			<td> <textarea name="comment" rows="3" cols="38" <?php echo ($user['level'] != 'User') ? 'readonly="readonly"' : '';?>><?php echo $ticket['comment']; ?></textarea> </td>
209
+			<td> <textarea name="comment" rows="3" cols="38" <?php echo ($user['level'] != 'User') ? 'readonly="readonly"' : ''; ?>><?php echo $ticket['comment']; ?></textarea> </td>
210 210
 		</tr>
211 211
 		<tr>
212 212
 			<td> </td><td> </td>
Please login to merge, or discard this patch.