Example #1
0
            $c->store();
            // Messaging
            fMessaging::create('affected', fURL::get(), $c->getId());
            fMessaging::create('success', fURL::get(), 'The consumable ' . $c->getName() . ' was successfully updated.');
            fURL::redirect(fURL::get());
        }
    } catch (fNotFoundException $e) {
        fMessaging::create('error', fURL::get(), 'The consumable requested, ID ' . $id . ', could not be found.');
        fURL::redirect(fURL::get());
    } catch (fExpectedException $e) {
        fMessaging::create('error', fURL::get(), $e->getMessage());
    }
    // Get manufacturers also for drop-down box
    #$manufacturers = fRecordSet::build('Manufacturer', NULL, array('name' => 'asc'));
    // Get list of models
    $models = Model::getSimple($db);
    // Get types
    if (feature('consumable_types')) {
        $types = Tag::get_by_type('consumable_type');
    }
    include 'views/consumables/addedit.php';
}
/**
 * Delete a consumable
 */
if ($action == 'delete') {
    // Get ID
    $id = fRequest::get('id', 'integer');
    try {
        $c = new Consumable($id);
        if (fRequest::isPost()) {