} // if ($_POST["btnSubmit"] != "add") { //IE < v8 submits name/InnerText NOT name/value // throw_the_bum_out(NULL,"Evicted(".__LINE__."): invalid btnSubmit ".$_POST["btnSubmit"]); // } if (new_audit()) { $_STATE->status = STATE::DONE; $_STATE->goback(1); //setup for goback } break 2; case STATE::UPDATE: state_fields(); //creates the accounting list for audit $_STATE->msgGreet = "Edit project record"; if (isset($_POST["btnReset"])) { record_info(); break 2; } // if ($_POST["btnSubmit"] != "update") { // throw_the_bum_out(NULL,"Evicted(".__LINE__."): invalid btnSubmit ".$_POST["btnSubmit"]); // } if (update_audit()) { $_STATE->status = STATE::DONE; $_STATE->goback(1); //setup for goback } break 2; default: throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): invalid state=" . $_STATE->status); } }
function delete_audit() { return false; //for now, no delete; use inactive instead global $_DB, $_STATE; record_info(); //set state fields for display if ($_SESSION["person_id"] == $_STATE->record_id) { //actually, won't get here because delete button $_STATE->msgStatus = "You can't delete yourself!"; //won't show for yourself return FALSE; } $name = $_STATE->fields["First Name"]->value() . " " . $_STATE->fields["Last Name"]->value(); $sql = "DELETE FROM " . $_DB->prefix . "c10_person_organization\n\t\t\tWHERE person_idref=" . $_STATE->record_id . " AND organization_idref=" . $_SESSION["organization_id"] . ";"; $_DB->exec($sql); $sql = "SELECT COUNT(*) AS count FROM " . $_DB->prefix . "c10_person_organization\n\t\t\tWHERE person_idref=" . $_STATE->record_id . ";"; $stmt = $_DB->query($sql); if ($stmt->fetchObject()->count > 0) { $_STATE->msgStatus = "The person \"" . $name . "\" has been removed from your organization"; $stmt->closeCursor; return TRUE; } $stmt->closeCursor(); $sql = "DELETE FROM " . $_DB->prefix . "c20_person_permit\n\t\t\tWHERE person_organization_idref=" . $_STATE->person_organization_id . ";"; $_DB->exec($sql); $sql = "DELETE FROM " . $_DB->prefix . "c00_person WHERE person_id=" . $_STATE->record_id . ";"; $_DB->exec($sql); $_STATE->msgStatus = "The person record for \"" . $name . "\" has been deleted"; return TRUE; }
break 2; } // if ($_POST["btnSubmit"] != "add") { //IE < v8 submits name/InnerText NOT name/value // throw_the_bum_out(NULL,"Evicted(".__LINE__."): invalid btnSubmit ".$_POST["btnSubmit"]); // } state_fields(); if (new_audit()) { $_STATE->status = STATE::DONE; $_STATE->goback(1); //setup for goback } break 2; case STATE::UPDATE: $_STATE->msgGreet = "Edit " . $_STATE->accounting . " record"; if (isset($_POST["btnReset"])) { record_info($_DB, $_STATE); break 2; } // if ($_POST["btnSubmit"] != "update") { // throw_the_bum_out(NULL,"Evicted(".__LINE__."): invalid btnSubmit ".$_POST["btnSubmit"]); // } state_fields(); if (update_audit()) { $_STATE->status = STATE::DONE; $_STATE->goback(1); //setup for goback } break 2; default: throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): invalid state=" . $_STATE->status); }