USP_DATAFORMTEMPLATE_EDIT_CONSTITUENTRECOGNITIONPROCESS_2
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN | |
@CHANGEAGENTID | uniqueidentifier | IN | |
@NAME | nvarchar(100) | IN | |
@DESCRIPTION | nvarchar(255) | IN | |
@IDSETREGISTERID | uniqueidentifier | IN | |
@INITIALSTATUSCODE | tinyint | IN | |
@CURRENTAPPUSERID | uniqueidentifier | IN | |
@SITEID | uniqueidentifier | IN |
Definition
Copy
create procedure dbo.USP_DATAFORMTEMPLATE_EDIT_CONSTITUENTRECOGNITIONPROCESS_2
(
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier = null,
@NAME nvarchar(100),
@DESCRIPTION nvarchar(255),
@IDSETREGISTERID uniqueidentifier,
@INITIALSTATUSCODE tinyint,
@CURRENTAPPUSERID uniqueidentifier,
@SITEID uniqueidentifier
)
as
set nocount on;
declare @CURRENTDATE datetime;
set @CURRENTDATE = getdate();
begin try
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
if (@SITEID is not null)
begin
if dbo.UFN_SITEALLOWEDFORUSER(@CURRENTAPPUSERID, @SITEID) = 0
begin
raiserror ('ERR_SITE_NOACCESS',13,1);
return 1;
end
end
update
dbo.CONSTITUENTRECOGNITIONPROCESS
set
NAME = @NAME,
DESCRIPTION = @DESCRIPTION,
IDSETREGISTERID = @IDSETREGISTERID,
INITIALSTATUSCODE = @INITIALSTATUSCODE,
CHANGEDBYID = @CHANGEAGENTID,
DATECHANGED = @CURRENTDATE
where
ID = @ID;
update
dbo.BUSINESSPROCESSINSTANCE
set
SITEID = @SITEID,
CHANGEDBYID = @CHANGEAGENTID,
DATECHANGED = @CURRENTDATE
where
BUSINESSPROCESSINSTANCE.BUSINESSPROCESSPARAMETERSETID = @ID
and BUSINESSPROCESSINSTANCE.BUSINESSPROCESSCATALOGID = '7616D877-034B-45A2-AB6D-3FCB63157DE2'
and (BUSINESSPROCESSINSTANCE.SITEID <> @SITEID
or BUSINESSPROCESSINSTANCE.SITEID is null and @SITEID is not null
or BUSINESSPROCESSINSTANCE.SITEID is not null and @SITEID is null);
end try
begin catch
exec dbo.USP_RAISE_ERROR;
return 1;
end catch
return 0;