spClone_ClientDonation

Parameters

Parameter Parameter Type Mode Description
@PKID int INOUT
@ContentID int IN
@CurrentUsersID int IN

Definition

Copy


CREATE procedure [dbo].[spClone_ClientDonation]
(
    @PKID int output,
    @ContentID int,
    @CurrentUsersID int
)
as
    declare @ClientDonationsID integer;
    set @ClientDonationsID = @PKID;

    declare @newGuid uniqueidentifier;
    set @newGuid = newid();

    insert into [dbo].ClientDonations (
    ClientsID,
    OwnerID,
    Guid,
    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,

    AcknowledgementBlock,
    AllowSpouseInfo,
    IncludeChallengeMatch,
    ChallengeMatchIntro,
    ChallengeMatch,
    ImpactStatementTypeID,
    AppealHistoryQueryID
    ) select
    ClientsID,

    @CurrentUsersID,
    @newGuid,
    ConstitCodeID,
    DonationOptions,
    TributeOptions,
    RedirectPageID,
    MerchantAccount,
    @ContentID,
    Attributes,
    DonateBtn,          -- DMB CR268447-022807: More props not copied...
    RecurrenceOptions,
    RecurrenceOptionsTruePledge,
    NoMGPledges,
    ShoppingCartPageID,
    EReceiptPdfForCreditCard,
    EReceiptPdfForDirectDebit,
    MarkReceiptedForCreditCard,
    MarkReceiptedForDirectDebit,
    EReceiptContent,
    EReceiptPdfMargin,
    CartMessage,
    ECardSendDateAttributeID,
    ECardRecipientFirstNameAttributeID,
    ECardRecipientLastNameAttributeID,
    CartSendDonationAcknowledgementAlways,
    MinimumGiftAmount,
    MinimumPledgePaymentAmount,
    ShowPledgePaymentDueDate,
    AcknowledgementBlock,
    AllowSpouseInfo,
    IncludeChallengeMatch,

    ChallengeMatchIntro,
    ChallengeMatch,
    ImpactStatementTypeID,
    AppealHistoryQueryID
    from
    [dbo].ClientDonations
    where
    ID = @PKID;

    select  @PKID = @@identity;

    insert into [dbo].DonationDesignations (
    ClientDonationsID,
    BackOfficeID,
    Name,
    IsDefault,
    BackOfficeIDGUID,
    DisplayOrder
    ) select
    @PKID,
    BackOfficeID,
    Name,

    IsDefault,
    BackOfficeIDGUID,
    DisplayOrder
    from
    [dbo].DonationDesignations
    where
    ClientDonationsID = @ClientDonationsID;

    insert into [dbo].DonationGivingLevels (
    ClientDonationsID,
    Name,
    Amount,
    IsDefault
    ) select
    @PKID,
    Name,
    Amount,
    IsDefault
    from
    [dbo].DonationGivingLevels
    where
    ClientDonationsID = @ClientDonationsID;

    insert into [dbo].DonationSources (
    ClientDonationsID,
    BackOfficeID,
    Name,
    IsDefault
    ) select
    @PKID,
    BackOfficeID,
    Name,
    IsDefault
    from
    [dbo].DonationSources
    where
    ClientDonationsID = @ClientDonationsID;

    exec spAuditThis @CurrentUsersID, 2, @newGuid, 10;