//------------------------------------------------------------------------------------- start_form(); start_table(TABLESTYLE2); $existing_comments = ""; $dec = 0; if (isset($selected_id)) { $myrow = get_work_order($selected_id); if (strlen($myrow[0]) == 0) { echo _("The order number sent is not valid."); safe_exit(); } // if it's a closed work order can't edit it if ($myrow["closed"] == 1) { echo "<center>"; display_error(_("This work order is closed and cannot be edited.")); safe_exit(); } $_POST['wo_ref'] = $myrow["wo_ref"]; $_POST['stock_id'] = $myrow["stock_id"]; //$_POST['quantity'] = qty_format($myrow["units_reqd"], $_POST['stock_id'], $dec); $_POST['quantity'] = $myrow["units_reqd"]; $_POST['StockLocation'] = $myrow["loc_code"]; $_POST['released'] = $myrow["released"]; $_POST['closed'] = $myrow["closed"]; $_POST['type'] = $myrow["type"]; $_POST['date_'] = sql2date($myrow["date_"]); $_POST['RequDate'] = sql2date($myrow["required_by"]); $_POST['released_date'] = sql2date($myrow["released_date"]); $_POST['memo_'] = ""; $_POST['units_issued'] = $myrow["units_issued"]; $_POST['Costs'] = price_format($myrow["additional_costs"]);
/** * Generates key * * @param int $bitsize Nume of bits to use for key. * * @return string $bitsize long string composed of available base32 chars. */ function generate_key($bitsize = 128) { $base_32_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'; if (8 > $bitsize || 0 !== $bitsize % 8) { // @TODO: handle this case. return safe_exit(); } $s = ''; for ($i = 0; $i < $bitsize / 8; $i++) { $s .= $base_32_chars[rand(0, 31)]; } return $s; }