From 2a2921231f4ff80e7f182ea4592d06b3ac96a4ce Mon Sep 17 00:00:00 2001 From: Skylar Date: Tue, 17 May 2016 03:23:46 -0600 Subject: [PATCH] Add update, locations features, and modify other stuff. --- getitem.php | 1 + getlocation.php | 27 +++++++++++++++++++++++++++ readfrom.php | 4 +--- search.php | 1 + updateitem.php | 19 +++++++++++++++++++ 5 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 getlocation.php create mode 100644 updateitem.php diff --git a/getitem.php b/getitem.php index 58fe2ab..fae3708 100644 --- a/getitem.php +++ b/getitem.php @@ -3,6 +3,7 @@ require 'required.php'; require 'dieifnotloggedin.php'; +$from = $_GET['from']; require 'readfrom.php'; $id = $_GET['id']; diff --git a/getlocation.php b/getlocation.php new file mode 100644 index 0000000..c4ad758 --- /dev/null +++ b/getlocation.php @@ -0,0 +1,27 @@ +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])); \ No newline at end of file diff --git a/readfrom.php b/readfrom.php index 5d25900..2593080 100644 --- a/readfrom.php +++ b/readfrom.php @@ -1,8 +1,6 @@ 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();