accounts/quotes/journal-edit-process.php

	access: accounts_quotes_write

	Allows the user to post an entry to the journal or edit an existing journal entry.
*/
// includes
require "../../include/config.php";
require "../../include/amberphplib/main.php";
if (user_permissions_get('accounts_quotes_write')) {
    /////////////////////////
    // start the journal processing
    $journal = new journal_process();
    $journal->prepare_set_journalname("account_quotes");
    // import form data
    $journal->process_form_input();
    //// ERROR CHECKING ///////////////////////
    // make sure the quote ID submitted really exists
    $sql_obj = new sql_query();
    $sql_obj->string = "SELECT id FROM account_quotes WHERE id='" . $journal->structure["customid"] . "'";
    $sql_obj->execute();
    if (!$sql_obj->num_rows()) {
        $_SESSION["error"]["message"][] = "Unable to find requested quote/transaction to modify journal for.";
    }
    /// if there was an error, go back to the entry page
    if ($_SESSION["error"]["message"]) {
        $_SESSION["error"]["form"]["journal_edit"] = "failed";
        header("Location: ../../index.php?page=accounts/quotes/journal.php&id=" . $journal->structure["customid"] . "&journalid=" . $journal->structure["id"] . "&action=" . $journal->structure["action"] . "");
        exit(0);
    } else {
        if ($journal->structure["action"] == "delete") {