/** * Re-open a completed timesheet so that the hours can be modified. */ function fixAction() { // Get the id of the active timesheet. $timesheetId = $this->getInt('id'); // Get the employee's current timesheet. $timesheetDao = new TimesheetDao(); $timesheet = $timesheetDao->get($timesheetId); // Re-open the timesheet. $timesheetDao->save($timesheet->id, array('completed' => false)); // Add an audit log for this completion. $auditLogDao = new AuditLogDao(); $auditLogDao->add(array('timesheet_id' => $timesheet->id, 'log' => "Timesheet re-opened.")); // Create the JSON object to return. $json = new stdClass(); $json->success = true; $json->payPeriod = $timesheet->pp_start; $json->msg = 'Your timesheet was re-opened successfully. Refreshing ' . 'the display...'; // Return the JSON. $this->_helper->json($json); }
/** * Re-open a completed timesheet so that the hours can be modified. */ function fixAction() { // Get the user's session. $session = new Zend_Session_Namespace('Web'); // Get the current user. $me = $session->employee; // Get the id of the active timesheet. $timesheetId = $this->getInt('id'); // Get the employee's current timesheet. $timesheetDao = new TimesheetDao(); $timesheet = $timesheetDao->get($timesheetId); // Re-open the timesheet. $timesheetDao->save($timesheet->id, array('completed' => false)); // Add an audit log for this completion. $auditLogDao = new AuditLogDao(); $auditLogDao->add(array('timesheet_id' => $timesheet->id, 'log' => "Timesheet re-opened by supervisor {$me->full_name}.")); // Create the JSON object to return. $json = new stdClass(); $json->success = true; $json->payPeriod = $timesheet->pp_start; $json->msg = 'Your timesheet was re-opened successfully.'; // Return the JSON. $this->_helper->json($json); }