USP_DATAFORMTEMPLATE_ADD_COPYTOSPOUSE_PHONE
The save procedure used by the add dataform template "Phone Copy To Spouse Add Form".
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | INOUT | The output parameter indicating the ID of the record added. |
@SPOUSEID | uniqueidentifier | IN | Spouse ID |
@PHONEID | uniqueidentifier | IN | Input parameter indicating the context ID for the record being added. |
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the procedure. |
@PHONETYPECODEID | uniqueidentifier | IN | Type |
@NUMBER | nvarchar(100) | IN | Number |
@PRIMARY | bit | IN | Set as primary phone number |
@DONOTCALL | bit | IN | Do not call this phone number |
@STARTTIME | UDT_HOURMINUTE | IN | Call after |
@ENDTIME | UDT_HOURMINUTE | IN | Call before |
@INFOSOURCECODEID | uniqueidentifier | IN | Information source |
@INFOSOURCECOMMENTS | nvarchar(256) | IN | Comments |
@COUNTRYID | uniqueidentifier | IN | Country |
@STARTDATE | date | IN | Start date |
@ENDDATE | date | IN | End date |
@DONOTCALLREASONCODEID | uniqueidentifier | IN | Reason |
@ISCONFIDENTIAL | bit | IN | This phone number is confidential |
@CONSTITUENTDATAREVIEWROLLBACKREASONID | uniqueidentifier | IN | Reason |
Definition
Copy
create procedure dbo.USP_DATAFORMTEMPLATE_ADD_COPYTOSPOUSE_PHONE
(
@ID uniqueidentifier = null output,
@SPOUSEID uniqueidentifier = null,
@PHONEID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier = null,
@PHONETYPECODEID uniqueidentifier = null,
@NUMBER nvarchar(100),
@PRIMARY bit = null,
@DONOTCALL bit = null,
@STARTTIME dbo.UDT_HOURMINUTE = '',
@ENDTIME dbo.UDT_HOURMINUTE = '',
@INFOSOURCECODEID uniqueidentifier = null,
@INFOSOURCECOMMENTS nvarchar(256) = '',
@COUNTRYID uniqueidentifier = null,
@STARTDATE date = null,
@ENDDATE date = null,
@DONOTCALLREASONCODEID uniqueidentifier = null,
@ISCONFIDENTIAL bit = null,
@CONSTITUENTDATAREVIEWROLLBACKREASONID uniqueidentifier = null -- used by constituent data review
)
as
set nocount on;
declare @CURRENTDATE datetime;
set @CURRENTDATE = getdate();
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
if @PRIMARY = 0 and not exists(select ID from dbo.PHONE where CONSTITUENTID = @SPOUSEID and ISPRIMARY = 1)
raiserror('BBERR_NOPRIMARY', 13, 1);
exec dbo.USP_PHONE_CREATE
@ID output,
@CHANGEAGENTID,
@CURRENTDATE,
@SPOUSEID,
@PHONETYPECODEID,
@NUMBER,
@PRIMARY,
@STARTTIME,
@ENDTIME,
@STARTDATE,
@DONOTCALL,
@DONOTCALLREASONCODEID,
@INFOSOURCECODEID,
@INFOSOURCECOMMENTS,
@COUNTRYID,
@ISCONFIDENTIAL;
--Update the end date since USP_PHONE_CREATE does everything we want except this.
update dbo.PHONE set ENDDATE = @ENDDATE where ID = @ID;
return 0;