sozsoft-platform/configs/seeds/sql/object/Hr_S_PerformanceFeedbackOpen.sql
2026-10-05 15:58:59 +03:00

29 lines
No EOL
1.2 KiB
Transact-SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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