Move email notifications about of PayDriver and into Transaction.  Send
a notification when the cart value is 0 due to shop credit.
This commit is contained in:
Colin Kuskie 2009-10-13 16:37:20 -07:00
parent e46ad0d8fd
commit b3858ef250
12 changed files with 206 additions and 150 deletions

View file

@ -15,6 +15,7 @@
- fixed #11057: Deleting wiki attachments
- fixed #11122: Survey icon is missing from admin console
- fixed #11107: linked image with caption
- fixed #10914: Shop: No email notifications sent when the cart has net value 0
7.8.1
- mark $session->datetime->time as deprecated and remove its use from core code

View file

@ -22,7 +22,8 @@ use Getopt::Long;
use WebGUI::Session;
use WebGUI::Storage;
use WebGUI::Asset;
use WebGUI::Shop::Pay;
use WebGUI::Shop::PayDriver;
my $toVersion = '7.8.2';
my $quiet; # this line required
@ -32,6 +33,7 @@ my $session = start(); # this line required
fixTableDefaultCharsets($session);
correctWikiAttachmentPermissions( $session );
transactionsNotifications( $session );
finish($session); # this line required
@ -99,6 +101,31 @@ sub correctWikiAttachmentPermissions {
print "Done.\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub transactionsNotifications {
my $session = shift;
print "\tMove Shop notifications from PayDriver to Transactions... " unless $quiet;
my $pay = WebGUI::Shop::Pay->new($session);
my $gateways = $pay->getPaymentGateways;
my $defaultNotificationGroup = '3';
my $defaultTemplate = 'bPz1yk6Y9uwMDMBcmMsSCg';
if (@{ $gateways }) {
my $firstGateway = $gateways->[0];
$defaultNotificationGroup = $firstGateway->get('saleNotificationGroupId');
$defaultTemplate = $firstGateway->get('receiptEmailTemplateId' );
foreach my $gateway (@{ $gateways }) {
my $properties = $gateway->get();
delete $properties->{ saleNotificationGroupId };
delete $properties->{ receiptEmailTemplateId };
$gateway->update($properties);
}
}
$session->setting->add('shopSaleNotificationGroupId', $defaultNotificationGroup);
$session->setting->add('shopReceiptEmailTemplateId', $defaultTemplate);
print "Done.\n" unless $quiet;
}
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
#----------------------------------------------------------------------------