case 'make_private':
             $sql = 'UPDATE ' . EQUIPMENT_CATEGORY_TABLE . ' SET ispublic=0 ' . ' WHERE category_id IN (' . implode(',', db_input($_POST['ids'])) . ')';
             if (db_query($sql) && ($num = db_affected_rows())) {
                 if ($num == $count) {
                     $msg = 'Selected categories made PRIVATE';
                 } else {
                     $warn = "{$num} of {$count} selected categories made PRIVATE";
                 }
             } else {
                 $errors['err'] = 'Unable to disable selected categories PRIVATE';
             }
             break;
         case 'delete':
             $i = 0;
             foreach ($_POST['ids'] as $k => $v) {
                 if (($c = Equipment_Category::lookup($v)) && $c->delete()) {
                     $i++;
                 }
             }
             if ($i == $count) {
                 $msg = 'Selected Equipment Category deleted successfully';
             } elseif ($i > 0) {
                 $warn = "{$i} of {$count} selected categories deleted";
             } elseif (!$errors['err']) {
                 $errors['err'] = 'Unable to delete selected Equipment Category';
             }
             break;
         default:
             $errors['err'] = 'Unknown action/command';
     }
 }
    Alex P <*****@*****.**>
    Copyright (c)  2013 XpressTek
    http://www.xpresstek.net

    Released under the GNU General Public License WITHOUT ANY WARRANTY.
    See LICENSE.TXT for details.

    vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/
require 'staff.inc.php';
require_once EQUIPMENT_INCLUDE_DIR . 'class.equipment.php';
$equipment = $category = null;
if ($_REQUEST['id'] && !($equipment = Equipment::lookup($_REQUEST['id']))) {
    $errors['err'] = 'Unknown or invalid equipment';
}
if ($_REQUEST['cid'] && !$equipment && !($category = Equipment_Category::lookup($_REQUEST['cid']))) {
    $errors['err'] = 'Unknown or invalid equipment category';
}
if ($_POST) {
    $errors = array();
    switch (strtolower($_POST['do'])) {
        case 'create':
        case 'add':
            if ($equipment = Equipment::add($_POST, $errors)) {
                $msg = 'Equipment added successfully';
            } elseif (!$errors['err']) {
                $errors['err'] = 'Unable to add Equipment. Try again!';
            }
            break;
        case 'update':
        case 'edit':