USP_DATAFORMTEMPLATE_EDIT_FEPPROCESS
The save procedure used by the edit dataform template "FEP Process Edit Form".
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN | The input ID parameter indicating the ID of the record being edited. |
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the procedure. |
@NAME | nvarchar(150) | IN | Name |
@DESCRIPTION | nvarchar(250) | IN | Description |
@SITEID | uniqueidentifier | IN | Site |
@ORGANIZATIONNAME | nvarchar(50) | IN | Organization name |
@COUNTRYID | uniqueidentifier | IN | Country |
@POSTCODE | nvarchar(12) | IN | ZIP Code |
@IDNUMBER | nvarchar(15) | IN | Identification number |
@CONTACTNAME | nvarchar(50) | IN | Contact person |
@CONTACTEMAIL | nvarchar(100) | IN | Email address |
@CONTACTPHONE | nvarchar(20) | IN | Phone |
@AFP | bit | IN | AFP (Association of Fundraising Professionals) |
@CASE | bit | IN | CASE (Council for Advancement and Support of Education) |
@AHP | bit | IN | AHP (Association for Healthcare Philanthropy) |
@ALDE | bit | IN | ALDE (Association of Lutheran Development Executives) |
@NCPG | bit | IN | NCPG (National Committee on Planned Giving) |
@CRD | bit | IN | CRD (Council for Resource Development) |
@OTHER | bit | IN | Other (please specify) |
@OTHERAFFILIATION | nvarchar(50) | IN | |
@INITIALYEAR | UDT_YEAR | IN | Year development program initiated (YYYY) |
@SUBSECTORCODE | tinyint | IN | Subsector or type of organization |
@FUNDRAISINGEXPENSES | money | IN | Fundraising Expenses |
@FTEPROFESSIONAL | decimal(20, 2) | IN | Full-time Professional staff (Period 2) |
@FTESUPPORT | decimal(20, 2) | IN | Full-time Support staff (Period 2) |
@FTECONSULTANT | decimal(20, 2) | IN | Consultant full-time equivalent (Period 2) |
@FTEVOLUNTEER | decimal(20, 2) | IN | Full-time Volunteer fundraisers (Period 2) |
@COMMENTS | nvarchar(250) | IN | Comments |
@CURRENTAPPUSERID | uniqueidentifier | IN | Input parameter indicating the ID of the current user. |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDIT_FEPPROCESS
(
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier = null,
@NAME nvarchar(150),
@DESCRIPTION nvarchar(250),
@SITEID uniqueidentifier,
@ORGANIZATIONNAME nvarchar(50),
@COUNTRYID uniqueidentifier,
@POSTCODE nvarchar(12),
@IDNUMBER nvarchar(15),
@CONTACTNAME nvarchar(50),
@CONTACTEMAIL nvarchar(100),
@CONTACTPHONE nvarchar(20),
@AFP bit,
@CASE bit,
@AHP bit,
@ALDE bit,
@NCPG bit,
@CRD bit,
@OTHER bit,
@OTHERAFFILIATION nvarchar(50),
@INITIALYEAR dbo.UDT_YEAR,
@SUBSECTORCODE tinyint,
@FUNDRAISINGEXPENSES money,
@FTEPROFESSIONAL decimal(20,2),
@FTESUPPORT decimal(20,2),
@FTECONSULTANT decimal(20,2),
@FTEVOLUNTEER decimal(20,2),
@COMMENTS nvarchar(250),
@CURRENTAPPUSERID uniqueidentifier = null
)
as
set nocount on;
declare @CURRENTDATE datetime = getDate();
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
if @SITEID is not null
begin
if dbo.UFN_SITEALLOWEDFORUSER(@CURRENTAPPUSERID, @SITEID) = 0
raiserror('ERR_SITE_NOACCESS', 13, 1);
end
else
begin
if dbo.UFN_SITEREQUIREDFORUSER(@CURRENTAPPUSERID) = 1
raiserror('ERR_SITEREQUIRED', 13, 1);
end
begin try
update dbo.FEPPROCESS set
NAME = @NAME,
DESCRIPTION = @DESCRIPTION,
SITEID = @SITEID,
ORGANIZATIONNAME = @ORGANIZATIONNAME,
COUNTRYID = @COUNTRYID,
POSTCODE = @POSTCODE,
IDNUMBER = @IDNUMBER,
CONTACTNAME = @CONTACTNAME,
CONTACTEMAIL = @CONTACTEMAIL,
CONTACTPHONE = @CONTACTPHONE,
AFP = @AFP,
[CASE] = @CASE,
AHP = @AHP,
ALDE = @ALDE,
NCPG = @NCPG,
CRD = @CRD,
OTHER = @OTHER,
OTHERAFFILIATION = @OTHERAFFILIATION,
INITIALYEAR = @INITIALYEAR,
SUBSECTORCODE = @SUBSECTORCODE,
FUNDRAISINGEXPENSES = @FUNDRAISINGEXPENSES,
FTEPROFESSIONAL = @FTEPROFESSIONAL,
FTESUPPORT = @FTESUPPORT,
FTECONSULTANT = @FTECONSULTANT,
FTEVOLUNTEER = @FTEVOLUNTEER,
COMMENTS = @COMMENTS
where ID = @ID;
update BUSINESSPROCESSINSTANCE set SITEID = @SITEID
where BUSINESSPROCESSINSTANCE.ID IN
(select BUSINESSPROCESSINSTANCE.ID
from BUSINESSPROCESSINSTANCE
inner join FEPSUBMITPROCESS on FEPSUBMITPROCESS.ID = BUSINESSPROCESSINSTANCE.BUSINESSPROCESSPARAMETERSETID
inner join FEPPROCESS on FEPPROCESS.ID = FEPSUBMITPROCESS.FEPPROCESSID
where FEPPROCESS.ID = @ID)
end try
begin catch
exec dbo.USP_RAISE_ERROR;
return 1;
end catch
return 0;