Skip to content
Snippets Groups Projects
Commit f5759394 authored by Graham Cole's avatar Graham Cole
Browse files

mail admin when an item is requested so it can be followed up

parent 96dad900
No related branches found
No related tags found
No related merge requests found
...@@ -6,6 +6,9 @@ $admin = false; ...@@ -6,6 +6,9 @@ $admin = false;
$admin_group="staff"; $admin_group="staff";
// who's notified of items being requested?
$junk_contact="admin@sucs.org";
$admin = isset($session->groups[$admin_group]); $admin = isset($session->groups[$admin_group]);
// If you're an admin and the path ends in Edit/ then a number put it into edit mode // If you're an admin and the path ends in Edit/ then a number put it into edit mode
...@@ -43,6 +46,14 @@ if ($session->loggedin && isset($_REQUEST['action'])) { ...@@ -43,6 +46,14 @@ if ($session->loggedin && isset($_REQUEST['action'])) {
// Request Item if its available // Request Item if its available
$query = "UPDATE inventory SET requested_by=?, requested_on=now() WHERE id=? AND requested_by IS NULL"; $query = "UPDATE inventory SET requested_by=?, requested_on=now() WHERE id=? AND requested_by IS NULL";
$DB->Query($query, array($session->username, $_REQUEST['item'])); $DB->Query($query, array($session->username, $_REQUEST['item']));
// mail someone so we know that this has been requested
$iteminfo = $DB->GetRow("SELECT title, description FROM inventory WHERE id=?", array($_REQUEST['item']));
$msgbody = "User {$session->username} has requested the junk item:\n\n";
$msgbody .= "{$iteminfo['title']}: {$iteminfo['description']}\n\n";
$msgbody .= "Please ensure this is taken away and never brought back.";
mail($junk_contact,"Junk item requested",$msgbody);
} }
elseif ($_REQUEST['action'] == "Un-Request") { elseif ($_REQUEST['action'] == "Un-Request") {
// Un-Request Item // Un-Request Item
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment