[Home] [Help]
4813: end if;
4814:
4815: -- Delete entire schedules history if p_perm_delete.
4816: if FND_API.TO_BOOLEAN(p_perm_delete) then
4817: DELETE pa_schedules_history
4818: WHERE assignment_id = p_assignment_id;
4819: end if;
4820:
4821: -- Calling the Timeline api to delete the timeline records
5128: CLOSE C1;
5129: /* End of code added for bug 2329948 */
5130:
5131:
5132: -- If records exist in pa_schedules_history with last_approved_flag
5133: -- set the flag to 'N'
5134: PA_SCHEDULE_UTILS.log_message(1, 'Setting last approved flag to N');
5135: update pa_schedules_history
5136: set last_approved_flag = 'N'
5131:
5132: -- If records exist in pa_schedules_history with last_approved_flag
5133: -- set the flag to 'N'
5134: PA_SCHEDULE_UTILS.log_message(1, 'Setting last approved flag to N');
5135: update pa_schedules_history
5136: set last_approved_flag = 'N'
5137: where assignment_id = p_assignment_id
5138: and last_approved_flag = 'Y';
5139:
5433: tuesday_hours, wednesday_hours, thursday_hours, friday_hours,
5434: saturday_hours, sunday_hours, change_id, last_approved_flag, request_id,
5435: program_application_id, program_id, program_update_date, creation_date,
5436: created_by, last_update_date, last_update_by, last_update_login
5437: from pa_schedules_history
5438: where assignment_id = p_assignment_id
5439: and last_approved_flag = 'Y';
5440:
5441: BEGIN
5480:
5481: -- Call create_timeline and delete records from schedule history
5482: -- if we inserted any rows.
5483: if l_index <> 0 then
5484: delete pa_schedules_history
5485: where assignment_id = p_assignment_id
5486: and last_approved_flag = 'Y';
5487:
5488: IF (l_x_return_status = FND_API.G_RET_STS_SUCCESS ) THEN
5522: FND_MSG_PUB.add_exc_msg( p_pkg_name => 'PA_SCHEDULE_PVT',
5523: p_procedure_name => 'revert_to_last_approved');
5524: END revert_to_last_approved;
5525:
5526: -- Effects: Adds schedule records for p_assignment_id to pa_schedules_history
5527: -- if they do not already exist.
5528: -- Impl Notes: If records already exist in pa_schedule_history with change_id,
5529: -- then do nothing. Otherwise, uncheck any records with last_approved_flag
5530: -- and copy schedule records there with correct change_id with
5549:
5550: -- Contains all the records with p_change_id.
5551: CURSOR C1 IS
5552: select assignment_id
5553: from pa_schedules_history
5554: where assignment_id = p_assignment_id
5555: and change_id = p_change_id;
5556:
5557: -- Contains the schedule records for assignment_id.
5568: BEGIN
5569: PA_SCHEDULE_UTILS.log_message(1,'Start of the update_history_table API');
5570: l_x_return_status := FND_API.G_RET_STS_SUCCESS;
5571:
5572: -- If there are no records in pa_schedules_history with change_id
5573: -- then update table.
5574: open c1;
5575: fetch c1 into l_assignment_id;
5576: if c1%NOTFOUND then
5575: fetch c1 into l_assignment_id;
5576: if c1%NOTFOUND then
5577: close c1;
5578:
5579: -- Copy records in pa_schedules to pa_schedules_history
5580: for rec in c2 loop
5581: insert into pa_schedules_history
5582: ( schedule_id, calendar_id, assignment_id, project_id,
5583: schedule_type_code, status_code, start_date, end_date, monday_hours,
5577: close c1;
5578:
5579: -- Copy records in pa_schedules to pa_schedules_history
5580: for rec in c2 loop
5581: insert into pa_schedules_history
5582: ( schedule_id, calendar_id, assignment_id, project_id,
5583: schedule_type_code, status_code, start_date, end_date, monday_hours,
5584: tuesday_hours, wednesday_hours, thursday_hours, friday_hours,
5585: saturday_hours, sunday_hours, change_id, last_approved_flag,
5596: rec.request_id, rec.program_application_id, rec.program_id,
5597: rec.program_update_date);
5598: end loop;
5599:
5600: -- If there are records in pa_schedules_history with change_id
5601: -- then do nothing.
5602: else
5603: close c1;
5604: end if;
8518: to_char(trunc(sunday_hours,2)) sun_hours,
8519: status_code,
8520: start_date,
8521: end_date
8522: FROM pa_schedules_history
8523: WHERE assignment_id = p_assignment_id
8524: AND last_approved_flag = 'Y'
8525: AND ( (start_date <= p_start_date AND end_date >= p_end_date)
8526: OR (start_date >= p_start_date AND end_date <= p_end_date)