forked from tylerhall/Shine
-
Notifications
You must be signed in to change notification settings - Fork 2
/
order-new.php
93 lines (82 loc) · 3.04 KB
/
order-new.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
92
93
<?PHP
require 'includes/master.inc.php';
$Auth->requireAdmin('login.php');
$nav = 'orders';
if(isset($_POST['btnCreateOrder']))
{
$Error->blank($_POST['app_id'], 'Application');
$Error->blank($_POST['first_name'], 'First Name');
$Error->blank($_POST['last_name'], 'Last Name');
$Error->email($_POST['email']);
if($Error->ok())
{
$app = new Application($_POST['app_id']);
$o = new Order();
$o->first_name = $_POST['first_name'];
$o->last_name = $_POST['last_name'];
$o->payer_email = $_POST['email'];
$o->app_id = $_POST['app_id'];
$o->type = 'Manual';
$o->dt = dater();
$o->item_name = $app->name;
$o->insert();
$o->generateLicense();
redirect('order.php?id=' . $o->id);
}
else
{
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$email = $_POST['email'];
}
}
else
{
$first_name = '';
$last_name = '';
$email = '';
}
$applications = DBObject::glob('Application', 'SELECT * FROM applications ORDER BY name');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Shine</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
<link rel="stylesheet" href="http://yui.yahooapis.com/2.7.0/build/reset-fonts-grids/reset-fonts-grids.css" type="text/css">
<link rel="stylesheet" href="css/yuiapp.css" type="text/css">
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
</head>
<body class="rounded">
<div id="doc3" class="yui-t6">
<div id="hd">
<?PHP include('inc/header.inc.php'); ?>
</div>
<div id="bd">
<div id="yui-main">
<div class="yui-b"><div class="yui-g">
<?PHP echo $Error; ?>
<div class="block">
<div class="hd">
<h2>Create Manual Order</h2>
</div>
<div class="bd">
<form action="order-new.php" method="post">
<p><label for="app_id">Application</label> <select name="app_id" id="app_id"><?PHP foreach($applications as $a) : ?><option value="<?PHP echo $a->id; ?>"><?PHP echo $a->name; ?></option><?PHP endforeach; ?></select></p>
<p><label for="first_name">First Name</label> <input type="text" name="first_name" id="first_name" value="<?PHP echo $first_name; ?>" class="text"></p>
<p><label for="last_name">Last Name</label> <input type="text" name="last_name" id="last_name" value="<?PHP echo $last_name; ?>" class="text"></p>
<p><label for="email">Email</label> <input type="text" name="email" id="email" value="<?PHP echo $email; ?>" class="text"></p>
<p><input type="submit" name="btnCreateOrder" value="Create Order" id="btnCreateOrder"></p>
</form>
</div>
</div>
</div></div>
</div>
<div id="sidebar" class="yui-b">
</div>
</div>
<div id="ft"></div>
</div>
</body>
</html>