USP_BATCH_MAKEINACTIVE

Executes the "Batch: Make inactive" record operation.

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN Input parameter indicating the ID of the record being updated.
@CURRENTAPPUSERID uniqueidentifier IN Input parameter indicating the ID of the current user.
@CHANGEAGENTID uniqueidentifier IN Input parameter indicating the ID of the change agent invoking the update.

Definition

Copy


CREATE procedure dbo.USP_BATCH_MAKEINACTIVE
(
    @ID uniqueidentifier,
    @CURRENTAPPUSERID uniqueidentifier,
    @CHANGEAGENTID uniqueidentifier
)
with execute as owner
as 
set nocount on;

begin try

    declare @GRANTED bit
    select @GRANTED=dbo.UFN_SECURITY_APPUSER_GRANTED_BATCHPROCESSOR(@CURRENTAPPUSERID, @ID)
    if @GRANTED = 0
        raiserror('You do not have permission to update this batch template.', 13, 1);

    --mark batch design as inactive

    update dbo.BATCHTEMPLATE set ACTIVE = 0 where ID = @ID;

end try
begin catch
    exec dbo.USP_RAISE_ERROR;
    return 1;
end catch

return 0;