Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE PROCEDURE [dbo].[as_en_getAvailableStatusesForInstance]
- @entityCode nvarchar(256),
- @instanceID int,
- @username nvarchar(32)
- AS
- BEGIN
- declare @langID int = (select langID from as_users where username = @username)
- execute as_print @langID
- select *, s.id StatusID ,
- (case isnull(buttonTitle,'')
- when '' then isnull(ls.name, s.name )
- else buttonTitle end
- ) Name
- from as_en_availableStatuses avs
- inner join as_en_statuses s on s.id = avs.availableStatusID
- left join [as_lang_statuses] ls on ls.itemID =s.id and langID = @langID
- where
- currentStatusID in (select statusID from as_en_entityInstances
- where id = @instanceID and entityID in (select id from as_en_entities
- where code = @entityCode)
- )
- and ( ( isnull(users, '') ='' and isnull(roles, '') ='' ) or dbo.sec_hasAccessByUsersRoles(@username, users, roles) = '1')
- order by avs.ord, s.ord
- END
Advertisement