un-b0rk3d the commerce system

This commit is contained in:
Roy Johnson 2006-03-19 23:51:06 +00:00
parent 0ee2d2ad66
commit 84d43b8d19
4 changed files with 10 additions and 9 deletions

View file

@ -128,7 +128,7 @@ sub checkoutForm {
$i18n = WebGUI::International->new($self->session, 'CommercePaymentITransact'); $i18n = WebGUI::International->new($self->session, 'CommercePaymentITransact');
$u = WebGUI::User->new($self->session->user->userId); $u = WebGUI::User->new($self->session,$self->session->user->userId);
$f = WebGUI::HTMLForm->new($self->session); $f = WebGUI::HTMLForm->new($self->session);
$f->text( $f->text(
@ -622,7 +622,7 @@ sub normalTransaction {
$self->{_recurring} = 0; $self->{_recurring} = 0;
$self->{_transactionParams} = { $self->{_transactionParams} = {
AMT => sprintf('%.2f', $normal->{amount}), AMT => sprintf('%.2f', $normal->{amount}),
DESCRIPTION => WebGUI::URL::escape($normal->{description}) || $i18n->get('no description'), DESCRIPTION => $self->session->url->escape($normal->{description}) || $i18n->get('no description'),
INVOICENUMBER => $normal->{invoiceNumber}, INVOICENUMBER => $normal->{invoiceNumber},
ORGID => $normal->{id}, ORGID => $normal->{id},
}; };
@ -650,7 +650,7 @@ sub recurringTransaction {
INITIALAMT => sprintf('%.2f', $initialAmount), INITIALAMT => sprintf('%.2f', $initialAmount),
TERM => $recurring->{term} || 9999, TERM => $recurring->{term} || 9999,
RECIPE => _resolveRecipe($recurring->{payPeriod}), RECIPE => _resolveRecipe($recurring->{payPeriod}),
DESCRIPTION => WebGUI::URL::escape($recurring->{description}) || $i18n->get('no description'), DESCRIPTION => $self->session->url->escape($recurring->{description}) || $i18n->get('no description'),
INVOICENUMBER => $recurring->{invoiceNumber}, INVOICENUMBER => $recurring->{invoiceNumber},
ORGID => $recurring->{id}, ORGID => $recurring->{id},
}; };

View file

@ -476,7 +476,7 @@ Returns the cached, local session variable.
=cut =cut
sub session { sub session {
my ($self) = @_; my $self = shift;
return $self->{_session}; return $self->{_session};
} }

View file

@ -383,8 +383,9 @@ sub www_checkoutSubmit {
# Write transaction to the log with status pending # Write transaction to the log with status pending
$transaction = WebGUI::Commerce::Transaction->new($session, 'new'); $transaction = WebGUI::Commerce::Transaction->new($session, 'new');
foreach (@{$currentPurchase->{items}}) { foreach (@{$currentPurchase->{items}}) {
$transaction->addItem($_->{item}, $_->{quantity}); $transaction->addItem($_->{item}, $_->{quantity});
$amount += ($_->{item}->price * $_->{quantity}); $amount += ($_->{item}->price * $_->{quantity});
$var->{purchaseDescription} .= $_->{quantity}.' x '.$_->{item}->name.'<br />'; $var->{purchaseDescription} .= $_->{quantity}.' x '.$_->{item}->name.'<br />';
} }
@ -451,10 +452,10 @@ sub www_checkoutSubmit {
_clearCheckoutScratch($session); _clearCheckoutScratch($session);
# If everythings ok show the purchase history # If everythings ok show the purchase history
return WebGUI::Operation::execute($session,'viewPurchaseHistory') unless ($checkoutError); return WebGUI::Operation::TransactionLog::www_viewPurchaseHistory($session) unless ($checkoutError);
# If an error has occurred show the template errorlog # If an error has occurred show the template errorlog
return $session->style->userStyle(WebGUI::Asset::Template->new($session,$session->setting->get("commerceTransactionErrorTemplateId"))->process(\%param)); return $session->style->userStyle(WebGUI::Asset->newByDynamicClass($session,$session->setting->get("commerceTransactionErrorTemplateId"))->process(\%param));
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -34,7 +34,7 @@ sub www_viewPurchaseHistory {
$var{errorMessage} = shift; $var{errorMessage} = shift;
@history = @{WebGUI::Commerce::Transaction->transactionsByUser($session->user->userId)}; @history = @{WebGUI::Commerce::Transaction->new($session)->transactionsByUser($session->user->userId)};
foreach (@history) { foreach (@history) {
%properties = %{$_->get}; %properties = %{$_->get};
$properties{initDate} = $session->datetime->epochToHuman($properties{initDate}); $properties{initDate} = $session->datetime->epochToHuman($properties{initDate});