$type = strtoupper($type); $orders = array(); $orders_id = ''; if ($type == 'SP') { $class_jo = new jng_sp_orders(); $orders = $class_jo->retrieveItemDetail($opid); $orders_id = $orders['jng_sp_orders_id']; } elseif ($type == 'JG') { $class_o = new orders(); $orders = $class_o->retrieveProductDetail($opid); $orders_id = $orders['orders_id']; } elseif ($type == 'DP') { $class_do = new depot_orders(); $orders_id = $opid; } $class_pi->addOrder($type, $orders_id); } $class_pi->createPDF(false, $output_type); } else { use_class('production_instruction'); $class_pi = new production_instruction(); $id = tep_db_prepare_input($_GET['opid']); $orders_products_id = explode(',', $id); $class_pi->loadOrderProducts($type, null, $orders_products_id); if (count($class_pi->orders_products) > 0) { echo $class_pi->printProductionInstruction(); } else { echo '<h1>There is no product to print</h1>'; } } }
<?php global $db; require_once '../confy.php'; require_once '../functions.php'; require_once '../functions-2.php'; require_once DIR_WS_FUNCTIONS . 'html_output.php'; tep_db_connect(); $allowed_type = array('DP', 'SP', 'JG'); $order_type = strtoupper($_GET['type']); $order_id = intval($_GET['id']); if (in_array($order_type, $allowed_type) && $order_id > 0) { use_class('production_instruction_pdf'); $class_pi = new production_instruction_pdf(); $class_pi->addOrder($order_type, $order_id); $class_pi->createPDF(false, 'F'); $message = 'PI Printed!'; } else { $message = 'BAD REQUEST:'; } echo '<strong>' . $message . ':</strong><br />'; echo 'Order Type = ' . $order_type . '<br />'; echo 'Order ID = ' . $order_id . '<br />'; tep_db_close();