-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathajax_setbookingstatus.php
60 lines (52 loc) · 1.49 KB
/
ajax_setbookingstatus.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
<?php
require_once("shared.php");
$rc = -1;
$msg = "";
try
{
if (isset($_POST['uuid']) && isset($_POST['status']) && isset($_POST['bookingcode']))
{
$statusfield = "";
$uuid = $_POST['uuid'];
$status = $_POST['status'];
$bookingcode = $_POST['bookingcode'];
if ($status == "paid")
$statusfield = "datepaid";
else if ($status == "completed")
$statusfield = "datecompleted";
else if ($status == "approved")
$statusfield = "dateapproved";
$userid = SharedGetUserIdFromUuid($uuid, $dblink);
if($status == 'uncompleted')
{
$dbupdate = "update bookings set " .
"datecompleted=NULL," .
"usersmodified_id=$userid " .
"where " .
"id=$bookingcode";
}
else
{
$dbupdate = "update bookings set " .
"$statusfield=CURRENT_TIMESTAMP," .
"usersmodified_id=$userid " .
"where " .
"id=$bookingcode";
}
error_log($dbupdate);
if ($dbresult = SharedQuery($dbupdate, $dblink))
$rc = 0;
else
$msg = "Error assigning architect...";
}
else
$msg = "Missing parameters...";
}
catch (Exception $e)
{
$msg = "Unable set booking status...";
}
$response = array("rc" => $rc, "msg" => $msg);
$json = json_encode($response);
echo $json;
?>