29 lines
No EOL
1.2 KiB
Transact-SQL
29 lines
No EOL
1.2 KiB
Transact-SQL
CREATE OR ALTER PROCEDURE [dbo].[Hr_S_PerformanceFeedbackOpen]
|
||
@FeedbackId uniqueidentifier,
|
||
@ActorId uniqueidentifier = NULL
|
||
AS
|
||
BEGIN
|
||
SET NOCOUNT ON;
|
||
|
||
DECLARE @ReviewId uniqueidentifier, @ReviewerId uniqueidentifier;
|
||
|
||
SELECT @ReviewId = ReviewId, @ReviewerId = ReviewerId
|
||
FROM Hr_T_PerformanceFeedback
|
||
WHERE Id = @FeedbackId AND IsDeleted = 0;
|
||
|
||
IF @ReviewId IS NULL
|
||
RETURN;
|
||
|
||
-- Değerlendirici, değerlendirmenin yetkinlikleri üzerinden puan verir; satırlar burada açılır.
|
||
INSERT INTO Hr_T_PerformanceFeedbackScore (Id, TenantId, FeedbackId, SkillId, IsActive, CreationTime, CreatorId, IsDeleted)
|
||
SELECT NEWID(), c.TenantId, @FeedbackId, c.SkillId, 1, GETUTCDATE(), @ActorId, 0
|
||
FROM Hr_T_PerformanceCompetency c
|
||
WHERE c.ReviewId = @ReviewId AND c.IsDeleted = 0
|
||
AND NOT EXISTS (
|
||
SELECT 1 FROM Hr_T_PerformanceFeedbackScore s
|
||
WHERE s.FeedbackId = @FeedbackId AND s.SkillId = c.SkillId AND s.IsDeleted = 0);
|
||
|
||
EXEC dbo.Hr_S_PerformanceNotify @ReviewId, @ReviewerId, N'Performans360Talebi',
|
||
N'App.Hr.Performance.Notification.Feedback.Subject', N'App.Hr.Performance.Notification.Feedback.Message', @ActorId;
|
||
END
|
||
GO |