Ejemplo n.º 1
0
function delete_group()
{
    echo "<div id='action_box'><div class='box_title'>Group Deleted</div>";
    $_ESCAPED_GROUP_ID = mysql_real_escape_string($_POST['group_id']);
    include 'includes/db_info.php';
    $query = "select group_name from " . $dbname . ".groups where group_id = " . $_ESCAPED_GROUP_ID;
    $result = mysql_query($query);
    while ($row = mysql_fetch_array($result)) {
        $query = "update " . $dbname . ".groups set inactive=1,group_name = '" . $row['group_name'] . " prior to " . date("Y-m-d") . "' \n\t\t\twhere group_id = " . $_ESCAPED_GROUP_ID;
        $result2 = mysql_query($query, $_SESSION['dbconn']) || die("Mysql Error: " . mysql_error());
        echo "Group " . $row['group_name'] . " with id=" . $_ESCAPED_GROUP_ID . " has been made inactive and has been \n\t\t\trenamed: " . $row['group_name'] . " prior to " . date("Y-m-d");
    }
    refresh_parent();
    echo "</div>";
}
function change_position() {
	$_ESCAPED_position_id = mysql_real_escape_string($_POST['position_id']);
	$_SESSION['position_id'] = $_ESCAPED_position_id;
	refresh_parent();
	close_window();
}
function delete_worktype()
{
    echo "<div id='action_box'><div class='box_title'>Worktype Deleted</div>";
    $_ESCAPED_WORKTYPE_ID = mysql_real_escape_string($_POST['worktype_id']);
    include 'includes/db_info.php';
    $query = "select work_name,group_name from " . $dbname . ".worktype," . $dbname . ".groups where\n\t\tworktype.work_id = " . $_ESCAPED_WORKTYPE_ID . " AND \n\t\tworktype.group_id = groups.group_id";
    $result = mysql_query($query);
    if ($row = mysql_fetch_array($result)) {
        $group_name = $row['group_name'];
        $work_name = $row['work_name'];
    }
    $query = "update " . $dbname . ".worktype set inactive = 1,work_name='" . $work_name . " upto " . date("m/y") . "' where work_id = " . $_ESCAPED_WORKTYPE_ID;
    $result = mysql_query($query, $_SESSION['dbconn']) || die("mysql error: " . mysql_error());
    echo "Worktype: " . $work_name . " in the " . $group_name . " group has been made inactive.";
    echo "This worktype will still be in the database as:<BR> " . $work_name . " upto " . date("m/y") . "<BR>";
    echo "It will not be deleted completely for the sake of hours reporting, but in all other aspects should be considered gone for good.";
    echo "</div>";
    refresh_parent();
}