// start the journal processing $journal = new journal_process(); $journal->prepare_set_journalname("customers"); // import form data $journal->process_form_input(); //// ERROR CHECKING /////////////////////// // TODO: update this section to use newer customer framework? // make sure the customers ID submitted really exists $sql_obj = new sql_query(); $sql_obj->string = "SELECT id FROM customers WHERE id='" . $journal->structure["customid"] . "' LIMIT 1"; $sql_obj->execute(); if (!$sql_obj->num_rows()) { log_write("error", "process", "Unable to find requested customer record to modify journal for."); } // verify journal entry status if ($journal->check_lock()) { log_write("error", "process", "Unable to edit the selected journal entry, it has been locked."); } // return to previous page upon error if (error_check()) { $_SESSION["error"]["form"]["journal_edit"] = "failed"; header("Location: ../index.php?page=customers/journal.php&id=" . $journal->structure["customid"] . "&journalid=" . $journal->structure["id"] . "&action=" . $journal->structure["action"] . ""); exit(0); } else { if ($journal->structure["action"] == "delete") { $journal->action_delete(); } else { // update or create $journal->action_update(); } // display updated details