Add a creation date to the Cart.

Use that date to expire carts older than an interval, via a new workflow.
Config file changes, tests, i18n.
This commit is contained in:
Colin Kuskie 2009-04-02 21:58:45 +00:00
parent 6bd159bcfd
commit 60a3906b05
9 changed files with 299 additions and 5 deletions

View file

@ -21,6 +21,7 @@
- Survey now shows warnings if bad goto, bad gotoExpressions, no question text, survey looping,
or no question answers are found.
- fixed: Gateway problem with VendorPayout.
- fixed #9976: carts not cleaned up
7.7.1
- the AdSku project: create a Sku that allows buyers to purchase advertising in select AdSpaces at selected priorities

View file

@ -10,6 +10,8 @@ save you many hours of grief.
7.7.2
--------------------------------------------------------------------
* WebGUI now requires Clone version 0.31 or greater.
* You must upgrade to WebGUI 7.7.2 before going on to higher versions of WebGUI due
to changes in the database table for the Cart.
7.7.1
--------------------------------------------------------------------

View file

@ -22,7 +22,8 @@ use Getopt::Long;
use WebGUI::Session;
use WebGUI::Storage;
use WebGUI::Asset;
use WebGUI::Workflow;
use WebGUI::Utility;
my $toVersion = '7.7.2';
my $quiet; # this line required
@ -37,6 +38,9 @@ addRssFeedAspect($session);
addRssFeedAspectToAssets($session);
addRssFeedAspectToCollaboration($session);
removeRssCapableAsset($session);
addCreationTimeToCart($session);
addCartKillerActivityToConfig($session);
addCartKillerActivityToWorkflow($session);
finish($session); # this line required
@ -128,6 +132,38 @@ sub removeRssCapableAsset {
print "Done.\n" unless $quiet;
}
#----------------------------------------------------------------------------
sub addCreationTimeToCart {
my $session = shift;
print "\tAdding creation time to cart..." unless $quiet;
$session->db->write("alter table cart add column creationDate int(20)");
$session->db->write('update cart set creationDate=NOW()');
print "Done.\n" unless $quiet;
}
#----------------------------------------------------------------------------
sub addCartKillerActivityToConfig {
my $session = shift;
print "\tAdding Remove Old Carts workflow activity to config files..." unless $quiet;
my $activities = $session->config->get('workflowActivities');
my $none = $activities->{'None'};
if (!isIn('WebGUI::Workflow::Activity::RemoveOldCarts', @{ $none })) {
push @{ $none }, 'WebGUI::Workflow::Activity::RemoveOldCarts';
}
$session->config->set('workflowActivities', $activities);
print "Done.\n" unless $quiet;
}
#----------------------------------------------------------------------------
sub addCartKillerActivityToWorkflow {
my $session = shift;
print "\tAdding Remove Old Carts workflow activity to Daily Workflow..." unless $quiet;
my $workflow = WebGUI::Workflow->new($session, 'pbworkflow000000000001');
my $removeCarts = $workflow->addActivity('WebGUI::Workflow::Activity::RemoveOldCarts');
$removeCarts->set('title', 'Remove old carts');
print "Done.\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does