lots of operation and auth fixes.
This commit is contained in:
parent
1ab3df1f30
commit
150087f703
19 changed files with 71 additions and 68 deletions
|
|
@ -39,8 +39,8 @@ sub _submenu {
|
|||
#-------------------------------------------------------------------
|
||||
sub _clearCheckoutScratch {
|
||||
my $session = shift; use WebGUI; WebGUI::dumpSession($session);
|
||||
_clearShippingScratch();
|
||||
_clearPaymentScratch();
|
||||
_clearShippingScratch($session);
|
||||
_clearPaymentScratch($session);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -107,9 +107,9 @@ sub www_cancelTransaction {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_checkout {
|
||||
my $session = shift; use WebGUI; WebGUI::dumpSession($session);
|
||||
return WebGUI::Operation::execute($session,'selectShippingMethod') unless (_shippingSelected);
|
||||
return WebGUI::Operation::execute($session,'selectShippingMethod') unless (_shippingSelected($session));
|
||||
|
||||
return WebGUI::Operation::execute($session,'selectPaymentGateway') unless (_paymentSelected);
|
||||
return WebGUI::Operation::execute($session,'selectPaymentGateway') unless (_paymentSelected($session));
|
||||
|
||||
return WebGUI::Operation::execute($session,'checkoutConfirm');
|
||||
}
|
||||
|
|
@ -129,7 +129,7 @@ sub www_checkoutConfirm {
|
|||
}
|
||||
|
||||
# If no payment gateway has been selected yet, have the user do so now.
|
||||
return WebGUI::Operation::execute($session,'checkout') unless (_paymentSelected && _shippingSelected);
|
||||
return WebGUI::Operation::execute($session,'checkout') unless (_paymentSelected($session) && _shippingSelected($session));
|
||||
|
||||
$var{errorLoop} = [ map {{message => $_}} @{$errors} ] if $errors;
|
||||
|
||||
|
|
@ -210,7 +210,7 @@ sub www_checkoutSubmit {
|
|||
}
|
||||
|
||||
# Check if a valid payment gateway has bee selected. If not have the user do so.
|
||||
return WebGUI::Operation::execute($session,'checkout') unless (_paymentSelected && _shippingSelected);
|
||||
return WebGUI::Operation::execute($session,'checkout') unless (_paymentSelected($session) && _shippingSelected($session));
|
||||
|
||||
# Load shipping plugin.
|
||||
$shipping = WebGUI::Commerce::Shipping->load($session, $session->scratch->get('shippingMethod'));
|
||||
|
|
@ -315,7 +315,7 @@ sub www_checkoutSubmit {
|
|||
$param{statusExplanation} = $i18n->get('status codes information');
|
||||
$param{resultLoop} = \@resultLoop;
|
||||
|
||||
_clearCheckoutScratch;
|
||||
_clearCheckoutScratch($session);
|
||||
|
||||
# If everythings ok show the purchase history
|
||||
return WebGUI::Operation::execute($session,'viewPurchaseHistory') unless ($checkoutError);
|
||||
|
|
@ -505,7 +505,7 @@ sub www_editCommerceSettings {
|
|||
|
||||
$session->style->setScript($session->config->get("extrasURL").'/swapLayers.js',{type=>"text/javascript"});
|
||||
|
||||
return _submenu($tabform->print, 'edit commerce settings title', 'commerce manage');
|
||||
return _submenu($session,$tabform->print, 'edit commerce settings title', 'commerce manage');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -513,7 +513,7 @@ sub www_editCommerceSettingsSave {
|
|||
my $session = shift; use WebGUI; WebGUI::dumpSession($session);
|
||||
return $session->privilege->adminOnly() unless ($session->user->isInGroup(3));
|
||||
|
||||
foreach ($session->request->params) {
|
||||
foreach ($session->request->param) {
|
||||
# Store the plugin confiuration data in a special table for security and the general settings in the
|
||||
# normal settings table for easy access.
|
||||
if (/~([^~]*)~([^~]*)~([^~]*)/) {
|
||||
|
|
@ -524,7 +524,7 @@ sub www_editCommerceSettingsSave {
|
|||
fieldValue => $session->form->process($_)
|
||||
});
|
||||
} elsif ($_ ne 'op') {
|
||||
WebGUI::Setting::set($_,$session->form->process($_));
|
||||
$session->setting->set($_,$session->form->process($_));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -561,7 +561,7 @@ sub www_listPendingTransactions {
|
|||
$output .= '</table>';
|
||||
$output .= $p->getBarTraditional($session->form->process("pn"));
|
||||
|
||||
_submenu($output, 'list pending transactions', 'list pending transactions');
|
||||
_submenu($session,$output, 'list pending transactions', 'list pending transactions');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -657,7 +657,7 @@ sub www_listTransactions {
|
|||
}
|
||||
$output .= '</table>';
|
||||
|
||||
return _submenu($output, 'list transactions')
|
||||
return _submenu($session,$output, 'list transactions')
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -665,7 +665,7 @@ sub www_selectPaymentGateway {
|
|||
my $session = shift; use WebGUI; WebGUI::dumpSession($session);
|
||||
my ($plugins, $f, $i18n, @pluginLoop, %var);
|
||||
|
||||
_clearPaymentScratch;
|
||||
_clearPaymentScratch($session);
|
||||
|
||||
$i18n = WebGUI::International->new($session, 'Commerce');
|
||||
$plugins = WebGUI::Commerce::Payment->getEnabledPlugins($session);
|
||||
|
|
@ -710,7 +710,7 @@ sub www_selectShippingMethod {
|
|||
my $session = shift; use WebGUI; WebGUI::dumpSession($session);
|
||||
my ($plugins, $f, $i18n, @pluginLoop, %var);
|
||||
|
||||
_clearShippingScratch;
|
||||
_clearShippingScratch($session);
|
||||
|
||||
$i18n = WebGUI::International->new($session, 'Commerce');
|
||||
$plugins = WebGUI::Commerce::Shipping->getEnabledPlugins($session);
|
||||
|
|
@ -768,7 +768,7 @@ sub www_updateCart {
|
|||
my $session = shift; use WebGUI; WebGUI::dumpSession($session);
|
||||
my $shoppingCart = WebGUI::Commerce::ShoppingCart->new($session);
|
||||
|
||||
foreach my $formElement ($session->request->params) {
|
||||
foreach my $formElement ($session->request->param) {
|
||||
if ($formElement =~ m/^quantity~([^~]*)~([^~]*)$/) {
|
||||
$shoppingCart->setQuantity($2, $1, $session->form->process($formElement));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ use WebGUI::Operation::Shared;
|
|||
sub getRequiredProfileFields {
|
||||
my $session = shift; use WebGUI; WebGUI::dumpSession($session);
|
||||
my @array;
|
||||
foreach my $field (@{WebGUI::ProfileField->getRequiredFields}) {
|
||||
foreach my $field (@{WebGUI::ProfileField->new($session,'dummy')->getRequiredFields}) {
|
||||
push(@array, {
|
||||
'profile.formElement' => $field->formField,
|
||||
'profile.formElement.label' => $field->getLabel
|
||||
|
|
@ -75,7 +75,7 @@ sub validateProfileData {
|
|||
my $error = "";
|
||||
my $warning = "";
|
||||
my $i18n = WebGUI::International->new($session);
|
||||
foreach my $field (@{WebGUI::ProfileField->getEditableFields}) {
|
||||
foreach my $field (@{WebGUI::ProfileField->new($session,'dummy')->getEditableFields}) {
|
||||
my $fieldValue = $field->formProcess;
|
||||
if (ref $fieldValue eq "ARRAY") {
|
||||
$data{$field->getId} = $$fieldValue[0];
|
||||
|
|
@ -84,7 +84,7 @@ sub validateProfileData {
|
|||
}
|
||||
if ($field->isRequired && !$data{$field->getId}) {
|
||||
$error .= '<li>'.$field->getLabel.' '.$i18n->get(451).'</li>';
|
||||
} elsif ($field->getId eq "email" && isDuplicateEmail($data{$field->getId})) {
|
||||
} elsif ($field->getId eq "email" && isDuplicateEmail($session,$data{$field->getId})) {
|
||||
$warning .= '<li>'.$i18n->get(1072).'</li>';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -300,10 +300,10 @@ sub www_saveSettings {
|
|||
next;
|
||||
}
|
||||
unless ($key eq "op") {
|
||||
WebGUI::Setting::set($key,$value);
|
||||
$session->setting->set($key,$value);
|
||||
}
|
||||
}
|
||||
return www_editSettings();
|
||||
return www_editSettings($session);
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ sub www_viewStatistics {
|
|||
($data) = $session->db->quickArray("select count(*) from groups");
|
||||
$output .= '<tr><td align="right" class="tableHeader">'.$i18n->get(89).':</td><td class="tableData">'.$data.'</td></tr>';
|
||||
$output .= '</table>';
|
||||
return _submenu($output);
|
||||
return _submenu($session,$output);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -407,7 +407,7 @@ sub www_editUserSave {
|
|||
my $authInstance = WebGUI::Operation::Auth::getInstance($_,$u->userId);
|
||||
$authInstance->editUserFormSave;
|
||||
}
|
||||
foreach my $field (@{WebGUI::ProfileField->getFields}) {
|
||||
foreach my $field (@{WebGUI::ProfileField->new($session,'dummy')->getFields}) {
|
||||
next if $field->getId =~ /contentPositions/;
|
||||
$u->profileField($field->getId,$field->formProcess);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue