} $pricedetails_loop[] = array('orderdetails_id' => $orderdetails->get_id(), 'pricedetails_id' => 'new', 'min_discount_quantity' => $next_min_discount_quantity, 'price' => 0, 'price_related_quantity' => 1); $orderdetails_loop[] = array('row_odd' => $row_odd, 'orderdetails_id' => $orderdetails->get_id(), 'supplier_list' => $supplier_list, 'supplierpartnr' => $orderdetails->get_supplierpartnr(), 'obsolete' => $orderdetails->get_obsolete(), 'pricedetails' => $pricedetails_loop); $row_odd = !$row_odd; } // add one additional row -> with this row you can add more orderdetails $supplier_list = $root_supplier->build_html_tree(0, true, false); $orderdetails_loop[] = array('row_odd' => $row_odd, 'orderdetails_id' => 'new', 'supplier_list' => $supplier_list, 'supplierpartnr' => '', 'obsolete' => false); $html->set_loop('orderdetails', $orderdetails_loop); // build attachements loop $master_picture_id = is_object($part->get_master_picture_attachement()) ? $part->get_master_picture_attachement()->get_id() : NULL; $attachements_loop = array(); $all_attachements = $part->get_attachements(); $row_odd = true; foreach ($all_attachements as $attachement) { $attachement_types_list = $root_attachement_type->build_html_tree($attachement->get_type()->get_id(), true, false); $attachements_loop[] = array('row_odd' => $row_odd, 'id' => $attachement->get_id(), 'attachement_types_list' => $attachement_types_list, 'name' => $attachement->get_name(), 'show_in_table' => $attachement->get_show_in_table(), 'is_picture' => $attachement->is_picture(), 'is_master_picture' => $attachement->get_id() == $master_picture_id, 'filename' => str_replace(BASE, BASE_RELATIVE, $attachement->get_filename()), 'filename_base_relative' => str_replace(BASE . '/', '', $attachement->get_filename()), 'picture_filename' => $attachement->is_picture() ? str_replace(BASE, BASE_RELATIVE, $attachement->get_filename()) : ''); $row_odd = !$row_odd; } // add one additional row -> with this row you can add more files $attachement_types_list = $root_attachement_type->build_html_tree(0, true, false); $attachements_loop[] = array('row_odd' => $row_odd, 'id' => 'new', 'attachement_types_list' => $attachement_types_list, 'name' => '', 'is_picture' => true, 'show_in_table' => false, 'is_master_picture' => false, 'filename' => '', 'filename_base_relative' => '', 'picture_filename' => ''); $html->set_loop('attachements_loop', $attachements_loop); } if ($print_unsaved_values || !isset($part) || !is_object($part)) { $html->set_variable('name', $new_name, 'string'); $html->set_variable('description', $new_description, 'string'); $html->set_variable('instock', $new_instock, 'integer'); $html->set_variable('mininstock', $new_mininstock, 'integer'); $html->set_variable('visible', $new_visible, 'boolean'); $html->set_variable('comment', $new_comment, 'string');
$html->set_variable('add_more', $add_more, 'boolean'); if (!$fatal_error) { try { if (is_object($selected_attachement_type)) { $parent_id = $selected_attachement_type->get_parent_id(); $html->set_variable('id', $selected_attachement_type->get_id(), 'integer'); $name = $selected_attachement_type->get_name(); } elseif ($action == 'add') { $parent_id = $new_parent_id; $name = $new_name; } else { $parent_id = 0; $name = ''; } $html->set_variable('name', $name, 'string'); $attachement_types_list = $root_attachement_type->build_html_tree($selected_id, true, false); $html->set_variable('attachement_types_list', $attachement_types_list, 'string'); $parent_attachement_types_list = $root_attachement_type->build_html_tree($parent_id, true, true); $html->set_variable('parent_attachement_types_list', $parent_attachement_types_list, 'string'); } catch (Exception $e) { $messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red'); $fatal_error = true; } } /******************************************************************************** * * Generate HTML Output * *********************************************************************************/ $reload_link = $fatal_error ? 'edit_attachement_types.php' : ''; // an empty string means that the...