static function transaction_35($original_data, $web_service_details) { global $data_list; $data = Migration::soap_call($web_service_details, 'asistenciaDetalles', array('uididpersona' => $original_data['item_id'], 'uididprograma' => $original_data['orig_id'], 'uididfecha' => $original_data['info'], 'intIdSede' => $original_data['branch_id'])); if ($data['error'] == false) { $uidIdPrograma = $original_data['orig_id']; $uidIdPersona = $original_data['item_id']; $attendance_date = $data['date_assist']; $session_id = self::get_session_id_by_programa_id($uidIdPrograma, $data_list); $user_id = self::get_user_id_by_persona_id($uidIdPersona, $data_list); if (empty($user_id)) { return array('message' => "User does not exists in DB: {$uidIdPersona}", 'status_id' => self::TRANSACTION_STATUS_FAILED); } if (empty($session_id)) { return array('message' => "Session does not exists {$uidIdPrograma}", 'status_id' => self::TRANSACTION_STATUS_FAILED); } $course_list = SessionManager::get_course_list_by_session_id($session_id); if (!empty($course_list)) { $course_data = current($course_list); if (isset($course_data['code'])) { //Check if user exist in the session $status = SessionManager::get_user_status_in_course_session($user_id, $course_data['id'], $session_id); if ($status === false) { return array('message' => "User #{$user_id} is not registered in course code: {$course_data['code']} - session_id: {$session_id}", 'status_id' => self::TRANSACTION_STATUS_FAILED); } $time = self::get_horario_value($session_id); $attendance_date .= " {$time}"; $attendance = new Attendance(); $course_info = api_get_course_info($course_data['code']); $attendance->set_course_id($course_info['code']); $attendance->set_course_int_id($course_info['real_id']); $attendance->set_session_id($session_id); $attendance_list = $attendance->get_attendances_list($course_info['real_id'], $session_id); if (empty($attendance_list)) { return array('message' => "Attendance not found for course code: {$course_info['code']} - session_id: {$session_id}", 'status_id' => self::TRANSACTION_STATUS_FAILED); //only 1 course per session } else { $attendance_data = current($attendance_list); $attendance_id = $attendance_data['id']; error_log("Attendance found in attendance_id = {$attendance_id} - course code: {$course_info['code']} - session_id: {$session_id} - {$attendance_date}"); } $cal_info = $attendance->get_attendance_calendar_data_by_date($attendance_id, $attendance_date); if ($cal_info && isset($cal_info['id'])) { $cal_id = $cal_info['id']; } else { return array('message' => "Attendance calendar does not exist for date: {$attendance_date} in attendance_id = {$attendance_id} - course code: {$course_info['code']} - session_id: {$session_id}", 'status_id' => self::TRANSACTION_STATUS_FAILED); } $attendance_sheet_before = $attendance->attendance_sheet_get_info($cal_id, $user_id); $result = $attendance->attendance_sheet_disable($cal_id, $user_id); $attendance_sheet_after = $attendance->attendance_sheet_get_info($cal_id, $user_id); if ($result) { return array('entity' => 'attendance_sheet', 'before' => $attendance_sheet_before, 'after' => $attendance_sheet_after, 'message' => "Attendance sheet removed", 'status_id' => self::TRANSACTION_STATUS_SUCCESSFUL); } else { return array('message' => "Attendance sheet can't be removed attendance_id: {$attendance_id} - cal_id: {$cal_id} - user_id: {$user_id} - course: {$course_info['code']} - session_id: {$session_id} ", 'status_id' => self::TRANSACTION_STATUS_FAILED); } } else { $message = "Something is wrong with the course"; } } else { $message = "NO course found for session id: {$session_id}"; } return array('message' => $message, 'status_id' => self::TRANSACTION_STATUS_FAILED); } else { return $data; } }