Ejemplo n.º 1
0
if (!$current_user->is_employee()) {
    alloc_error("You do not have permission to access time sheets", true);
}
$timeSheetID = $_POST["timeSheetID"];
$timeSheetItemID = $_POST["timeSheetItem_timeSheetItemID"];
if (($_POST["timeSheetItem_save"] || $_POST["timeSheetItem_edit"] || $_POST["timeSheetItem_delete"]) && $timeSheetID) {
    $timeSheet = new timeSheet();
    $timeSheet->set_id($timeSheetID);
    $timeSheet->select();
    $timeSheet->load_pay_info();
    $timeSheetItem = new timeSheetItem();
    if ($timeSheetItemID) {
        $timeSheetItem->set_id($timeSheetItemID);
        $timeSheetItem->select();
    }
    $timeSheetItem->read_globals();
    $timeSheetItem->read_globals("timeSheetItem_");
    if ($_POST["timeSheetItem_save"]) {
        $timeSheetItem->read_globals();
        $timeSheetItem->read_globals("timeSheetItem_");
        $rtn = $timeSheetItem->save();
        $rtn and $TPL["message_good"][] = "Time Sheet Item saved.";
        $_POST["timeSheetItem_taskID"] and $t = "&taskID=" . $_POST["timeSheetItem_taskID"];
        alloc_redirect($TPL["url_alloc_timeSheet"] . "timeSheetID=" . $timeSheetID . $t);
    } else {
        if ($_POST["timeSheetItem_edit"]) {
            alloc_redirect($TPL["url_alloc_timeSheet"] . "timeSheetID=" . $timeSheetID . "&timeSheetItem_edit=true&timeSheetItemID=" . $timeSheetItem->get_id());
        } else {
            if ($_POST["timeSheetItem_delete"]) {
                $timeSheetItem->select();
                $timeSheetItem->delete();