// load journal main data $order->id = $_POST['id'] != '' ? $_POST['id'] : ''; // will be null unless opening an existing purchase/receive $order->journal_id = JOURNAL_ID == 20 ? 7 : 13; // credit memo $order->gl_type = JOURNAL_ID == 20 ? 'por' : 'sos'; $order->post_date = $post_date; $order->period = $period; $order->admin_id = $_SESSION['admin_id']; $order->purch_order_id = db_prepare_input($_POST['purch_order_id']); // customer PO/Ref number $order->description = constant('GENERAL_JOURNAL_' . $order->journal_id . '_DESC'); $order->total_amount = $currencies->clean_value(db_prepare_input($_POST['total']), DEFAULT_CURRENCY); $order->gl_acct_id = JOURNAL_ID == 20 ? AP_DEFAULT_PURCHASE_ACCOUNT : AR_DEFAULT_GL_ACCT; $order->item_rows[0] = array('pstd' => '1', 'id' => '', 'desc' => db_prepare_input($_POST['desc_1']), 'total' => $currencies->clean_value(db_prepare_input($_POST['total_1'])), 'acct' => db_prepare_input($_POST['acct_1'])); $post_credit = $order->post_ordr($action); if (!$post_credit) { $order = new objectInfo($_POST); $order->post_date = gen_db_date_short($_POST['post_date']); // fix the date to original format $order->id = $_POST['id'] != '' ? $_POST['id'] : ''; // will be null unless opening an existing purchase/receive $messageStack->add(GL_ERROR_NO_POST, 'error'); } gen_add_audit_log(AUDIT_LOG_DESC, $order->purchase_invoice_id, $order->total_amount); if (DEBUG) { $messageStack->write_debug(); } if ($action == 'save') { gen_redirect(html_href_link(FILENAME_DEFAULT, gen_get_all_get_params(array('action')), 'SSL')); }
// load journal main data $order->id = $_POST['id'] != '' ? $_POST['id'] : ''; // will be null unless opening an existing purchase/receive $order->journal_id = JOURNAL_ID == 18 ? 13 : 7; // credit memo $order->gl_type = JOURNAL_ID == 18 ? 'sos' : 'por'; $order->post_date = $post_date; $order->period = $period; $order->admin_id = $_SESSION['admin_id']; $order->purch_order_id = db_prepare_input($_POST['purch_order_id']); // customer PO/Ref number $order->description = sprintf(TEXT_JID_ENTRY, constant('ORD_TEXT_' . $order->journal_id . '_WINDOW_TITLE')); $order->total_amount = $currencies->clean_value(db_prepare_input($_POST['total']), DEFAULT_CURRENCY); $order->gl_acct_id = JOURNAL_ID == 18 ? AR_DEFAULT_GL_ACCT : AP_DEFAULT_PURCHASE_ACCOUNT; $order->item_rows[0] = array('pstd' => '1', 'id' => '', 'desc' => db_prepare_input($_POST['desc_1']), 'total' => $currencies->clean_value(db_prepare_input($_POST['total_1'])), 'acct' => db_prepare_input($_POST['acct_1'])); $post_credit = $order->post_ordr($_REQUEST['action']); $messageStack->add("order id is now: {$order->id}", 'caution'); $oID = $order->id; // need to fetch id for printing if (!$post_credit) { $order = new objectInfo($_POST); $order->post_date = gen_db_date($_POST['post_date']); // fix the date to original format $order->id = $_POST['id'] != '' ? $_POST['id'] : ''; // will be null unless opening an existing purchase/receive $messageStack->add(GL_ERROR_NO_POST, 'error'); } gen_add_audit_log(AUDIT_LOG_DESC, $order->purchase_invoice_id, $order->total_amount); if (DEBUG) { $messageStack->write_debug(); }
if ($order->ship_telephone1 === false) { $error = $messageStack->add(GEN_ERRMSG_NO_DATA . ORD_SHIP_TO . ' / ' . GEN_TELEPHONE1, 'error'); } if ($order->ship_email === false) { $error = $messageStack->add(GEN_ERRMSG_NO_DATA . ORD_SHIP_TO . ' / ' . GEN_EMAIL, 'error'); } } } // Item row errors if (!$order->item_rows) { $error = $messageStack->add(GL_ERROR_NO_ITEMS, 'error'); } // End of error checking, process the order if (!$error) { // Post the order if ($post_success = $order->post_ordr($action)) { // Post the order class to the db gen_add_audit_log(constant('ORD_TEXT_' . JOURNAL_ID . '_WINDOW_TITLE') . ' - ' . ($_POST['id'] ? TEXT_EDIT : TEXT_ADD), $order->purchase_invoice_id, $order->total_amount); if (DEBUG) { $messageStack->write_debug(); } if ($action == 'save') { gen_redirect(html_href_link(FILENAME_DEFAULT, gen_get_all_get_params(array('action')), 'SSL')); } elseif ($action == 'payment') { switch (JOURNAL_ID) { case 6: $jID = 20; break; // payments // payments case 12:
} if ($order->ship_telephone1 === false) { $error = $messageStack->add(GEN_ERRMSG_NO_DATA . ORD_SHIP_TO . ' / ' . GEN_TELEPHONE1, 'error'); } if ($order->ship_email === false) { $error = $messageStack->add(GEN_ERRMSG_NO_DATA . ORD_SHIP_TO . ' / ' . GEN_EMAIL, 'error'); } } // Item row errors if (!$order->item_rows) { $error = $messageStack->add(GL_ERROR_NO_ITEMS, 'error'); } // End of error checking, check for attachments and process the order if (!$error) { // Post the order if ($post_success = $order->post_ordr($_REQUEST['action'])) { // Post the order class to the db if ($order->rm_attach) { @unlink(PHREEBOOKS_DIR_MY_ORDERS . 'order_' . $order->id . '.zip'); } if (is_uploaded_file($_FILES['file_name']['tmp_name'])) { saveUploadZip('file_name', PHREEBOOKS_DIR_MY_ORDERS, 'order_' . $order->id . '.zip'); } gen_add_audit_log(constant('ORD_TEXT_' . JOURNAL_ID . '_WINDOW_TITLE') . ' - ' . ($_POST['id'] ? TEXT_EDIT : TEXT_ADD), $order->purchase_invoice_id, $order->total_amount); if (DEBUG) { $messageStack->write_debug(); } if ($_REQUEST['action'] == 'save') { gen_redirect(html_href_link(FILENAME_DEFAULT, gen_get_all_get_params(array('action')), 'SSL')); } elseif ($_REQUEST['action'] == 'payment') { switch (JOURNAL_ID) {