function lock_task_workunit($id_workunit)
{
    global $config;
    if (!check_workunit_permission($id_workunit)) {
        return false;
    }
    $sql = sprintf('UPDATE tworkunit SET locked = "%s" WHERE id = %d', $config['id_user'], $id_workunit);
    return (bool) process_sql($sql);
}
Exemple #2
0
$from_one_month = "$prev_year-$prev_month-$day";


// Lock workunits for this month

//check_workunit_permission ($id_workunit) 
//lock_task_workunit ($id_workunit) 

if ($lock_month != ""){
	$this_month = date('Y-m-d H:i:s',strtotime("$year-$month-01"));
	$this_month_limit = date('Y-m-d H:i:s',strtotime("$year-$month-31"));
	
	$workunits = get_db_all_rows_sql ("SELECT id FROM tworkunit WHERE id_user='******' AND locked = '' AND timestamp >= '$this_month' AND timestamp < '$this_month_limit'");

	foreach ($workunits as $workunit) {
		if (check_workunit_permission ($workunit["id"]))
			lock_task_workunit ($workunit["id"]);
	}
}

$now = date("Y-m-d H:i:s");
$now_year = date("Y");
$now_month = date("m");

$working_month = get_parameter ("working_month", $now_month);
$working_year = get_parameter ("working_year", $now_year);

$begin_month = "$now_year-$now_month-01 00:00:00";
$end_month = "$now_year-$now_month-31 23:59:59";

echo "<h2>".__('Monthly report') . "</h2>";