Add support for status labels for assets.
This commit is contained in:
parent
7131d016c5
commit
83cf691a96
27
getstatus.php
Normal file
27
getstatus.php
Normal file
@ -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!');
|
||||||
|
}
|
||||||
|
$status;
|
||||||
|
if ($from == 'assets') {
|
||||||
|
$status = $database->select($from, 'status_id', ['id' => $id])[0];
|
||||||
|
} else {
|
||||||
|
sendError("Command only valid for assets.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($status == null) {
|
||||||
|
$status = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$list = $database->select('status_labels', ['id', 'name', 'notes']);
|
||||||
|
//array_unshift($list, ['id' => "0", name => "Other"]);
|
||||||
|
|
||||||
|
die(json_encode(['status' => 'OK', 'itemstatus' => $status, 'list' => $list]));
|
@ -11,7 +11,7 @@ if (is_empty($id)) {
|
|||||||
sendError('Missing item ID!');
|
sendError('Missing item ID!');
|
||||||
}
|
}
|
||||||
if ($from == 'assets') {
|
if ($from == 'assets') {
|
||||||
$database->update($from, ['name' => $_POST['name'], 'rtd_location_id' => $_POST['location'], 'order_number' => $_POST['order_number']], ['id' => $id]);
|
$database->update($from, ['name' => $_POST['name'], 'rtd_location_id' => $_POST['location'], 'order_number' => $_POST['order_number'], 'status_id' => $_POST['status']], ['id' => $id]);
|
||||||
} else {
|
} else {
|
||||||
$database->update($from, ['name' => $_POST['name'], 'location_id' => $_POST['location'], 'qty' => $_POST['qty'], 'order_number' => $_POST['order_number']], ['id' => $id]);
|
$database->update($from, ['name' => $_POST['name'], 'location_id' => $_POST['location'], 'qty' => $_POST['qty'], 'order_number' => $_POST['order_number']], ['id' => $id]);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user