From 4683e4b769ae11229f56b9e0b551b9345a512b96 Mon Sep 17 00:00:00 2001 From: Kaleb Murphy Date: Thu, 31 Jul 2008 20:16:53 +0000 Subject: [PATCH] upgrade script corrects assetId of paymentgateway's receipt template id. --- docs/upgrades/upgrade_7.5.18-7.5.19.pl | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/upgrades/upgrade_7.5.18-7.5.19.pl b/docs/upgrades/upgrade_7.5.18-7.5.19.pl index cf1f7d072..d335605e9 100644 --- a/docs/upgrades/upgrade_7.5.18-7.5.19.pl +++ b/docs/upgrades/upgrade_7.5.18-7.5.19.pl @@ -20,7 +20,7 @@ use Getopt::Long; use WebGUI::Session; use WebGUI::Storage; use WebGUI::Asset; - +use WebGUI::Shop::PayDriver; my $toVersion = '7.5.19'; my $quiet; # this line required @@ -32,6 +32,7 @@ my $session = start(); # this line required addNewInboxIndexes( $session ); updateAddressTable( $session ); addProductShipping( $session ); +correctPayDriverReceiptTemplate( $session ); finish($session); # this line required @@ -44,6 +45,23 @@ finish($session); # this line required # print "DONE!\n" unless $quiet; #} +#---------------------------------------------------------------------------- +# Corrects the asset id of the default receipt email template for the PayDriver +sub correctPayDriverReceiptTemplate{ + my $session = shift; + + #Grab all PaymentDriver id's. + my @ids = $session->db->buildArray("select paymentGatewayId from paymentGateway"); + for my $id(@ids){ + my $paymentGateway = WebGUI::Shop::PayDriver->new($session,$id); + my $options = $paymentGateway->get(); + if($options->{'receiptEmailTemplateId'} eq 'BMzuE91-XB8E-XGll1zpvA'){ + $options->{'receiptEmailTemplateId'} = 'bPz1yk6Y9uwMDMBcmMsSCg'; + $paymentGateway->update($options); + } + } +} + #---------------------------------------------------------------------------- # Removes the name field and adds a firstName and lastName field sub updateAddressTable {