-
Notifications
You must be signed in to change notification settings - Fork 1
/
routetoindividualnewprocess.php
91 lines (62 loc) · 3.1 KB
/
routetoindividualnewprocess.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
session_start();
require_once("db.php");
require_once("fxns.php");
$id = $_SESSION['id'];
$employeeid = $id;
check_usersignin();
$documentid = strip_tags($_POST['documentid']); // documentid
if(isset($_POST['trackid'])){
$trackingid = strip_tags($_POST['trackid']);
$trackidpresent = 1;
} else {
$trackidpresent = 0;_
}
$sourceoffice = strip_tags($_POST['sourceoffice']);
//$recipientperson = strip_tags($_POST['recipientperson']);
$message = strip_tags($_POST['message']);
$recipienttype = strip_tags($_POST['recipienttype']);
$creationdate = strip_tags($_POST['creationdate']);
$onlinedocument = strip_tags($_POST['onlinedocument']);
$sourceoffice = stripslashes($sourceoffice);
$message = stripslashes($message);
$creationdate = stripslashes($creationdate);
$onlinedocument = stripslashes($onlinedocument);
$sourceoffice = mysqli_real_escape_string($db, $sourceoffice);
$message = mysqli_real_escape_string($db, $message);
$recipienttype = mysqli_real_escape_string($db, $recipienttype);
$creationdate = mysqli_real_escape_string($db, $creationdate);
$onlinedocument = mysqli_real_escape_string($db, $onlinedocument);
foreach($_POST['recipientifperson'] as $receivingoffice){
require_once("db.php");
if($sourceoffice == ''){
echo "Please select a source office.";
return;
}
if($creationdate == ''){
echo "Please input the appropriate Date of Action.";
return;
}
if($trackpresentid == 1) {
$cascade = "INSERT INTO track (documentid, source, sourceoffice, recipienttype, recipientifoffice, creationdate, message, status, onlinedocument, actionrelatedid) VALUES "
. "('$documentid', '$employeeid', '$sourceoffice', '$recipienttype', '$receivingoffice', '$creationdate', '$message', 'Sent', '$onlinedocument', '$trackingid')";
} else {
$cascade = "INSERT INTO track (documentid, source, sourceoffice, recipienttype, recipientifoffice, creationdate, message, status, onlinedocument) VALUES "
. "('$documentid', '$employeeid', '$sourceoffice', '$recipienttype', '$receivingoffice', '$creationdate', '$message', 'Sent', '$onlinedocument')";
}
if ($check = $db->query($cascade) === TRUE ) {
$activity = "Route Document $documentid to Office $receivingoffice with message: $message";
registeractivity($id, $activity);
} else {
echo "Error: ".$db->error;
return;
}
}
echo "What do you want to do next?<br />";
echo "<ul>";
echo "<li><a href= ''>Route this document to offices</a></li>";
echo "<li><a href= ''>Route this document to specific individuals</a></li>";
echo "<li><a href='index.php'>Go back to my active documents list.</a></li>";
echo "</ul>";
// header("Location: viewrouteddocument.php?id=$documentid");
?>