Passed
Push — master ( 901674...46121d )
by Saepul
02:24
created
emailsend.php 2 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -4,35 +4,35 @@  discard block
 block discarded – undo
4 4
 @$idemail = $_GET['id'];
5 5
 $email = $emails->get_email_queue_by_id($idemail);
6 6
 if (isset($_POST['submit'])) {
7
-    $emailstatus = $_POST['emailstatus'];
8
-    if ($emailstatus == 'Sent') {
9
-        $errors[] = 'You have sent this email!';
10
-    } else {
11
-        $to = $_POST['emailto'];
12
-        $cc = substr($_POST['emailcc'], 0, -2);
13
-        $subject = $_POST['emailsubject'];
14
-        $message = $_POST['message'];
7
+	$emailstatus = $_POST['emailstatus'];
8
+	if ($emailstatus == 'Sent') {
9
+		$errors[] = 'You have sent this email!';
10
+	} else {
11
+		$to = $_POST['emailto'];
12
+		$cc = substr($_POST['emailcc'], 0, -2);
13
+		$subject = $_POST['emailsubject'];
14
+		$message = $_POST['message'];
15 15
 
16
-        $headers = [];
17
-        $headers[] = 'MIME-Version: 1.0';
18
-        $headers[] = 'Content-type: text/plain; charset=iso-8859-1';
19
-        $headers[] = 'From: Helpdesk System <[email protected]>';
20
-        $headers[] = "Cc: $cc";
21
-        $headers[] = 'Bcc:';
22
-        $headers[] = 'Reply-To: Helpdesk System <[email protected]>';
23
-        $headers[] = 'X-Mailer: PHP/'.phpversion();
24
-        //echo $to."<br>".$cc."<br>".$subject."<br>".$message;
25
-        //echo $emailstatus;
16
+		$headers = [];
17
+		$headers[] = 'MIME-Version: 1.0';
18
+		$headers[] = 'Content-type: text/plain; charset=iso-8859-1';
19
+		$headers[] = 'From: Helpdesk System <[email protected]>';
20
+		$headers[] = "Cc: $cc";
21
+		$headers[] = 'Bcc:';
22
+		$headers[] = 'Reply-To: Helpdesk System <[email protected]>';
23
+		$headers[] = 'X-Mailer: PHP/'.phpversion();
24
+		//echo $to."<br>".$cc."<br>".$subject."<br>".$message;
25
+		//echo $emailstatus;
26 26
 
27
-        $ok = mail($to, $subject, $message, implode("\r\n", $headers));
28
-        if ($ok) {
29
-            $emails->update_status_email($idemail, 'Sent');
30
-            header('Location: emailsend.php?success');
31
-        } else {
32
-            $emails->update_status_email($idemail, 'Cannot Send');
33
-            $errors[] = 'Sorry, email cannot send now! Please try again.';
34
-        }
35
-    }
27
+		$ok = mail($to, $subject, $message, implode("\r\n", $headers));
28
+		if ($ok) {
29
+			$emails->update_status_email($idemail, 'Sent');
30
+			header('Location: emailsend.php?success');
31
+		} else {
32
+			$emails->update_status_email($idemail, 'Cannot Send');
33
+			$errors[] = 'Sorry, email cannot send now! Please try again.';
34
+		}
35
+	}
36 36
 }
37 37
 ?>
38 38
 <!DOCTYPE HTML>
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
 	</fieldset>
84 84
 	</form>
85 85
 	<?php 
86
-    if (empty($errors) === false) {
87
-        echo '<p class=errormsg>'.implode('</p><p class=errormsg>', $errors).'</p>';
88
-    }
89
-    if (isset($_GET['success']) && empty($_GET['success'])) {
90
-        echo 'Email has been sent!';
91
-    }
92
-    ?>
86
+	if (empty($errors) === false) {
87
+		echo '<p class=errormsg>'.implode('</p><p class=errormsg>', $errors).'</p>';
88
+	}
89
+	if (isset($_GET['success']) && empty($_GET['success'])) {
90
+		echo 'Email has been sent!';
91
+	}
92
+	?>
93 93
 </body>
94 94
 </html>
95 95
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
     $emailstatus = $_POST['emailstatus'];
8 8
     if ($emailstatus == 'Sent') {
9 9
         $errors[] = 'You have sent this email!';
10
-    } else {
10
+    }else {
11 11
         $to = $_POST['emailto'];
12 12
         $cc = substr($_POST['emailcc'], 0, -2);
13 13
         $subject = $_POST['emailsubject'];
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
         if ($ok) {
29 29
             $emails->update_status_email($idemail, 'Sent');
30 30
             header('Location: emailsend.php?success');
31
-        } else {
31
+        }else {
32 32
             $emails->update_status_email($idemail, 'Cannot Send');
33 33
             $errors[] = 'Sorry, email cannot send now! Please try again.';
34 34
         }
Please login to merge, or discard this patch.
customeredit.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -4,16 +4,16 @@  discard block
 block discarded – undo
4 4
 $id_cust = $_GET['id'];
5 5
 $member = $customers->customer_data($id_cust);
6 6
 if (isset($_POST['submit'])) {
7
-    $namacustomer = $_POST['namacustomer'];
8
-    $password = $_POST['password'];
9
-    $alamat = $_POST['alamat'];
10
-    $Telp = $_POST['telp'];
11
-    $email = $_POST['email'];
12
-    $PIC = $_POST['PIC'];
13
-    $selesperson = $_POST['selesperson'];
14
-    $customerproduct = $_POST['customerproduct'];
15
-    $customers->update_customer($id_cust, $namacustomer, $alamat, $Telp, $email, $PIC, $selesperson, $customerproduct);
16
-    header('Location: customerlist.php');
7
+	$namacustomer = $_POST['namacustomer'];
8
+	$password = $_POST['password'];
9
+	$alamat = $_POST['alamat'];
10
+	$Telp = $_POST['telp'];
11
+	$email = $_POST['email'];
12
+	$PIC = $_POST['PIC'];
13
+	$selesperson = $_POST['selesperson'];
14
+	$customerproduct = $_POST['customerproduct'];
15
+	$customers->update_customer($id_cust, $namacustomer, $alamat, $Telp, $email, $PIC, $selesperson, $customerproduct);
16
+	header('Location: customerlist.php');
17 17
 }
18 18
 ?>
19 19
 <!DOCTYPE HTML>
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
 	</form>
126 126
 
127 127
 	<?php 
128
-    if (empty($errors) === false) {
129
-        echo '<p class=errormsg>'.implode('</p><p class=errormsg>', $errors).'</p>';
130
-    }
131
-    ?>
128
+	if (empty($errors) === false) {
129
+		echo '<p class=errormsg>'.implode('</p><p class=errormsg>', $errors).'</p>';
130
+	}
131
+	?>
132 132
 </body>
133 133
 </html>
134 134
\ No newline at end of file
Please login to merge, or discard this patch.
email/notify_new_ticket.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -5,24 +5,24 @@
 block discarded – undo
5 5
 $emailstatus = 'New';
6 6
 $new_emails = $emails->get_email_by_status($emailstatus);
7 7
 foreach ($new_emails as $new_email) {
8
-    $idemail = $new_email['idemail'];
9
-    $to = $new_email['emailto'];
10
-    $cc = substr($new_email['emailcc'], 0, -2);
11
-    $subject = $new_email['emailsubject'];
12
-    $message = $new_email['message'];
8
+	$idemail = $new_email['idemail'];
9
+	$to = $new_email['emailto'];
10
+	$cc = substr($new_email['emailcc'], 0, -2);
11
+	$subject = $new_email['emailsubject'];
12
+	$message = $new_email['message'];
13 13
 
14
-    $headers = [];
15
-    $headers[] = 'MIME-Version: 1.0';
16
-    $headers[] = 'Content-type: text/plain; charset=iso-8859-1';
17
-    $headers[] = 'From: Helpdesk System <[email protected]>';
18
-    $headers[] = "Cc: $cc";
19
-    $headers[] = 'Bcc:';
20
-    $headers[] = 'Reply-To: Helpdesk System <[email protected]>';
21
-    $headers[] = 'X-Mailer: PHP/'.phpversion();
22
-    $ok = mail($to, $subject, $message, implode("\r\n", $headers));
23
-    if ($ok) {
24
-        $emails->update_status_email($idemail, 'Sent');
25
-    } else {
26
-        $emails->update_status_email($idemail, 'Cannot Send');
27
-    }
14
+	$headers = [];
15
+	$headers[] = 'MIME-Version: 1.0';
16
+	$headers[] = 'Content-type: text/plain; charset=iso-8859-1';
17
+	$headers[] = 'From: Helpdesk System <[email protected]>';
18
+	$headers[] = "Cc: $cc";
19
+	$headers[] = 'Bcc:';
20
+	$headers[] = 'Reply-To: Helpdesk System <[email protected]>';
21
+	$headers[] = 'X-Mailer: PHP/'.phpversion();
22
+	$ok = mail($to, $subject, $message, implode("\r\n", $headers));
23
+	if ($ok) {
24
+		$emails->update_status_email($idemail, 'Sent');
25
+	} else {
26
+		$emails->update_status_email($idemail, 'Cannot Send');
27
+	}
28 28
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
     $ok = mail($to, $subject, $message, implode("\r\n", $headers));
23 23
     if ($ok) {
24 24
         $emails->update_status_email($idemail, 'Sent');
25
-    } else {
25
+    }else {
26 26
         $emails->update_status_email($idemail, 'Cannot Send');
27 27
     }
28 28
 }
Please login to merge, or discard this patch.
email/sla_remainder.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -4,22 +4,22 @@
 block discarded – undo
4 4
 //$general->logged_out_protect();
5 5
 $sla_emails = $emails->get_email_sla_remainder();
6 6
 foreach ($sla_emails as $sla_email) {
7
-    $idemail = $sla_email['idemail'];
8
-    $to = $sla_email['emailto'];
9
-    $cc = substr($sla_email['emailcc'], 0, -2);
10
-    $subject = $sla_email['emailsubject'];
11
-    $message = $sla_email['message'];
7
+	$idemail = $sla_email['idemail'];
8
+	$to = $sla_email['emailto'];
9
+	$cc = substr($sla_email['emailcc'], 0, -2);
10
+	$subject = $sla_email['emailsubject'];
11
+	$message = $sla_email['message'];
12 12
 
13
-    $headers = [];
14
-    $headers[] = 'MIME-Version: 1.0';
15
-    $headers[] = 'Content-type: text/plain; charset=iso-8859-1';
16
-    $headers[] = 'From: Helpdesk System <[email protected]>';
17
-    $headers[] = "Cc:$cc";
18
-    $headers[] = 'Bcc:';
19
-    $headers[] = 'Reply-To: Helpdesk System <[email protected]>';
20
-    $headers[] = 'X-Mailer: PHP/'.phpversion();
21
-    echo $idemail.'<br>';
22
-    /*
13
+	$headers = [];
14
+	$headers[] = 'MIME-Version: 1.0';
15
+	$headers[] = 'Content-type: text/plain; charset=iso-8859-1';
16
+	$headers[] = 'From: Helpdesk System <[email protected]>';
17
+	$headers[] = "Cc:$cc";
18
+	$headers[] = 'Bcc:';
19
+	$headers[] = 'Reply-To: Helpdesk System <[email protected]>';
20
+	$headers[] = 'X-Mailer: PHP/'.phpversion();
21
+	echo $idemail.'<br>';
22
+	/*
23 23
     $ok = mail($to, $subject, $message, implode("\r\n", $headers));
24 24
     if ($ok)
25 25
     {	$emails->update_status_email($idemail,"Sent");
Please login to merge, or discard this patch.
email/test_send_email.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 $headers[] = 'X-Mailer: PHP/'.phpversion();
22 22
 $ok = mail($to, $subject, $message, implode("\r\n", $headers));
23 23
 if ($ok) {
24
-    echo 'Email sent successfully!!';
24
+	echo 'Email sent successfully!!';
25 25
 } else {
26
-    echo 'Failed: Email cannot be sent!!';
26
+	echo 'Failed: Email cannot be sent!!';
27 27
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,6 +22,6 @@
 block discarded – undo
22 22
 $ok = mail($to, $subject, $message, implode("\r\n", $headers));
23 23
 if ($ok) {
24 24
     echo 'Email sent successfully!!';
25
-} else {
25
+}else {
26 26
     echo 'Failed: Email cannot be sent!!';
27 27
 }
Please login to merge, or discard this patch.
core/classes/Tickets.php 2 patches
Indentation   +349 added lines, -349 removed lines patch added patch discarded remove patch
@@ -3,308 +3,308 @@  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 ticket_exists($projectid)
14
-    {
15
-        $query = $this->db->prepare('SELECT COUNT(`id`) FROM `tickets` WHERE `ticketnumber`= ?');
16
-        $query->bindValue(1, $projectid);
17
-
18
-        try {
19
-            $query->execute();
20
-            $rows = $query->fetchColumn();
21
-            if ($rows == 1) {
22
-                return true;
23
-            } else {
24
-                return false;
25
-            }
26
-        } catch (PDOException $e) {
27
-            die($e->getMessage());
28
-        }
29
-    }
30
-
31
-    public function add_ticket($ticketnumber, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $documentedby, $pro)
32
-    {
33
-        $current = time();
34
-        $querystring = 'INSERT INTO `tickets` (`ticketnumber`,`sla`,`reporteddate`, `reportedby`, `telp`, `email`, `problemsummary`,`problemdetail`,`ticketstatus`,`assignee`,`documentedby`,`documenteddate`,`pro`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
35
-        $query = $this->db->prepare($querystring);
36
-        $query->bindValue(1, $ticketnumber);
37
-        $query->bindValue(2, $sla);
38
-        //$query->bindValue(3, $idcustomer);
39
-        $query->bindValue(3, $reporteddate);
40
-        $query->bindValue(4, $reportedby);
41
-        $query->bindValue(5, $telp);
42
-        $query->bindValue(6, $email);
43
-        $query->bindValue(7, $problemsummary);
44
-        $query->bindValue(8, $problemdetail);
45
-        $query->bindValue(9, $ticketstatus);
46
-        $query->bindValue(10, $assignee);
47
-        $query->bindValue(11, $documentedby);
48
-        $query->bindValue(12, $current);
49
-        $query->bindValue(13, $pro);
50
-
51
-        try {
52
-            $query->execute();
53
-        } catch (PDOException $e) {
54
-            die($e->getMessage());
55
-        }
56
-    }
57
-
58
-    public function update_ticket($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate)
59
-    {
60
-        $querystring = 'UPDATE `tickets` SET `sla` = ? , `reporteddate` = ? , `reportedby` = ? , `telp` = ? ,`email` = ? , `problemsummary` = ? , `problemdetail` = ? ,`ticketstatus` = ?, `assignee` = ? , `assigneddate` = ?, `pendingby` = ?,`pendingdate` = ?, `resolution` = ? ,`resolvedby` = ?,`resolveddate` = ?,`closedby` = ?,`closeddate` = ? WHERE `id` = ?';
61
-        $query = $this->db->prepare($querystring);
62
-        $query->bindValue(1, $sla);
63
-        $query->bindValue(2, $reporteddate);
64
-        $query->bindValue(3, $reportedby);
65
-        $query->bindValue(4, $telp);
66
-        $query->bindValue(5, $email);
67
-        $query->bindValue(6, $problemsummary);
68
-        $query->bindValue(7, $problemdetail);
69
-        $query->bindValue(8, $ticketstatus);
70
-        $query->bindValue(9, $assignee);
71
-        $query->bindValue(10, $assigneddate);
72
-        $query->bindValue(11, $pendingby);
73
-        $query->bindValue(12, $pendingdate);
74
-        $query->bindValue(13, $resolution);
75
-        $query->bindValue(14, $resolvedby);
76
-        $query->bindValue(15, $resolveddate);
77
-        $query->bindValue(16, $closedby);
78
-        $query->bindValue(17, $closeddate);
79
-        $query->bindValue(18, $id);
80
-
81
-        try {
82
-            $query->execute();
83
-        } catch (PDOException $e) {
84
-            die($e->getMessage());
85
-        }
86
-    }
87
-
88
-    public function delete($id)
89
-    {
90
-        $sql = 'DELETE FROM `tickets` WHERE `id` = ?';
91
-        $query = $this->db->prepare($sql);
92
-        $query->bindValue(1, $id);
93
-
94
-        try {
95
-            $query->execute();
96
-        } catch (PDOException $e) {
97
-            die($e->getMessage());
98
-        }
99
-    }
100
-
101
-    public function ticket_data($id)
102
-    {
103
-        $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `id`= ?');
104
-        $query->bindValue(1, $id);
105
-
106
-        try {
107
-            $query->execute();
108
-
109
-            return $query->fetch();
110
-        } catch (PDOException $e) {
111
-            die($e->getMessage());
112
-        }
113
-    }
114
-
115
-    public function get_tickets()
116
-    {
117
-        $query = $this->db->prepare('SELECT * FROM `tickets` ORDER BY `ticketnumber` DESC');
118
-
119
-        try {
120
-            $query->execute();
121
-        } catch (PDOException $e) {
122
-            die($e->getMessage());
123
-        }
124
-
125
-        return $query->fetchAll();
126
-    }
127
-
128
-    public function get_pro()
129
-    {
130
-        $query = $this->db->prepare('SELECT pro FROM `tickets`');
131
-
132
-        try {
133
-            $query->execute();
134
-        } catch (PDOException $e) {
135
-            die($e->getMessage());
136
-        }
137
-
138
-        return $query->fetchAll();
139
-    }
140
-
141
-    public function get_opened_tickets()
142
-    {
143
-        $query = $this->db->prepare("SELECT * FROM `tickets` WHERE `ticketstatus` <> 'Closed' ORDER BY `ticketnumber` DESC");
144
-
145
-        try {
146
-            $query->execute();
147
-        } catch (PDOException $e) {
148
-            die($e->getMessage());
149
-        }
150
-
151
-        return $query->fetchAll();
152
-    }
153
-
154
-    public function get_tickets_by_requester($userid)
155
-    {
156
-        $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `documentedby`= ? ORDER BY `ticketnumber` DESC');
157
-        $query->bindValue(1, $userid);
158
-
159
-        try {
160
-            $query->execute();
161
-        } catch (PDOException $e) {
162
-            die($e->getMessage());
163
-        }
164
-
165
-        return $query->fetchAll();
166
-    }
167
-
168
-    public function get_tickets_by_assignee($userid)
169
-    {
170
-        $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `assignee`= ? ORDER BY `ticketnumber` DESC');
171
-        $query->bindValue(1, $userid);
172
-
173
-        try {
174
-            $query->execute();
175
-        } catch (PDOException $e) {
176
-            die($e->getMessage());
177
-        }
178
-
179
-        return $query->fetchAll();
180
-    }
181
-
182
-    public function get_tickets_by_resolver($username)
183
-    {
184
-        $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `resolvedby`= ? ORDER BY `ticketnumber` DESC');
185
-        $query->bindValue(1, $username);
186
-
187
-        try {
188
-            $query->execute();
189
-        } catch (PDOException $e) {
190
-            die($e->getMessage());
191
-        }
192
-
193
-        return $query->fetchAll();
194
-    }
195
-
196
-    public function get_tickets_by_resolver_not_closed($username)
197
-    {
198
-        $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `resolvedby`=? and `ticketstatus` <> ? ORDER BY `ticketnumber` DESC');
199
-        $query->bindValue(1, $username);
200
-        $query->bindValue(2, 'Closed');
201
-
202
-        try {
203
-            $query->execute();
204
-        } catch (PDOException $e) {
205
-            die($e->getMessage());
206
-        }
207
-
208
-        return $query->fetchAll();
209
-    }
210
-
211
-    public function get_tickets_by_status($ticketstatus)
212
-    {
213
-        $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `ticketstatus`=? ORDER BY `ticketnumber` DESC');
214
-        $query->bindValue(1, $ticketstatus);
215
-
216
-        try {
217
-            $query->execute();
218
-        } catch (PDOException $e) {
219
-            die($e->getMessage());
220
-        }
221
-
222
-        return $query->fetchAll();
223
-    }
224
-
225
-    public function search_closed_ticket($fromperiod, $toperiod)
226
-    {
227
-        $query = $this->db->prepare("SELECT * FROM `tickets` WHERE `documenteddate` >= ? AND `documenteddate` <= ? AND `ticketstatus` = 'Closed' ORDER BY `documenteddate` DESC");
228
-        $query->bindValue(1, $fromperiod);
229
-        $query->bindValue(2, $toperiod);
230
-
231
-        try {
232
-            $query->execute();
233
-        } catch (PDOException $e) {
234
-            die($e->getMessage());
235
-        }
236
-
237
-        return $query->fetchAll();
238
-    }
239
-
240
-    public function count_tickets_by_customer()
241
-    {
242
-        $query = $this->db->prepare('SELECT `idcustomer`, count(*) as `total` FROM `tickets` GROUP BY `idcustomer` ORDER BY total DESC LIMIT 5');
243
-
244
-        try {
245
-            $query->execute();
246
-        } catch (PDOException $e) {
247
-            die($e->getMessage());
248
-        }
249
-
250
-        return $query->fetchAll();
251
-    }
252
-
253
-    public function count_tickets_by_status()
254
-    {
255
-        $query = $this->db->prepare('SELECT ticketstatus, count(*) as total FROM `tickets` GROUP BY ticketstatus');
256
-
257
-        try {
258
-            $query->execute();
259
-        } catch (PDOException $e) {
260
-            die($e->getMessage());
261
-        }
262
-
263
-        return $query->fetchAll();
264
-    }
265
-
266
-    public function count_resolved_tickets_by_month()
267
-    {
268
-        $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`))";
269
-        $query = $this->db->prepare($sql);
270
-
271
-        try {
272
-            $query->execute();
273
-        } catch (PDOException $e) {
274
-            die($e->getMessage());
275
-        }
276
-
277
-        return $query->fetchAll();
278
-    }
279
-
280
-    public function count_inprogress_tickets_by_month()
281
-    {
282
-        $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`))";
283
-        $query = $this->db->prepare($sql);
284
-
285
-        try {
286
-            $query->execute();
287
-        } catch (PDOException $e) {
288
-            die($e->getMessage());
289
-        }
290
-
291
-        return $query->fetchAll();
292
-    }
293
-
294
-    public function get_last_ticket()
295
-    {
296
-        $query = $this->db->prepare('SELECT * FROM `tickets` ORDER BY id DESC LIMIT 1');
297
-
298
-        try {
299
-            $query->execute();
300
-
301
-            return $query->fetch();
302
-        } catch (PDOException $e) {
303
-            die($e->getMessage());
304
-        }
305
-    }
306
-
307
-    /*
6
+	private $db;
7
+
8
+	public function __construct($database)
9
+	{
10
+		$this->db = $database;
11
+	}
12
+
13
+	public function ticket_exists($projectid)
14
+	{
15
+		$query = $this->db->prepare('SELECT COUNT(`id`) FROM `tickets` WHERE `ticketnumber`= ?');
16
+		$query->bindValue(1, $projectid);
17
+
18
+		try {
19
+			$query->execute();
20
+			$rows = $query->fetchColumn();
21
+			if ($rows == 1) {
22
+				return true;
23
+			} else {
24
+				return false;
25
+			}
26
+		} catch (PDOException $e) {
27
+			die($e->getMessage());
28
+		}
29
+	}
30
+
31
+	public function add_ticket($ticketnumber, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $documentedby, $pro)
32
+	{
33
+		$current = time();
34
+		$querystring = 'INSERT INTO `tickets` (`ticketnumber`,`sla`,`reporteddate`, `reportedby`, `telp`, `email`, `problemsummary`,`problemdetail`,`ticketstatus`,`assignee`,`documentedby`,`documenteddate`,`pro`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
35
+		$query = $this->db->prepare($querystring);
36
+		$query->bindValue(1, $ticketnumber);
37
+		$query->bindValue(2, $sla);
38
+		//$query->bindValue(3, $idcustomer);
39
+		$query->bindValue(3, $reporteddate);
40
+		$query->bindValue(4, $reportedby);
41
+		$query->bindValue(5, $telp);
42
+		$query->bindValue(6, $email);
43
+		$query->bindValue(7, $problemsummary);
44
+		$query->bindValue(8, $problemdetail);
45
+		$query->bindValue(9, $ticketstatus);
46
+		$query->bindValue(10, $assignee);
47
+		$query->bindValue(11, $documentedby);
48
+		$query->bindValue(12, $current);
49
+		$query->bindValue(13, $pro);
50
+
51
+		try {
52
+			$query->execute();
53
+		} catch (PDOException $e) {
54
+			die($e->getMessage());
55
+		}
56
+	}
57
+
58
+	public function update_ticket($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate)
59
+	{
60
+		$querystring = 'UPDATE `tickets` SET `sla` = ? , `reporteddate` = ? , `reportedby` = ? , `telp` = ? ,`email` = ? , `problemsummary` = ? , `problemdetail` = ? ,`ticketstatus` = ?, `assignee` = ? , `assigneddate` = ?, `pendingby` = ?,`pendingdate` = ?, `resolution` = ? ,`resolvedby` = ?,`resolveddate` = ?,`closedby` = ?,`closeddate` = ? WHERE `id` = ?';
61
+		$query = $this->db->prepare($querystring);
62
+		$query->bindValue(1, $sla);
63
+		$query->bindValue(2, $reporteddate);
64
+		$query->bindValue(3, $reportedby);
65
+		$query->bindValue(4, $telp);
66
+		$query->bindValue(5, $email);
67
+		$query->bindValue(6, $problemsummary);
68
+		$query->bindValue(7, $problemdetail);
69
+		$query->bindValue(8, $ticketstatus);
70
+		$query->bindValue(9, $assignee);
71
+		$query->bindValue(10, $assigneddate);
72
+		$query->bindValue(11, $pendingby);
73
+		$query->bindValue(12, $pendingdate);
74
+		$query->bindValue(13, $resolution);
75
+		$query->bindValue(14, $resolvedby);
76
+		$query->bindValue(15, $resolveddate);
77
+		$query->bindValue(16, $closedby);
78
+		$query->bindValue(17, $closeddate);
79
+		$query->bindValue(18, $id);
80
+
81
+		try {
82
+			$query->execute();
83
+		} catch (PDOException $e) {
84
+			die($e->getMessage());
85
+		}
86
+	}
87
+
88
+	public function delete($id)
89
+	{
90
+		$sql = 'DELETE FROM `tickets` WHERE `id` = ?';
91
+		$query = $this->db->prepare($sql);
92
+		$query->bindValue(1, $id);
93
+
94
+		try {
95
+			$query->execute();
96
+		} catch (PDOException $e) {
97
+			die($e->getMessage());
98
+		}
99
+	}
100
+
101
+	public function ticket_data($id)
102
+	{
103
+		$query = $this->db->prepare('SELECT * FROM `tickets` WHERE `id`= ?');
104
+		$query->bindValue(1, $id);
105
+
106
+		try {
107
+			$query->execute();
108
+
109
+			return $query->fetch();
110
+		} catch (PDOException $e) {
111
+			die($e->getMessage());
112
+		}
113
+	}
114
+
115
+	public function get_tickets()
116
+	{
117
+		$query = $this->db->prepare('SELECT * FROM `tickets` ORDER BY `ticketnumber` DESC');
118
+
119
+		try {
120
+			$query->execute();
121
+		} catch (PDOException $e) {
122
+			die($e->getMessage());
123
+		}
124
+
125
+		return $query->fetchAll();
126
+	}
127
+
128
+	public function get_pro()
129
+	{
130
+		$query = $this->db->prepare('SELECT pro FROM `tickets`');
131
+
132
+		try {
133
+			$query->execute();
134
+		} catch (PDOException $e) {
135
+			die($e->getMessage());
136
+		}
137
+
138
+		return $query->fetchAll();
139
+	}
140
+
141
+	public function get_opened_tickets()
142
+	{
143
+		$query = $this->db->prepare("SELECT * FROM `tickets` WHERE `ticketstatus` <> 'Closed' ORDER BY `ticketnumber` DESC");
144
+
145
+		try {
146
+			$query->execute();
147
+		} catch (PDOException $e) {
148
+			die($e->getMessage());
149
+		}
150
+
151
+		return $query->fetchAll();
152
+	}
153
+
154
+	public function get_tickets_by_requester($userid)
155
+	{
156
+		$query = $this->db->prepare('SELECT * FROM `tickets` WHERE `documentedby`= ? ORDER BY `ticketnumber` DESC');
157
+		$query->bindValue(1, $userid);
158
+
159
+		try {
160
+			$query->execute();
161
+		} catch (PDOException $e) {
162
+			die($e->getMessage());
163
+		}
164
+
165
+		return $query->fetchAll();
166
+	}
167
+
168
+	public function get_tickets_by_assignee($userid)
169
+	{
170
+		$query = $this->db->prepare('SELECT * FROM `tickets` WHERE `assignee`= ? ORDER BY `ticketnumber` DESC');
171
+		$query->bindValue(1, $userid);
172
+
173
+		try {
174
+			$query->execute();
175
+		} catch (PDOException $e) {
176
+			die($e->getMessage());
177
+		}
178
+
179
+		return $query->fetchAll();
180
+	}
181
+
182
+	public function get_tickets_by_resolver($username)
183
+	{
184
+		$query = $this->db->prepare('SELECT * FROM `tickets` WHERE `resolvedby`= ? ORDER BY `ticketnumber` DESC');
185
+		$query->bindValue(1, $username);
186
+
187
+		try {
188
+			$query->execute();
189
+		} catch (PDOException $e) {
190
+			die($e->getMessage());
191
+		}
192
+
193
+		return $query->fetchAll();
194
+	}
195
+
196
+	public function get_tickets_by_resolver_not_closed($username)
197
+	{
198
+		$query = $this->db->prepare('SELECT * FROM `tickets` WHERE `resolvedby`=? and `ticketstatus` <> ? ORDER BY `ticketnumber` DESC');
199
+		$query->bindValue(1, $username);
200
+		$query->bindValue(2, 'Closed');
201
+
202
+		try {
203
+			$query->execute();
204
+		} catch (PDOException $e) {
205
+			die($e->getMessage());
206
+		}
207
+
208
+		return $query->fetchAll();
209
+	}
210
+
211
+	public function get_tickets_by_status($ticketstatus)
212
+	{
213
+		$query = $this->db->prepare('SELECT * FROM `tickets` WHERE `ticketstatus`=? ORDER BY `ticketnumber` DESC');
214
+		$query->bindValue(1, $ticketstatus);
215
+
216
+		try {
217
+			$query->execute();
218
+		} catch (PDOException $e) {
219
+			die($e->getMessage());
220
+		}
221
+
222
+		return $query->fetchAll();
223
+	}
224
+
225
+	public function search_closed_ticket($fromperiod, $toperiod)
226
+	{
227
+		$query = $this->db->prepare("SELECT * FROM `tickets` WHERE `documenteddate` >= ? AND `documenteddate` <= ? AND `ticketstatus` = 'Closed' ORDER BY `documenteddate` DESC");
228
+		$query->bindValue(1, $fromperiod);
229
+		$query->bindValue(2, $toperiod);
230
+
231
+		try {
232
+			$query->execute();
233
+		} catch (PDOException $e) {
234
+			die($e->getMessage());
235
+		}
236
+
237
+		return $query->fetchAll();
238
+	}
239
+
240
+	public function count_tickets_by_customer()
241
+	{
242
+		$query = $this->db->prepare('SELECT `idcustomer`, count(*) as `total` FROM `tickets` GROUP BY `idcustomer` ORDER BY total DESC LIMIT 5');
243
+
244
+		try {
245
+			$query->execute();
246
+		} catch (PDOException $e) {
247
+			die($e->getMessage());
248
+		}
249
+
250
+		return $query->fetchAll();
251
+	}
252
+
253
+	public function count_tickets_by_status()
254
+	{
255
+		$query = $this->db->prepare('SELECT ticketstatus, count(*) as total FROM `tickets` GROUP BY ticketstatus');
256
+
257
+		try {
258
+			$query->execute();
259
+		} catch (PDOException $e) {
260
+			die($e->getMessage());
261
+		}
262
+
263
+		return $query->fetchAll();
264
+	}
265
+
266
+	public function count_resolved_tickets_by_month()
267
+	{
268
+		$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`))";
269
+		$query = $this->db->prepare($sql);
270
+
271
+		try {
272
+			$query->execute();
273
+		} catch (PDOException $e) {
274
+			die($e->getMessage());
275
+		}
276
+
277
+		return $query->fetchAll();
278
+	}
279
+
280
+	public function count_inprogress_tickets_by_month()
281
+	{
282
+		$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`))";
283
+		$query = $this->db->prepare($sql);
284
+
285
+		try {
286
+			$query->execute();
287
+		} catch (PDOException $e) {
288
+			die($e->getMessage());
289
+		}
290
+
291
+		return $query->fetchAll();
292
+	}
293
+
294
+	public function get_last_ticket()
295
+	{
296
+		$query = $this->db->prepare('SELECT * FROM `tickets` ORDER BY id DESC LIMIT 1');
297
+
298
+		try {
299
+			$query->execute();
300
+
301
+			return $query->fetch();
302
+		} catch (PDOException $e) {
303
+			die($e->getMessage());
304
+		}
305
+	}
306
+
307
+	/*
308 308
         public function notify_assignee($id,$ticketnumber,$email_assignee)
309 309
         {	if (substr(php_uname(), 0, 7) == "Windows"){
310 310
                 $cmd = "D:\mowes_portable\www\helpdesk\batch\sendemail.bat";
@@ -318,51 +318,51 @@  discard block
 block discarded – undo
318 318
             }
319 319
         }*/
320 320
 
321
-    public function log_tickets($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate, $changes, $changeby)
322
-    {
323
-        $changedate = time();
324
-        $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`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
325
-        $query = $this->db->prepare($querystring);
326
-        $query->bindValue(1, $id);
327
-        $query->bindValue(2, $sla);
328
-        $query->bindValue(3, $reporteddate);
329
-        $query->bindValue(4, $reportedby);
330
-        $query->bindValue(5, $telp);
331
-        $query->bindValue(6, $email);
332
-        $query->bindValue(7, $problemsummary);
333
-        $query->bindValue(8, $problemdetail);
334
-        $query->bindValue(9, $ticketstatus);
335
-        $query->bindValue(10, $assignee);
336
-        $query->bindValue(11, $assigneddate);
337
-        $query->bindValue(12, $pendingby);
338
-        $query->bindValue(13, $pendingdate);
339
-        $query->bindValue(14, $resolution);
340
-        $query->bindValue(15, $resolvedby);
341
-        $query->bindValue(16, $resolveddate);
342
-        $query->bindValue(17, $closedby);
343
-        $query->bindValue(18, $closeddate);
344
-        $query->bindValue(19, $changes);
345
-        $query->bindValue(20, $changeby);
346
-        $query->bindValue(21, $changedate);
347
-
348
-        try {
349
-            $query->execute();
350
-        } catch (PDOException $e) {
351
-            die($e->getMessage());
352
-        }
353
-    }
354
-
355
-    public function get_audit_trail($id)
356
-    {
357
-        $query = $this->db->prepare('SELECT * FROM `log_tickets` WHERE `id`= ? ORDER BY `changedate` DESC');
358
-        $query->bindValue(1, $id);
359
-
360
-        try {
361
-            $query->execute();
362
-        } catch (PDOException $e) {
363
-            die($e->getMessage());
364
-        }
365
-
366
-        return $query->fetchAll();
367
-    }
321
+	public function log_tickets($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate, $changes, $changeby)
322
+	{
323
+		$changedate = time();
324
+		$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`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
325
+		$query = $this->db->prepare($querystring);
326
+		$query->bindValue(1, $id);
327
+		$query->bindValue(2, $sla);
328
+		$query->bindValue(3, $reporteddate);
329
+		$query->bindValue(4, $reportedby);
330
+		$query->bindValue(5, $telp);
331
+		$query->bindValue(6, $email);
332
+		$query->bindValue(7, $problemsummary);
333
+		$query->bindValue(8, $problemdetail);
334
+		$query->bindValue(9, $ticketstatus);
335
+		$query->bindValue(10, $assignee);
336
+		$query->bindValue(11, $assigneddate);
337
+		$query->bindValue(12, $pendingby);
338
+		$query->bindValue(13, $pendingdate);
339
+		$query->bindValue(14, $resolution);
340
+		$query->bindValue(15, $resolvedby);
341
+		$query->bindValue(16, $resolveddate);
342
+		$query->bindValue(17, $closedby);
343
+		$query->bindValue(18, $closeddate);
344
+		$query->bindValue(19, $changes);
345
+		$query->bindValue(20, $changeby);
346
+		$query->bindValue(21, $changedate);
347
+
348
+		try {
349
+			$query->execute();
350
+		} catch (PDOException $e) {
351
+			die($e->getMessage());
352
+		}
353
+	}
354
+
355
+	public function get_audit_trail($id)
356
+	{
357
+		$query = $this->db->prepare('SELECT * FROM `log_tickets` WHERE `id`= ? ORDER BY `changedate` DESC');
358
+		$query->bindValue(1, $id);
359
+
360
+		try {
361
+			$query->execute();
362
+		} catch (PDOException $e) {
363
+			die($e->getMessage());
364
+		}
365
+
366
+		return $query->fetchAll();
367
+	}
368 368
 }
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -20,10 +20,10 @@  discard block
 block discarded – undo
20 20
             $rows = $query->fetchColumn();
21 21
             if ($rows == 1) {
22 22
                 return true;
23
-            } else {
23
+            }else {
24 24
                 return false;
25 25
             }
26
-        } catch (PDOException $e) {
26
+        }catch (PDOException $e) {
27 27
             die($e->getMessage());
28 28
         }
29 29
     }
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
         try {
52 52
             $query->execute();
53
-        } catch (PDOException $e) {
53
+        }catch (PDOException $e) {
54 54
             die($e->getMessage());
55 55
         }
56 56
     }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
         try {
82 82
             $query->execute();
83
-        } catch (PDOException $e) {
83
+        }catch (PDOException $e) {
84 84
             die($e->getMessage());
85 85
         }
86 86
     }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
         try {
95 95
             $query->execute();
96
-        } catch (PDOException $e) {
96
+        }catch (PDOException $e) {
97 97
             die($e->getMessage());
98 98
         }
99 99
     }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
             $query->execute();
108 108
 
109 109
             return $query->fetch();
110
-        } catch (PDOException $e) {
110
+        }catch (PDOException $e) {
111 111
             die($e->getMessage());
112 112
         }
113 113
     }
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
         try {
120 120
             $query->execute();
121
-        } catch (PDOException $e) {
121
+        }catch (PDOException $e) {
122 122
             die($e->getMessage());
123 123
         }
124 124
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
         try {
133 133
             $query->execute();
134
-        } catch (PDOException $e) {
134
+        }catch (PDOException $e) {
135 135
             die($e->getMessage());
136 136
         }
137 137
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
         try {
146 146
             $query->execute();
147
-        } catch (PDOException $e) {
147
+        }catch (PDOException $e) {
148 148
             die($e->getMessage());
149 149
         }
150 150
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
         try {
160 160
             $query->execute();
161
-        } catch (PDOException $e) {
161
+        }catch (PDOException $e) {
162 162
             die($e->getMessage());
163 163
         }
164 164
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 
173 173
         try {
174 174
             $query->execute();
175
-        } catch (PDOException $e) {
175
+        }catch (PDOException $e) {
176 176
             die($e->getMessage());
177 177
         }
178 178
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 
187 187
         try {
188 188
             $query->execute();
189
-        } catch (PDOException $e) {
189
+        }catch (PDOException $e) {
190 190
             die($e->getMessage());
191 191
         }
192 192
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 
202 202
         try {
203 203
             $query->execute();
204
-        } catch (PDOException $e) {
204
+        }catch (PDOException $e) {
205 205
             die($e->getMessage());
206 206
         }
207 207
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 
216 216
         try {
217 217
             $query->execute();
218
-        } catch (PDOException $e) {
218
+        }catch (PDOException $e) {
219 219
             die($e->getMessage());
220 220
         }
221 221
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 
231 231
         try {
232 232
             $query->execute();
233
-        } catch (PDOException $e) {
233
+        }catch (PDOException $e) {
234 234
             die($e->getMessage());
235 235
         }
236 236
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 
244 244
         try {
245 245
             $query->execute();
246
-        } catch (PDOException $e) {
246
+        }catch (PDOException $e) {
247 247
             die($e->getMessage());
248 248
         }
249 249
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 
257 257
         try {
258 258
             $query->execute();
259
-        } catch (PDOException $e) {
259
+        }catch (PDOException $e) {
260 260
             die($e->getMessage());
261 261
         }
262 262
 
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 
271 271
         try {
272 272
             $query->execute();
273
-        } catch (PDOException $e) {
273
+        }catch (PDOException $e) {
274 274
             die($e->getMessage());
275 275
         }
276 276
 
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 
285 285
         try {
286 286
             $query->execute();
287
-        } catch (PDOException $e) {
287
+        }catch (PDOException $e) {
288 288
             die($e->getMessage());
289 289
         }
290 290
 
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
             $query->execute();
300 300
 
301 301
             return $query->fetch();
302
-        } catch (PDOException $e) {
302
+        }catch (PDOException $e) {
303 303
             die($e->getMessage());
304 304
         }
305 305
     }
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 
348 348
         try {
349 349
             $query->execute();
350
-        } catch (PDOException $e) {
350
+        }catch (PDOException $e) {
351 351
             die($e->getMessage());
352 352
         }
353 353
     }
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 
360 360
         try {
361 361
             $query->execute();
362
-        } catch (PDOException $e) {
362
+        }catch (PDOException $e) {
363 363
             die($e->getMessage());
364 364
         }
365 365
 
Please login to merge, or discard this patch.
core/classes/HDNews.php 2 patches
Indentation   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -2,98 +2,98 @@
 block discarded – undo
2 2
 
3 3
 class HDNews
4 4
 {
5
-    private $db;
6
-
7
-    public function __construct($database)
8
-    {
9
-        $this->db = $database;
10
-    }
11
-
12
-    public function add_news($newsdate, $title, $detail, $createdby, $createdon, $expired)
13
-    {
14
-        $query = $this->db->prepare('INSERT INTO `news` (`newsdate`,`title`, `detail`, `createdby`, `createdon`, `expired`) VALUES (?, ?, ?, ?, ?, ?)');
15
-        $query->bindValue(1, $newsdate);
16
-        $query->bindValue(2, $title);
17
-        $query->bindValue(3, $detail);
18
-        $query->bindValue(4, $createdby);
19
-        $query->bindValue(5, $createdon);
20
-        $query->bindValue(6, $expired);
21
-
22
-        try {
23
-            $query->execute();
24
-        } catch (PDOException $e) {
25
-            die($e->getMessage());
26
-        }
27
-    }
28
-
29
-    public function update_news($id, $newsdate, $title, $detail, $createdby, $createdon, $expired)
30
-    {
31
-        $query = $this->db->prepare('UPDATE `news` SET `newsdate` = ? , `title` = ? ,`detail` = ? , `createdby` = ? , `createdon` = ? , `expired` = ? WHERE `id` = ?');
32
-        $query->bindValue(1, $newsdate);
33
-        $query->bindValue(2, $title);
34
-        $query->bindValue(3, $detail);
35
-        $query->bindValue(4, $createdby);
36
-        $query->bindValue(5, $createdon);
37
-        $query->bindValue(6, $expired);
38
-        $query->bindValue(7, $id);
39
-
40
-        try {
41
-            $query->execute();
42
-        } catch (PDOException $e) {
43
-            die($e->getMessage());
44
-        }
45
-    }
46
-
47
-    public function delete($id)
48
-    {
49
-        $sql = 'DELETE FROM `news` WHERE `id` = ?';
50
-        $query = $this->db->prepare($sql);
51
-        $query->bindValue(1, $id);
52
-
53
-        try {
54
-            $query->execute();
55
-        } catch (PDOException $e) {
56
-            die($e->getMessage());
57
-        }
58
-    }
59
-
60
-    public function news_data($id)
61
-    {
62
-        $query = $this->db->prepare('SELECT * FROM `news` WHERE `id`= ?');
63
-        $query->bindValue(1, $id);
64
-
65
-        try {
66
-            $query->execute();
67
-
68
-            return $query->fetch();
69
-        } catch (PDOException $e) {
70
-            die($e->getMessage());
71
-        }
72
-    }
73
-
74
-    public function get_news()
75
-    {
76
-        $query = $this->db->prepare('SELECT * FROM `news` ORDER BY `newsdate` ASC');
77
-
78
-        try {
79
-            $query->execute();
80
-        } catch (PDOException $e) {
81
-            die($e->getMessage());
82
-        }
83
-
84
-        return $query->fetchAll();
85
-    }
86
-
87
-    public function get_headline_news()
88
-    {
89
-        $query = $this->db->prepare('SELECT * FROM `news` WHERE UNIX_TIMESTAMP( curdate( ) ) < `expired` ORDER BY `newsdate` ASC');
90
-
91
-        try {
92
-            $query->execute();
93
-        } catch (PDOException $e) {
94
-            die($e->getMessage());
95
-        }
96
-
97
-        return $query->fetchAll();
98
-    }
5
+	private $db;
6
+
7
+	public function __construct($database)
8
+	{
9
+		$this->db = $database;
10
+	}
11
+
12
+	public function add_news($newsdate, $title, $detail, $createdby, $createdon, $expired)
13
+	{
14
+		$query = $this->db->prepare('INSERT INTO `news` (`newsdate`,`title`, `detail`, `createdby`, `createdon`, `expired`) VALUES (?, ?, ?, ?, ?, ?)');
15
+		$query->bindValue(1, $newsdate);
16
+		$query->bindValue(2, $title);
17
+		$query->bindValue(3, $detail);
18
+		$query->bindValue(4, $createdby);
19
+		$query->bindValue(5, $createdon);
20
+		$query->bindValue(6, $expired);
21
+
22
+		try {
23
+			$query->execute();
24
+		} catch (PDOException $e) {
25
+			die($e->getMessage());
26
+		}
27
+	}
28
+
29
+	public function update_news($id, $newsdate, $title, $detail, $createdby, $createdon, $expired)
30
+	{
31
+		$query = $this->db->prepare('UPDATE `news` SET `newsdate` = ? , `title` = ? ,`detail` = ? , `createdby` = ? , `createdon` = ? , `expired` = ? WHERE `id` = ?');
32
+		$query->bindValue(1, $newsdate);
33
+		$query->bindValue(2, $title);
34
+		$query->bindValue(3, $detail);
35
+		$query->bindValue(4, $createdby);
36
+		$query->bindValue(5, $createdon);
37
+		$query->bindValue(6, $expired);
38
+		$query->bindValue(7, $id);
39
+
40
+		try {
41
+			$query->execute();
42
+		} catch (PDOException $e) {
43
+			die($e->getMessage());
44
+		}
45
+	}
46
+
47
+	public function delete($id)
48
+	{
49
+		$sql = 'DELETE FROM `news` WHERE `id` = ?';
50
+		$query = $this->db->prepare($sql);
51
+		$query->bindValue(1, $id);
52
+
53
+		try {
54
+			$query->execute();
55
+		} catch (PDOException $e) {
56
+			die($e->getMessage());
57
+		}
58
+	}
59
+
60
+	public function news_data($id)
61
+	{
62
+		$query = $this->db->prepare('SELECT * FROM `news` WHERE `id`= ?');
63
+		$query->bindValue(1, $id);
64
+
65
+		try {
66
+			$query->execute();
67
+
68
+			return $query->fetch();
69
+		} catch (PDOException $e) {
70
+			die($e->getMessage());
71
+		}
72
+	}
73
+
74
+	public function get_news()
75
+	{
76
+		$query = $this->db->prepare('SELECT * FROM `news` ORDER BY `newsdate` ASC');
77
+
78
+		try {
79
+			$query->execute();
80
+		} catch (PDOException $e) {
81
+			die($e->getMessage());
82
+		}
83
+
84
+		return $query->fetchAll();
85
+	}
86
+
87
+	public function get_headline_news()
88
+	{
89
+		$query = $this->db->prepare('SELECT * FROM `news` WHERE UNIX_TIMESTAMP( curdate( ) ) < `expired` ORDER BY `newsdate` ASC');
90
+
91
+		try {
92
+			$query->execute();
93
+		} catch (PDOException $e) {
94
+			die($e->getMessage());
95
+		}
96
+
97
+		return $query->fetchAll();
98
+	}
99 99
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
         try {
23 23
             $query->execute();
24
-        } catch (PDOException $e) {
24
+        }catch (PDOException $e) {
25 25
             die($e->getMessage());
26 26
         }
27 27
     }
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
         try {
41 41
             $query->execute();
42
-        } catch (PDOException $e) {
42
+        }catch (PDOException $e) {
43 43
             die($e->getMessage());
44 44
         }
45 45
     }
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
         try {
54 54
             $query->execute();
55
-        } catch (PDOException $e) {
55
+        }catch (PDOException $e) {
56 56
             die($e->getMessage());
57 57
         }
58 58
     }
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
             $query->execute();
67 67
 
68 68
             return $query->fetch();
69
-        } catch (PDOException $e) {
69
+        }catch (PDOException $e) {
70 70
             die($e->getMessage());
71 71
         }
72 72
     }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
         try {
79 79
             $query->execute();
80
-        } catch (PDOException $e) {
80
+        }catch (PDOException $e) {
81 81
             die($e->getMessage());
82 82
         }
83 83
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 
91 91
         try {
92 92
             $query->execute();
93
-        } catch (PDOException $e) {
93
+        }catch (PDOException $e) {
94 94
             die($e->getMessage());
95 95
         }
96 96
 
Please login to merge, or discard this patch.
core/classes/Emails.php 2 patches
Indentation   +201 added lines, -201 removed lines patch added patch discarded remove patch
@@ -3,211 +3,211 @@
 block discarded – undo
3 3
 date_default_timezone_set('Asia/Jakarta');
4 4
 class Emails
5 5
 {
6
-    private $db;
7
-
8
-    public function __construct($database)
9
-    {
10
-        $this->db = $database;
11
-    }
12
-
13
-    public function add_email($idticket, $senddate, $emailto, $emailcc, $emailbcc, $emailsubject, $message, $emailstatus)
14
-    {
15
-        $querystring = 'INSERT INTO `log_emails` (`idticket`,`senddate`,`emailto`,`emailcc`, `emailbcc`,`emailsubject`,`message`, `emailstatus`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)';
16
-        $query = $this->db->prepare($querystring);
17
-        $query->bindValue(1, $idticket);
18
-        $query->bindValue(2, $senddate);
19
-        $query->bindValue(3, $emailto);
20
-        $query->bindValue(4, $emailcc);
21
-        $query->bindValue(5, $emailbcc);
22
-        $query->bindValue(6, $emailsubject);
23
-        $query->bindValue(7, $message);
24
-        $query->bindValue(8, $emailstatus);
25
-
26
-        try {
27
-            $query->execute();
28
-        } catch (PDOException $e) {
29
-            die($e->getMessage());
30
-        }
31
-    }
32
-
33
-    public function add_sla_remainder($idticket, $ticketnumber, $slasenddate, $emailto, $emailcc, $emailbcc, $emailsubject, $message)
34
-    {
35
-        $emailsubject = "Ticket No: $ticketnumber has reached 75% of SLA Resolution Goal Time";
36
-        $message =
6
+	private $db;
7
+
8
+	public function __construct($database)
9
+	{
10
+		$this->db = $database;
11
+	}
12
+
13
+	public function add_email($idticket, $senddate, $emailto, $emailcc, $emailbcc, $emailsubject, $message, $emailstatus)
14
+	{
15
+		$querystring = 'INSERT INTO `log_emails` (`idticket`,`senddate`,`emailto`,`emailcc`, `emailbcc`,`emailsubject`,`message`, `emailstatus`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)';
16
+		$query = $this->db->prepare($querystring);
17
+		$query->bindValue(1, $idticket);
18
+		$query->bindValue(2, $senddate);
19
+		$query->bindValue(3, $emailto);
20
+		$query->bindValue(4, $emailcc);
21
+		$query->bindValue(5, $emailbcc);
22
+		$query->bindValue(6, $emailsubject);
23
+		$query->bindValue(7, $message);
24
+		$query->bindValue(8, $emailstatus);
25
+
26
+		try {
27
+			$query->execute();
28
+		} catch (PDOException $e) {
29
+			die($e->getMessage());
30
+		}
31
+	}
32
+
33
+	public function add_sla_remainder($idticket, $ticketnumber, $slasenddate, $emailto, $emailcc, $emailbcc, $emailsubject, $message)
34
+	{
35
+		$emailsubject = "Ticket No: $ticketnumber has reached 75% of SLA Resolution Goal Time";
36
+		$message =
37 37
 "Dear Assignee, \r\n
38 38
 We remaind you that your ticket No: $ticketnumber has reached 75% of SLA Resolution Goal Time.\r\n
39 39
 Please give resolution for this ticket as soon as posible.\r\n
40 40
 Thank you. \r\n
41 41
 Regards, \r\n
42 42
 Helpdesk";
43
-        $querystring = 'INSERT INTO `log_emails` (`idticket`,`senddate`,`emailto`,`emailcc`, `emailbcc`,`emailsubject`,`message`, `emailstatus`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)';
44
-        $query = $this->db->prepare($querystring);
45
-        $query->bindValue(1, $idticket);
46
-        $query->bindValue(2, $slasenddate);
47
-        $query->bindValue(3, $emailto);
48
-        $query->bindValue(4, $emailcc);
49
-        $query->bindValue(5, $emailbcc);
50
-        $query->bindValue(6, $emailsubject);
51
-        $query->bindValue(7, $message);
52
-        $query->bindValue(8, 'SLA Remainder');
53
-
54
-        try {
55
-            $query->execute();
56
-        } catch (PDOException $e) {
57
-            die($e->getMessage());
58
-        }
59
-    }
60
-
61
-    public function update_status_email($idemail, $emailstatus)
62
-    {
63
-        $querystring = 'UPDATE `log_emails` SET `emailstatus` = ? WHERE `idemail` = ?';
64
-        $query = $this->db->prepare($querystring);
65
-        $query->bindValue(1, $emailstatus);
66
-        $query->bindValue(2, $idemail);
67
-
68
-        try {
69
-            $query->execute();
70
-        } catch (PDOException $e) {
71
-            die($e->getMessage());
72
-        }
73
-    }
74
-
75
-    public function delete($idemail)
76
-    {
77
-        $sql = 'DELETE FROM `log_emails` WHERE `idemail` = ?';
78
-        $query = $this->db->prepare($sql);
79
-        $query->bindValue(1, $idemail);
80
-
81
-        try {
82
-            $query->execute();
83
-        } catch (PDOException $e) {
84
-            die($e->getMessage());
85
-        }
86
-    }
87
-
88
-    public function get_email_by_idemail($idemail)
89
-    {
90
-        $query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `idemail`= ?');
91
-        $query->bindValue(1, $idemail);
92
-
93
-        try {
94
-            $query->execute();
95
-
96
-            return $query->fetch();
97
-        } catch (PDOException $e) {
98
-            die($e->getMessage());
99
-        }
100
-    }
101
-
102
-    public function get_email_by_idticket($idticket)
103
-    {
104
-        $query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `idticket`= ?');
105
-        $query->bindValue(1, $idticket);
106
-
107
-        try {
108
-            $query->execute();
109
-
110
-            return $query->fetch();
111
-        } catch (PDOException $e) {
112
-            die($e->getMessage());
113
-        }
114
-    }
115
-
116
-    public function get_email_by_status($emailstatus)
117
-    {
118
-        $query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `emailstatus`= ?');
119
-        $query->bindValue(1, $emailstatus);
120
-
121
-        try {
122
-            $query->execute();
123
-        } catch (PDOException $e) {
124
-            die($e->getMessage());
125
-        }
126
-
127
-        return $query->fetchAll();
128
-    }
129
-
130
-    public function get_email_sla_remainder()
131
-    {
132
-        $query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `emailstatus`= ? and senddate <= UNIX_TIMESTAMP(NOW())');
133
-        $query->bindValue(1, 'SLA Remainder');
134
-
135
-        try {
136
-            $query->execute();
137
-        } catch (PDOException $e) {
138
-            die($e->getMessage());
139
-        }
140
-
141
-        return $query->fetchAll();
142
-    }
143
-
144
-    public function get_email()
145
-    {
146
-        $query = $this->db->prepare('SELECT * FROM `log_emails` ORDER BY `idemail` ASC');
147
-
148
-        try {
149
-            $query->execute();
150
-        } catch (PDOException $e) {
151
-            die($e->getMessage());
152
-        }
153
-
154
-        return $query->fetchAll();
155
-    }
156
-
157
-    public function get_email_queue()
158
-    {
159
-        $query = $this->db->prepare("SELECT * FROM `log_emails` WHERE `emailstatus` <> 'Sent' AND senddate <= UNIX_TIMESTAMP(NOW()) ORDER BY `senddate` ASC");
160
-
161
-        try {
162
-            $query->execute();
163
-        } catch (PDOException $e) {
164
-            die($e->getMessage());
165
-        }
166
-
167
-        return $query->fetchAll();
168
-    }
169
-
170
-    public function get_email_queue_by_id($idemail)
171
-    {
172
-        $query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `idemail`= ?');
173
-        $query->bindValue(1, $idemail);
174
-
175
-        try {
176
-            $query->execute();
177
-
178
-            return $query->fetch();
179
-        } catch (PDOException $e) {
180
-            die($e->getMessage());
181
-        }
182
-    }
183
-
184
-    public function send_new_ticket()
185
-    {
186
-        if (substr(php_uname(), 0, 7) == 'Windows') {
187
-            //$cmd = "D:\mowes_portable\www\helpdesk\batch\sendnewticket.bat";
188
-            $cmd = "C:\xampp\htdocs\helpdesk\batch\sendnewticket.bat";
189
-            $WshShell = new COM('WScript.Shell');
190
-            $oExec = $WshShell->Run("cmd /C $cmd", 0, false);
191
-
192
-            return $oExec == 0 ? true : false;
193
-        } else {
194
-            $cmd = 'php /batch/sendnewticket.bat';
195
-            exec($cmd.' > /dev/null &');
196
-        }
197
-    }
198
-
199
-    public function send_sla_remainder()
200
-    {
201
-        if (substr(php_uname(), 0, 7) == 'Windows') {
202
-            //$cmd = "D:\mowes_portable\www\helpdesk\batch\sendslaremainder.bat";
203
-            $cmd = "C:\xampp\htdocs\helpdesk\batch\sendslaremainder.bat";
204
-            $WshShell = new COM('WScript.Shell');
205
-            $oExec = $WshShell->Run("cmd /C $cmd", 0, false);
206
-
207
-            return $oExec == 0 ? true : false;
208
-        } else {
209
-            $cmd = 'php /batch/sendslaremainder.bat';
210
-            exec($cmd.' > /dev/null &');
211
-        }
212
-    }
43
+		$querystring = 'INSERT INTO `log_emails` (`idticket`,`senddate`,`emailto`,`emailcc`, `emailbcc`,`emailsubject`,`message`, `emailstatus`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)';
44
+		$query = $this->db->prepare($querystring);
45
+		$query->bindValue(1, $idticket);
46
+		$query->bindValue(2, $slasenddate);
47
+		$query->bindValue(3, $emailto);
48
+		$query->bindValue(4, $emailcc);
49
+		$query->bindValue(5, $emailbcc);
50
+		$query->bindValue(6, $emailsubject);
51
+		$query->bindValue(7, $message);
52
+		$query->bindValue(8, 'SLA Remainder');
53
+
54
+		try {
55
+			$query->execute();
56
+		} catch (PDOException $e) {
57
+			die($e->getMessage());
58
+		}
59
+	}
60
+
61
+	public function update_status_email($idemail, $emailstatus)
62
+	{
63
+		$querystring = 'UPDATE `log_emails` SET `emailstatus` = ? WHERE `idemail` = ?';
64
+		$query = $this->db->prepare($querystring);
65
+		$query->bindValue(1, $emailstatus);
66
+		$query->bindValue(2, $idemail);
67
+
68
+		try {
69
+			$query->execute();
70
+		} catch (PDOException $e) {
71
+			die($e->getMessage());
72
+		}
73
+	}
74
+
75
+	public function delete($idemail)
76
+	{
77
+		$sql = 'DELETE FROM `log_emails` WHERE `idemail` = ?';
78
+		$query = $this->db->prepare($sql);
79
+		$query->bindValue(1, $idemail);
80
+
81
+		try {
82
+			$query->execute();
83
+		} catch (PDOException $e) {
84
+			die($e->getMessage());
85
+		}
86
+	}
87
+
88
+	public function get_email_by_idemail($idemail)
89
+	{
90
+		$query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `idemail`= ?');
91
+		$query->bindValue(1, $idemail);
92
+
93
+		try {
94
+			$query->execute();
95
+
96
+			return $query->fetch();
97
+		} catch (PDOException $e) {
98
+			die($e->getMessage());
99
+		}
100
+	}
101
+
102
+	public function get_email_by_idticket($idticket)
103
+	{
104
+		$query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `idticket`= ?');
105
+		$query->bindValue(1, $idticket);
106
+
107
+		try {
108
+			$query->execute();
109
+
110
+			return $query->fetch();
111
+		} catch (PDOException $e) {
112
+			die($e->getMessage());
113
+		}
114
+	}
115
+
116
+	public function get_email_by_status($emailstatus)
117
+	{
118
+		$query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `emailstatus`= ?');
119
+		$query->bindValue(1, $emailstatus);
120
+
121
+		try {
122
+			$query->execute();
123
+		} catch (PDOException $e) {
124
+			die($e->getMessage());
125
+		}
126
+
127
+		return $query->fetchAll();
128
+	}
129
+
130
+	public function get_email_sla_remainder()
131
+	{
132
+		$query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `emailstatus`= ? and senddate <= UNIX_TIMESTAMP(NOW())');
133
+		$query->bindValue(1, 'SLA Remainder');
134
+
135
+		try {
136
+			$query->execute();
137
+		} catch (PDOException $e) {
138
+			die($e->getMessage());
139
+		}
140
+
141
+		return $query->fetchAll();
142
+	}
143
+
144
+	public function get_email()
145
+	{
146
+		$query = $this->db->prepare('SELECT * FROM `log_emails` ORDER BY `idemail` ASC');
147
+
148
+		try {
149
+			$query->execute();
150
+		} catch (PDOException $e) {
151
+			die($e->getMessage());
152
+		}
153
+
154
+		return $query->fetchAll();
155
+	}
156
+
157
+	public function get_email_queue()
158
+	{
159
+		$query = $this->db->prepare("SELECT * FROM `log_emails` WHERE `emailstatus` <> 'Sent' AND senddate <= UNIX_TIMESTAMP(NOW()) ORDER BY `senddate` ASC");
160
+
161
+		try {
162
+			$query->execute();
163
+		} catch (PDOException $e) {
164
+			die($e->getMessage());
165
+		}
166
+
167
+		return $query->fetchAll();
168
+	}
169
+
170
+	public function get_email_queue_by_id($idemail)
171
+	{
172
+		$query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `idemail`= ?');
173
+		$query->bindValue(1, $idemail);
174
+
175
+		try {
176
+			$query->execute();
177
+
178
+			return $query->fetch();
179
+		} catch (PDOException $e) {
180
+			die($e->getMessage());
181
+		}
182
+	}
183
+
184
+	public function send_new_ticket()
185
+	{
186
+		if (substr(php_uname(), 0, 7) == 'Windows') {
187
+			//$cmd = "D:\mowes_portable\www\helpdesk\batch\sendnewticket.bat";
188
+			$cmd = "C:\xampp\htdocs\helpdesk\batch\sendnewticket.bat";
189
+			$WshShell = new COM('WScript.Shell');
190
+			$oExec = $WshShell->Run("cmd /C $cmd", 0, false);
191
+
192
+			return $oExec == 0 ? true : false;
193
+		} else {
194
+			$cmd = 'php /batch/sendnewticket.bat';
195
+			exec($cmd.' > /dev/null &');
196
+		}
197
+	}
198
+
199
+	public function send_sla_remainder()
200
+	{
201
+		if (substr(php_uname(), 0, 7) == 'Windows') {
202
+			//$cmd = "D:\mowes_portable\www\helpdesk\batch\sendslaremainder.bat";
203
+			$cmd = "C:\xampp\htdocs\helpdesk\batch\sendslaremainder.bat";
204
+			$WshShell = new COM('WScript.Shell');
205
+			$oExec = $WshShell->Run("cmd /C $cmd", 0, false);
206
+
207
+			return $oExec == 0 ? true : false;
208
+		} else {
209
+			$cmd = 'php /batch/sendslaremainder.bat';
210
+			exec($cmd.' > /dev/null &');
211
+		}
212
+	}
213 213
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
         try {
27 27
             $query->execute();
28
-        } catch (PDOException $e) {
28
+        }catch (PDOException $e) {
29 29
             die($e->getMessage());
30 30
         }
31 31
     }
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
         try {
55 55
             $query->execute();
56
-        } catch (PDOException $e) {
56
+        }catch (PDOException $e) {
57 57
             die($e->getMessage());
58 58
         }
59 59
     }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
         try {
69 69
             $query->execute();
70
-        } catch (PDOException $e) {
70
+        }catch (PDOException $e) {
71 71
             die($e->getMessage());
72 72
         }
73 73
     }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
         try {
82 82
             $query->execute();
83
-        } catch (PDOException $e) {
83
+        }catch (PDOException $e) {
84 84
             die($e->getMessage());
85 85
         }
86 86
     }
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
             $query->execute();
95 95
 
96 96
             return $query->fetch();
97
-        } catch (PDOException $e) {
97
+        }catch (PDOException $e) {
98 98
             die($e->getMessage());
99 99
         }
100 100
     }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             $query->execute();
109 109
 
110 110
             return $query->fetch();
111
-        } catch (PDOException $e) {
111
+        }catch (PDOException $e) {
112 112
             die($e->getMessage());
113 113
         }
114 114
     }
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
         try {
122 122
             $query->execute();
123
-        } catch (PDOException $e) {
123
+        }catch (PDOException $e) {
124 124
             die($e->getMessage());
125 125
         }
126 126
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 
135 135
         try {
136 136
             $query->execute();
137
-        } catch (PDOException $e) {
137
+        }catch (PDOException $e) {
138 138
             die($e->getMessage());
139 139
         }
140 140
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 
148 148
         try {
149 149
             $query->execute();
150
-        } catch (PDOException $e) {
150
+        }catch (PDOException $e) {
151 151
             die($e->getMessage());
152 152
         }
153 153
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 
161 161
         try {
162 162
             $query->execute();
163
-        } catch (PDOException $e) {
163
+        }catch (PDOException $e) {
164 164
             die($e->getMessage());
165 165
         }
166 166
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
             $query->execute();
177 177
 
178 178
             return $query->fetch();
179
-        } catch (PDOException $e) {
179
+        }catch (PDOException $e) {
180 180
             die($e->getMessage());
181 181
         }
182 182
     }
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
             $oExec = $WshShell->Run("cmd /C $cmd", 0, false);
191 191
 
192 192
             return $oExec == 0 ? true : false;
193
-        } else {
193
+        }else {
194 194
             $cmd = 'php /batch/sendnewticket.bat';
195 195
             exec($cmd.' > /dev/null &');
196 196
         }
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
             $oExec = $WshShell->Run("cmd /C $cmd", 0, false);
206 206
 
207 207
             return $oExec == 0 ? true : false;
208
-        } else {
208
+        }else {
209 209
             $cmd = 'php /batch/sendslaremainder.bat';
210 210
             exec($cmd.' > /dev/null &');
211 211
         }
Please login to merge, or discard this patch.
core/classes/Report.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -2,37 +2,37 @@
 block discarded – undo
2 2
 
3 3
 class Reports
4 4
 {
5
-    private $db;
6
-
7
-    public function __construct($database)
8
-    {
9
-        $this->db = $database;
10
-    }
11
-
12
-    public function data_report($idreport)
13
-    {
14
-        $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `slaid`= ?');
15
-        $query->bindValue(1, $slaid);
16
-
17
-        try {
18
-            $query->execute();
19
-
20
-            return $query->fetch();
21
-        } catch (PDOException $e) {
22
-            die($e->getMessage());
23
-        }
24
-    }
25
-
26
-    public function data_report_002()
27
-    {
28
-        $query = $this->db->prepare('SELECT * FROM `sla` ORDER BY `slaid` ASC');
29
-
30
-        try {
31
-            $query->execute();
32
-        } catch (PDOException $e) {
33
-            die($e->getMessage());
34
-        }
35
-
36
-        return $query->fetchAll();
37
-    }
5
+	private $db;
6
+
7
+	public function __construct($database)
8
+	{
9
+		$this->db = $database;
10
+	}
11
+
12
+	public function data_report($idreport)
13
+	{
14
+		$query = $this->db->prepare('SELECT * FROM `tickets` WHERE `slaid`= ?');
15
+		$query->bindValue(1, $slaid);
16
+
17
+		try {
18
+			$query->execute();
19
+
20
+			return $query->fetch();
21
+		} catch (PDOException $e) {
22
+			die($e->getMessage());
23
+		}
24
+	}
25
+
26
+	public function data_report_002()
27
+	{
28
+		$query = $this->db->prepare('SELECT * FROM `sla` ORDER BY `slaid` ASC');
29
+
30
+		try {
31
+			$query->execute();
32
+		} catch (PDOException $e) {
33
+			die($e->getMessage());
34
+		}
35
+
36
+		return $query->fetchAll();
37
+	}
38 38
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
             $query->execute();
19 19
 
20 20
             return $query->fetch();
21
-        } catch (PDOException $e) {
21
+        }catch (PDOException $e) {
22 22
             die($e->getMessage());
23 23
         }
24 24
     }
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
         try {
31 31
             $query->execute();
32
-        } catch (PDOException $e) {
32
+        }catch (PDOException $e) {
33 33
             die($e->getMessage());
34 34
         }
35 35
 
Please login to merge, or discard this patch.