USP_DATAFORMTEMPLATE_PLANNEDGIFTSITES_EDITSAVE

The save procedure used by the edit dataform template "Planned Gift Sites Edit Form".

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN The input ID parameter indicating the ID of the record being edited.
@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 procedure.
@SITES xml IN Sites

Definition

Copy


                    CREATE procedure dbo.USP_DATAFORMTEMPLATE_PLANNEDGIFTSITES_EDITSAVE 
                    (
                        @ID uniqueidentifier,
                        @CURRENTAPPUSERID uniqueidentifier,
                        @CHANGEAGENTID uniqueidentifier = null,
                        @SITES xml
                    ) 
                    as

                        set nocount on;

                        if @SITES is null begin 
                            if dbo.UFN_SITEREQUIREDFORUSER(@CURRENTAPPUSERID) = 1 begin
                                raiserror('Site is required.',13,1)
                                return
                            end
                        end

                        exec dbo.USP_PLANNEDGIFTSITE_VALIDATESITES @SITES;                        

                        if @CHANGEAGENTID is null
                            exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;

                        declare @NOW datetime;
                        set @NOW = getdate();

                        begin try

                            exec dbo.USP_PLANNEDGIFT_GETSITES_UPDATEFROMXML @ID, @SITES, @CHANGEAGENTID, @NOW;

                        end try
                        begin catch

                            exec dbo.USP_RAISE_ERROR;
                            return 1;

                        end catch

                        return 0;