Merge branch 'master' of github.com:plainblack/webgui
This commit is contained in:
commit
a2264ab799
12 changed files with 190 additions and 25 deletions
|
|
@ -133,7 +133,7 @@ sub generateFeed {
|
|||
my $limit = shift || $self->get('maxHeadlines');
|
||||
my $feed = XML::FeedPP::Atom->new();
|
||||
my $log = $self->session->log;
|
||||
|
||||
|
||||
# build one feed out of many
|
||||
my $newlyCached = 0;
|
||||
foreach my $url (split(/\s+/, $self->get('rssUrl'))) {
|
||||
|
|
@ -154,35 +154,45 @@ sub generateFeed {
|
|||
utf8::downgrade($value, 1);
|
||||
eval {
|
||||
my $singleFeed = XML::FeedPP->new($value, utf8_flag => 1, -type => 'string');
|
||||
$feed->merge($singleFeed);
|
||||
$feed->merge_channel($singleFeed);
|
||||
$feed->merge_item($singleFeed);
|
||||
};
|
||||
if ($@) {
|
||||
$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
|
||||
if ($self->get('hasTerms') ne '') {
|
||||
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 @items = $feed->match_item(title => qr/$termRegex/msi);
|
||||
push @items, $feed->match_item(description => qr/$termRegex/msi);
|
||||
$feed->clear_item;
|
||||
$feed->uniq_item;
|
||||
foreach my $item (@items) {
|
||||
$feed->add_item($item);
|
||||
}
|
||||
$feed->clear_item;
|
||||
ITEM: foreach my $item (@items) {
|
||||
$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
|
||||
$feed->normalize();
|
||||
|
||||
$feed->sort_item();
|
||||
|
||||
# limit the feed to the maximum number of headlines (or the feed generator limit).
|
||||
$feed->limit_item($limit);
|
||||
|
||||
|
||||
# mark this asset as updated
|
||||
$self->update({}) if ($newlyCached);
|
||||
|
||||
|
||||
return $feed;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -386,8 +386,8 @@ sub www_addFolderSave {
|
|||
title => $filename,
|
||||
menuTitle => $filename,
|
||||
url => $base->getUrl.'/'.$filename,
|
||||
groupIdEdit => $session->form->process('groupIdEdit') || $base->get('groupIdEdit'),
|
||||
groupIdView => $session->form->process('groupIdView') || $base->get('groupIdView'),
|
||||
groupIdEdit => $base->get('groupIdEdit'),
|
||||
groupIdView => $base->get('groupIdView'),
|
||||
ownerUserId => $session->user->userId,
|
||||
startDate => $base->get('startDate'),
|
||||
endDate => $base->get('endDate'),
|
||||
|
|
@ -410,6 +410,7 @@ sub www_addFolderSave {
|
|||
className => 'WebGUI::Asset::Wobject::Folder',
|
||||
#filename => $filename,
|
||||
});
|
||||
WebGUI::VersionTag->autoCommitWorkingIfEnabled($session, { allowComments => 0 });
|
||||
$session->http->setRedirect($base->getUrl('op=formHelper;class=HTMLArea;sub=imageTree'));
|
||||
return undef;
|
||||
}
|
||||
|
|
@ -495,6 +496,7 @@ sub www_addImageSave {
|
|||
$child->update({url => $child->fixUrl});
|
||||
$child->applyConstraints;
|
||||
}
|
||||
WebGUI::VersionTag->autoCommitWorkingIfEnabled($session, { allowComments => 0 });
|
||||
$session->http->setRedirect($base->getUrl('op=formHelper;class=HTMLArea;sub=imageTree'));
|
||||
return undef;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -265,7 +265,8 @@ The status of this item. The default is 'NotShipped'. Other statuses include: Ca
|
|||
sub update {
|
||||
my ($self, $newProperties) = @_;
|
||||
my $id = id $self;
|
||||
my $session = $self->transaction->session;
|
||||
my $transaction = $self->transaction;
|
||||
my $session = $transaction->session;
|
||||
my $taxDriver = WebGUI::Shop::Tax->getDriver( $session );
|
||||
|
||||
if (exists $newProperties->{item}) {
|
||||
|
|
@ -296,7 +297,7 @@ sub update {
|
|||
$newProperties->{ taxConfiguration } =
|
||||
to_json( $taxDriver->getTransactionTaxData( $sku, $address ) || '{}' );
|
||||
|
||||
unless ($sku->isShippingRequired) {
|
||||
if (!$sku->isShippingRequired && $transaction->get('isSuccessful')) {
|
||||
$newProperties->{orderStatus} = 'Shipped';
|
||||
}
|
||||
}
|
||||
|
|
@ -310,7 +311,7 @@ sub update {
|
|||
if (exists $newProperties->{options} && ref($newProperties->{options}) eq "HASH") {
|
||||
$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});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -159,6 +159,7 @@ Factored out into a separate subroutine for the sake of testability.
|
|||
|
||||
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;
|
||||
select
|
||||
r.Survey_responseId, r.username, r.userId, r.startDate,
|
||||
|
|
@ -166,7 +167,7 @@ select
|
|||
s.timeLimit, s.doAfterTimeLimit,
|
||||
ad.title, ad.url
|
||||
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
|
||||
r.isComplete = 0
|
||||
and s.timeLimit > 0
|
||||
|
|
@ -175,7 +176,6 @@ where
|
|||
and ad.assetId = s.assetId
|
||||
and ad.revisionDate = s.revisionDate
|
||||
and s.revisionDate = r.revisionDate
|
||||
and upd.userId = r.userId
|
||||
END_SQL
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -621,6 +621,12 @@ our $I18N = {
|
|||
context => q|field label|
|
||||
},
|
||||
|
||||
'Status' => {
|
||||
message => q|Status|,
|
||||
lastUpdated => 0,
|
||||
context => q|Whether a transaction was successful, or not.|
|
||||
},
|
||||
|
||||
'payment method' => {
|
||||
message => q|Payment Method|,
|
||||
lastUpdated => 0,
|
||||
|
|
@ -1695,6 +1701,17 @@ our $I18N = {
|
|||
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|
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue