Merge commit 'v7.10.15' into 8
Conflicts: docs/gotcha.txt docs/previousVersion.sql docs/templates.txt lib/WebGUI.pm lib/WebGUI/Asset.pm lib/WebGUI/Asset/Event.pm lib/WebGUI/Asset/File.pm lib/WebGUI/Asset/MapPoint.pm lib/WebGUI/Asset/RichEdit.pm lib/WebGUI/Asset/Sku/Product.pm lib/WebGUI/Asset/Snippet.pm lib/WebGUI/Asset/Story.pm lib/WebGUI/Asset/Template.pm lib/WebGUI/Asset/Template/TemplateToolkit.pm lib/WebGUI/Asset/Wobject/Calendar.pm lib/WebGUI/Asset/Wobject/Carousel.pm lib/WebGUI/Asset/Wobject/Collaboration.pm lib/WebGUI/Asset/Wobject/Dashboard.pm lib/WebGUI/Asset/Wobject/DataForm.pm lib/WebGUI/Asset/Wobject/Folder.pm lib/WebGUI/Asset/Wobject/Map.pm lib/WebGUI/Asset/Wobject/Search.pm lib/WebGUI/Asset/Wobject/Shelf.pm lib/WebGUI/Asset/Wobject/StockData.pm lib/WebGUI/Asset/Wobject/StoryTopic.pm lib/WebGUI/Asset/Wobject/SyndicatedContent.pm lib/WebGUI/Asset/Wobject/Thingy.pm lib/WebGUI/Asset/Wobject/WeatherData.pm lib/WebGUI/AssetClipboard.pm lib/WebGUI/AssetCollateral/DataForm/Entry.pm lib/WebGUI/AssetExportHtml.pm lib/WebGUI/AssetLineage.pm lib/WebGUI/AssetMetaData.pm lib/WebGUI/AssetTrash.pm lib/WebGUI/AssetVersioning.pm lib/WebGUI/Auth.pm lib/WebGUI/Cache/CHI.pm lib/WebGUI/Content/AssetManager.pm lib/WebGUI/Fork/ProgressBar.pm lib/WebGUI/Form/JsonTable.pm lib/WebGUI/Form/TimeField.pm lib/WebGUI/Form/Zipcode.pm lib/WebGUI/Group.pm lib/WebGUI/International.pm lib/WebGUI/Macro/AssetProxy.pm lib/WebGUI/Macro/FileUrl.pm lib/WebGUI/Operation/SSO.pm lib/WebGUI/Operation/User.pm lib/WebGUI/Role/Asset/Subscribable.pm lib/WebGUI/Shop/Cart.pm lib/WebGUI/Shop/Transaction.pm lib/WebGUI/Shop/TransactionItem.pm lib/WebGUI/Test.pm lib/WebGUI/URL/Content.pm lib/WebGUI/URL/Uploads.pm lib/WebGUI/User.pm lib/WebGUI/Workflow/Activity/ExtendCalendarRecurrences.pm lib/WebGUI/Workflow/Activity/SendNewsletters.pm lib/WebGUI/i18n/English/Asset.pm lib/WebGUI/i18n/English/WebGUI.pm sbin/installClass.pl sbin/rebuildLineage.pl sbin/search.pl sbin/testEnvironment.pl t/Asset/Asset.t t/Asset/AssetClipboard.t t/Asset/AssetLineage.t t/Asset/AssetMetaData.t t/Asset/Event.t t/Asset/File.t t/Asset/File/Image.t t/Asset/Post/notification.t t/Asset/Sku.t t/Asset/Story.t t/Asset/Template.t t/Asset/Wobject/Collaboration/templateVariables.t t/Asset/Wobject/Collaboration/unarchiveAll.t t/Asset/Wobject/Shelf.t t/Auth.t t/Macro/EditableToggle.t t/Macro/FilePump.t t/Shop/Cart.t t/Shop/Transaction.t t/Storage.t t/User.t t/Workflow.t
This commit is contained in:
commit
277faae8a1
783 changed files with 32041 additions and 25495 deletions
|
|
@ -936,8 +936,10 @@ sub www_ajaxPrices {
|
|||
} || 0,
|
||||
|
||||
shipping => eval {
|
||||
die unless $shipping;
|
||||
$self->update({ shippingAddressId => $shipping });
|
||||
#die unless $shipping;
|
||||
if ( $shipping ) {
|
||||
$self->update({ shippingAddressId => $shipping });
|
||||
}
|
||||
my $ship = WebGUI::Shop::Ship->new($self->session);
|
||||
$ship->getOptions($self);
|
||||
} || [],
|
||||
|
|
@ -1234,7 +1236,13 @@ sub www_view {
|
|||
|
||||
my $billingAddressId = $self->billingAddressId;
|
||||
if ($billingAddressId) {
|
||||
$billingAddressOptions{'update_address'} = sprintf $i18n->get('Update %s'), $self->getBillingAddress->get('label');
|
||||
my $billingAddress = eval { $self->getBillingAddress };
|
||||
if ( defined $billingAddress ) {
|
||||
$billingAddressOptions{'update_address'} = sprintf $i18n->get('Update %s'), $billingAddress->get('label');
|
||||
}
|
||||
elsif (my $e = WebGUI::Error->caught("WebGUI::Error::ObjectNotFound") && $self->get('billingAddressId')) {
|
||||
$self->update({billingAddressId=>''});
|
||||
}
|
||||
}
|
||||
|
||||
%billingAddressOptions = (%billingAddressOptions, %addressOptions);
|
||||
|
|
@ -1250,7 +1258,10 @@ sub www_view {
|
|||
|
||||
my $shippingAddressId = $self->shippingAddressId;
|
||||
if ($shippingAddressId) {
|
||||
$shippingAddressOptions{'update_address'} = sprintf $i18n->get('Update %s'), $self->getShippingAddress->get('label');
|
||||
my $shippingAddress = eval { $self->getShippingAddress };
|
||||
if ( defined $shippingAddress ) {
|
||||
$shippingAddressOptions{'update_address'} = sprintf $i18n->get('Update %s'), $shippingAddress->get('label');
|
||||
}
|
||||
}
|
||||
%shippingAddressOptions = (%shippingAddressOptions, %addressOptions);
|
||||
|
||||
|
|
|
|||
|
|
@ -271,8 +271,9 @@ sub processPayment {
|
|||
at => $self->identityToken,
|
||||
);
|
||||
my $response = LWP::UserAgent->new->post($self->payPalUrl, \%form);
|
||||
my ($status, @lines) = split("\n", uri_unescape($response->content));
|
||||
my %params = map { split /=/ } @lines;
|
||||
my ($status, @lines) = split("\n", $response->content);
|
||||
my %params = map { split /=/ }
|
||||
map { uri_unescape($_) } @lines;
|
||||
|
||||
if ($status =~ /FAIL/) {
|
||||
my $message = '<table><tr><th>Field</th><th>Value</th></tr>';
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ Base class for all modules which do tax calculations in the Shop.
|
|||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use base WebGUI::Shop::TaxDriver;
|
||||
use base 'WebGUI::Shop::TaxDriver';
|
||||
|
||||
my $driver = WebGUI::Shop::TaxDriver->new($session);
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,11 @@ property shippingAddressName => (
|
|||
noFormPost => 1,
|
||||
default => '',
|
||||
);
|
||||
property shippingOrganization => (
|
||||
is => 'rw',
|
||||
noFormPost => 1,
|
||||
default => '',
|
||||
);
|
||||
property shippingAddress1 => (
|
||||
is => 'rw',
|
||||
noFormPost => 1,
|
||||
|
|
@ -122,6 +127,11 @@ property isRecurring => (
|
|||
noFormPost => 1,
|
||||
default => '',
|
||||
);
|
||||
property paymentOrganization => (
|
||||
is => 'rw',
|
||||
noFormPost => 1,
|
||||
default => '',
|
||||
);
|
||||
property paymentAddress1 => (
|
||||
is => 'rw',
|
||||
noFormPost => 1,
|
||||
|
|
@ -663,7 +673,9 @@ A hash reference with the address properties.
|
|||
|
||||
sub formatAddress {
|
||||
my ($self, $address) = @_;
|
||||
my $formatted = $address->{name} . "<br />" . $address->{address1} . "<br />";
|
||||
my $formatted = $address->{name} . "<br />";
|
||||
$formatted .= $address->{organization} . "<br />" if ($address->{organization} ne "");
|
||||
$formatted .= $address->{address1} . "<br />";
|
||||
$formatted .= $address->{address2} . "<br />" if ($address->{address2} ne "");
|
||||
$formatted .= $address->{address3} . "<br />" if ($address->{address3} ne "");
|
||||
$formatted .= $address->{city} . ", ";
|
||||
|
|
@ -797,6 +809,7 @@ sub getTransactionVars {
|
|||
shippingPrice => sprintf( "%.2f", $self->shippingPrice ),
|
||||
shippingAddress => $self->formatAddress( {
|
||||
name => $self->shippingAddressName,
|
||||
organization => $self->shippingOrganization,
|
||||
address1 => $self->shippingAddress1,
|
||||
address2 => $self->shippingAddress2,
|
||||
address3 => $self->shippingAddress3,
|
||||
|
|
@ -808,6 +821,7 @@ sub getTransactionVars {
|
|||
} ),
|
||||
paymentAddress => $self->formatAddress({
|
||||
name => $self->paymentAddressName,
|
||||
organization => $self->paymentOrganization,
|
||||
address1 => $self->paymentAddress1,
|
||||
address2 => $self->paymentAddress2,
|
||||
address3 => $self->paymentAddress3,
|
||||
|
|
@ -825,25 +839,31 @@ sub getTransactionVars {
|
|||
my $address = '';
|
||||
if ($self->shippingAddressId ne $item->get('shippingAddressId')) {
|
||||
$address = $self->formatAddress({
|
||||
name => $item->get('shippingAddressName'),
|
||||
address1 => $item->get('shippingAddress1'),
|
||||
address2 => $item->get('shippingAddress2'),
|
||||
address3 => $item->get('shippingAddress3'),
|
||||
city => $item->get('shippingCity'),
|
||||
state => $item->get('shippingState'),
|
||||
code => $item->get('shippingCode'),
|
||||
country => $item->get('shippingCountry'),
|
||||
phoneNumber => $item->get('shippingPhoneNumber'),
|
||||
name => $item->get('shippingAddressName'),
|
||||
organization => $self->get('shippingOrganization'),
|
||||
address1 => $item->get('shippingAddress1'),
|
||||
address2 => $item->get('shippingAddress2'),
|
||||
address3 => $item->get('shippingAddress3'),
|
||||
city => $item->get('shippingCity'),
|
||||
state => $item->get('shippingState'),
|
||||
code => $item->get('shippingCode'),
|
||||
country => $item->get('shippingCountry'),
|
||||
phoneNumber => $item->get('shippingPhoneNumber'),
|
||||
});
|
||||
}
|
||||
|
||||
# Post purchase actions
|
||||
my $actionsLoop = [];
|
||||
my $actions = $item->getSku->getPostPurchaseActions( $item );
|
||||
for my $label ( keys %{$actions} ) {
|
||||
push @{$actionsLoop}, {
|
||||
label => $label,
|
||||
url => $actions->{$label},
|
||||
my $sku = eval { $item->getSku };
|
||||
my $has_sku = 0;
|
||||
if (! WebGUI::Error->caught) {
|
||||
my $actions = $sku->getPostPurchaseActions( $item );
|
||||
$has_sku = 1;
|
||||
for my $label ( keys %{$actions} ) {
|
||||
push @{$actionsLoop}, {
|
||||
label => $label,
|
||||
url => $actions->{$label},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -861,7 +881,8 @@ sub getTransactionVars {
|
|||
%{$item->get},
|
||||
%taxVars,
|
||||
viewItemUrl => $url->page('shop=transaction;method=viewItem;transactionId='.$self->getId.';itemId='.$item->getId, 1),
|
||||
price => sprintf("%.2f", $item->get('price')),
|
||||
hasSku => $has_sku,
|
||||
price => sprintf( "%.2f", $item->get('price') ),
|
||||
pricePlusTax => sprintf( "%.2f", $price + $taxAmount ),
|
||||
extendedPrice => sprintf( "%.2f", $quantity * $price ),
|
||||
extendedPricePlusTax => sprintf( "%.2f", $quantity * ( $price + $taxAmount ) ),
|
||||
|
|
@ -1222,8 +1243,8 @@ Refunds a specific item from a transaction and then issues shop credit.
|
|||
sub www_refundItem {
|
||||
my ($class, $session) = @_;
|
||||
return $session->privilege->insufficient unless (WebGUI::Shop::Admin->new($session)->canManage);
|
||||
my $self = $class->new($session, $session->form->get("transactionId"));
|
||||
my $form = $session->form;
|
||||
my $self = $class->new($session, $form->get("transactionId"));
|
||||
my $item = eval { $self->getItem($form->get("itemId")) };
|
||||
if (WebGUI::Error->caught()) {
|
||||
$session->log->error("Can't get item ".$form->get("itemId"));
|
||||
|
|
@ -1327,15 +1348,16 @@ sub www_view {
|
|||
</tr>
|
||||
<tr>
|
||||
<th>}. $i18n->get("shipping address") .q{</th><td>}. $transaction->formatAddress({
|
||||
name => $transaction->get('shippingAddressName'),
|
||||
address1 => $transaction->get('shippingAddress1'),
|
||||
address2 => $transaction->get('shippingAddress2'),
|
||||
address3 => $transaction->get('shippingAddress3'),
|
||||
city => $transaction->get('shippingCity'),
|
||||
state => $transaction->get('shippingState'),
|
||||
code => $transaction->get('shippingCode'),
|
||||
country => $transaction->get('shippingCountry'),
|
||||
phoneNumber => $transaction->get('shippingPhoneNumber'),
|
||||
name => $transaction->get('shippingAddressName'),
|
||||
organization => $transaction->get('shippingOrganization'),
|
||||
address1 => $transaction->get('shippingAddress1'),
|
||||
address2 => $transaction->get('shippingAddress2'),
|
||||
address3 => $transaction->get('shippingAddress3'),
|
||||
city => $transaction->get('shippingCity'),
|
||||
state => $transaction->get('shippingState'),
|
||||
code => $transaction->get('shippingCode'),
|
||||
country => $transaction->get('shippingCountry'),
|
||||
phoneNumber => $transaction->get('shippingPhoneNumber'),
|
||||
}) .q{</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -1346,15 +1368,16 @@ sub www_view {
|
|||
</tr>
|
||||
<tr>
|
||||
<th>}. $i18n->get("payment address") .q{</th><td>}. $transaction->formatAddress({
|
||||
name => $transaction->get('paymentAddressName'),
|
||||
address1 => $transaction->get('paymentAddress1'),
|
||||
address2 => $transaction->get('paymentAddress2'),
|
||||
address3 => $transaction->get('paymentAddress3'),
|
||||
city => $transaction->get('paymentCity'),
|
||||
state => $transaction->get('paymentState'),
|
||||
code => $transaction->get('paymentCode'),
|
||||
country => $transaction->get('paymentCountry'),
|
||||
phoneNumber => $transaction->get('paymentPhoneNumber'),
|
||||
name => $transaction->get('paymentAddressName'),
|
||||
organization => $transaction->get('paymentOrganization'),
|
||||
address1 => $transaction->get('paymentAddress1'),
|
||||
address2 => $transaction->get('paymentAddress2'),
|
||||
address3 => $transaction->get('paymentAddress3'),
|
||||
city => $transaction->get('paymentCity'),
|
||||
state => $transaction->get('paymentState'),
|
||||
code => $transaction->get('paymentCode'),
|
||||
country => $transaction->get('paymentCountry'),
|
||||
phoneNumber => $transaction->get('paymentPhoneNumber'),
|
||||
}) .q{</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
@ -1379,6 +1402,8 @@ sub www_view {
|
|||
<tbody>
|
||||
};
|
||||
foreach my $item (@{$transaction->getItems}) {
|
||||
eval { $item->getSku; };
|
||||
my $sku_exists = !WebGUI::Error->caught;
|
||||
$output .= WebGUI::Form::formHeader($session)
|
||||
.WebGUI::Form::hidden($session, {name=>"shop",value=>"transaction"})
|
||||
.WebGUI::Form::hidden($session, {name=>"method",value=>"updateItem"})
|
||||
|
|
@ -1386,9 +1411,15 @@ sub www_view {
|
|||
.WebGUI::Form::hidden($session, {name=>"itemId",value=>$item->getId})
|
||||
.q{
|
||||
<tr>
|
||||
<td>}.$item->get('lastUpdated').q{</td>
|
||||
<td><a href="}.$url->page('shop=transaction;method=viewItem;transactionId='.$transaction->getId.';itemId='.$item->getId).q{">}.$item->get('configuredTitle').q{</a></td>
|
||||
<td>}.$transaction->formatCurrency($item->get('price')).q{</td>
|
||||
<td>}.$item->get('lastUpdated').qq{</td>\n}.
|
||||
(
|
||||
$sku_exists
|
||||
? q{<td><a href="}.$url->page('shop=transaction;method=viewItem;transactionId='.$transaction->getId
|
||||
. ';itemId='.$item->getId).q{">}.$item->get('configuredTitle').qq{</a></td>\n}
|
||||
: q{<td>}.$item->get('configuredTitle').q{<br />}.$i18n->get('item sku deleted').qq{</td>\n}
|
||||
|
||||
)
|
||||
. q{<td>}.$transaction->formatCurrency($item->get('price')).q{</td>
|
||||
<td>}.$item->get('quantity').q{</td>
|
||||
};
|
||||
if ($item->get('shippingAddressId') eq $transaction->get('shippingAddressId')) {
|
||||
|
|
@ -1397,15 +1428,16 @@ sub www_view {
|
|||
else {
|
||||
$output .= q{
|
||||
<td class="smallAddress">}. $transaction->formatAddress({
|
||||
name => $item->get('shippingAddressName'),
|
||||
address1 => $item->get('shippingAddress1'),
|
||||
address2 => $item->get('shippingAddress2'),
|
||||
address3 => $item->get('shippingAddress3'),
|
||||
city => $item->get('shippingCity'),
|
||||
state => $item->get('shippingState'),
|
||||
code => $item->get('shippingCode'),
|
||||
country => $item->get('shippingCountry'),
|
||||
phoneNumber => $item->get('shippingPhoneNumber'),
|
||||
name => $item->get('shippingAddressName'),
|
||||
organization => $item->get('shippingOrganization'),
|
||||
address1 => $item->get('shippingAddress1'),
|
||||
address2 => $item->get('shippingAddress2'),
|
||||
address3 => $item->get('shippingAddress3'),
|
||||
city => $item->get('shippingCity'),
|
||||
state => $item->get('shippingState'),
|
||||
code => $item->get('shippingCode'),
|
||||
country => $item->get('shippingCountry'),
|
||||
phoneNumber => $item->get('shippingPhoneNumber'),
|
||||
}) .q{</td>
|
||||
};
|
||||
}
|
||||
|
|
@ -1464,7 +1496,12 @@ sub www_viewItem {
|
|||
$session->log->error("Can't get item ".$session->form->get("itemId"));
|
||||
return $class->www_view($session);
|
||||
}
|
||||
return $item->getSku->www_view;
|
||||
my $sku = eval { $item->getSku };
|
||||
if (WebGUI::Error->caught()) {
|
||||
$session->errorHandler->error("Can't get sku for ".$session->form->get("itemId"));
|
||||
return $class->www_view($session);
|
||||
}
|
||||
return $sku->www_view;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -72,6 +72,11 @@ property shippingName => (
|
|||
noFormPost => 1,
|
||||
default => '',
|
||||
);
|
||||
property shippingOrganization => (
|
||||
is => 'rw',
|
||||
noFormPost => 1,
|
||||
default => '',
|
||||
);
|
||||
property shippingAddress1 => (
|
||||
is => 'rw',
|
||||
noFormPost => 1,
|
||||
|
|
@ -356,15 +361,20 @@ sub getSku {
|
|||
|
||||
=head2 issueCredit ( )
|
||||
|
||||
Returns the money from this item to the user in the form of in-store credit.
|
||||
Returns the money from this item to the user in the form of in-store credit. Items marked
|
||||
cancelled cannot be refunded.
|
||||
|
||||
=cut
|
||||
|
||||
sub issueCredit {
|
||||
my $self = shift;
|
||||
return if $self->orderStatus eq 'Cancelled';
|
||||
return unless $self->transaction->isSuccessful;
|
||||
my $credit = WebGUI::Shop::Credit->new($self->transaction->session, $self->transaction->userId);
|
||||
$credit->adjust(($self->price * $self->quantity), "Issued credit on sku ".$self->assetId." for transaction item ".$self->getId." on transaction ".$self->transaction->getId);
|
||||
$self->getSku->onRefund($self);
|
||||
if (my $sku = eval {$self->getSku}) {
|
||||
$sku->onRefund($self);
|
||||
}
|
||||
$self->update({orderStatus=>'Cancelled'});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue