Passed
Push — master ( 8dd1b9...249eab )
by Saepul
02:51
created
home.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,1 +1,1 @@
 block discarded – undo
1
-<?php 
require 'core/init.php';
$general->logged_out_protect();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>Helpdesk System</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
<link rel="icon" href="images/favicon.ico" type="image/x-icon">
</head>
<frameset name="mainfs" rows="85,*" frameborder="0" border="0" framespacing="0">
	<frame src="header.php" name="topFrame" scrolling="NO" noresize />
	<frameset name="contentfs" cols="200,*" frameborder="0" border="0" framespacing="0">
		<frame src="navigator.php" name="leftFrame" scrolling="NO" noresize />
		<frame src="content.php" name="contentFrame" />
	</frameset>
</frameset><noframes></noframes>
<body>
</body>
</html>
2 1
\ No newline at end of file
2
+<?php 
require 'core/init.php'; $general->logged_out_protect(); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>Helpdesk System</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
<link rel="icon" href="images/favicon.ico" type="image/x-icon">
</head>
<frameset name="mainfs" rows="85,*" frameborder="0" border="0" framespacing="0">
	<frame src="header.php" name="topFrame" scrolling="NO" noresize />
	<frameset name="contentfs" cols="200,*" frameborder="0" border="0" framespacing="0">
		<frame src="navigator.php" name="leftFrame" scrolling="NO" noresize />
		<frame src="content.php" name="contentFrame" />
	</frameset>
</frameset><noframes></noframes>
<body>
</body>
</html>
3 3
\ No newline at end of file
Please login to merge, or discard this patch.
login.php 2 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -3,26 +3,26 @@  discard block
 block discarded – undo
3 3
 require 'core/init.php';
4 4
 $general->logged_in_protect();
5 5
 if (empty($_POST) === false) {
6
-    $username = strip_tags(addslashes(trim($_POST['username'])));
7
-    $password = strip_tags(addslashes(trim($_POST['password'])));
8
-    if (empty($username) === true || empty($password) === true) {
9
-        $errors[] = 'Sorry, but we need your username and password.';
10
-    } elseif ($users->user_exists($username) === false) {
11
-        $errors[] = 'Sorry, that username doesn\'t exists. Please try again.';
12
-    } else {
13
-        $login = $users->login($username, $password);
14
-        if ($login === false) {
15
-            $errors[] = 'Sorry, that username/password is invalid. Please try again.';
16
-        } elseif (!$users->email_confirmed($username)) {
17
-            $errors[] = 'Sorry, your account is locked. Please contact Administrator.';
18
-        } else {
19
-            $_SESSION['loginid'] = $login;
20
-            $users->log_users($login, 'Login to Helpdesk System');
21
-            echo $login;
22
-            header('location: home.php');
23
-            exit();
24
-        }
25
-    }
6
+	$username = strip_tags(addslashes(trim($_POST['username'])));
7
+	$password = strip_tags(addslashes(trim($_POST['password'])));
8
+	if (empty($username) === true || empty($password) === true) {
9
+		$errors[] = 'Sorry, but we need your username and password.';
10
+	} elseif ($users->user_exists($username) === false) {
11
+		$errors[] = 'Sorry, that username doesn\'t exists. Please try again.';
12
+	} else {
13
+		$login = $users->login($username, $password);
14
+		if ($login === false) {
15
+			$errors[] = 'Sorry, that username/password is invalid. Please try again.';
16
+		} elseif (!$users->email_confirmed($username)) {
17
+			$errors[] = 'Sorry, your account is locked. Please contact Administrator.';
18
+		} else {
19
+			$_SESSION['loginid'] = $login;
20
+			$users->log_users($login, 'Login to Helpdesk System');
21
+			echo $login;
22
+			header('location: home.php');
23
+			exit();
24
+		}
25
+	}
26 26
 }
27 27
 ?>
28 28
 <!DOCTYPE html>
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 	</table>
57 57
 </div>
58 58
 <?php 
59
-    if (empty($errors) === false) {
60
-        echo '<p class="errormsg">'.implode('</p><p class="errormsg">', $errors).'</p>';
61
-    }
59
+	if (empty($errors) === false) {
60
+		echo '<p class="errormsg">'.implode('</p><p class="errormsg">', $errors).'</p>';
61
+	}
62 62
 ?>
63 63
 <div class="footer">
64 64
 </div>
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@
 block discarded – undo
9 9
         $errors[] = 'Sorry, but we need your username and password.';
10 10
     } elseif ($users->user_exists($username) === false) {
11 11
         $errors[] = 'Sorry, that username doesn\'t exists. Please try again.';
12
-    } else {
12
+    }else {
13 13
         $login = $users->login($username, $password);
14 14
         if ($login === false) {
15 15
             $errors[] = 'Sorry, that username/password is invalid. Please try again.';
16 16
         } elseif (!$users->email_confirmed($username)) {
17 17
             $errors[] = 'Sorry, your account is locked. Please contact Administrator.';
18
-        } else {
18
+        }else {
19 19
             $_SESSION['loginid'] = $login;
20 20
             $users->log_users($login, 'Login to Helpdesk System');
21 21
             echo $login;
Please login to merge, or discard this patch.
useredit.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -4,19 +4,19 @@
 block discarded – undo
4 4
 $id = $_GET['id'];
5 5
 $member = $users->userdata($id);
6 6
 if (isset($_POST['submit'])) {
7
-    $fullname = $_POST['fullname'];
8
-    $username = htmlentities($_POST['username']);
9
-    $password = $_POST['password'];
10
-    $email = htmlentities($_POST['email']);
11
-    $Telp = $_POST['telp'];
12
-    $level = $_POST['level'];
13
-    $locked = $_POST['locked'];
14
-    //echo 'Old Passw: '.$member['password']. ' New Passw:'. $password;
15
-    if ($password == '') {
16
-        $password = $member['password'];
17
-    }
18
-    $users->update($id, $username, $password, $email, $fullname, $Telp, $level, $locked);
19
-    header('Location: userlist.php');
7
+	$fullname = $_POST['fullname'];
8
+	$username = htmlentities($_POST['username']);
9
+	$password = $_POST['password'];
10
+	$email = htmlentities($_POST['email']);
11
+	$Telp = $_POST['telp'];
12
+	$level = $_POST['level'];
13
+	$locked = $_POST['locked'];
14
+	//echo 'Old Passw: '.$member['password']. ' New Passw:'. $password;
15
+	if ($password == '') {
16
+		$password = $member['password'];
17
+	}
18
+	$users->update($id, $username, $password, $email, $fullname, $Telp, $level, $locked);
19
+	header('Location: userlist.php');
20 20
 }
21 21
 ?>
22 22
 <!DOCTYPE HTML>
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.
core/classes/General.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -2,24 +2,24 @@
 block discarded – undo
2 2
 
3 3
 class General
4 4
 {
5
-    public function logged_in()
6
-    {
7
-        return(isset($_SESSION['loginid'])) ? true : false;
8
-    }
5
+	public function logged_in()
6
+	{
7
+		return(isset($_SESSION['loginid'])) ? true : false;
8
+	}
9 9
 
10
-    public function logged_in_protect()
11
-    {
12
-        if ($this->logged_in() === true) {
13
-            header('Location: home.php');
14
-            exit();
15
-        }
16
-    }
10
+	public function logged_in_protect()
11
+	{
12
+		if ($this->logged_in() === true) {
13
+			header('Location: home.php');
14
+			exit();
15
+		}
16
+	}
17 17
 
18
-    public function logged_out_protect()
19
-    {
20
-        if ($this->logged_in() === false) {
21
-            header('Location: index.php');
22
-            exit();
23
-        }
24
-    }
18
+	public function logged_out_protect()
19
+	{
20
+		if ($this->logged_in() === false) {
21
+			header('Location: index.php');
22
+			exit();
23
+		}
24
+	}
25 25
 }
Please login to merge, or discard this patch.
core/classes/SLA.php 2 patches
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -2,102 +2,102 @@
 block discarded – undo
2 2
 
3 3
 class SLA
4 4
 {
5
-    private $db;
6
-
7
-    public function __construct($database)
8
-    {
9
-        $this->db = $database;
10
-    }
11
-
12
-    public function sla_exists($slaid)
13
-    {
14
-        $query = $this->db->prepare('SELECT COUNT(`slaid`) FROM `sla` WHERE `slaid`= ?');
15
-        $query->bindValue(1, $slaid);
16
-
17
-        try {
18
-            $query->execute();
19
-            $rows = $query->fetchColumn();
20
-            if ($rows == 1) {
21
-                return true;
22
-            } else {
23
-                return false;
24
-            }
25
-        } catch (PDOException $e) {
26
-            die($e->getMessage());
27
-        }
28
-    }
29
-
30
-    public function add_sla($slaid, $namasla, $responsetime, $resolutiontime, $slawarning)
31
-    {
32
-        $querystring = 'INSERT INTO `sla` (`slaid`,`namasla`,`responsetime`, `resolutiontime`, `slawarning`) VALUES (?, ?, ?, ?, ?)';
33
-        $query = $this->db->prepare($querystring);
34
-        $query->bindValue(1, $slaid);
35
-        $query->bindValue(2, $namasla);
36
-        $query->bindValue(3, $responsetime);
37
-        $query->bindValue(4, $resolutiontime);
38
-        $query->bindValue(5, $slawarning);
39
-
40
-        try {
41
-            $query->execute();
42
-        } catch (PDOException $e) {
43
-            die($e->getMessage());
44
-        }
45
-    }
46
-
47
-    public function update_sla($slaid, $namasla, $responsetime, $resolutiontime, $slawarning)
48
-    {
49
-        $querystring = 'UPDATE `sla` SET `namasla` = ? , `responsetime` = ? , `resolutiontime` = ?, `slawarning` = ?  WHERE `slaid` = ?';
50
-        $query = $this->db->prepare($querystring);
51
-        $query->bindValue(1, $namasla);
52
-        $query->bindValue(2, $responsetime);
53
-        $query->bindValue(3, $resolutiontime);
54
-        $query->bindValue(4, $slawarning);
55
-        $query->bindValue(5, $slaid);
56
-
57
-        try {
58
-            $query->execute();
59
-        } catch (PDOException $e) {
60
-            die($e->getMessage());
61
-        }
62
-    }
63
-
64
-    public function delete($id)
65
-    {
66
-        $sql = 'DELETE FROM `sla` WHERE `slaid` = ?';
67
-        $query = $this->db->prepare($sql);
68
-        $query->bindValue(1, $id);
69
-
70
-        try {
71
-            $query->execute();
72
-        } catch (PDOException $e) {
73
-            die($e->getMessage());
74
-        }
75
-    }
76
-
77
-    public function sla_data($slaid)
78
-    {
79
-        $query = $this->db->prepare('SELECT * FROM `sla` WHERE `slaid`= ?');
80
-        $query->bindValue(1, $slaid);
81
-
82
-        try {
83
-            $query->execute();
84
-
85
-            return $query->fetch();
86
-        } catch (PDOException $e) {
87
-            die($e->getMessage());
88
-        }
89
-    }
90
-
91
-    public function get_sla()
92
-    {
93
-        $query = $this->db->prepare('SELECT * FROM `sla` ORDER BY `slaid` ASC');
94
-
95
-        try {
96
-            $query->execute();
97
-        } catch (PDOException $e) {
98
-            die($e->getMessage());
99
-        }
100
-
101
-        return $query->fetchAll();
102
-    }
5
+	private $db;
6
+
7
+	public function __construct($database)
8
+	{
9
+		$this->db = $database;
10
+	}
11
+
12
+	public function sla_exists($slaid)
13
+	{
14
+		$query = $this->db->prepare('SELECT COUNT(`slaid`) FROM `sla` WHERE `slaid`= ?');
15
+		$query->bindValue(1, $slaid);
16
+
17
+		try {
18
+			$query->execute();
19
+			$rows = $query->fetchColumn();
20
+			if ($rows == 1) {
21
+				return true;
22
+			} else {
23
+				return false;
24
+			}
25
+		} catch (PDOException $e) {
26
+			die($e->getMessage());
27
+		}
28
+	}
29
+
30
+	public function add_sla($slaid, $namasla, $responsetime, $resolutiontime, $slawarning)
31
+	{
32
+		$querystring = 'INSERT INTO `sla` (`slaid`,`namasla`,`responsetime`, `resolutiontime`, `slawarning`) VALUES (?, ?, ?, ?, ?)';
33
+		$query = $this->db->prepare($querystring);
34
+		$query->bindValue(1, $slaid);
35
+		$query->bindValue(2, $namasla);
36
+		$query->bindValue(3, $responsetime);
37
+		$query->bindValue(4, $resolutiontime);
38
+		$query->bindValue(5, $slawarning);
39
+
40
+		try {
41
+			$query->execute();
42
+		} catch (PDOException $e) {
43
+			die($e->getMessage());
44
+		}
45
+	}
46
+
47
+	public function update_sla($slaid, $namasla, $responsetime, $resolutiontime, $slawarning)
48
+	{
49
+		$querystring = 'UPDATE `sla` SET `namasla` = ? , `responsetime` = ? , `resolutiontime` = ?, `slawarning` = ?  WHERE `slaid` = ?';
50
+		$query = $this->db->prepare($querystring);
51
+		$query->bindValue(1, $namasla);
52
+		$query->bindValue(2, $responsetime);
53
+		$query->bindValue(3, $resolutiontime);
54
+		$query->bindValue(4, $slawarning);
55
+		$query->bindValue(5, $slaid);
56
+
57
+		try {
58
+			$query->execute();
59
+		} catch (PDOException $e) {
60
+			die($e->getMessage());
61
+		}
62
+	}
63
+
64
+	public function delete($id)
65
+	{
66
+		$sql = 'DELETE FROM `sla` WHERE `slaid` = ?';
67
+		$query = $this->db->prepare($sql);
68
+		$query->bindValue(1, $id);
69
+
70
+		try {
71
+			$query->execute();
72
+		} catch (PDOException $e) {
73
+			die($e->getMessage());
74
+		}
75
+	}
76
+
77
+	public function sla_data($slaid)
78
+	{
79
+		$query = $this->db->prepare('SELECT * FROM `sla` WHERE `slaid`= ?');
80
+		$query->bindValue(1, $slaid);
81
+
82
+		try {
83
+			$query->execute();
84
+
85
+			return $query->fetch();
86
+		} catch (PDOException $e) {
87
+			die($e->getMessage());
88
+		}
89
+	}
90
+
91
+	public function get_sla()
92
+	{
93
+		$query = $this->db->prepare('SELECT * FROM `sla` ORDER BY `slaid` ASC');
94
+
95
+		try {
96
+			$query->execute();
97
+		} catch (PDOException $e) {
98
+			die($e->getMessage());
99
+		}
100
+
101
+		return $query->fetchAll();
102
+	}
103 103
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
             $rows = $query->fetchColumn();
20 20
             if ($rows == 1) {
21 21
                 return true;
22
-            } else {
22
+            }else {
23 23
                 return false;
24 24
             }
25
-        } catch (PDOException $e) {
25
+        }catch (PDOException $e) {
26 26
             die($e->getMessage());
27 27
         }
28 28
     }
@@ -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
     }
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
         try {
58 58
             $query->execute();
59
-        } catch (PDOException $e) {
59
+        }catch (PDOException $e) {
60 60
             die($e->getMessage());
61 61
         }
62 62
     }
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
         try {
71 71
             $query->execute();
72
-        } catch (PDOException $e) {
72
+        }catch (PDOException $e) {
73 73
             die($e->getMessage());
74 74
         }
75 75
     }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
             $query->execute();
84 84
 
85 85
             return $query->fetch();
86
-        } catch (PDOException $e) {
86
+        }catch (PDOException $e) {
87 87
             die($e->getMessage());
88 88
         }
89 89
     }
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
         try {
96 96
             $query->execute();
97
-        } catch (PDOException $e) {
97
+        }catch (PDOException $e) {
98 98
             die($e->getMessage());
99 99
         }
100 100
 
Please login to merge, or discard this patch.
core/connect/database.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 $config = [
4
-    'host'		    => 'localhost',
5
-    'username' 	=> 'root',
6
-    'password' 	=> 'root',
7
-    'dbname' 	  => 'helpdesk',
4
+	'host'		    => 'localhost',
5
+	'username' 	=> 'root',
6
+	'password' 	=> 'root',
7
+	'dbname' 	  => 'helpdesk',
8 8
 ];
9 9
 
10 10
 $db = new PDO('mysql:host='.$config['host'].';dbname='.$config['dbname'], $config['username'], $config['password']);
Please login to merge, or discard this patch.
ticketnew.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 		</tr>
139 139
 		<tr>
140 140
 			<td> Reported By* </td><td> : </td>
141
-			<td> <?php echo $user['fullname'];?> <input type='hidden' size='50' name='reportedby' value="<?php echo $user['fullname'];?>" maxlength="50"> </td>
141
+			<td> <?php echo $user['fullname']; ?> <input type='hidden' size='50' name='reportedby' value="<?php echo $user['fullname']; ?>" maxlength="50"> </td>
142 142
 		</tr>
143 143
 		<tr>
144 144
 			<td> Urgency (SLA)*</td><td> : </td>
@@ -177,8 +177,8 @@  discard block
 block discarded – undo
177 177
 			<td> </td>
178 178
 			<td> </td>
179 179
 			<td> <br/>
180
-			<?php $assignee = $users->get_user_random_by_level('Admin');?>
181
-			<input type="hidden" name="idassignee" value="<?php echo $assignee['id'];?>"/>
180
+			<?php $assignee = $users->get_user_random_by_level('Admin'); ?>
181
+			<input type="hidden" name="idassignee" value="<?php echo $assignee['id']; ?>"/>
182 182
 			<input type='submit' name='submit' value=' Submit '>  &nbsp;&nbsp;&nbsp;
183 183
 			<input type='reset' name='reset' value=' Reset '> 
184 184
 			</td>
Please login to merge, or discard this patch.
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -6,33 +6,33 @@  discard block
 block discarded – undo
6 6
 $documentedby = $_SESSION['loginid'];
7 7
 $user = $users->userdata($_SESSION['loginid']);
8 8
 if (isset($_POST['submit'])) {
9
-    $lastticket = $tickets->get_last_ticket();
10
-    $id = $lastticket['id'] + 1;
11
-    $ticketnumber = $id.'/SR/'.date('M').'/'.date('Y'); //format nomor tiket
12
-    $sla = $_POST['sla'];
13
-    $reporteddate = strtotime($_POST['reporteddate']);
14
-    $reportedby = $_POST['reportedby'];
15
-    $telp = $_POST['telp'];
16
-    $email = $_POST['email'];
17
-    $problemsummary = $_POST['problemsummary'];
18
-    $problemdetail = $_POST['problemdetail'];
19
-    $ticketstatus = 'Assigned'; //ketika pertama kali dibuat, status="Assigned" ke salah satu teknisi
20
-    $assignee = $_POST['idassignee'];
21
-    $pro = $_POST['pro'];
22
-    $changes = 'Create New Ticket';
23
-    $datasla = $slas->sla_data($sla);
24
-    $resolutiontime = $datasla['resolutiontime'];
25
-    $tickets->add_ticket($ticketnumber, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $documentedby, $pro);
26
-    $assigneddate = '';
27
-    $pendingby = '';
28
-    $pendingdate = '';
29
-    $resolution = '';
30
-    $resolvedby = '';
31
-    $resolveddate = '';
32
-    $closedby = '';
33
-    $closeddate = '';
34
-    $tickets->log_tickets($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate, $changes, $changeby);
35
-    header("Location: ticketread.php?id=$id");
9
+	$lastticket = $tickets->get_last_ticket();
10
+	$id = $lastticket['id'] + 1;
11
+	$ticketnumber = $id.'/SR/'.date('M').'/'.date('Y'); //format nomor tiket
12
+	$sla = $_POST['sla'];
13
+	$reporteddate = strtotime($_POST['reporteddate']);
14
+	$reportedby = $_POST['reportedby'];
15
+	$telp = $_POST['telp'];
16
+	$email = $_POST['email'];
17
+	$problemsummary = $_POST['problemsummary'];
18
+	$problemdetail = $_POST['problemdetail'];
19
+	$ticketstatus = 'Assigned'; //ketika pertama kali dibuat, status="Assigned" ke salah satu teknisi
20
+	$assignee = $_POST['idassignee'];
21
+	$pro = $_POST['pro'];
22
+	$changes = 'Create New Ticket';
23
+	$datasla = $slas->sla_data($sla);
24
+	$resolutiontime = $datasla['resolutiontime'];
25
+	$tickets->add_ticket($ticketnumber, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $documentedby, $pro);
26
+	$assigneddate = '';
27
+	$pendingby = '';
28
+	$pendingdate = '';
29
+	$resolution = '';
30
+	$resolvedby = '';
31
+	$resolveddate = '';
32
+	$closedby = '';
33
+	$closeddate = '';
34
+	$tickets->log_tickets($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate, $changes, $changeby);
35
+	header("Location: ticketread.php?id=$id");
36 36
 }
37 37
 ?>
38 38
 <!DOCTYPE HTML>
@@ -115,12 +115,12 @@  discard block
 block discarded – undo
115 115
 			<td> Urgency (SLA)*</td><td> : </td>
116 116
 			<td><select name="sla">
117 117
 				<?php 
118
-                    $sla = $slas->get_sla();
119
-                    echo '<option value="'.$slaval['slaid'].'" selected="selected">'.$slaval['namasla'].'</option>';
120
-                    foreach ($sla as $slaval) {
121
-                        echo '<option value="'.$slaval['slaid'].'">'.$slaval['namasla'].'</option>';
122
-                    }
123
-                ?>
118
+					$sla = $slas->get_sla();
119
+					echo '<option value="'.$slaval['slaid'].'" selected="selected">'.$slaval['namasla'].'</option>';
120
+					foreach ($sla as $slaval) {
121
+						echo '<option value="'.$slaval['slaid'].'">'.$slaval['namasla'].'</option>';
122
+					}
123
+				?>
124 124
 				</select>
125 125
 			</td>
126 126
 		</tr>
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
 			<td> Type</td><td> : </td>
129 129
 			<td><select name="pro">
130 130
 				<?php 
131
-                    //$pro = $slas->get_sla();
132
-                    echo '<option value=""></option>';
133
-                    echo '<option value="Hardware">Hardware</option>';
134
-                    echo '<option value="Software">Software</option>';
135
-                ?>
131
+					//$pro = $slas->get_sla();
132
+					echo '<option value=""></option>';
133
+					echo '<option value="Hardware">Hardware</option>';
134
+					echo '<option value="Software">Software</option>';
135
+				?>
136 136
 				</select>
137 137
 			</td>
138 138
 		</tr>
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
 	</form>
160 160
 
161 161
 	<?php 
162
-    if (empty($errors) === false) {
163
-        echo '<p class=errormsg>'.implode('</p><p class=errormsg>', $errors).'</p>';
164
-    }
165
-    ?>
162
+	if (empty($errors) === false) {
163
+		echo '<p class=errormsg>'.implode('</p><p class=errormsg>', $errors).'</p>';
164
+	}
165
+	?>
166 166
 </body>
167 167
 </html>
168 168
\ No newline at end of file
Please login to merge, or discard this patch.
ticketread.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 			<td> Urgency (SLA)</td><td> : </td>
44 44
 			<td> 
45 45
 			<?php 
46
-                $sladata = $slas->sla_data($ticket['sla']);
47
-                echo $sladata['namasla'];
48
-            ?>
46
+				$sladata = $slas->sla_data($ticket['sla']);
47
+				echo $sladata['namasla'];
48
+			?>
49 49
 			</td>
50 50
 		</tr>
51 51
 		<tr>
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
 			<td width="120"> Assign to </td><td> : </td>
64 64
 			<td> 
65 65
 			<?php
66
-                $userassignee = $users->userdata($ticket['assignee']);
67
-                echo $userassignee['fullname'];
68
-            ?>
66
+				$userassignee = $users->userdata($ticket['assignee']);
67
+				echo $userassignee['fullname'];
68
+			?>
69 69
 			</td>
70 70
 		</tr>
71 71
 		<tr>
@@ -85,14 +85,14 @@  discard block
 block discarded – undo
85 85
 	<table class="formtable">
86 86
 	<tr bgcolor="#e0e0e0" ><td width="150">Updated On</td><td width="150">Updated By</td><td>Description</td></tr>
87 87
 	<?php
88
-        $list_log_tickets = $tickets->get_audit_trail($id);
89
-        foreach ($list_log_tickets as $log_ticket) {
90
-            $changed_by = $users->userdata($log_ticket['changeby']);
91
-            echo '<tr><td>'.date('d-M-Y H:i:s', $log_ticket['changedate']).'</td>'.
92
-                 '<td>'.$changed_by['fullname'].'</td>'.
93
-                 '<td>'.$log_ticket['changes'].'</td></tr>';
94
-        }
95
-    ?>
88
+		$list_log_tickets = $tickets->get_audit_trail($id);
89
+		foreach ($list_log_tickets as $log_ticket) {
90
+			$changed_by = $users->userdata($log_ticket['changeby']);
91
+			echo '<tr><td>'.date('d-M-Y H:i:s', $log_ticket['changedate']).'</td>'.
92
+				 '<td>'.$changed_by['fullname'].'</td>'.
93
+				 '<td>'.$log_ticket['changes'].'</td></tr>';
94
+		}
95
+	?>
96 96
 	</table>
97 97
 	</fieldset>
98 98
 	<br/><br/>
Please login to merge, or discard this patch.