if (count($messages) == 0) { $reload_site = true; } break; case 'device_parts_apply': // apply new quantities and new mountnames, or remove parts from this device for ($i = 0; $i < $device_parts_rowcount; $i++) { $part_id = isset($_REQUEST['id_' . $i]) ? (int) $_REQUEST['id_' . $i] : 0; $quantity = isset($_REQUEST['quantity_' . $i]) ? abs((int) $_REQUEST['quantity_' . $i]) : 0; $mountname = isset($_REQUEST['mountnames_' . $i]) ? trim((string) $_REQUEST['mountnames_' . $i]) : ''; try { $device_part = new DevicePart($database, $current_user, $log, $part_id); if ($quantity > 0) { $device_part->set_attributes(array('quantity' => $quantity, 'mountnames' => $mountname)); } else { $device_part->delete(); } // remove the part from this device } catch (Exception $e) { $messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red'); } } if (count($messages) == 0) { $reload_site = true; } break; case 'book_parts': // book parts from this device (decrease "instock" of all parts in this device) try { $device->book_parts($export_multiplier); $reload_site = true;