USP_DATAFORMTEMPLATE_ADD_REVENUEBATCHGROUP

The save procedure used by the add dataform template "Revenue Batch Group Add Form".

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier INOUT The output parameter indicating the ID of the record added.
@NAME nvarchar(100) IN Name
@DESCRIPTION nvarchar(300) IN Description
@GROUPTYPEID uniqueidentifier IN Group type
@PRIMARYCONTACTID uniqueidentifier IN Primary contact
@GIVESANONYMOUSLY bit IN Group gives anonymously
@ADDRESSTYPECODEID uniqueidentifier IN Address type
@COUNTRYID uniqueidentifier IN Country
@ADDRESSBLOCK nvarchar(150) IN Address
@CITY nvarchar(50) IN City
@STATEID uniqueidentifier IN State
@POSTCODE nvarchar(12) IN ZIP/Postal code
@PHONETYPECODEID uniqueidentifier IN Phone type
@NUMBER nvarchar(100) IN Phone number
@EMAILADDRESSTYPECODEID uniqueidentifier IN Email type
@EMAILADDRESS UDT_EMAILADDRESS IN Email address
@WEBADDRESS UDT_WEBADDRESS IN Website
@MEMBERS xml IN Members
@STARTDATE datetime IN Start date
@NEWMEMBERSEARCHID uniqueidentifier IN Search for constituent to include in the group
@CHANGEAGENTID uniqueidentifier IN Input parameter indicating the ID of the change agent invoking the procedure.
@CURRENTAPPUSERID uniqueidentifier IN Input parameter indicating the ID of the current user.
@DONOTMAIL bit IN Do not send mail to this address
@DONOTMAILREASONCODEID uniqueidentifier IN Reason
@OMITFROMVALIDATION bit IN Omit this address from validation
@CART nvarchar(10) IN
@DPC nvarchar(8) IN
@LOT nvarchar(5) IN
@COUNTYCODEID uniqueidentifier IN
@CONGRESSIONALDISTRICTCODEID uniqueidentifier IN
@LASTVALIDATIONATTEMPTDATE datetime IN
@VALIDATIONMESSAGE nvarchar(100) IN
@CERTIFICATIONDATA int IN
@DONOTCALL bit IN Do not call this phone number
@DONOTEMAIL bit IN Do not send email to this address
@INFOSOURCECODEID uniqueidentifier IN

Definition

Copy


                    CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_REVENUEBATCHGROUP
                    (
                        @ID uniqueidentifier output,
                        @NAME nvarchar(100),
                        @DESCRIPTION nvarchar(300) = '',
                        @GROUPTYPEID uniqueidentifier = null,
                        @PRIMARYCONTACTID uniqueidentifier = null,
                        @GIVESANONYMOUSLY bit = null,
                        @ADDRESSTYPECODEID uniqueidentifier = null,
                        @COUNTRYID uniqueidentifier = null,
                        @ADDRESSBLOCK nvarchar(150) = '',
                        @CITY nvarchar(50) = '',
                        @STATEID uniqueidentifier = null,
                        @POSTCODE nvarchar(12) = '',
                        @PHONETYPECODEID uniqueidentifier = null,
                        @NUMBER nvarchar(100) = '',
                        @EMAILADDRESSTYPECODEID uniqueidentifier = null,
                        @EMAILADDRESS dbo.UDT_EMAILADDRESS = '',
                        @WEBADDRESS dbo.UDT_WEBADDRESS = '',

                        @MEMBERS xml = null,
                        @STARTDATE datetime = null,
                        @NEWMEMBERSEARCHID uniqueidentifier = null, -- Not used in save operation, only exists to setup new member lookup control.


                        @CHANGEAGENTID uniqueidentifier = null,
                        @CURRENTAPPUSERID uniqueidentifier,
                        @DONOTMAIL bit = 0,
                        @DONOTMAILREASONCODEID uniqueidentifier = null,
                        @OMITFROMVALIDATION bit = 0,
                        @CART nvarchar(10) = '',
                        @DPC nvarchar(8) = '',
                        @LOT nvarchar(5) = '',
                        @COUNTYCODEID uniqueidentifier = null,
                        @CONGRESSIONALDISTRICTCODEID uniqueidentifier = null,
                        @LASTVALIDATIONATTEMPTDATE datetime = null,
                        @VALIDATIONMESSAGE nvarchar(100) = '',
                        @CERTIFICATIONDATA integer = 0,
                        @DONOTCALL bit = 0,
                        @DONOTEMAIL bit = 0,
                        @INFOSOURCECODEID uniqueidentifier = null
                    ) 
                    as
                        set nocount on;

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

                        -- Check if the group type can be a donor

                        declare @CANBEDONOR bit
                        select @CANBEDONOR = CANBEDONOR from dbo.GROUPTYPE where ID = @GROUPTYPEID
                        if @CANBEDONOR = 0
                            raiserror('GROUPTYPECANNOTBEDONOR', 13, 1)

                        if @DONOTMAIL = 0
                          set @DONOTMAILREASONCODEID = null

                        begin try
                            exec dbo.USP_BATCHREVENUE_ADDGROUP @ID output, @NAME, @DESCRIPTION, @GROUPTYPEID, @GIVESANONYMOUSLY, @ADDRESSTYPECODEID, @COUNTRYID, @ADDRESSBLOCK
                                @CITY, @STATEID, @POSTCODE, @PHONETYPECODEID, @NUMBER, @EMAILADDRESSTYPECODEID, @EMAILADDRESS, @WEBADDRESS, @MEMBERS, @STARTDATE
                                @CHANGEAGENTID, @CURRENTAPPUSERID, @DONOTMAIL, @DONOTMAILREASONCODEID,
                                @OMITFROMVALIDATION, @CART, @DPC, @LOT, @COUNTYCODEID, @CONGRESSIONALDISTRICTCODEID,
                                @LASTVALIDATIONATTEMPTDATE, @VALIDATIONMESSAGE, @CERTIFICATIONDATA, @DONOTCALL, @DONOTEMAIL, null, null, null, @INFOSOURCECODEID
                        end try
                        begin catch
                            exec dbo.USP_RAISE_ERROR;
                            return 1;
                        end catch

                        return 0;