all loop iterators have to be declared lexical. PBP/108
This commit is contained in:
parent
52132e61f4
commit
08fbd46d28
8 changed files with 31 additions and 34 deletions
|
|
@ -772,13 +772,13 @@ resides.
|
|||
=cut
|
||||
|
||||
sub _getDatabaseInfo {
|
||||
my (@tables, $tableName, $sth, $columnDefinition, $currentColumn, $databaseDefinition);
|
||||
my (@tables, $sth, $columnDefinition, $currentColumn, $databaseDefinition);
|
||||
my $self = shift;
|
||||
|
||||
my $dbLink = $self->_getDbLink;
|
||||
@tables = $dbLink->db->buildArray("show tables");
|
||||
|
||||
foreach $tableName (@tables) {
|
||||
foreach my $tableName (@tables) {
|
||||
$sth = $dbLink->db->read("describe ".$tableName);
|
||||
|
||||
while ($columnDefinition = $sth->hashRef) {
|
||||
|
|
@ -1940,7 +1940,7 @@ Processes and stores the field properties, and will alter the table according to
|
|||
=cut
|
||||
|
||||
sub www_editFieldSave {
|
||||
my ($databaseDef, $key, $joinNumber, @tables, $processed, $tableName,
|
||||
my ($databaseDef, $joinNumber, @tables, $processed, $tableName,
|
||||
$joinAColumnName, $joinATableName, $joinBColumnName, $joinBTableName,
|
||||
@joinConstraints, @differenceConstraints, $maxAllowedLength, $fieldId,
|
||||
@error, $properties, $i18n);
|
||||
|
|
@ -2028,7 +2028,7 @@ my @columnConstraints;
|
|||
my %fingerprint;
|
||||
my $dbLink = $self->_getDbLink;
|
||||
|
||||
foreach $key (sort(keys(%{$self->session->form->paramsHashRef}))) {
|
||||
foreach my $key (sort(keys(%{$self->session->form->paramsHashRef}))) {
|
||||
if ($key =~ m/^database(\d+)/ && $self->session->form->process($key)) {
|
||||
$joinNumber = $1;
|
||||
my $databaseName = $self->session->form->process("database$joinNumber");
|
||||
|
|
@ -3332,7 +3332,6 @@ revision number in form param 'rev'; otherwise the latest revision is used.
|
|||
=cut
|
||||
|
||||
sub www_viewFile {
|
||||
my ($field, $revision);
|
||||
my $self = shift;
|
||||
|
||||
return $self->session->privilege->insufficient() unless ($self->canView);
|
||||
|
|
@ -3341,7 +3340,7 @@ sub www_viewFile {
|
|||
my $recordId = $self->session->form->process('rid');
|
||||
my $revision = $self->session->form->process('rev');
|
||||
|
||||
$field = $self->_getFieldProperties($fieldId);
|
||||
my $field = $self->_getFieldProperties($fieldId);
|
||||
|
||||
if ($field->{formFieldType} eq 'file') {
|
||||
my ($mimeType, $data) = $self->_getFileFromDatabase($recordId, $field->{fieldName}, $revision);
|
||||
|
|
@ -3364,7 +3363,6 @@ This particular caching scheme is used in stead of storage, since privileges sho
|
|||
=cut
|
||||
|
||||
sub www_viewThumbnail {
|
||||
my ($field, $revision, $thumbnailData);
|
||||
my $self = shift;
|
||||
|
||||
return $self->session->privilege->insufficient() unless ($self->canView);
|
||||
|
|
@ -3372,12 +3370,12 @@ sub www_viewThumbnail {
|
|||
my $fieldId = $self->session->form->process('fid');
|
||||
my $recordId = $self->session->form->process('rid');
|
||||
my $revision = $self->session->form->process('rev');
|
||||
$field = $self->_getFieldProperties($self->session->form->process("fid"));
|
||||
my $field = $self->_getFieldProperties($self->session->form->process("fid"));
|
||||
|
||||
if ($field->{formFieldType} eq 'file') {
|
||||
my $cache = WebGUI::Cache->new($self->session, ["sqlform",$recordId,$fieldId,$revision], 24*60*60);
|
||||
|
||||
$thumbnailData = $cache->get;
|
||||
my $thumbnailData = $cache->get;
|
||||
|
||||
unless ($thumbnailData) {
|
||||
my ($mimeType, $data) = $self->_getFileFromDatabase($recordId, $field->{fieldName}, $revision);
|
||||
|
|
@ -3923,7 +3921,7 @@ my %sortWeights = (
|
|||
);
|
||||
|
||||
sub _constructSearchQuery {
|
||||
my (@tables, @joinConstraints, $tableCounter, @constraints, $currentField, $conditional, @joinSequence);
|
||||
my (@tables, @joinConstraints, $tableCounter, @constraints, $conditional, @joinSequence);
|
||||
my $self = shift;
|
||||
my $searchInFields = shift;
|
||||
my $showFields = shift;
|
||||
|
|
@ -3946,7 +3944,7 @@ sub _constructSearchQuery {
|
|||
$tableCounter = 2;
|
||||
|
||||
# Process search fields.
|
||||
foreach $currentField (@$searchInFields) {
|
||||
foreach my $currentField (@$searchInFields) {
|
||||
# Set conditional given for this field or to like or regexp mode if in normal search
|
||||
my $searchMode = $self->session->form->process("searchMode") || $self->session->scratch->get('SQLForm_'.$self->getId.'searchMode');
|
||||
if ($searchMode) {
|
||||
|
|
|
|||
|
|
@ -398,7 +398,7 @@ Draws the pie chart.
|
|||
=cut
|
||||
|
||||
sub draw {
|
||||
my ($currentSlice, $coordinates, $sliceData, $leftPlaneVisible, $rightPlaneVisible);
|
||||
my ($currentSlice, $coordinates, $leftPlaneVisible, $rightPlaneVisible);
|
||||
my $self = shift;
|
||||
|
||||
$self->processDataset;
|
||||
|
|
@ -407,7 +407,7 @@ sub draw {
|
|||
my @slices = sort sortSlices @{$self->{_slices}};
|
||||
|
||||
# First draw the bottom planes and the labels behind the chart.
|
||||
foreach $sliceData (@slices) {
|
||||
foreach my $sliceData (@slices) {
|
||||
# Draw bottom
|
||||
$self->drawBottom($sliceData);
|
||||
|
||||
|
|
@ -419,7 +419,7 @@ sub draw {
|
|||
# Second draw the sides
|
||||
# If angle == 0 do a 2d pie
|
||||
if ($self->getTiltAngle != 0) {
|
||||
foreach $sliceData (@slices) { #(sort sortSlices @{$self->{_slices}}) {
|
||||
foreach my $sliceData (@slices) { #(sort sortSlices @{$self->{_slices}}) {
|
||||
$leftPlaneVisible = (_mod2pi($sliceData->{startAngle}) <= 0.5*pi || _mod2pi($sliceData->{startAngle} >= 1.5*pi));
|
||||
$rightPlaneVisible = (_mod2pi($sliceData->{stopAngle}) >= 0.5*pi && _mod2pi($sliceData->{stopAngle} <= 1.5*pi));
|
||||
|
||||
|
|
@ -446,7 +446,7 @@ sub draw {
|
|||
}
|
||||
|
||||
# Finally draw the top planes of each slice and the labels that are in front of the chart.
|
||||
foreach $sliceData (@slices) {
|
||||
foreach my $sliceData (@slices) {
|
||||
$self->drawTop($sliceData) if ($self->getTiltAngle != 0);
|
||||
|
||||
if (_mod2pi($sliceData->{avgAngle}) > pi) {
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ Draws all the bars.
|
|||
=cut
|
||||
|
||||
sub drawGraph {
|
||||
my ($currentBar, %location);
|
||||
my %location;
|
||||
my $self = shift;
|
||||
|
||||
$self->processDataSet;
|
||||
|
|
@ -137,7 +137,7 @@ sub drawGraph {
|
|||
|
||||
$location{x} = $self->getChartOffset->{x} ;
|
||||
$location{y} = $self->getChartOffset->{y} + $self->getChartHeight;
|
||||
foreach $currentBar (@{$self->{_bars}}) {
|
||||
foreach my $currentBar (@{$self->{_bars}}) {
|
||||
if ($self->getDrawMode eq 'stacked') {
|
||||
$self->drawStackedBar($currentBar, \%location, $barWidth);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -404,7 +404,7 @@ C<viewPurchaseHistory> operation.
|
|||
sub www_checkoutSubmit {
|
||||
my $session = shift;
|
||||
my ($plugin, $shoppingCart, $transaction, $var, $amount, @cartItems, $i18n, @transactions,
|
||||
@normal, $currentPurchase, $checkoutError, @resultLoop, %param, $normal, $recurring,
|
||||
@normal, $checkoutError, @resultLoop, %param, $normal, $recurring,
|
||||
$formError, $shipping, $shippingCost, $shippingDescription);
|
||||
|
||||
$i18n = WebGUI::International->new($session, 'Commerce');
|
||||
|
|
@ -449,7 +449,7 @@ sub www_checkoutSubmit {
|
|||
map {push(@transactions, {recurring => 1, items => [$_]})} @$recurring;
|
||||
push(@transactions, {recurring => 0, items => [@$normal]}) if (@$normal);
|
||||
|
||||
foreach $currentPurchase (@transactions) {
|
||||
foreach my $currentPurchase (@transactions) {
|
||||
$amount = 0;
|
||||
$var = {};
|
||||
|
||||
|
|
@ -634,7 +634,7 @@ Calls C<www_editCommerceSettingsSave> on form submission.
|
|||
|
||||
sub www_editCommerceSettings {
|
||||
my $session = shift;
|
||||
my (%tabs, $tabform, $currentPlugin, $ac, $jscript, $i18n,
|
||||
my (%tabs, $tabform, $ac, $jscript, $i18n,
|
||||
$paymentPlugin, @paymentPlugins, %paymentPlugins, @failedPaymentPlugins, $plugin,
|
||||
$shippingPlugin, @shippingPlugins, %shippingPlugins, @failedShippingPlugins);
|
||||
return $session->privilege->adminOnly unless canView($session);
|
||||
|
|
@ -741,7 +741,7 @@ sub www_editCommerceSettings {
|
|||
-extras => 'onchange="activePayment=operateHidden(this.options[this.selectedIndex].value,activePayment)"'
|
||||
);
|
||||
|
||||
foreach $currentPlugin (@paymentPlugins) {
|
||||
foreach my $currentPlugin (@paymentPlugins) {
|
||||
my $style = '" style="display: none;' unless ($currentPlugin->namespace eq $paymentPlugin);
|
||||
$tabform->getTab('payment')->raw('<tr id="'.$currentPlugin->namespace.$style.'"><td colspan="2" width="100%">'.
|
||||
'<table border="0" cellspacing="0" cellpadding="0" width="100%">'.
|
||||
|
|
@ -780,7 +780,7 @@ sub www_editCommerceSettings {
|
|||
-extras => 'onchange="activeShipping=operateHidden(this.options[this.selectedIndex].value,activeShipping)"'
|
||||
);
|
||||
|
||||
foreach $currentPlugin (@shippingPlugins) {
|
||||
foreach my $currentPlugin (@shippingPlugins) {
|
||||
my $style = '" style="display: none;' unless ($currentPlugin->namespace eq $shippingPlugin);
|
||||
$tabform->getTab('shipping')->raw('<tr id="'.$currentPlugin->namespace.$style.'"><td colspan="2" width="100%">'.
|
||||
'<table border="0" cellspacing="0" cellpadding="0" width="100%">'.
|
||||
|
|
@ -897,7 +897,7 @@ The screen is not templated.
|
|||
|
||||
sub www_listTransactions {
|
||||
my $session = shift;
|
||||
my ($output, %criteria, $transaction, @transactions);
|
||||
my ($output, %criteria, @transactions);
|
||||
|
||||
return $session->privilege->insufficient unless canView($session);
|
||||
|
||||
|
|
@ -968,7 +968,7 @@ sub www_listTransactions {
|
|||
'<th>'. $i18n->get('shipping cost'). '</th>'.
|
||||
'<th>'. $i18n->get('status'). '</th>'.
|
||||
'<th>'. $i18n->get('shipping status'). '</th></tr>';
|
||||
foreach $transaction (@transactions) {
|
||||
foreach my $transaction (@transactions) {
|
||||
$output .= '<tr bgcolor="#ddd">';
|
||||
$output .= '<td>'.$session->icon->delete('op=deleteTransaction;tid='.$transaction->get('transactionId')).'</td>';
|
||||
my $userId = $transaction->get('userId');
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ sub www_editFontSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editPalette {
|
||||
my ($name, $palette, $output, $color);
|
||||
my ($name, $palette, $output);
|
||||
my $session = shift;
|
||||
my $paletteId = shift || $session->form->process('pid');
|
||||
|
||||
|
|
@ -324,7 +324,7 @@ sub www_editPalette {
|
|||
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><th></th><th>'.$i18n->get('fill color').'</th><th>'.$i18n->get('stroke color').'</th></tr>';
|
||||
foreach $color (@{$palette->getColorsInPalette}) {
|
||||
foreach my $color (@{$palette->getColorsInPalette}) {
|
||||
$output .= '<tr>';
|
||||
$output .= '<td>';
|
||||
$output .= $session->icon->delete('op=removeColorFromPalette;pid='.$palette->getId.';index='.$palette->getColorIndex($color));
|
||||
|
|
|
|||
|
|
@ -852,7 +852,7 @@ The current WebGUI session object.
|
|||
|
||||
sub www_manageProduct {
|
||||
my $session = shift;
|
||||
my ($product, $output, $parameter, $option, $optionId, $i18n);
|
||||
my ($product, $output, $option, $i18n);
|
||||
|
||||
return $session->privilege->insufficient unless canView($session);
|
||||
|
||||
|
|
@ -882,14 +882,14 @@ sub www_manageProduct {
|
|||
$output .= "<h2>Parameters</h2>";
|
||||
$output .= '<a href="'.$session->url->page('op=editProductParameter;parameterId=new;productId='.$product->get('productId')).'">'.
|
||||
$i18n->get('add parameter').'</a><br />';
|
||||
foreach $parameter (@{$product->getParameter}) {
|
||||
foreach my $parameter (@{$product->getParameter}) {
|
||||
$output .= $session->icon->delete('op=deleteProductParameter;parameterId='.$parameter->{parameterId}).
|
||||
$session->icon->edit('op=editProductParameter;parameterId='.$parameter->{parameterId});
|
||||
$output .= '<span style="margin-left: 10px"><b>'.$parameter->{name}.'</b></span><br />';
|
||||
$output .= '<a style="margin-left: 20px" href="'.
|
||||
$session->url->page('op=editProductParameterOption;optionId=new;parameterId='.$parameter->{parameterId}).'">'.
|
||||
$i18n->get('add option').'</a><br />';
|
||||
foreach $optionId (@{$parameter->{options}}) {
|
||||
foreach my $optionId (@{$parameter->{options}}) {
|
||||
$option = $product->getOption($optionId);
|
||||
$output .= '<span style="margin-left: 20px">'.
|
||||
$session->icon->delete('op=deleteProductParameterOption;optionId='.$option->{optionId}).
|
||||
|
|
|
|||
|
|
@ -254,12 +254,12 @@ A reference to the current session.
|
|||
|
||||
sub www_editProfileSave {
|
||||
my $session = shift;
|
||||
my ($profile, $fieldName, $error, $u, $warning);
|
||||
my ($profile, $error, $warning);
|
||||
return WebGUI::Operation::Auth::www_auth($session, "init") if ($session->user->userId eq '1');
|
||||
($profile, $error, $warning) = validateProfileData($session);
|
||||
$error .= $warning;
|
||||
return www_editProfile($session, '<ul>'.$error.'</ul>') if($error ne "");
|
||||
foreach $fieldName (keys %{$profile}) {
|
||||
foreach my $fieldName (keys %{$profile}) {
|
||||
$session->user->profileField($fieldName,$profile->{$fieldName});
|
||||
}
|
||||
return WebGUI::Operation::Auth::www_auth($session);
|
||||
|
|
|
|||
|
|
@ -501,10 +501,9 @@ sub is_constant {
|
|||
}
|
||||
|
||||
sub sum {
|
||||
my ($sum, $elem);
|
||||
$sum = 0;
|
||||
my $sum = 0;
|
||||
my $arrRef = shift;
|
||||
foreach $elem (@{$arrRef}) { $sum += $elem; }
|
||||
foreach my $elem (@{$arrRef}) { $sum += $elem; }
|
||||
return($sum);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue