예제 #1
0
        $db->transStart();
        if ($purchase_invoice_id) {
            $order->journal_main_array['purchase_invoice_id'] = $purchase_invoice_id;
            $order->purchase_invoice_id = $purchase_invoice_id;
        } else {
            $order->purchase_invoice_id = '';
            if (!$order->validate_purchase_invoice_id()) {
                $error = true;
                break;
            }
        }
        if (!$order->Post('insert')) {
            $error = true;
        }
        if ($order->purchase_invoice_id == '') {
            if (!$order->increment_purchase_invoice_id()) {
                $error = true;
            }
        }
        if (!$error) {
            gen_add_audit_log(constant('ORD_TEXT_' . JOURNAL_ID . '_WINDOW_TITLE') . ' - ' . TEXT_ADD, $order->purchase_invoice_id, $order->total_amount);
            // set the closed flag on the quote
            $result = $db->Execute("update " . TABLE_JOURNAL_MAIN . " set closed = '1' where id = " . $id);
            $db->transCommit();
            // finished successfully
            // ***************************** END TRANSACTION *******************************
        }
        break;
    default:
}
/*****************   prepare to display templates  *************************/