if (is_object($selected_supplier)) { $parent_id = $selected_supplier->get_parent_id(); $html->set_variable('id', $selected_supplier->get_id(), 'integer'); $html->set_variable('name', $selected_supplier->get_name(), 'string'); $html->set_variable('address', $selected_supplier->get_address(), 'string'); $html->set_variable('phone_number', $selected_supplier->get_phone_number(), 'string'); $html->set_variable('fax_number', $selected_supplier->get_fax_number(), 'string'); $html->set_variable('email_address', $selected_supplier->get_email_address(), 'string'); $html->set_variable('website', $selected_supplier->get_website(), 'string'); $html->set_variable('auto_product_url', $selected_supplier->get_auto_product_url(NULL), 'string'); } elseif ($action == 'add') { $parent_id = $new_parent_id; } else { $parent_id = 0; } $supplier_list = $root_supplier->build_html_tree($selected_id, true, false); $html->set_variable('supplier_list', $supplier_list, 'string'); $parent_supplier_list = $root_supplier->build_html_tree($parent_id, true, true); $html->set_variable('parent_supplier_list', $parent_supplier_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_suppliers.php' : ''; // an empty string means that the...
$html->set_variable('name', $part->get_name(), 'string'); $html->set_variable('description', $part->get_description(), 'string'); $html->set_variable('instock', $part->get_instock(), 'integer'); $html->set_variable('mininstock', $part->get_mininstock(), 'integer'); $html->set_variable('visible', $part->get_visible(), 'boolean'); $html->set_variable('comment', $part->get_comment(), 'string'); // dropdown lists -> get IDs $category_id = is_object($part->get_category()) ? $part->get_category()->get_id() : 0; $footprint_id = is_object($part->get_footprint()) ? $part->get_footprint()->get_id() : 0; $storelocation_id = is_object($part->get_storelocation()) ? $part->get_storelocation()->get_id() : 0; $manufacturer_id = is_object($part->get_manufacturer()) ? $part->get_manufacturer()->get_id() : 0; // build orderdetails loop $orderdetails_loop = array(); $row_odd = true; foreach ($part->get_orderdetails() as $orderdetails) { $supplier_list = $root_supplier->build_html_tree($orderdetails->get_supplier()->get_id(), true, false); $pricedetails_loop = array(); foreach ($orderdetails->get_pricedetails() as $pricedetails) { $pricedetails_loop[] = array('row_odd' => !$row_odd, 'orderdetails_id' => $orderdetails->get_id(), 'pricedetails_id' => $pricedetails->get_id(), 'min_discount_quantity' => $pricedetails->get_min_discount_quantity(), 'price' => $pricedetails->get_price(false, $pricedetails->get_price_related_quantity()), 'price_related_quantity' => $pricedetails->get_price_related_quantity()); } if (count($pricedetails_loop) > 0) { $next_min_discount_quantity = $pricedetails_loop[count($pricedetails_loop) - 1]['min_discount_quantity'] * 10; } else { $next_min_discount_quantity = 1; } $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);