spCloneInto_ClientDonation
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@TargetClientDonationsId | int | IN | |
@TargetContentId | int | IN | |
@SourceClientDonationsId | int | IN | |
@SourceContentID | int | IN | |
@CurrentUsersID | int | IN |
Definition
Copy
CREATE procedure [dbo].[spCloneInto_ClientDonation]
(
@TargetClientDonationsId int,
@TargetContentId int,
@SourceClientDonationsId int,
@SourceContentID int,
@CurrentUsersID int
)
as
with src as(
select
ID
,ClientsID
,OwnerID
,ConstitCodeID
,DonationOptions
,TributeOptions
,RedirectPageID
,MerchantAccount
,ContentID
,Attributes
,DonateBtn
,RecurrenceOptions
,RecurrenceOptionsTruePledge
,NoMGPledges
,ShoppingCartPageID
,EReceiptPdfForCreditCard
,EReceiptPdfForDirectDebit
,MarkReceiptedForCreditCard
,MarkReceiptedForDirectDebit
,EReceiptContent
,EReceiptPdfMargin
,CartMessage
,ECardSendDateAttributeID
,ECardRecipientFirstNameAttributeID
,ECardRecipientLastNameAttributeID
,CartSendDonationAcknowledgementAlways
,MinimumGiftAmount
,MinimumPledgePaymentAmount
,ShowPledgePaymentDueDate
from
[dbo].ClientDonations s --source
where
s.ID = @SourceClientDonationsId
)
update t set
ClientsID = s.ClientsID,
OwnerID = @CurrentUsersID,
ConstitCodeID = s.ConstitCodeID,
DonationOptions = s.DonationOptions,
TributeOptions = s.TributeOptions,
RedirectPageID = s.RedirectPageID,
MerchantAccount = s.MerchantAccount,
ContentID = @TargetContentId,
Attributes = s.Attributes,
DonateBtn = s.DonateBtn,
RecurrenceOptions = s.RecurrenceOptions,
RecurrenceOptionsTruePledge = s.RecurrenceOptionsTruePledge,
NoMGPledges = s.NoMGPledges,
ShoppingCartPageID = s.ShoppingCartPageID,
EReceiptPdfForCreditCard = s.EReceiptPdfForCreditCard,
EReceiptPdfForDirectDebit = s.EReceiptPdfForDirectDebit,
MarkReceiptedForCreditCard = s.MarkReceiptedForCreditCard,
MarkReceiptedForDirectDebit = s.MarkReceiptedForDirectDebit,
EReceiptContent = s.EReceiptContent,
EReceiptPdfMargin = s.EReceiptPdfMargin,
CartMessage = s.CartMessage,
ECardSendDateAttributeID = s.ECardSendDateAttributeID,
ECardRecipientFirstNameAttributeID = s.ECardRecipientFirstNameAttributeID,
ECardRecipientLastNameAttributeID = s.ECardRecipientLastNameAttributeID,
CartSendDonationAcknowledgementAlways = s.CartSendDonationAcknowledgementAlways,
MinimumGiftAmount = s.MinimumGiftAmount,
MinimumPledgePaymentAmount = s.MinimumPledgePaymentAmount,
ShowPledgePaymentDueDate = s.ShowPledgePaymentDueDate
from
[dbo].ClientDonations t --target
left join src s
on s.ID=s.ID
where
t.ID = @TargetClientDonationsId
--CWC - not doing this because microsite (which uses this SP) does not use
--the donation designations table
--insert into [dbo].DonationDesignations (
--ClientDonationsID,
--BackOfficeID,
--Name,
--IsDefault
--) select
--@TargetClientDonationsId,
--BackOfficeID,
--Name,
--IsDefault
--from
--[dbo].DonationDesignations
--where
--ClientDonationsID = @SourceClientDonationsId;
delete from [dbo].DonationGivingLevels
where ClientDonationsID = @TargetClientDonationsId
insert into [dbo].DonationGivingLevels(ClientDonationsID, Name, Amount, IsAthon)
select
@TargetClientDonationsId,
s.Name,
s.Amount,
s.IsAthon
from [dbo].DonationGivingLevels s
where s.ClientDonationsID = @SourceClientDonationsId
------------------------
delete from [dbo].DonationSources
where ClientDonationsID = @TargetClientDonationsId;
insert into [dbo].DonationSources (ClientDonationsID, BackOfficeID, Name, IsDefault)
select
@TargetClientDonationsId,
BackOfficeID,
Name,
IsDefault
from [dbo].DonationSources
where ClientDonationsID = @SourceClientDonationsId;
-------------------------
declare @newGuid uniqueidentifier;
select @newGuid = [guid] from ClientDonations where ID=@TargetClientDonationsId
exec spAuditThis @CurrentUsersID, 2, @newGuid, 10;