Merge branch 'master' of github.com:plainblack/webgui

This commit is contained in:
JT Smith 2009-10-20 11:05:50 -05:00
commit a2264ab799
12 changed files with 190 additions and 25 deletions

View file

@ -5,6 +5,7 @@
- fixed #11060: Some tables have latin1 as the default character set - fixed #11060: Some tables have latin1 as the default character set
- fixed #11089: No message body in Notification - fixed #11089: No message body in Notification
- fixed #2569: robots.txt issues - fixed #2569: robots.txt issues
- refixed #2569: robots.txt issues
- fixed #11104: Wrong name for request tracker post form template - fixed #11104: Wrong name for request tracker post form template
- fixed #11077: Untested result in WebGUI::Storage->getFiles - fixed #11077: Untested result in WebGUI::Storage->getFiles
- fixed #11080: Asset Manage Crumb Trail flyout menu - fixed #11080: Asset Manage Crumb Trail flyout menu
@ -25,6 +26,10 @@
- fixed #11139: referencing an item in the clipboard - fixed #11139: referencing an item in the clipboard
- fixed #11146: Upgrade Error 7.7.21 to 7.7.22 - fixed #11146: Upgrade Error 7.7.21 to 7.7.22
- fixed #11147: fail safe template is missing embedded style - fixed #11147: fail safe template is missing embedded style
- fixed #11137: Customers see failed orders
- fixed #11156: Syndicated Content doesn't show all headlines in feed
- fixed #11138: RichEdit, upload image does not commit a version tag
- fixed ExpireIncompleteSurveyResponses Workflow: process responses for deleted users
7.8.1 7.8.1
- mark $session->datetime->time as deprecated and remove its use from core code - mark $session->datetime->time as deprecated and remove its use from core code

View file

@ -154,28 +154,38 @@ sub generateFeed {
utf8::downgrade($value, 1); utf8::downgrade($value, 1);
eval { eval {
my $singleFeed = XML::FeedPP->new($value, utf8_flag => 1, -type => 'string'); my $singleFeed = XML::FeedPP->new($value, utf8_flag => 1, -type => 'string');
$feed->merge($singleFeed); $feed->merge_channel($singleFeed);
$feed->merge_item($singleFeed);
}; };
if ($@) { if ($@) {
$log->error("Syndicated Content asset (".$self->getId.") has a bad feed URL (".$url."). Failed with ".$@); $log->error("Syndicated Content asset (".$self->getId.") has a bad feed URL (".$url."). Failed with ".$@);
} }
} }
# build a new feed that matches the term the user is interested in # build a new feed that matches the term the user is interested in
if ($self->get('hasTerms') ne '') { if ($self->get('hasTerms') ne '') {
my @terms = split /,\s*/, $self->get('hasTerms'); # get the list of terms my @terms = split /,\s*/, $self->get('hasTerms'); # get the list of terms
my $termRegex = join("|", map quotemeta($_), @terms); # turn the terms into a regex string my $termRegex = join("|", map quotemeta($_), @terms); # turn the terms into a regex string
my @items = $feed->match_item(title => qr/$termRegex/msi); my @items = $feed->match_item(title => qr/$termRegex/msi);
push @items, $feed->match_item(description => qr/$termRegex/msi); push @items, $feed->match_item(description => qr/$termRegex/msi);
$feed->clear_item; $feed->clear_item;
$feed->uniq_item; ITEM: foreach my $item (@items) {
foreach my $item (@items) { $feed->add_item($item);
$feed->add_item($item); }
}
} }
my %seen = {};
my @items = $feed->get_item;
$feed->clear_item;
ITEM: foreach my $item (@items) {
my $key = join "\n", $item->link, $item->pubDate, $item->description, $item->title;
next ITEM if $seen{$key}++;
$feed->add_item($item);
}
# sort them by date and remove any duplicate from the OR based term matching above # sort them by date and remove any duplicate from the OR based term matching above
$feed->normalize(); $feed->sort_item();
# limit the feed to the maximum number of headlines (or the feed generator limit). # limit the feed to the maximum number of headlines (or the feed generator limit).
$feed->limit_item($limit); $feed->limit_item($limit);

View file

@ -386,8 +386,8 @@ sub www_addFolderSave {
title => $filename, title => $filename,
menuTitle => $filename, menuTitle => $filename,
url => $base->getUrl.'/'.$filename, url => $base->getUrl.'/'.$filename,
groupIdEdit => $session->form->process('groupIdEdit') || $base->get('groupIdEdit'), groupIdEdit => $base->get('groupIdEdit'),
groupIdView => $session->form->process('groupIdView') || $base->get('groupIdView'), groupIdView => $base->get('groupIdView'),
ownerUserId => $session->user->userId, ownerUserId => $session->user->userId,
startDate => $base->get('startDate'), startDate => $base->get('startDate'),
endDate => $base->get('endDate'), endDate => $base->get('endDate'),
@ -410,6 +410,7 @@ sub www_addFolderSave {
className => 'WebGUI::Asset::Wobject::Folder', className => 'WebGUI::Asset::Wobject::Folder',
#filename => $filename, #filename => $filename,
}); });
WebGUI::VersionTag->autoCommitWorkingIfEnabled($session, { allowComments => 0 });
$session->http->setRedirect($base->getUrl('op=formHelper;class=HTMLArea;sub=imageTree')); $session->http->setRedirect($base->getUrl('op=formHelper;class=HTMLArea;sub=imageTree'));
return undef; return undef;
} }
@ -495,6 +496,7 @@ sub www_addImageSave {
$child->update({url => $child->fixUrl}); $child->update({url => $child->fixUrl});
$child->applyConstraints; $child->applyConstraints;
} }
WebGUI::VersionTag->autoCommitWorkingIfEnabled($session, { allowComments => 0 });
$session->http->setRedirect($base->getUrl('op=formHelper;class=HTMLArea;sub=imageTree')); $session->http->setRedirect($base->getUrl('op=formHelper;class=HTMLArea;sub=imageTree'));
return undef; return undef;
} }

View file

@ -265,7 +265,8 @@ The status of this item. The default is 'NotShipped'. Other statuses include: Ca
sub update { sub update {
my ($self, $newProperties) = @_; my ($self, $newProperties) = @_;
my $id = id $self; my $id = id $self;
my $session = $self->transaction->session; my $transaction = $self->transaction;
my $session = $transaction->session;
my $taxDriver = WebGUI::Shop::Tax->getDriver( $session ); my $taxDriver = WebGUI::Shop::Tax->getDriver( $session );
if (exists $newProperties->{item}) { if (exists $newProperties->{item}) {
@ -296,7 +297,7 @@ sub update {
$newProperties->{ taxConfiguration } = $newProperties->{ taxConfiguration } =
to_json( $taxDriver->getTransactionTaxData( $sku, $address ) || '{}' ); to_json( $taxDriver->getTransactionTaxData( $sku, $address ) || '{}' );
unless ($sku->isShippingRequired) { if (!$sku->isShippingRequired && $transaction->get('isSuccessful')) {
$newProperties->{orderStatus} = 'Shipped'; $newProperties->{orderStatus} = 'Shipped';
} }
} }
@ -310,7 +311,7 @@ sub update {
if (exists $newProperties->{options} && ref($newProperties->{options}) eq "HASH") { if (exists $newProperties->{options} && ref($newProperties->{options}) eq "HASH") {
$properties{$id}{options} = JSON->new->encode($newProperties->{options}); $properties{$id}{options} = JSON->new->encode($newProperties->{options});
} }
$properties{$id}{lastUpdated} = WebGUI::DateTime->new($self->transaction->session,time())->toDatabase; $properties{$id}{lastUpdated} = WebGUI::DateTime->new($session,time())->toDatabase;
$self->transaction->session->db->setRow("transactionItem","itemId",$properties{$id}); $self->transaction->session->db->setRow("transactionItem","itemId",$properties{$id});
} }

View file

@ -159,6 +159,7 @@ Factored out into a separate subroutine for the sake of testability.
sub getSql { sub getSql {
# Use a left outer join on userProfileData so that we still get back responses for users that have been deleted
return <<END_SQL; return <<END_SQL;
select select
r.Survey_responseId, r.username, r.userId, r.startDate, r.Survey_responseId, r.username, r.userId, r.startDate,
@ -166,7 +167,7 @@ select
s.timeLimit, s.doAfterTimeLimit, s.timeLimit, s.doAfterTimeLimit,
ad.title, ad.url ad.title, ad.url
from from
Survey_response r, Survey s, assetData ad, userProfileData upd Survey_response r left outer join userProfileData upd on r.userId = upd.userId, Survey s, assetData ad
where where
r.isComplete = 0 r.isComplete = 0
and s.timeLimit > 0 and s.timeLimit > 0
@ -175,7 +176,6 @@ where
and ad.assetId = s.assetId and ad.assetId = s.assetId
and ad.revisionDate = s.revisionDate and ad.revisionDate = s.revisionDate
and s.revisionDate = r.revisionDate and s.revisionDate = r.revisionDate
and upd.userId = r.userId
END_SQL END_SQL
} }

View file

@ -621,6 +621,12 @@ our $I18N = {
context => q|field label| context => q|field label|
}, },
'Status' => {
message => q|Status|,
lastUpdated => 0,
context => q|Whether a transaction was successful, or not.|
},
'payment method' => { 'payment method' => {
message => q|Payment Method|, message => q|Payment Method|,
lastUpdated => 0, lastUpdated => 0,
@ -1695,6 +1701,17 @@ our $I18N = {
context => q|commerce setting help| context => q|commerce setting help|
}, },
'Success' => {
message => q|Success|,
lastUpdated => 0,
context => q|commerce setting help|
},
'Failed' => {
message => q|Failure|,
lastUpdated => 0,
context => q|commerce setting help|
},
}; };

View file

@ -20,7 +20,7 @@ use Data::Dumper;
use WebGUI::Test; use WebGUI::Test;
use WebGUI::Session; use WebGUI::Session;
use Test::More tests => 21; # increment this value for each test you create use Test::More tests => 22; # increment this value for each test you create
use Test::Deep; use Test::Deep;
use WebGUI::Asset::Wobject::SyndicatedContent; use WebGUI::Asset::Wobject::SyndicatedContent;
use XML::FeedPP; use XML::FeedPP;
@ -162,9 +162,6 @@ $cache->set($rssContent, 60);
my $filteredFeed = $syndicated_content->generateFeed(); my $filteredFeed = $syndicated_content->generateFeed();
use Data::Dumper;
diag Dumper($filteredFeed->get_item());
cmp_deeply( cmp_deeply(
[ map { $_->title } $filteredFeed->get_item() ], [ map { $_->title } $filteredFeed->get_item() ],
[ [
@ -176,3 +173,34 @@ cmp_deeply(
); );
$cache->delete; $cache->delete;
####################################################################
#
# Odd feeds
#
####################################################################
##Feed with no links or pubDates.
my $oncpUrl = 'http://www.oncp.gob.ve/oncp.xml';
$syndicated_content->update({
rssUrl => $oncpUrl,
hasTerms => '',
maxHeadlines => 50,
});
my $cache = WebGUI::Cache->new($session, $oncpUrl, 'RSS');
open my $rssFile, '<', WebGUI::Test->getTestCollateralPath('oncp.xml')
or die "Unable to get RSS file: oncp.xml";
my $rssContent = do { local $/; <$rssFile>; };
close $rssFile;
$cache->set($rssContent, 60);
my $oddFeed1 = $syndicated_content->generateFeed();
my @oddItems = $oddFeed1->get_item();
is (@oddItems, 13, 'feed has items even without pubDates or links');
$cache->delete;

View file

@ -13,7 +13,7 @@ my $session = WebGUI::Test->session;
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Tests # Tests
plan tests => 25; plan tests => 26;
use_ok('WebGUI::Workflow::Activity::ExpireIncompleteSurveyResponses'); use_ok('WebGUI::Workflow::Activity::ExpireIncompleteSurveyResponses');
@ -127,6 +127,13 @@ $session->db->write('update Survey_response set endDate = 0, isComplete = 0 wher
# Make sure SQL only returns 1 incomplete response # Make sure SQL only returns 1 incomplete response
is( scalar $session->db->buildArray($SQL), 1, 'Make sure SQL only returns 1 incomplete response'); is( scalar $session->db->buildArray($SQL), 1, 'Make sure SQL only returns 1 incomplete response');
##
# Make sure workflow handles responses for deleted users
#
$session->db->write('update Survey_response set userId = ? where Survey_responseId = ?', ['not-a-user-id', $responseId]);
is( scalar $session->db->buildArray($SQL), 1, 'Still returns 1 row, even though user does not exist (sql left outer join)');
$session->db->write('update Survey_response set userId = ? where Survey_responseId = ?', [$user->getId, $responseId]);
## ##
# Delete Expired # Delete Expired
## ##

View file

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="iso-8859-1" ?>
<rss version="2.0"><channel>
<title><![CDATA[Oficina Nacional de Crédito Público]]></title>
<link>http://www.oncp.gob.ve</link>
<description>Información Financiera</description>
<language>es-ve</language>
<copyright>Oficina Nacional de Crédito Público - 2009</copyright>
<image>
<title>Oficina Nacional de Crédito Público</title>
<url>http://www.oncp.gob.ve/data/themes/digital//banner/oncp.png</url>
<link>http://www.oncp.gob.ve</link>
</image>
<item>
<title><![CDATA[Deuda Interna I Sem 09 / MM US$ 20.441]]></title>
<link>http://www.oncp.gob.ve</link>
<description><![CDATA[MM US$ 20.441]]></description>
<guid isPermaLink="true">http://www.oncp.gob.ve</guid>
</item>
<item>
<title><![CDATA[Deuda Externa I Sem 09 / MM US$ 29.894]]></title>
<link>http://www.oncp.gob.ve</link>
<description><![CDATA[MM US$ 29.894]]></description>
</item>
<item>
<title><![CDATA[Tasa Pasiva / 14,52%]]></title>
<link>http://www.oncp.gob.ve</link>
<description><![CDATA[14,52%]]></description>
</item>
<item>
<title><![CDATA[Tasa Activa / 19,56%]]></title>
<link>http://www.oncp.gob.ve</link>
<description><![CDATA[19,56%]]></description>
</item>
<item>
<title><![CDATA[Variación PIB II Trimestre / -2,4%]]></title>
<link>http://www.oncp.gob.ve</link>
<description><![CDATA[-2,4%]]></description>
</item>
<item>
<title><![CDATA[PIB II Trimestre 2009 / M BsF 13.979.77]]></title>
<link>http://www.oncp.gob.ve</link>
<description><![CDATA[M BsF 13.979.77]]></description>
</item>
<item>
<title><![CDATA[Unidad Tributaria / BsF. 55,00]]></title>
<link>http://www.oncp.gob.ve</link>
<description><![CDATA[BsF. 55,00]]></description>
</item>
<item>
<title><![CDATA[Cesta Venezolana / US$ 65,32]]></title>
<link>http://www.oncp.gob.ve</link>
<description><![CDATA[US$ 65,32]]></description>
</item>
<item>
<title><![CDATA[Cesta OPEP / US$ 67,92]]></title>
<link>http://www.oncp.gob.ve</link>
<description><![CDATA[US$ 67,92]]></description>
</item>
<item>
<title><![CDATA[Variación Acumuladaa / 15,6%]]></title>
<link>http://www.oncp.gob.ve</link>
<description><![CDATA[15,6%]]></description>
</item>
<item>
<title><![CDATA[IPC Variación Agosto 2009 / 2,2%]]></title>
<link>http://www.oncp.gob.ve</link>
<description><![CDATA[2,2%]]></description>
</item>
<item>
<title><![CDATA[Reservas Internacionales con BCV + FEM / MM US$ 33.213 (32.384 + 829)]]></title>
<link>http://www.oncp.gob.ve</link>
<description><![CDATA[MM US$ 33.213 (32.384 + 829)]]></description>
</item>
<item>
<title><![CDATA[Variación Acumulada / 15,6%]]></title>
<link>http://www.oncp.gob.ve</link>
<description><![CDATA[15,6%]]></description>
</item>
</channel>
</rss>