Merge branch 'master' into WebGUI8
This commit is contained in:
commit
2400f19099
797 changed files with 33894 additions and 27196 deletions
|
|
@ -67,7 +67,7 @@ sub canView {
|
|||
my $uid = $self->uid;
|
||||
|
||||
return 1 if (($session->user->userId eq $uid || $uid eq "") && $session->user->profileField('ableToBeFriend'));
|
||||
|
||||
|
||||
my $user = WebGUI::User->new($session,$uid);
|
||||
return 0 if($user->isVisitor); #This should never happen but let's make sure
|
||||
return 0 unless ($user->profileField('ableToBeFriend')); #User doesn't have friends enabled
|
||||
|
|
@ -310,7 +310,7 @@ sub www_removeFriend {
|
|||
my $i18n = WebGUI::International->new($session,"Account_Friends");
|
||||
$errorMsg = $i18n->get("not a friend error");
|
||||
}
|
||||
|
||||
|
||||
if($errorMsg ne "") {
|
||||
my $backUrl = $self->getUrl("module=friends");
|
||||
return $self->showError($var,$errorMsg,$backUrl,$self->getErrorTemplateId);
|
||||
|
|
@ -352,7 +352,7 @@ sub www_removeFriendConfirm {
|
|||
elsif(!$friend->isFriend($friendId)){
|
||||
$errorMsg = $i18n->get("not a friend error");
|
||||
}
|
||||
|
||||
|
||||
if($errorMsg ne "") {
|
||||
my $backUrl = $self->getUrl("module=friends");
|
||||
return $self->showError($var,$errorMsg,$backUrl,$self->getErrorTemplateId);
|
||||
|
|
@ -401,7 +401,7 @@ sub www_sendFriendsRequest {
|
|||
#Overwrite these
|
||||
$var->{'user_full_name' } = $user->getWholeName;
|
||||
$var->{'user_member_since' } = $user->dateCreated;
|
||||
|
||||
|
||||
my $defaultComment = sprintf(
|
||||
$i18n->get('default friend comments'),
|
||||
$user->getFirstName,
|
||||
|
|
@ -419,12 +419,12 @@ sub www_sendFriendsRequest {
|
|||
value => $defaultComment,
|
||||
width => "600",
|
||||
});
|
||||
|
||||
|
||||
$var->{'form_header' } = WebGUI::Form::formHeader($session,{
|
||||
action => $self->getUrl("module=friends;do=sendFriendsRequestSave;uid=$uid"),
|
||||
extras => q{name="messageForm"}
|
||||
});
|
||||
|
||||
|
||||
$var->{'submit_button' } = WebGUI::Form::submit($session,{});
|
||||
$var->{'form_footer' } = WebGUI::Form::formFooter($session, {});
|
||||
|
||||
|
|
@ -487,7 +487,7 @@ sub www_view {
|
|||
my $user = $self->getUser;
|
||||
|
||||
$self->appendCommonVars($var);
|
||||
|
||||
|
||||
my $displayView = $uid ne "";
|
||||
$var->{'display_message'} = $msg;
|
||||
|
||||
|
|
@ -507,10 +507,13 @@ sub www_view {
|
|||
#Deal with rows per page
|
||||
my $rpp = $session->form->get("rpp") || 25;
|
||||
my $rpp_url = ";rpp=$rpp";
|
||||
|
||||
#Cache the base url
|
||||
my $friendsUrl = $self->getUrl("op=account;module=friends;do=view");
|
||||
|
||||
# Handle viewing someone else's friends
|
||||
my $uid_url = $session->user->userId eq $uid ? q{} : ";uid=$uid";
|
||||
|
||||
#Cache the base url
|
||||
my $friendsUrl = $self->getUrl("op=account;module=friends;do=view$uid_url");
|
||||
|
||||
#Note for anyone who attempts to sort this list by the user's whole name:
|
||||
#You can do this, but the only way to do it efficiently is to join
|
||||
#the users, userProfileData, and groupings table. This will break if the groups API
|
||||
|
|
@ -525,7 +528,7 @@ sub www_view {
|
|||
$rpp
|
||||
);
|
||||
$p->setDataByArrayRef(\@friendIds);
|
||||
|
||||
|
||||
#Export page to template
|
||||
my @friends = ();
|
||||
foreach my $friendId ( @{$p->getPageData} ) {
|
||||
|
|
@ -533,7 +536,7 @@ sub www_view {
|
|||
next if($friend->isVisitor);
|
||||
#If you have friends turned off you shouldn't show up when other people view your friends friends
|
||||
next if($displayView && !$friend->profileField('ableToBeFriend'));
|
||||
|
||||
|
||||
my $hash = {};
|
||||
# TODO Move this into a sub that can be more easily overridden
|
||||
$hash->{'friend_full_name' } = $friend->getWholeName;
|
||||
|
|
@ -564,7 +567,7 @@ sub www_view {
|
|||
push(@friends,$hash);
|
||||
}
|
||||
my $friendCount = $p->getRowCount;
|
||||
|
||||
|
||||
$var->{'friends_loop' } = \@friends;
|
||||
$var->{'has_friends' } = $friendCount > 0;
|
||||
$var->{'friends_total' } = $friendCount;
|
||||
|
|
|
|||
|
|
@ -337,7 +337,7 @@ sub getInboxNotificationTemplateId {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getInboxSMSNotificationTemplateId ( )
|
||||
=head2 getInboxSmsNotificationTemplateId ( )
|
||||
|
||||
This method returns the template ID for inbox SMS notifications.
|
||||
|
||||
|
|
@ -947,7 +947,8 @@ sub www_inviteUserSave {
|
|||
my $invitation = WebGUI::Mail::Send->create(
|
||||
$session, {
|
||||
to => $to,
|
||||
from => $email,
|
||||
from => $session->setting->get('companyEmail'),
|
||||
replyTo => $email,
|
||||
subject => $subject,
|
||||
}
|
||||
);
|
||||
|
|
@ -957,9 +958,9 @@ sub www_inviteUserSave {
|
|||
|
||||
my $emailBody = $self->processTemplate( $var, $self->getInviteUserMessageTemplateId );
|
||||
|
||||
$invitation->addText($emailBody);
|
||||
$invitation->addHtml($emailBody);
|
||||
|
||||
$invitation->send;
|
||||
$invitation->queue;
|
||||
|
||||
} ## end for my $inviteeEmail (@toList)
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use WebGUI::Exception;
|
|||
use WebGUI::International;
|
||||
use WebGUI::Pluggable;
|
||||
use WebGUI::Utility;
|
||||
use WebGUI::Shop::Vendor;
|
||||
use JSON qw{ from_json };
|
||||
|
||||
use base qw/WebGUI::Account/;
|
||||
|
|
@ -58,6 +59,10 @@ sub appendCommonVars {
|
|||
|
||||
$var->{ 'manage_tax_url' } = $self->getUrl( 'module=shop;do=manageTaxData' );
|
||||
$var->{ 'manageTaxIsActive' } = $method eq 'manageTaxData';
|
||||
|
||||
eval { WebGUI::Shop::Vendor->newByUserId($session, $session->user->userId); };
|
||||
$var->{ 'userIsVendor' } = ! Exception::Class->caught();
|
||||
$session->log->warn($@);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -253,36 +258,39 @@ Page that show your earnings if you are a vendor.
|
|||
sub www_viewSales {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $vendor = WebGUI::Shop::Vendor->newByUserId( $session, $session->user->userId );
|
||||
|
||||
my $var = $vendor->getPayoutTotals;
|
||||
my $totalSales = 0;
|
||||
my $vendor = eval { WebGUI::Shop::Vendor->newByUserId( $session, $session->user->userId ); };
|
||||
my @products;
|
||||
my $totalSales = 0;
|
||||
my $var = {};
|
||||
if (! Exception::Class->caught()) {
|
||||
|
||||
my $sth = $session->db->read(
|
||||
q{ SELECT t1.*, sum(t1.quantity) as quantity, sum(t1.vendorPayoutAmount) as payoutAmount }
|
||||
. q{ FROM transactionItem as t1, transaction as t2 }
|
||||
. q{ WHERE t1.transactionId=t2.transactionId AND t2.isSuccessful <> 0 }
|
||||
. q{ AND vendorId=? }
|
||||
. q{ group by assetId order by quantity desc },
|
||||
[ $vendor->getId ]
|
||||
);
|
||||
ROW: while (my $row = $sth->hashRef) {
|
||||
my $data = $row;
|
||||
$var = $vendor->getPayoutTotals;
|
||||
|
||||
# Add asset properties to tmpl_vars.
|
||||
my $asset = eval { WebGUI::Asset->newById( $session, $row->{ assetId } ); };
|
||||
if (Exception::Class->caught()) {
|
||||
$session->log->error('Unable to instanciate assetId '.$row->{ assetId }.": $@");
|
||||
next ROW;
|
||||
my $sth = $session->db->read(
|
||||
q{ SELECT t1.*, sum(t1.quantity) as quantity, sum(t1.vendorPayoutAmount) as payoutAmount }
|
||||
. q{ FROM transactionItem as t1, transaction as t2 }
|
||||
. q{ WHERE t1.transactionId=t2.transactionId AND t2.isSuccessful <> 0 }
|
||||
. q{ AND vendorId=? }
|
||||
. q{ group by assetId order by quantity desc },
|
||||
[ $vendor->getId ]
|
||||
);
|
||||
while (my $row = $sth->hashRef) {
|
||||
my $data = $row;
|
||||
|
||||
# Add asset properties to tmpl_vars.
|
||||
my $asset = eval { WebGUI::Asset->newById( $session, $row->{ assetId } ); };
|
||||
if (Exception::Class->caught()) {
|
||||
$session->log->error('Unable to instanciate assetId '.$row->{ assetId }.": $@");
|
||||
next;
|
||||
}
|
||||
$row = { %{ $row }, %{ $asset->get } } if $asset;
|
||||
|
||||
push @products, $row;
|
||||
|
||||
$totalSales += $row->{quantity};
|
||||
}
|
||||
$row = { %{ $row }, %{ $asset->get } } if $asset;
|
||||
|
||||
push @products, $row;
|
||||
|
||||
$totalSales += $row->{quantity};
|
||||
$sth->finish;
|
||||
}
|
||||
$sth->finish;
|
||||
|
||||
$var->{ product_loop } = \@products;
|
||||
$var->{ total_products } = scalar @products;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue