﻿DECLARE intezmenytanevekCursor CURSOR LOCAL FOR
	SELECT ia.C_INTEZMENYID, ia.C_TANEVID
		FROM T_INTEZMENYADATOK ia
		JOIN T_TANEV t on t.ID = ia.C_TANEVID and t.C_AKTIV = 'T'

DECLARE @intezmenyId int, @tanevId int

OPEN intezmenytanevekCursor
FETCH NEXT FROM intezmenytanevekCursor INTO @intezmenyId, @tanevId

WHILE @@FETCH_STATUS = 0
BEGIN
		EXEC sp_UpdateRendszerbeallitasok
			@intezmenyId = @intezmenyId,
			@tanevId = @tanevId,
			@dictionaryTipus = 'MunkakorTipus',
			@beallitasTipus = 5441,
			@beallitasAzonosito = 'Alkalmazottak_lathatjak_a_diakok_adatait'

		EXEC sp_UpdateRendszerbeallitasok
			@intezmenyId = @intezmenyId,
			@tanevId = @tanevId,
			@dictionaryTipus = 'CsoportTipus',
			@beallitasTipus = 6764,
			@beallitasAzonosito = 'Tanorahoz_tartozo_csoportok'

	FETCH NEXT FROM intezmenytanevekCursor INTO @intezmenyId, @tanevId
END

CLOSE intezmenytanevekCursor
DEALLOCATE intezmenytanevekCursor