Forward port the PayDriver bug fixes from 7.5 branch. Labels are always

taken consistently from the JSON blob, and not a mixture of the two.
This commit is contained in:
Colin Kuskie 2009-01-15 00:34:34 +00:00
parent 3348df94da
commit 1b6dd7be63
6 changed files with 47 additions and 71 deletions

View file

@ -5,6 +5,7 @@
- fixed #9492: Problem in passing form variables to Macro SQL inside a snippet
- fixed #9404: Head tags for admin user with admin mode off
- fixed #9507: Navigation: relDepth is calculated with starting point, instead of the first displayed page
- fixed a bug where no Payment Gateway labels show up when checking out.
7.6.8
- added #!/usr/bin/env perl to all utility scripts

View file

@ -22,6 +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.6.9';
@ -31,6 +33,7 @@ my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
fixPayDriverLabels($session);
finish($session); # this line required
@ -44,6 +47,27 @@ finish($session); # this line required
# print "DONE!\n" unless $quiet;
#}
#----------------------------------------------------------------------------
# Get rid of the duplicate label properties in the PayDrivers.
sub fixPayDriverLabels {
my $session = shift;
print "\tGet rid of the duplicate label properties in the PayDrivers... " unless $quiet;
my $pay = WebGUI::Shop::Pay->new($session);
my $gateways = $pay->getPaymentGateways;
foreach my $gateway (@{ $gateways }) {
my $gatewayId = $gateway->getId;
my $jsonLabel = $gateway->get('label');
next if $jsonLabel;
my $dbLabel = $session->db->quickScalar('select label from paymentGateway where paymentGatewayId=?', [$gatewayId]);
my $properties = $gateway->get();
$properties->{label} = $dbLabel;
$gateway->update($properties);
}
$session->db->write('alter table paymentGateway drop column label');
print "DONE!\n" unless $quiet;
}
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------