X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2FttTimesheetHelper.class.php;h=1d43f1527f70f52fb760200a429d2bd47fd79c0b;hb=351514c0823db572768c8f4d7f9dbb4fad81447c;hp=df654e074b5ec467a16864baaf5d56942ab227ef;hpb=a64a8d017c37bec34585e0c345a0c139ac3b43a0;p=timetracker.git diff --git a/WEB-INF/lib/ttTimesheetHelper.class.php b/WEB-INF/lib/ttTimesheetHelper.class.php index df654e07..1d43f152 100644 --- a/WEB-INF/lib/ttTimesheetHelper.class.php +++ b/WEB-INF/lib/ttTimesheetHelper.class.php @@ -154,7 +154,7 @@ class ttTimesheetHelper { if ($user->isClient()) $client_part = "and client_id = $user->client_id"; $sql = "select * from tt_timesheets". - " where id = $timesheet_id and group_id = $group_id and org_id = $org_id $client_part and status = 1"; + " where id = $timesheet_id and group_id = $group_id and org_id = $org_id $client_part and status is not null"; $res = $mdb2->query($sql); if (!is_a($res, 'PEAR_Error')) { if ($val = $res->fetchRow()) @@ -189,4 +189,24 @@ class ttTimesheetHelper { $affected = $mdb2->exec($sql); return (!is_a($affected, 'PEAR_Error')); } + + // update function - updates the timesheet in database. + static function update($fields) { + global $user; + $mdb2 = getConnection(); + + $group_id = $user->getGroup(); + $org_id = $user->org_id; + + $timesheet_id = $fields['id']; // Timesheet we are updating. + $name = $fields['name']; // Timesheet name. + $submitter_comment = $fields['submitter_comment']; + $status = $fields['status']; // Project status. + + $sql = "update tt_timesheets set name = ".$mdb2->quote($name).", submitter_comment = ".$mdb2->quote($submitter_comment). + ", status = ".$mdb2->quote($status). + " where id = $timesheet_id and group_id = $group_id and org_id = $org_id"; + $affected = $mdb2->exec($sql); + return (!is_a($affected, 'PEAR_Error')); + } }