Exemple #1
0
function new_audit()
{
    global $_DB, $_STATE;
    if (!field_input_audit()) {
        return FALSE;
    }
    $hash = md5($_STATE->fields["Name"]->value() . $_STATE->fields["Description"]->value());
    $sql = "INSERT INTO " . $_DB->prefix . "a14_subtask (name, task_idref) VALUES (:hash, " . $_STATE->task_id . ");";
    $stmt = $_DB->prepare($sql);
    $stmt->bindValue(':hash', $hash, PDO::PARAM_STR);
    $stmt->execute();
    $sql = "SELECT subtask_id FROM " . $_DB->prefix . "a14_subtask WHERE name=:hash;";
    $stmt = $_DB->prepare($sql);
    $stmt->bindValue(':hash', $hash, PDO::PARAM_STR);
    $stmt->execute();
    $_STATE->record_id = $stmt->fetchObject()->subtask_id;
    $stmt->closeCursor();
    update_db();
    $_STATE->msgStatus = "The subtask record for \"" . $_STATE->fields["Name"]->value() . "\" has been added to the task";
    return TRUE;
}
Exemple #2
0
function new_audit()
{
    global $_DB, $_STATE;
    if (!field_input_audit()) {
        return FALSE;
    }
    $login_id = find_login();
    if ($login_id != -1) {
        $_STATE->msgStatus = "This login name already exists";
        return false;
    }
    $hash = md5($_STATE->fields["First Name"]->value() . $_STATE->fields["Last Name"]->value());
    $sql = "INSERT INTO " . $_DB->prefix . "c00_person (lastname) VALUES (:hash);";
    $stmt = $_DB->prepare($sql);
    $stmt->bindValue(':hash', $hash, PDO::PARAM_STR);
    $stmt->execute();
    $sql = "SELECT person_id FROM " . $_DB->prefix . "c00_person WHERE lastname=:hash;";
    $stmt = $_DB->prepare($sql);
    $stmt->bindValue(':hash', $hash, PDO::PARAM_STR);
    $stmt->execute();
    $_STATE->record_id = $stmt->fetchObject()->person_id;
    $stmt->closeCursor();
    update_db();
    $sql = "INSERT INTO " . $_DB->prefix . "c10_person_organization (person_idref, organization_idref)\n\t\t\tVALUES (" . $_STATE->record_id . ", " . $_SESSION["organization_id"] . ");";
    $_DB->exec($sql);
    $_STATE->msgStatus = "The person record for \"" . $_STATE->fields["First Name"]->value() . " " . $_STATE->fields["Last Name"]->value() . "\" has been added to your organization";
    $_STATE->msgStatus .= "<br>Add a RATE record before entering hours";
    return TRUE;
}
Exemple #3
0
function new_audit()
{
    global $_DB, $_STATE;
    if (!field_input_audit()) {
        foreach ($_STATE->fields as $name => $field) {
            $field->disabled = false;
        }
        return FALSE;
    }
    $hash = md5($_STATE->fields["Name"]->value() . $_STATE->fields["Description"]->value());
    $sql = "INSERT INTO " . $_DB->prefix . "a00_organization (name) VALUES (:hash);";
    $stmt = $_DB->prepare($sql);
    $stmt->bindValue(':hash', $hash, PDO::PARAM_STR);
    $stmt->execute();
    $sql = "SELECT organization_id FROM " . $_DB->prefix . "a00_organization WHERE name=:hash;";
    $stmt = $_DB->prepare($sql);
    $stmt->bindValue(':hash', $hash, PDO::PARAM_STR);
    $stmt->execute();
    $_STATE->record_id = $stmt->fetchObject()->organization_id;
    $stmt->closeCursor();
    update_db();
    $sql = "INSERT INTO " . $_DB->prefix . "a10_project (organization_idref,name,description)\n\t\t\tVALUES (" . $_STATE->record_id . ",'" . $hash . "','initial seed project - please change');";
    $_DB->exec($sql);
    $sql = "SELECT project_id FROM " . $_DB->prefix . "a10_project WHERE name='" . $hash . "';";
    $stmt = $_DB->query($sql);
    $ID = $stmt->fetchObject()->project_id;
    $stmt->closeCursor();
    $sql = "UPDATE " . $_DB->prefix . "a10_project SET name='seed' WHERE project_id=" . $ID . ";";
    $_DB->exec($sql);
    $sql = "INSERT INTO " . $_DB->prefix . "a12_task (project_idref,name,description)\n\t\t\tVALUES (" . $ID . ",'" . $hash . "','initial seed task - please change');";
    $_DB->exec($sql);
    $sql = "SELECT task_id FROM " . $_DB->prefix . "a12_task WHERE name='" . $hash . "';";
    $stmt = $_DB->query($sql);
    $ID = $stmt->fetchObject()->task_id;
    $stmt->closeCursor();
    $sql = "UPDATE " . $_DB->prefix . "a12_task SET name='seed' WHERE task_id=" . $ID . ";";
    $_DB->exec($sql);
    $sql = "INSERT INTO " . $_DB->prefix . "a14_subtask (task_idref,name,description)\n\t\t\tVALUES (" . $ID . ",'seed','initial seed subtask - please change');";
    $_DB->exec($sql);
    $_STATE->msgStatus = "The organization \"" . $_STATE->fields["Name"]->value() . "\" has been added";
    return TRUE;
}
Exemple #4
0
function new_audit()
{
    global $_DB, $_STATE;
    if (!field_input_audit()) {
        return FALSE;
    }
    //hash the name to make sure we get this record back - then update it with correct name:
    $hash = md5($_STATE->fields["Name"]->value() . $_STATE->fields["Description"]->value());
    $sql = "INSERT INTO " . $_DB->prefix . "a10_project (name, organization_idref)\n\t\t\tVALUES (:hash," . $_SESSION["organization_id"] . ");";
    $stmt = $_DB->prepare($sql);
    $stmt->bindValue(':hash', $hash, PDO::PARAM_STR);
    $stmt->execute();
    $sql = "SELECT project_id FROM " . $_DB->prefix . "a10_project WHERE name=:hash;";
    $stmt = $_DB->prepare($sql);
    $stmt->bindValue(':hash', $hash, PDO::PARAM_STR);
    $stmt->execute();
    $_STATE->record_id = $stmt->fetchObject()->project_id;
    $stmt->closeCursor();
    update_db();
    $sql = "INSERT INTO " . $_DB->prefix . "a12_task (project_idref,name,description)\n\t\t\tVALUES (" . $_STATE->record_id . ",'" . $hash . "','initial seed task - please change');";
    $_DB->exec($sql);
    $sql = "SELECT task_id FROM " . $_DB->prefix . "a12_task WHERE name='" . $hash . "';";
    $stmt = $_DB->query($sql);
    $ID = $stmt->fetchObject()->task_id;
    $stmt->closeCursor();
    $sql = "UPDATE " . $_DB->prefix . "a12_task SET name='seed' WHERE task_id=" . $ID . ";";
    $_DB->exec($sql);
    $sql = "INSERT INTO " . $_DB->prefix . "a14_subtask (task_idref,name,description)\n\t\t\tVALUES (" . $ID . ",'seed','initial seed subtask - please change');";
    $_DB->exec($sql);
    $_STATE->msgStatus = "The project record for \"" . $_STATE->fields["Name"]->value() . "\" has been added to your organization";
    return TRUE;
}
function new_audit()
{
    global $_DB, $_STATE;
    if (!field_input_audit()) {
        return false;
    }
    $hash = md5($_STATE->fields["Name"]->value() . $_STATE->fields["Description"]->value());
    $sql = "INSERT INTO " . $_DB->prefix . "a12_task (name, project_idref)\n\t\t\tVALUES (:hash, " . $_STATE->project_id . ");";
    $stmt = $_DB->prepare($sql);
    $stmt->bindValue(':hash', $hash, PDO::PARAM_STR);
    $stmt->execute();
    $sql = "SELECT task_id FROM " . $_DB->prefix . "a12_task WHERE name=:hash;";
    $stmt = $_DB->prepare($sql);
    $stmt->bindValue(':hash', $hash, PDO::PARAM_STR);
    $stmt->execute();
    $_STATE->record_id = $stmt->fetchObject()->task_id;
    $stmt->closeCursor();
    update_db();
    $sql = "INSERT INTO " . $_DB->prefix . "a14_subtask (task_idref,name,description)\n\t\t\tVALUES (" . $_STATE->record_id . ",'seed','initial seed subtask - please change');";
    $_DB->exec($sql);
    $_STATE->msgStatus = "The task record for \"" . $_STATE->fields["Name"]->value() . "\" has been added to the project";
    return true;
}
function new_audit()
{
    global $_DB, $_STATE;
    if (!field_input_audit()) {
        foreach ($_STATE->fields as $name => $field) {
            $field->disabled = false;
        }
        return FALSE;
    }
    $hash = md5($_STATE->fields["Name"]->value() . $_STATE->fields["Description"]->value());
    $sql = "INSERT INTO " . $_DB->prefix . "d20_repository (organization_idref,filename)\n\t\t\tVALUES (" . $_SESSION["organization_id"] . ",:hash);";
    $stmt = $_DB->prepare($sql);
    $stmt->bindValue(':hash', $hash, PDO::PARAM_STR);
    $stmt->execute();
    $sql = "SELECT repository_id FROM " . $_DB->prefix . "d20_repository WHERE filename=:hash;";
    $stmt = $_DB->prepare($sql);
    $stmt->bindValue(':hash', $hash, PDO::PARAM_STR);
    $stmt->execute();
    $_STATE->record_id = $stmt->fetchObject()->repository_id;
    $stmt->closeCursor();
    update_db();
    $_STATE->msgStatus = "The deposit \"" . $_STATE->fields["Name"]->value() . "\" has been added";
    return TRUE;
}
function new_value_audit()
{
    global $_DB, $_STATE;
    if (!field_input_audit()) {
        return FALSE;
    }
    $hash = md5($_STATE->fields["Name"]->value() . $_STATE->fields["Description"]->value());
    $sql = "INSERT INTO " . $_DB->prefix . "e02_prop_value (name, property_idref)\n\t\t\tVALUES (:hash, " . $_STATE->property_id . ");";
    $stmt = $_DB->prepare($sql);
    $stmt->bindValue(':hash', $hash, PDO::PARAM_STR);
    $stmt->execute();
    $sql = "SELECT prop_value_id FROM " . $_DB->prefix . "e02_prop_value WHERE name=:hash;";
    $stmt = $_DB->prepare($sql);
    $stmt->bindValue(':hash', $hash, PDO::PARAM_STR);
    $stmt->execute();
    $_STATE->record_id = $stmt->fetchObject()->prop_value_id;
    $stmt->closeCursor();
    update_value();
    $_STATE->msgStatus = "The value \"" . $_STATE->fields["Name"]->value() . "\" has been added to the property";
    return TRUE;
}
Exemple #8
0
function new_audit()
{
    global $_DB, $_STATE;
    if (!field_input_audit()) {
        return FALSE;
    }
    $hash = md5($_STATE->fields["Name"]->value() . $_STATE->fields["Description"]->value());
    $sql = "INSERT INTO " . $_DB->prefix . "a20_accounting (name, organization_idref)\n\t\t\tVALUES (:hash," . $_SESSION["organization_id"] . ");";
    $stmt = $_DB->prepare($sql);
    $stmt->bindValue(':hash', $hash, PDO::PARAM_STR);
    $stmt->execute();
    $sql = "SELECT accounting_id FROM " . $_DB->prefix . "a20_accounting WHERE name=:hash;";
    $stmt = $_DB->prepare($sql);
    $stmt->bindValue(':hash', $hash, PDO::PARAM_STR);
    $stmt->execute();
    $_STATE->record_id = $stmt->fetchObject()->accounting_id;
    $stmt->closeCursor();
    update_db();
    $sql = "INSERT INTO " . $_DB->prefix . "a21_account (accounting_idref,name,description)\n\t\t\tVALUES (" . $_STATE->record_id . ",'seed','initial seed account - please change');";
    $_DB->exec($sql);
    $_STATE->msgStatus = "The accounting record has been added";
    return TRUE;
}