예제 #1
0
        case 'increment':
            // add one part
            try {
                if (!is_object($part)) {
                    throw new Exception('Es wurde keine gültige Bauteil-ID übermittelt!');
                }
                $part->set_instock($part->get_instock() + 1);
                $reload_site = true;
            } catch (Exception $e) {
                $messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red');
            }
            break;
        case 'export':
            try {
                $parts = Part::search_parts($database, $current_user, $log, $keyword, '', $search_name, $search_description, $search_comment, $search_footprint, $search_category, $search_storelocation, $search_supplier, $search_supplierpartnr, $search_manufacturer);
                $export_string = export_parts($parts, 'searchparts', $export_format_id, true, 'search_parts');
            } catch (Exception $e) {
                $messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red');
            }
            break;
    }
}
if (isset($reload_site) && $reload_site) {
    // reload the site to avoid multiple actions by manual refreshing
    $header = 'Location: show_search_parts.php?keyword=' . $keyword;
    if ($search_name) {
        $header .= '&search_name=1';
    }
    if ($search_category) {
        $header .= '&search_category=1';
    }
예제 #2
0
     break;
 case 'export':
     try {
         $device_parts = $device->get_parts();
         if ($export_only_missing) {
             foreach ($device_parts as $key => $devicepart) {
                 $needed = $devicepart->get_mount_quantity() * $export_multiplier;
                 $instock = $devicepart->get_part()->get_instock();
                 $mininstock = $devicepart->get_part()->get_mininstock();
                 if ($instock - $needed >= $mininstock) {
                     unset($device_parts[$key]);
                 }
             }
         }
         $download = isset($_REQUEST['export_download']);
         $export_string = export_parts($device_parts, 'deviceparts', $export_format_id, $download, 'deviceparts_' . $device->get_name(), array('export_quantity' => $export_multiplier));
     } catch (Exception $e) {
         $messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red');
     }
     break;
 case 'import_readtext':
     try {
         $import_data = import_text_to_array($import_file_content, $import_format, $import_separator);
         match_devicepart_names_to_ids($database, $current_user, $log, $import_data);
         $import_loop = build_deviceparts_import_template_loop($database, $current_user, $log, $import_data);
     } catch (Exception $e) {
         $messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red');
     }
     break;
 case 'import':
     $only_check_data = isset($_REQUEST['check_import_data']);
예제 #3
0
            }
            break;
        case 'export':
            try {
                if ($selected_supplier_id > 0) {
                    $supplier = new Supplier($database, $current_user, $log, $selected_supplier_id);
                    $parts = Part::get_order_parts($database, $current_user, $log, array($selected_supplier_id));
                    // parts from ONE supplier
                    $filename = 'order_parts_' . $supplier->get_name();
                } else {
                    $parts = Part::get_order_parts($database, $current_user, $log);
                    // parts from ALL suppliers
                    $filename = 'order_parts';
                }
                $download = isset($_REQUEST['export_download']);
                $export_string = export_parts($parts, 'orderparts', $export_format_id, $download, $filename);
            } catch (Exception $e) {
                $messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red');
            }
            break;
    }
}
if (isset($reload_site) && $reload_site && !$config['debug']['request_debugging_enable']) {
    // reload the site to avoid multiple actions by manual refreshing
    header('Location: show_order_parts.php?selected_supplier_id=' . $selected_supplier_id);
}
/********************************************************************************
 *
 *   Generate Supplier Dropdown-List
 *
 *********************************************************************************/