// Get objects matching the printer/consumable $consumable = new Consumable($consumable_id); // Update cost if present if ($cost) { $consumable->setCost($cost); $consumable->store(); } // Update consumable $updated = $consumable->increaseStockBy($qty); #die(var_export($updated)); // Check status of installation if ($updated == FALSE) { fMessaging::create('error', $redirect, $consumable->err); fURL::redirect($redirect); } else { fMessaging::create('success', $redirect, sprintf('The consumable stock for %s has been updated.', $consumable->getName())); fURL::redirect($redirect); } } catch (fNotFoundException $e) { fMessaging::create('error', $redirect, 'The requested object with ID ' . $id . ', could not be found.'); fURL::redirect($redirect); } } else { // Get consumable object from ID if ($consumable_id != NULL) { $c = Consumable::getOne($consumable_id); } // No POSTed data, show form (based on request method) $view = fRequest::isAjax() ? 'ajax.php' : 'simple.php'; include 'views/stock/' . $view; }