public function updateSandboxUrl($id) { $this->view = null; try { $workitem = new WorkItem($id); $user = User::find(Session::uid()); if ($workitem->getMechanicId() != $user->getId() && !$workitem->getIsRelRunner() || $workitem->getStatus() == 'Done') { throw new Exception('Action not allowed'); } $url = trim($_POST['url']); $notes = trim($_POST['notes']) ? trim($_POST['notes']) : null; $workitem->setSandbox($url); $workitem->save(); if ($notes) { //add review notes $fee_amount = 0.0; $fee_desc = 'Review Notes: ' . $notes; $mechanic_id = $workitem->getMechanicId(); $itemid = $workitem->getId(); $is_expense = 1; $fee_category = ''; Fee::add($itemid, $fee_amount, $fee_category, $fee_desc, $mechanic_id, $is_expense); } $journal_message = '\\#' . $workitem->getId() . ' updated by @' . $user->getNickname() . " Branch URL: {$url}"; Utils::systemNotification($journal_message); echo json_encode(array('success' => false, 'message' => $journal_message)); } catch (Exception $e) { echo json_encode(array('success' => false, 'message' => $e->getMessage())); } }