USP_DATAFORMTEMPLATE_ADD_CONSTITUENTGROUPMEMBER

The save procedure used by the add dataform template "Constituent Group Member Add Form".

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier INOUT The output parameter indicating the ID of the record added.
@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.
@GROUPID uniqueidentifier IN Group/Household
@CONSTITUENTID uniqueidentifier IN Input parameter indicating the context ID for the record being added.
@RECOGNIZEMEMBERFORHOUSEHOLD bit IN Recognize member for household gifts
@ADDEDCONSTITUENTTOOTHERMEMBERSRECOGNITION xml IN Added constituent to other members recognition
@ADDEDCONSTITUENTFROMOTHERMEMBERSRECOGNITION xml IN Added constituent from other members recognition

Definition

Copy


                    CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_CONSTITUENTGROUPMEMBER
                    (
                        @ID uniqueidentifier = null output,
                        @CURRENTAPPUSERID uniqueidentifier,
                        @CHANGEAGENTID uniqueidentifier = null,    
                        @GROUPID uniqueidentifier,
                        @CONSTITUENTID uniqueidentifier,
                        @RECOGNIZEMEMBERFORHOUSEHOLD bit = null,
                        @ADDEDCONSTITUENTTOOTHERMEMBERSRECOGNITION xml = null,
                        @ADDEDCONSTITUENTFROMOTHERMEMBERSRECOGNITION xml = null
                    )
                    as
                        set nocount on;

                        if (dbo.UFN_APPUSER_ISSYSADMIN(@CURRENTAPPUSERID) = 0) and
                           (dbo.UFN_SECURITY_APPUSER_GRANTED_FORM_FORCONSTIT(@CURRENTAPPUSERID, '9E6C59D0-D366-42E3-B61C-3F060DCC8CCD', @GROUPID) = 0)
                        begin
                            raiserror('ERR_GROUP_NOACCESS', 13, 1)
                            return 1
                        end

                        begin try
                            exec dbo.USP_GROUPMEMBERADD @ID output, @CHANGEAGENTID, @GROUPID, @CONSTITUENTID, @RECOGNIZEMEMBERFORHOUSEHOLD;

                            --JamesWill WI176681 2012-01-11 Don't touch the recognition defaults unless the group is a household (since only 

                            --household groups will give the user a chance to actually set the recognition defaults) 

                            if dbo.UFN_CONSTITUENT_ISHOUSEHOLD(@GROUPID) = 1
                            begin
                                exec dbo.USP_GETRECOGNITIONDEFAULTSBETWEENMEMBERSBYSOURCE_UPDATEFROMXML @GROUPID, @CONSTITUENTID
                                    @ADDEDCONSTITUENTTOOTHERMEMBERSRECOGNITION, @CHANGEAGENTID

                                exec dbo.USP_GETRECOGNITIONDEFAULTSBETWEENMEMBERSBYRECIPIENT_UPDATEFROMXML @GROUPID, @CONSTITUENTID
                                    @ADDEDCONSTITUENTFROMOTHERMEMBERSRECOGNITION, @CHANGEAGENTID
                            end
                        end try
                        begin catch
                            exec dbo.USP_RAISE_ERROR;
                            return 1;
                        end catch

                        return 0;