Example #1
0
     try {
         if (!is_object($selected_footprint)) {
             throw new Exception('Es ist kein Footprint markiert oder es trat ein Fehler auf!');
         }
         $selected_footprint->set_attributes(array('name' => $new_name, 'parent_id' => $new_parent_id, 'filename' => $new_filename));
     } catch (Exception $e) {
         $messages[] = array('text' => 'Die neuen Werte konnten nicht gespeichert werden!', 'strong' => true, 'color' => 'red');
         $messages[] = array('text' => 'Fehlermeldung: ' . nl2br($e->getMessage()), 'color' => 'red');
     }
     break;
 case 'save_proposed_filenames':
     $errors = array();
     for ($i = 0; $i < $broken_footprints_count; $i++) {
         $spf_footprint_id = isset($_REQUEST['broken_footprint_id_' . $i]) ? $_REQUEST['broken_footprint_id_' . $i] : -1;
         // -1 will produce an error
         $spf_new_filename = isset($_REQUEST['proposed_filename_' . $i]) ? to_unix_path($_REQUEST['proposed_filename_' . $i]) : NULL;
         $spf_checked = isset($_REQUEST['filename_checkbox_' . $i]) || $save_all_proposed_filenames;
         if (strlen($spf_new_filename) > 0 && !is_path_absolute_and_unix($spf_new_filename)) {
             $spf_new_filename = BASE . '/' . $spf_new_filename;
         }
         // switch from relative path (like "img/foo.png") to absolute path (like "/var/www/part-db/img/foo.png")
         try {
             if ($spf_checked) {
                 $spf_broken_footprint = new Footprint($database, $current_user, $log, $spf_footprint_id);
                 $spf_broken_footprint->set_filename($spf_new_filename);
             }
         } catch (Exception $e) {
             $errors[] = $e->getMessage();
         }
     }
     foreach ($errors as $error) {
Example #2
0
$new_supplier_id = isset($_REQUEST['supplier_id']) ? (int) $_REQUEST['supplier_id'] : 0;
$new_supplierpartnr = isset($_REQUEST['supplierpartnr']) ? (string) $_REQUEST['supplierpartnr'] : '';
$new_obsolete = isset($_REQUEST['obsolete']);
// section: pricedetails
$pricedetails_id = isset($_REQUEST['pricedetails_id']) ? (int) $_REQUEST['pricedetails_id'] : 0;
$new_price = isset($_REQUEST['price']) ? (double) str_replace(',', '.', $_REQUEST['price']) : 0;
// TODO: use the PHP class "NumberFormatter"
$new_min_discount_quantity = isset($_REQUEST['min_discount_quantity']) ? (int) $_REQUEST['min_discount_quantity'] : 1;
$new_price_related_quantity = isset($_REQUEST['price_related_quantity']) ? (int) $_REQUEST['price_related_quantity'] : 1;
// section: attachements
$new_show_in_table = isset($_REQUEST['show_in_table']);
$new_is_master_picture = isset($_REQUEST['is_master_picture']);
$attachement_id = isset($_REQUEST['attachement_id']) ? (int) $_REQUEST['attachement_id'] : 0;
$new_attachement_type_id = isset($_REQUEST['attachement_type_id']) ? (int) $_REQUEST['attachement_type_id'] : 0;
$new_name = isset($_REQUEST['name']) ? (string) $_REQUEST['name'] : '';
$new_filename = isset($_REQUEST['attachement_filename']) ? to_unix_path(trim((string) $_REQUEST['attachement_filename'])) : '';
if (strlen($new_filename) > 0 && !is_path_absolute_and_unix($new_filename)) {
    $new_filename = BASE . '/' . $new_filename;
}
// switch from relative path (like "img/foo.png") to absolute path (like "/var/www/part-db/img/foo.png")
// section: delete part
$delete_files_from_hdd = isset($_REQUEST['delete_files_from_hdd']);
$action = 'default';
if (isset($_REQUEST['create_new_part'])) {
    $action = 'create_new_part';
}
if (isset($_REQUEST["apply_attributes"])) {
    $action = 'apply_attributes';
}
if (isset($_REQUEST["orderdetails_add"])) {
    $action = 'orderdetails_add';