Add update, locations features, and modify other stuff.

hi
Skylar Ittner 8 years ago
parent f3b52f1dd9
commit 2a2921231f

@ -3,6 +3,7 @@
require 'required.php';
require 'dieifnotloggedin.php';
$from = $_GET['from'];
require 'readfrom.php';
$id = $_GET['id'];

@ -0,0 +1,27 @@
<?php
require 'required.php';
//require 'dieifnotloggedin.php';
$from = $_GET['from'];
require 'readfrom.php';
$id = $_GET['id'];
if (is_empty($id)) {
sendError('Missing item ID!');
}
$loc;
if ($from == 'assets') {
$loc = $database->select($from, 'rtd_location_id', ['id' => $id])[0];
} else {
$loc = $database->select($from, 'location_id', ['id' => $id])[0];
}
if ($loc == null) {
$loc = 0;
}
$list = $database->select('locations', ['id', 'name']);
array_unshift($list, ['id' => "0", name => "None/Other"]);
die(json_encode(['status' => 'OK', 'location' => $loc, 'list' => $list]));

@ -1,8 +1,6 @@
<?php
$from = 'assets';
switch ($_GET['from']) {
switch ($from) {
case 'accessories':
case 'accessory':
case 'acc':

@ -5,6 +5,7 @@ require 'required.php';
require 'dieifnotloggedin.php';
$q = $_GET['q'];
$from = $_GET['from'];
require 'readfrom.php';
if (is_empty($q)) {

@ -0,0 +1,19 @@
<?php
require 'required.php';
require 'dieifnotloggedin.php';
$from = $_POST['from'];
require 'readfrom.php';
$id = $_POST['id'];
if (is_empty($id)) {
sendError('Missing item ID!');
}
if ($from == 'assets') {
$database->update($from, ['name' => $_POST['name'], 'rtd_location_id' => $_POST['location'], 'order_number' => $_POST['order_number']], ['id' => $id]);
} else {
$database->update($from, ['name' => $_POST['name'], 'location_id' => $_POST['location'], 'qty' => $_POST['qty'], 'order_number' => $_POST['order_number']], ['id' => $id]);
}
sendOK();
Loading…
Cancel
Save