first round of Perl::Critic cleanups. Do not use return undef, use a bare return instead

This commit is contained in:
Colin Kuskie 2007-12-05 00:30:43 +00:00
parent 75041656ee
commit 96178fd70c
92 changed files with 209 additions and 209 deletions

View file

@ -374,7 +374,7 @@ sub getNextInstance {
return $instance; return $instance;
} }
$self->debug("Didn't see any workflow instances to run."); $self->debug("Didn't see any workflow instances to run.");
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -349,7 +349,7 @@ sub tryAssetMethod {
my $asset = shift; my $asset = shift;
my $method = shift; my $method = shift;
my $state = $asset->get("state"); my $state = $asset->get("state");
return undef if ($state ne "published" && $state ne "archived" && !$session->var->isAdminOn); # can't interact with an asset if it's not published return if ($state ne "published" && $state ne "archived" && !$session->var->isAdminOn); # can't interact with an asset if it's not published
$session->asset($asset); $session->asset($asset);
my $methodToTry = "www_".$method; my $methodToTry = "www_".$method;
my $output = eval{$asset->$methodToTry()}; my $output = eval{$asset->$methodToTry()};

View file

@ -76,9 +76,9 @@ sub create {
my $class = shift; my $class = shift;
my $session = shift; my $session = shift;
my $properties = shift || {}; my $properties = shift || {};
return undef unless $properties->{name}; return unless $properties->{name};
my $test = $class->newByName($session, $properties->{name}); my $test = $class->newByName($session, $properties->{name});
return undef if defined $test; return if defined $test;
my $id = $session->db->setRow("adSpace","adSpaceId",{adSpaceId=>"new"}); my $id = $session->db->setRow("adSpace","adSpaceId",{adSpaceId=>"new"});
my $self = $class->new($session, $id); my $self = $class->new($session, $id);
$self->set($properties); $self->set($properties);
@ -236,7 +236,7 @@ sub new {
my $session = shift; my $session = shift;
my $id = shift; my $id = shift;
my $properties = $session->db->getRow("adSpace","adSpaceId",$id); my $properties = $session->db->getRow("adSpace","adSpaceId",$id);
return undef unless $properties->{adSpaceId}; return unless $properties->{adSpaceId};
bless {_session=>$session, _properties=>$properties}, $class; bless {_session=>$session, _properties=>$properties}, $class;
} }
@ -261,7 +261,7 @@ sub newByName {
my $session = shift; my $session = shift;
my $name = shift; my $name = shift;
my $properties = $session->db->getRow("adSpace","name",$name); my $properties = $session->db->getRow("adSpace","name",$name);
return undef unless $properties->{adSpaceId}; return unless $properties->{adSpaceId};
bless {_session=>$session, _properties=>$properties}, $class; bless {_session=>$session, _properties=>$properties}, $class;
} }

View file

@ -156,7 +156,7 @@ sub new {
my $session = shift; my $session = shift;
my $id = shift; my $id = shift;
my $properties = $session->db->getRow("advertisement","adId",$id); my $properties = $session->db->getRow("advertisement","adId",$id);
return undef unless $properties->{adId}; return unless $properties->{adId};
bless {_session=>$session, _properties=>$properties}, $class; bless {_session=>$session, _properties=>$properties}, $class;
} }

View file

@ -88,7 +88,7 @@ The missing URL.
sub addMissing { sub addMissing {
my $self = shift; my $self = shift;
my $assetUrl = shift; my $assetUrl = shift;
return undef unless ($self->session->var->isAdminOn); return unless ($self->session->var->isAdminOn);
my $ac = $self->getAdminConsole; my $ac = $self->getAdminConsole;
my $i18n = WebGUI::International->new($self->session, "Asset"); my $i18n = WebGUI::International->new($self->session, "Asset");
my $output = $i18n->get("missing page query"); my $output = $i18n->get("missing page query");
@ -295,7 +295,7 @@ sub checkView {
return $notFound->www_view; return $notFound->www_view;
} }
$self->logView(); $self->logView();
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -1150,7 +1150,7 @@ Returns a toolbar with a set of icons that hyperlink to functions that delete, e
sub getToolbar { sub getToolbar {
my $self = shift; my $self = shift;
return undef unless $self->canEdit; return unless $self->canEdit;
return $self->{_toolbar} if (exists $self->{_toolbar}); return $self->{_toolbar} if (exists $self->{_toolbar});
my $userUiLevel = $self->session->user->profileField("uiLevel"); my $userUiLevel = $self->session->user->profileField("uiLevel");
my $uiLevels = $self->session->config->get("assetToolbarUiLevel"); my $uiLevels = $self->session->config->get("assetToolbarUiLevel");
@ -1308,7 +1308,7 @@ sub getValue {
} }
return $self->{_propertyDefinitions}{$key}{defaultValue}; return $self->{_propertyDefinitions}{$key}{defaultValue};
} }
return undef; return;
} }
@ -1563,7 +1563,7 @@ sub manageAssets {
</div> </div>
'; ';
$self->session->output->print($output); $self->session->output->print($output);
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -1590,7 +1590,7 @@ sub manageAssetsSearch {
$output .= WebGUI::Form::formFooter($self->session); $output .= WebGUI::Form::formFooter($self->session);
$self->session->output->print($output); $self->session->output->print($output);
$output = ''; $output = '';
return undef unless ($self->session->form->get("doit") && ($self->session->form->get("keywords") ne "" || $self->session->form->get("class") ne "any")); return unless ($self->session->form->get("doit") && ($self->session->form->get("keywords") ne "" || $self->session->form->get("class") ne "any"));
my $class = $self->session->form->process("class","className") eq "any" ? undef : $self->session->form->process("class","className"); my $class = $self->session->form->process("class","className") eq "any" ? undef : $self->session->form->process("class","className");
my $assets = WebGUI::Search->new($self->session,0)->search({ my $assets = WebGUI::Search->new($self->session,0)->search({
keywords=>$self->session->form->get("keywords"), keywords=>$self->session->form->get("keywords"),
@ -1655,7 +1655,7 @@ sub manageAssetsSearch {
//]]> //]]>
</script> <div class="adminConsoleSpacer"> &nbsp;</div>'; </script> <div class="adminConsoleSpacer"> &nbsp;</div>';
$self->session->output->print($output); $self->session->output->print($output);
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -1691,23 +1691,23 @@ sub new {
unless (defined $assetId) { unless (defined $assetId) {
$session->errorHandler->error("Asset constructor new() requires an assetId."); $session->errorHandler->error("Asset constructor new() requires an assetId.");
return undef; return;
} }
my $revisionDate = shift || $class->getCurrentRevisionDate($session, $assetId); my $revisionDate = shift || $class->getCurrentRevisionDate($session, $assetId);
return undef unless ($revisionDate); return unless ($revisionDate);
unless ($class ne 'WebGUI::Asset' or defined $className) { unless ($class ne 'WebGUI::Asset' or defined $className) {
($className) = $session->db->quickArray("select className from asset where assetId=?", [$assetId]); ($className) = $session->db->quickArray("select className from asset where assetId=?", [$assetId]);
unless ($className) { unless ($className) {
$session->errorHandler->error("Couldn't instantiate asset: ".$assetId. ": couldn't find class name"); $session->errorHandler->error("Couldn't instantiate asset: ".$assetId. ": couldn't find class name");
return undef; return;
} }
} }
if ($className) { if ($className) {
$class = $class->loadModule($session, $className); $class = $class->loadModule($session, $className);
return undef unless (defined $class); return unless (defined $class);
} }
my $cache = WebGUI::Cache->new($session, ["asset",$assetId,$revisionDate]); my $cache = WebGUI::Cache->new($session, ["asset",$assetId,$revisionDate]);
@ -1718,7 +1718,7 @@ sub new {
$properties = WebGUI::Asset->assetDbProperties($session, $assetId, $class, $revisionDate); $properties = WebGUI::Asset->assetDbProperties($session, $assetId, $class, $revisionDate);
unless (exists $properties->{assetId}) { unless (exists $properties->{assetId}) {
$session->errorHandler->error("Asset $assetId $class $revisionDate is missing properties. Consult your database tables for corruption. "); $session->errorHandler->error("Asset $assetId $class $revisionDate is missing properties. Consult your database tables for corruption. ");
return undef; return;
} }
$cache->set($properties,60*60*24); $cache->set($properties,60*60*24);
} }
@ -1727,7 +1727,7 @@ sub new {
bless $object, $class; bless $object, $class;
return $object; return $object;
} }
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -1755,7 +1755,7 @@ sub newByDynamicClass {
my $session = shift; my $session = shift;
my $assetId = shift; my $assetId = shift;
my $revisionDate = shift; my $revisionDate = shift;
return undef unless defined $assetId; return unless defined $assetId;
my $assetClass = $session->stow->get("assetClass"); my $assetClass = $session->stow->get("assetClass");
my $className = $assetClass->{$assetId}; my $className = $assetClass->{$assetId};
unless ($className) { unless ($className) {
@ -1763,7 +1763,7 @@ sub newByDynamicClass {
$assetClass->{$assetId} = $className; $assetClass->{$assetId} = $className;
$session->stow->set("assetClass",$assetClass); $session->stow->set("assetClass",$assetClass);
} }
return undef unless ($className); return unless ($className);
return WebGUI::Asset->new($session,$assetId,$className,$revisionDate); return WebGUI::Asset->new($session,$assetId,$className,$revisionDate);
} }
@ -1788,10 +1788,10 @@ sub newByPropertyHashRef {
my $class = shift; my $class = shift;
my $session = shift; my $session = shift;
my $properties = shift; my $properties = shift;
return undef unless defined $properties; return unless defined $properties;
return undef unless exists $properties->{className}; return unless exists $properties->{className};
my $className = $class->loadModule($session, $properties->{className}); my $className = $class->loadModule($session, $properties->{className});
return undef unless (defined $className); return unless (defined $className);
bless {_session=>$session, _properties => $properties}, $className; bless {_session=>$session, _properties => $properties}, $className;
} }
@ -1832,7 +1832,7 @@ sub newByUrl {
return WebGUI::Asset->new($session,$id, $class, $revisionDate); return WebGUI::Asset->new($session,$id, $class, $revisionDate);
} else { } else {
$session->errorHandler->warn("The URL $url was requested, but does not exist in your asset tree."); $session->errorHandler->warn("The URL $url was requested, but does not exist in your asset tree.");
return undef; return;
} }
} }
return WebGUI::Asset->getDefault($session); return WebGUI::Asset->getDefault($session);
@ -2205,7 +2205,7 @@ sub www_add {
my $self = shift; my $self = shift;
my %prototypeProperties; my %prototypeProperties;
my $class = $self->loadModule($self->session, $self->session->form->process("class","className")); my $class = $self->loadModule($self->session, $self->session->form->process("class","className"));
return undef unless (defined $class); return unless (defined $class);
return $self->session->privilege->insufficient() unless ($class->canAdd($self->session)); return $self->session->privilege->insufficient() unless ($class->canAdd($self->session));
if ($self->session->form->process('prototype')) { if ($self->session->form->process('prototype')) {
my $prototype = WebGUI::Asset->new($self->session, $self->session->form->process("prototype"),$class); my $prototype = WebGUI::Asset->new($self->session, $self->session->form->process("prototype"),$class);
@ -2303,7 +2303,7 @@ sub www_changeUrlConfirm {
return 'redirect'; return 'redirect';
} }
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -2468,7 +2468,7 @@ sub www_view {
return $check if (defined $check); return $check if (defined $check);
$self->prepareView; $self->prepareView;
$self->session->output->print($self->view); $self->session->output->print($self->view);
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -704,7 +704,7 @@ sub getRecurrenceDates {
my %date; my %date;
my $recur = {$self->getRecurrence}; my $recur = {$self->getRecurrence};
return undef unless $recur->{recurType}; return unless $recur->{recurType};
my %dayNames = ( my %dayNames = (
monday => "m", monday => "m",

View file

@ -233,7 +233,7 @@ Returns a toolbar with a set of icons that hyperlink to functions that delete, e
sub getToolbar { sub getToolbar {
my $self = shift; my $self = shift;
return undef if ($self->getToolbarState); return if ($self->getToolbarState);
return $self->SUPER::getToolbar(); return $self->SUPER::getToolbar();
} }

View file

@ -48,7 +48,7 @@ sub addChild {
my @other = @_; my @other = @_;
if ($properties->{className} ne "WebGUI::Asset::Post") { if ($properties->{className} ne "WebGUI::Asset::Post") {
$self->session->errorHandler->security("add a ".$properties->{className}." to a ".$self->get("className")); $self->session->errorHandler->security("add a ".$properties->{className}." to a ".$self->get("className"));
return undef; return;
} }
return $self->SUPER::addChild($properties, @other); return $self->SUPER::addChild($properties, @other);
} }
@ -371,7 +371,7 @@ sub getEditUrl {
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub getImageUrl { sub getImageUrl {
my $self = shift; my $self = shift;
return undef if ($self->get("storageId") eq ""); return if ($self->get("storageId") eq "");
my $storage = $self->getStorageLocation; my $storage = $self->getStorageLocation;
my $url; my $url;
foreach my $filename (@{$storage->getFiles}) { foreach my $filename (@{$storage->getFiles}) {
@ -578,7 +578,7 @@ sub getThread {
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub getThumbnailUrl { sub getThumbnailUrl {
my $self = shift; my $self = shift;
return undef if ($self->get("storageId") eq ""); return if ($self->get("storageId") eq "");
my $storage = $self->getStorageLocation; my $storage = $self->getStorageLocation;
my $url; my $url;
foreach my $filename (@{$storage->getFiles}) { foreach my $filename (@{$storage->getFiles}) {
@ -663,8 +663,8 @@ An integer indicating either thumbss up (+1) or thumbs down (-1)
sub insertUserPostRating { sub insertUserPostRating {
my $self = shift; my $self = shift;
my $rating = shift; my $rating = shift;
return undef unless ($rating == -1 || $rating == 1); return unless ($rating == -1 || $rating == 1);
return undef if $self->hasRated; return if $self->hasRated;
$self->session->db->write("insert into Post_rating (assetId,userId,ipAddress,dateOfRating,rating) values (?,?,?,?,?)", $self->session->db->write("insert into Post_rating (assetId,userId,ipAddress,dateOfRating,rating) values (?,?,?,?,?)",
[$self->getId, [$self->getId,
$self->session->user->userId, $self->session->user->userId,
@ -914,8 +914,8 @@ An integer indicating either thumbss up (+1) or thumbs down (-1)
sub rate { sub rate {
my $self = shift; my $self = shift;
my $rating = shift; my $rating = shift;
return undef unless ($rating == -1 || $rating == 1); return unless ($rating == -1 || $rating == 1);
return undef if $self->hasRated; return if $self->hasRated;
$self->insertUserPostRating($rating); $self->insertUserPostRating($rating);
$self->recalculatePostRating(); $self->recalculatePostRating();
$self->getThread->updateThreadRating(); $self->getThread->updateThreadRating();

View file

@ -584,8 +584,8 @@ An integer between 1 and 5 (5 being best) to rate this post with.
sub rate { sub rate {
my $self = shift; my $self = shift;
my $rating = shift; my $rating = shift;
return undef unless ($rating == -1 || $rating == 1); return unless ($rating == -1 || $rating == 1);
return undef if $self->hasRated; return if $self->hasRated;
$self->SUPER::rate($rating); $self->SUPER::rate($rating);
##Thread specific karma adjustment for CS ##Thread specific karma adjustment for CS

View file

@ -159,7 +159,7 @@ if there is no such feed.
sub getRssUrl { sub getRssUrl {
my $self = shift; my $self = shift;
my $rssFromParentId = $self->get('rssCapableRssFromParentId'); my $rssFromParentId = $self->get('rssCapableRssFromParentId');
return undef unless defined $rssFromParentId; return unless defined $rssFromParentId;
WebGUI::Asset->newByDynamicClass($self->session, $rssFromParentId)->getUrl; WebGUI::Asset->newByDynamicClass($self->session, $rssFromParentId)->getUrl;
} }

View file

@ -422,7 +422,7 @@ Returns a toolbar with a set of icons that hyperlink to functions that delete, e
sub getToolbar { sub getToolbar {
my $self = shift; my $self = shift;
return undef if ($self->getToolbarState); return if ($self->getToolbarState);
return $self->SUPER::getToolbar(); return $self->SUPER::getToolbar();
} }

View file

@ -364,7 +364,7 @@ sub getOverridesList {
$output .= '<table cellspacing="0" cellpadding="3" border="1">'; $output .= '<table cellspacing="0" cellpadding="3" border="1">';
$output .= '<tr class="tableHeader"><td>'.$i18n->get('fieldName').'</td><td>'.$i18n->get('edit delete fieldname').'</td><td>'.$i18n->get('Original Value').'</td><td>'.$i18n->get('New value').'</td><td>'.$i18n->get('Replacement value').'</td></tr>'; $output .= '<tr class="tableHeader"><td>'.$i18n->get('fieldName').'</td><td>'.$i18n->get('edit delete fieldname').'</td><td>'.$i18n->get('Original Value').'</td><td>'.$i18n->get('New value').'</td><td>'.$i18n->get('Replacement value').'</td></tr>';
my $shortcut = $self->getShortcutOriginal; my $shortcut = $self->getShortcutOriginal;
return undef unless defined $shortcut; return unless defined $shortcut;
foreach my $definition (@{$shortcut->definition($self->session)}) { foreach my $definition (@{$shortcut->definition($self->session)}) {
foreach my $prop (keys %{$definition->{properties}}) { foreach my $prop (keys %{$definition->{properties}}) {
next if $definition->{properties}{$prop}{fieldType} eq 'hidden'; next if $definition->{properties}{$prop}{fieldType} eq 'hidden';

View file

@ -117,7 +117,7 @@ Returns a toolbar with a set of icons that hyperlink to functions that delete, e
sub getToolbar { sub getToolbar {
my $self = shift; my $self = shift;
return undef if ($self->getToolbarState); return if ($self->getToolbarState);
return '<p>'.$self->SUPER::getToolbar().'</p>'; return '<p>'.$self->SUPER::getToolbar().'</p>';
} }

View file

@ -27,7 +27,7 @@ You can't add children to a wiki page.
=cut =cut
sub addChild { sub addChild {
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -185,7 +185,7 @@ sub getEditForm {
sub getWiki { sub getWiki {
my $self = shift; my $self = shift;
my $parent = $self->getParent; my $parent = $self->getParent;
return undef unless defined $parent and $parent->isa('WebGUI::Asset::Wobject::WikiMaster'); return unless defined $parent and $parent->isa('WebGUI::Asset::Wobject::WikiMaster');
return $parent; return $parent;
} }

View file

@ -257,7 +257,7 @@ sub addChild {
if ($properties->{className} ne "WebGUI::Asset::Event") { if ($properties->{className} ne "WebGUI::Asset::Event") {
$self->session->errorHandler->security("add a ".$properties->{className}." to a ".$self->get("className")); $self->session->errorHandler->security("add a ".$properties->{className}." to a ".$self->get("className"));
return undef; return;
} }
return $self->SUPER::addChild($properties, @other); return $self->SUPER::addChild($properties, @other);

View file

@ -80,7 +80,7 @@ sub addChild {
if ($properties->{className} ne "WebGUI::Asset::Post::Thread" if ($properties->{className} ne "WebGUI::Asset::Post::Thread"
and $properties->{className} ne 'WebGUI::Asset::RSSFromParent') { and $properties->{className} ne 'WebGUI::Asset::RSSFromParent') {
$self->session->errorHandler->security("add a ".$properties->{className}." to a ".$self->get("className")); $self->session->errorHandler->security("add a ".$properties->{className}." to a ".$self->get("className"));
return undef; return;
} }
return $self->SUPER::addChild($properties, @other); return $self->SUPER::addChild($properties, @other);
} }

View file

@ -264,11 +264,11 @@ sub addToScratchCart {
my $scratchCart = $self->session->scratch->get('EMS_scratch_cart'); my $scratchCart = $self->session->scratch->get('EMS_scratch_cart');
my @eventsInCart = split("\n",$scratchCart); my @eventsInCart = split("\n",$scratchCart);
my ($isApproved) = $self->session->db->quickArray("select approved from EventManagementSystem_products where productId = ?",[$event]); my ($isApproved) = $self->session->db->quickArray("select approved from EventManagementSystem_products where productId = ?",[$event]);
return undef unless $isApproved; return unless $isApproved;
unless (scalar(@eventsInCart) || $scratchCart) { unless (scalar(@eventsInCart) || $scratchCart) {
# the cart is empty, so check if this is a master event or not. # the cart is empty, so check if this is a master event or not.
my ($isChild) = $self->session->db->quickArray("select prerequisiteId from EventManagementSystem_products where productId = ?",[$event]); my ($isChild) = $self->session->db->quickArray("select prerequisiteId from EventManagementSystem_products where productId = ?",[$event]);
return undef if $isChild; return if $isChild;
$self->session->scratch->set('currentMainEvent',$event); $self->session->scratch->set('currentMainEvent',$event);
$self->session->scratch->set('EMS_scratch_cart', $event); $self->session->scratch->set('EMS_scratch_cart', $event);
return $event; return $event;
@ -276,7 +276,7 @@ sub addToScratchCart {
# check if event is actually available. # check if event is actually available.
my ($numberRegistered) = $self->session->db->quickArray("select count(*) from EventManagementSystem_registrations as r, EventManagementSystem_purchases as p, transaction as t where t.transactionId=p.transactionId and t.status='Completed' and r.purchaseId = p.purchaseId and r.returned=0 and r.productId=?",[$event]); my ($numberRegistered) = $self->session->db->quickArray("select count(*) from EventManagementSystem_registrations as r, EventManagementSystem_purchases as p, transaction as t where t.transactionId=p.transactionId and t.status='Completed' and r.purchaseId = p.purchaseId and r.returned=0 and r.productId=?",[$event]);
my ($maxAttendees) = $self->session->db->quickArray("select maximumAttendees from EventManagementSystem_products where productId=?",[$event]); my ($maxAttendees) = $self->session->db->quickArray("select maximumAttendees from EventManagementSystem_products where productId=?",[$event]);
return undef unless ($self->canApproveEvents || ($maxAttendees > $numberRegistered)); return unless ($self->canApproveEvents || ($maxAttendees > $numberRegistered));
my $bid = $self->session->scratch->get('currentBadgeId'); my $bid = $self->session->scratch->get('currentBadgeId');
my @pastEvents = ($bid)?$self->session->db->buildArray("select r.productId from EventManagementSystem_registrations as r, EventManagementSystem_purchases as p, transaction as t where r.returned=0 and r.badgeId=? and t.transactionId=p.transactionId and t.status='Completed' and p.purchaseId=r.purchaseId group by productId",[$bid]):(); my @pastEvents = ($bid)?$self->session->db->buildArray("select r.productId from EventManagementSystem_registrations as r, EventManagementSystem_purchases as p, transaction as t where r.returned=0 and r.badgeId=? and t.transactionId=p.transactionId and t.status='Completed' and p.purchaseId=r.purchaseId group by productId",[$bid]):();

View file

@ -97,7 +97,7 @@ sub definition {
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub duplicate { sub duplicate {
# Buggo: how do we duplicate these? # Buggo: how do we duplicate these?
return undef; return;
} }

View file

@ -444,12 +444,12 @@ sub getProjectInstance {
my $session = shift; my $session = shift;
my $db = $session->db; my $db = $session->db;
my $projectId = $_[0]; my $projectId = $_[0];
return undef unless $projectId; return unless $projectId;
my ($assetId) = $db->quickArray("select assetId from PM_project where projectId=?",[$projectId]); my ($assetId) = $db->quickArray("select assetId from PM_project where projectId=?",[$projectId]);
if($assetId) { if($assetId) {
return WebGUI::Asset->newByDynamicClass($session,$assetId); return WebGUI::Asset->newByDynamicClass($session,$assetId);
} }
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -824,8 +824,8 @@ recent revision will be fetched.
sub _getFileFromDatabase { sub _getFileFromDatabase {
my ($constraint, $dbLink); my ($constraint, $dbLink);
my $self = shift; my $self = shift;
my $recordId = shift || return undef; my $recordId = shift || return;
my $fieldName = shift || return undef; my $fieldName = shift || return;
my $revision = shift; my $revision = shift;
$dbLink = $self->_getDbLink; $dbLink = $self->_getDbLink;
@ -4088,7 +4088,7 @@ sub _constructSearchQuery {
my $searchType = ($self->session->form->process("searchType") || $self->session->scratch->get('SQLForm_'.$self->getId.'searchType')) eq 'and' ? 'and' : 'or'; my $searchType = ($self->session->form->process("searchType") || $self->session->scratch->get('SQLForm_'.$self->getId.'searchType')) eq 'and' ? 'and' : 'or';
return undef if (!@constraints); return if (!@constraints);
# Construct the search query # Construct the search query
my $sortField = @sortClauses ? ('('.join('+', @sortClauses).') AS sqlform_orderby') : '1 AS sqlform_orderby'; my $sortField = @sortClauses ? ('('.join('+', @sortClauses).') AS sqlform_orderby') : '1 AS sqlform_orderby';

View file

@ -154,7 +154,7 @@ sub _convertToEpoch {
my $time = $_[1]; my $time = $_[1];
unless ($date =~ m{^\d+/\d+/\d+} and $time =~ m{^\d+:\d+}) { unless ($date =~ m{^\d+/\d+/\d+} and $time =~ m{^\d+:\d+}) {
return undef; return;
} }
my ($month,$day,$year) = split("/",$date); my ($month,$day,$year) = split("/",$date);

View file

@ -289,7 +289,7 @@ sub _find_record {
} }
} }
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -348,7 +348,7 @@ sub _get_rss_data {
if (!$response->is_success()) { if (!$response->is_success()) {
$session->errorHandler->warn("Error retrieving url '$url': " . $session->errorHandler->warn("Error retrieving url '$url': " .
$response->status_line()); $response->status_line());
return undef; return;
} }
my $xml = $response->content(); my $xml = $response->content();
@ -380,7 +380,7 @@ sub _get_rss_data {
$session->errorHandler->warn("error parsing rss for url $url :".$@); $session->errorHandler->warn("error parsing rss for url $url :".$@);
#Returning undef on a parse failure is a change from previous behaviour, #Returning undef on a parse failure is a change from previous behaviour,
#but it SHOULDN'T have a major effect. #but it SHOULDN'T have a major effect.
return undef; return;
} }
# make sure that the {channel} points to the channel # make sure that the {channel} points to the channel

View file

@ -48,7 +48,7 @@ Removes asset from lineage, places it in clipboard state. The "gap" in the linea
sub cut { sub cut {
my $self = shift; my $self = shift;
return undef if ($self->getId eq $self->session->setting->get("defaultPage") || $self->getId eq $self->session->setting->get("notFoundPage")); return if ($self->getId eq $self->session->setting->get("defaultPage") || $self->getId eq $self->session->setting->get("notFoundPage"));
$self->session->db->beginTransaction; $self->session->db->beginTransaction;
$self->session->db->write("update asset set state='clipboard-limbo' where lineage like ? and state='published'",[$self->get("lineage").'%']); $self->session->db->write("update asset set state='clipboard-limbo' where lineage like ? and state='published'",[$self->get("lineage").'%']);
$self->session->db->write("update asset set state='clipboard', stateChangedBy=?, stateChanged=? where assetId=?", [$self->session->user->userId, $self->session->datetime->time(), $self->getId]); $self->session->db->write("update asset set state='clipboard', stateChangedBy=?, stateChanged=? where assetId=?", [$self->session->user->userId, $self->session->datetime->time(), $self->getId]);

View file

@ -222,7 +222,7 @@ sub importPackage {
$self->session->http->setRedirect($self->getUrl("op=commitVersionTag;tagId=".WebGUI::VersionTag->getWorking($self->session)->getId)); $self->session->http->setRedirect($self->getUrl("op=commitVersionTag;tagId=".WebGUI::VersionTag->getWorking($self->session)->getId));
} }
} }
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -184,7 +184,7 @@ Removes asset from lineage, places it in trash state. The "gap" in the lineage i
sub trash { sub trash {
my $self = shift; my $self = shift;
return undef if ($self->getId eq $self->session->setting->get("defaultPage") || $self->getId eq $self->session->setting->get("notFoundPage")); return if ($self->getId eq $self->session->setting->get("defaultPage") || $self->getId eq $self->session->setting->get("notFoundPage"));
foreach my $asset ($self, @{$self->getLineage(['descendants'], {returnObjects => 1})}) { foreach my $asset ($self, @{$self->getLineage(['descendants'], {returnObjects => 1})}) {
$asset->_invokeWorkflowOnExportedFiles($self->session->setting->get('trashWorkflow'), 1); $asset->_invokeWorkflowOnExportedFiles($self->session->setting->get('trashWorkflow'), 1);
} }

View file

@ -173,7 +173,7 @@ Override this method in your asset if you want your asset to automatically run i
=cut =cut
sub getAutoCommitWorkflowId { sub getAutoCommitWorkflowId {
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -536,9 +536,9 @@ sub www_purgeRevision {
my $session = $self->session; my $session = $self->session;
return $session->privilege->insufficient() unless $self->canEdit; return $session->privilege->insufficient() unless $self->canEdit;
my $revisionDate = $session->form->process("revisionDate"); my $revisionDate = $session->form->process("revisionDate");
return undef unless $revisionDate; return unless $revisionDate;
my $asset = WebGUI::Asset->new($session,$self->getId,$self->get("className"),$revisionDate); my $asset = WebGUI::Asset->new($session,$self->getId,$self->get("className"),$revisionDate);
return undef if ($asset->get('revisionDate') != $revisionDate); return if ($asset->get('revisionDate') != $revisionDate);
my $parent = $asset->getParent; my $parent = $asset->getParent;
$asset->purgeRevision; $asset->purgeRevision;
if ($session->form->process("proceed") eq "manageRevisionsInTag") { if ($session->form->process("proceed") eq "manageRevisionsInTag") {

View file

@ -304,7 +304,7 @@ sub createAccountSave {
); );
} }
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -364,7 +364,7 @@ sub deactivateAccountConfirm {
#}); #});
$self->logout; $self->logout;
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -680,7 +680,7 @@ sub login {
$self->session->errorHandler->warn($error) if $error; $self->session->errorHandler->warn($error) if $error;
} }
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -705,7 +705,7 @@ sub logout {
$self->session->errorHandler->warn($error) if $error; $self->session->errorHandler->warn($error) if $error;
} }
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -251,7 +251,7 @@ sub createAccountSave {
$self->logout; $self->logout;
return $self->displayLogin($i18n->get('check email for validation','AuthWebGUI')); return $self->displayLogin($i18n->get('check email for validation','AuthWebGUI'));
} }
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -94,7 +94,7 @@ Retrieve content from the filesystem cache.
sub get { sub get {
my $self = shift; my $self = shift;
return undef if ($self->session->config->get("disableCache")); return if ($self->session->config->get("disableCache"));
# getting better performance using native dbi than webgui sql # getting better performance using native dbi than webgui sql
my $dbh = $self->session->db->dbh; my $dbh = $self->session->db->dbh;
my $sth = $dbh->prepare("select content from cache where namespace=? and cachekey=? and expires>?"); my $sth = $dbh->prepare("select content from cache where namespace=? and cachekey=? and expires>?");
@ -102,7 +102,7 @@ sub get {
my $data = $sth->fetchrow_arrayref; my $data = $sth->fetchrow_arrayref;
$sth->finish; $sth->finish;
my $content = $data->[0]; my $content = $data->[0];
return undef unless ($content); return unless ($content);
# Storable doesn't like non-reference arguments, so we wrap it in a scalar ref. # Storable doesn't like non-reference arguments, so we wrap it in a scalar ref.
return ${thaw($content)}; return ${thaw($content)};
} }

View file

@ -105,12 +105,12 @@ Retrieve content from the filesystem cache.
sub get { sub get {
my $self = shift; my $self = shift;
return undef if ($self->session->config->get("disableCache")); return if ($self->session->config->get("disableCache"));
my $folder = $self->getFolder; my $folder = $self->getFolder;
if (-e $folder."/expires" && -e $folder."/cache" && open(my $FILE,"<",$folder."/expires")) { if (-e $folder."/expires" && -e $folder."/cache" && open(my $FILE,"<",$folder."/expires")) {
my $expires = <$FILE>; my $expires = <$FILE>;
close($FILE); close($FILE);
return undef if ($expires < $self->session->datetime->time()); return if ($expires < $self->session->datetime->time());
my $value; my $value;
eval {$value = retrieve($folder."/cache")}; eval {$value = retrieve($folder."/cache")};
if (ref $value eq "SCALAR") { if (ref $value eq "SCALAR") {
@ -119,7 +119,7 @@ sub get {
return $value; return $value;
} }
} }
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -82,7 +82,7 @@ undef if it's not recurring.
=cut =cut
sub duration { sub duration {
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -95,7 +95,7 @@ your item you don't have to override this method or if you do, you can just retu
=cut =cut
sub handler { sub handler {
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -134,7 +134,7 @@ You only need to override this method if your gateway uses a webbased contacting
=cut =cut
sub confirmRecurringTransaction { sub confirmRecurringTransaction {
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -277,7 +277,7 @@ The term number you want the status of.
=cut =cut
sub getRecurringPaymentStatus { sub getRecurringPaymentStatus {
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -383,7 +383,7 @@ A hashref containing:
=cut =cut
sub normalTransaction { sub normalTransaction {
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -408,7 +408,7 @@ A hashref containing:
=cut =cut
sub recurringTransaction { sub recurringTransaction {
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -36,7 +36,7 @@ our @ISA = qw(WebGUI::Commerce::Payment);
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub connectionError { sub connectionError {
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -119,7 +119,7 @@ sub connectionError {
$self = shift; $self = shift;
return $self->resultMessage if ($self->{_connectionError}); return $self->resultMessage if ($self->{_connectionError});
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -325,7 +325,7 @@ sub getRecurringPaymentStatus {
my $transactionData = $self->session->db->quickHashRef("select * from ITransact_recurringStatus where gatewayId=".$self->session->db->quote($recurringId)); my $transactionData = $self->session->db->quickHashRef("select * from ITransact_recurringStatus where gatewayId=".$self->session->db->quote($recurringId));
unless ($transactionData->{recipe}) { # if for some reason there's no transaction data, we shouldn't calc anything unless ($transactionData->{recipe}) { # if for some reason there's no transaction data, we shouldn't calc anything
$self->session->errorHandler->error("For some reason recurring transaction $recurringId doesn't have any recurring status transaction data. This is most likely because you don't have the Recurring Postback URL set in your ITransact virtual terminal."); $self->session->errorHandler->error("For some reason recurring transaction $recurringId doesn't have any recurring status transaction data. This is most likely because you don't have the Recurring Postback URL set in your ITransact virtual terminal.");
return undef; return;
} }
my $lastTerm = int(($transactionData->{lastTransaction} - $transactionData->{initDate}) / $resolve{$transactionData->{recipe}}) + 1; my $lastTerm = int(($transactionData->{lastTransaction} - $transactionData->{initDate}) / $resolve{$transactionData->{recipe}}) + 1;
@ -337,7 +337,7 @@ sub getRecurringPaymentStatus {
$paymentHistory{resultCode} = $transactionData->{status}.' '.$transactionData->{errorMessage}; $paymentHistory{resultCode} = $transactionData->{status}.' '.$transactionData->{errorMessage};
$paymentHistory{resultCode} = 0 if $transactionData->{status} eq 'OK'; $paymentHistory{resultCode} = 0 if $transactionData->{status} eq 'OK';
} else { } else {
return undef; return;
} }
return \%paymentHistory; return \%paymentHistory;
@ -350,7 +350,7 @@ sub errorCode {
$resultCode = $self->{_response}->{Status}; $resultCode = $self->{_response}->{Status};
return $resultCode unless ($resultCode eq 'OK'); return $resultCode unless ($resultCode eq 'OK');
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -607,7 +607,7 @@ sub transactionError {
$resultCode = $self->resultCode; $resultCode = $self->resultCode;
return $self->resultMessage if ($resultCode ne 'OK'); return $self->resultMessage if ($resultCode ne 'OK');
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -401,7 +401,7 @@ you'll have to overload this method. Defaults to undef.
=cut =cut
sub trackingNumber { sub trackingNumber {
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -414,7 +414,7 @@ info of his package. Overload this method if your plugin supports tracking. Defa
=cut =cut
sub trackingUrl { sub trackingUrl {
return undef; return;
} }
1; 1;

View file

@ -95,7 +95,7 @@ sub cancelTransaction {
$self->status('Canceled'); $self->status('Canceled');
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -293,7 +293,7 @@ sub getByGatewayId {
" and gateway=".$self->session->db->quote($paymentGateway)); " and gateway=".$self->session->db->quote($paymentGateway));
return WebGUI::Commerce::Transaction->new($self->session, $transactionId) if $transactionId; return WebGUI::Commerce::Transaction->new($self->session, $transactionId) if $transactionId;
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -248,7 +248,7 @@ sub db {
} else { } else {
$self->session->errorHandler->warn("DatabaseLink [".$self->getId."] The DSN specified is of an improper format."); $self->session->errorHandler->warn("DatabaseLink [".$self->getId."] The DSN specified is of an improper format.");
} }
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -344,7 +344,7 @@ sub new {
unless (defined($databaseLink{databaseLinkId})) unless (defined($databaseLink{databaseLinkId}))
{ {
$session->errorHandler->warn("Could not find database link '".$databaseLinkId."'"); $session->errorHandler->warn("Could not find database link '".$databaseLinkId."'");
return undef; return;
} }
bless {_session=>$session, _databaseLink => \%databaseLink }, $class; bless {_session=>$session, _databaseLink => \%databaseLink }, $class;

View file

@ -548,7 +548,7 @@ A string representing the output format for the date. Defaults to '%z %Z'. You c
sub webguiDate { sub webguiDate {
my $self = shift; my $self = shift;
my $session = $self->session; my $session = $self->session;
return undef unless ($session); return unless ($session);
my $format = shift || "%z %Z"; my $format = shift || "%z %Z";
my $temp; my $temp;

View file

@ -66,7 +66,7 @@ sub AUTOLOAD {
eval ($cmd); eval ($cmd);
if ($@) { if ($@) {
$session->errorHandler->error("Couldn't compile form control: ".$name.". Root cause: ".$@); $session->errorHandler->error("Couldn't compile form control: ".$name.". Root cause: ".$@);
return undef; return;
} }
my $class = "WebGUI::Form::".$name; my $class = "WebGUI::Form::".$name;
return $class->new($session,@params)->toHtml; return $class->new($session,@params)->toHtml;

View file

@ -91,7 +91,7 @@ A class method that returns a value to be used as the autogenerated ID for this
=cut =cut
sub generateIdParameter { sub generateIdParameter {
return undef return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -112,7 +112,7 @@ sub getValueFromPost {
if (defined $formValue) { if (defined $formValue) {
return $formValue; return $formValue;
} else { } else {
return undef; return;
} }
} }

View file

@ -75,7 +75,7 @@ An optional value to use instead of POST input.
sub getValueFromPost { sub getValueFromPost {
my $self = shift; my $self = shift;
my $color = @_ ? shift : $self->session->form->param($self->get("name")); my $color = @_ ? shift : $self->session->form->param($self->get("name"));
return undef unless $color =~ /\#\w{6}/; return unless $color =~ /\#\w{6}/;
return $color; return $color;
} }

View file

@ -131,7 +131,7 @@ sub getValueFromPost {
$self->session->errorHandler->warn("Date value: $value"); $self->session->errorHandler->warn("Date value: $value");
# Verify format # Verify format
return undef return
unless ($value =~ m/(?:\d{2}|\d{4})\D\d{2}\D\d{2}\D\d{2}\D\d{2}\D\d{2}/); unless ($value =~ m/(?:\d{2}|\d{4})\D\d{2}\D\d{2}\D\d{2}\D\d{2}\D\d{2}/);
# Fix time zone # Fix time zone

View file

@ -118,7 +118,7 @@ sub new {
eval ($load); eval ($load);
if ($@) { if ($@) {
$session->errorHandler->error("Couldn't compile form control: ".$fieldType.". Root cause: ".$@); $session->errorHandler->error("Couldn't compile form control: ".$fieldType.". Root cause: ".$@);
return undef; return;
} }
my $formObj = $cmd->new($session, $param); my $formObj = $cmd->new($session, $param);
if ($formObj->isa('WebGUI::Form::List')) { if ($formObj->isa('WebGUI::Form::List')) {

View file

@ -86,7 +86,7 @@ sub getValueFromPost {
if ($value =~ /^([0-9a-zA-Z]([-.+\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$/i) { if ($value =~ /^([0-9a-zA-Z]([-.+\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$/i) {
return $value; return $value;
} }
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -220,14 +220,14 @@ sub getValueFromPost {
my @files = @{ $storage->getFiles }; my @files = @{ $storage->getFiles };
if (scalar(@files) < 1) { if (scalar(@files) < 1) {
$storage->delete; $storage->delete;
return undef; return;
} else { } else {
my $id = $storage->getId; my $id = $storage->getId;
$self->set("value", $id); $self->set("value", $id);
return $id; return $id;
} }
} }
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -77,7 +77,7 @@ A class method that returns a value to be used as the autogenerated ID for this
=cut =cut
sub generateIdParameter { sub generateIdParameter {
return undef return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -200,7 +200,7 @@ sub getValueFromPost {
@files = @images; @files = @images;
} }
return undef unless @files; return unless @files;
$storage->generateThumbnail($_) for @images; # Make a thumbnail for each filename in @images $storage->generateThumbnail($_) for @images; # Make a thumbnail for each filename in @images
} }
} }

View file

@ -86,7 +86,7 @@ sub getValueFromPost {
if ($value =~ /^[x\d \.\-\+\(\)]+$/ and $value =~ /\d/) { if ($value =~ /^[x\d \.\-\+\(\)]+$/ and $value =~ /\d/) {
return $value; return $value;
} }
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -85,7 +85,7 @@ A class method that returns a value to be used as the autogenerated ID for this
=cut =cut
sub generateIdParameter { sub generateIdParameter {
return undef return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -78,7 +78,7 @@ Returns undef.
=cut =cut
sub getValueFromPost { sub getValueFromPost {
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -103,7 +103,7 @@ Outputs nothing.
=cut =cut
sub toHtmlAsHidden { sub toHtmlAsHidden {
return undef; return;
} }

View file

@ -173,7 +173,7 @@ sub getSliderValue {
return $i if $keys[$i] eq $self->get('value')->[0]; return $i if $keys[$i] eq $self->get('value')->[0];
} }
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -132,7 +132,7 @@ sub getValueFromPost {
return $value return $value
} }
else { else {
return undef; return;
} }
} }
@ -147,7 +147,7 @@ sub getValueFromPost {
} else { } else {
# Mysql format # Mysql format
my $value = $self->session->form->param($self->get("name")); my $value = $self->session->form->param($self->get("name"));
return undef unless $value =~ /^\d{2}\D\d{2}(\D\d{2})?$/; return unless $value =~ /^\d{2}\D\d{2}(\D\d{2})?$/;
return $value; return $value;
} }
} }

View file

@ -94,7 +94,7 @@ sub getValueFromPost {
if ($value =~ /^[A-Z\d\s\-]+$/) { if ($value =~ /^[A-Z\d\s\-]+$/) {
return $value; return $value;
} }
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -74,7 +74,7 @@ sub AUTOLOAD {
eval ($cmd); eval ($cmd);
if ($@) { if ($@) {
$self->session->errorHandler->error("Couldn't compile form control: ".$name.". Root cause: ".$@); $self->session->errorHandler->error("Couldn't compile form control: ".$name.". Root cause: ".$@);
return undef; return;
} }
my $class = "WebGUI::Form::".$name; my $class = "WebGUI::Form::".$name;
return $class->new($self->session, $params)->getValueFromPost(@args); return $class->new($self->session, $params)->getValueFromPost(@args);
@ -177,7 +177,7 @@ sub process {
return $default; return $default;
} }
if ($value =~ /^[\s]+$/) { if ($value =~ /^[\s]+$/) {
return undef; return;
} }
return $value; return $value;
} }

View file

@ -1024,7 +1024,7 @@ sub new {
unless ($groupExists) { unless ($groupExists) {
$self->{_session}->errorHandler->warn('WebGUI::Group->new called with a non-existant groupId:' $self->{_session}->errorHandler->warn('WebGUI::Group->new called with a non-existant groupId:'
.'['.$self->{_groupId}.']'); .'['.$self->{_groupId}.']');
return undef; return;
} }
} }

View file

@ -87,7 +87,7 @@ sub AUTOLOAD {
eval ($cmd); eval ($cmd);
if ($@) { if ($@) {
$self->session->errorHandler->error("Couldn't compile form control: ".$name.". Root cause: ".$@); $self->session->errorHandler->error("Couldn't compile form control: ".$name.". Root cause: ".$@);
return undef; return;
} }
my $class = "WebGUI::Form::".$name; my $class = "WebGUI::Form::".$name;
$self->{_data} .= $class->new($self->session,%params)->toHtmlWithWrapper; $self->{_data} .= $class->new($self->session,%params)->toHtmlWithWrapper;

View file

@ -602,12 +602,12 @@ sub processConfigurationForm {
my $class = shift; my $class = shift;
my $session = shift; my $session = shift;
return undef unless ($class->getPluginList($session)); return unless ($class->getPluginList($session));
my $namespace = "WebGUI::Image::".$session->form->process('graphingPlugin'); my $namespace = "WebGUI::Image::".$session->form->process('graphingPlugin');
$namespace =~ s/_/::/g; $namespace =~ s/_/::/g;
return undef unless (isIn($namespace, @{$class->getPluginList($session)})); return unless (isIn($namespace, @{$class->getPluginList($session)}));
my $graph = $class->load($session, $namespace); my $graph = $class->load($session, $namespace);

View file

@ -148,7 +148,7 @@ sub getColorIndex {
return $index if ($self->getColor($index)->getId eq $color->getId); return $index if ($self->getColor($index)->getId eq $color->getId);
} }
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -372,7 +372,7 @@ sub removeColor {
my $self = shift; my $self = shift;
my $paletteIndex = shift; my $paletteIndex = shift;
return undef unless (defined $paletteIndex); return unless (defined $paletteIndex);
my $color = $self->getColor($paletteIndex); my $color = $self->getColor($paletteIndex);
@ -426,10 +426,10 @@ sub setColor {
my $index = shift; my $index = shift;
my $color = shift; my $color = shift;
return undef if ($index >= $self->getNumberOfColors); return if ($index >= $self->getNumberOfColors);
return undef if ($index < 0); return if ($index < 0);
return undef unless (defined $index); return unless (defined $index);
return undef unless (defined $color); return unless (defined $color);
$color->save; $color->save;
@ -484,7 +484,7 @@ sub setPaletteIndex {
my $self = shift; my $self = shift;
my $index = shift; my $index = shift;
return undef unless (defined $index); return unless (defined $index);
$index = ($self->getNumberOfColors - 1) if ($index >= $self->getNumberOfColors); $index = ($self->getNumberOfColors - 1) if ($index >= $self->getNumberOfColors);
$index = 0 if ($index < 0); $index = 0 if ($index < 0);

View file

@ -72,10 +72,10 @@ sub addPrivateMessage {
my $userId = $messageData->{userId}; my $userId = $messageData->{userId};
my $sentBy = $messageData->{sentBy} || $self->session->user->userId; my $sentBy = $messageData->{sentBy} || $self->session->user->userId;
return undef unless $userId; return unless $userId;
my $u = WebGUI::User->new($self->session,$userId); my $u = WebGUI::User->new($self->session,$userId);
return undef unless ($isReply || $u->acceptsPrivateMessages($sentBy)); return unless ($isReply || $u->acceptsPrivateMessages($sentBy));
return $self->addMessage($messageData); return $self->addMessage($messageData);
} }

View file

@ -219,7 +219,7 @@ sub new {
my $class = shift; my $class = shift;
my $session = shift; my $session = shift;
$ldapLinkId = shift; $ldapLinkId = shift;
return undef unless $ldapLinkId; return unless $ldapLinkId;
$ldapLink = $session->db->quickHashRef("select * from ldapLink where ldapLinkId=?",[$ldapLinkId]); $ldapLink = $session->db->quickHashRef("select * from ldapLink where ldapLinkId=?",[$ldapLinkId]);
bless {_session=>$session, _ldapLinkId=>$ldapLinkId, _ldapLink=>$ldapLink }, $class; bless {_session=>$session, _ldapLinkId=>$ldapLinkId, _ldapLink=>$ldapLink }, $class;
} }

View file

@ -37,7 +37,7 @@ sub process {
return "[AD:".$name."]"; return "[AD:".$name."]";
} }
my $adSpace = WebGUI::AdSpace->newByName($session, $name); my $adSpace = WebGUI::AdSpace->newByName($session, $name);
return undef unless defined $adSpace; return unless defined $adSpace;
return $adSpace->displayImpression; return $adSpace->displayImpression;
} }

View file

@ -50,7 +50,7 @@ sub process {
$output .= "AssetProxy:".Time::HiRes::tv_interval($t) if ($session->errorHandler->canShowPerformanceIndicators()); $output .= "AssetProxy:".Time::HiRes::tv_interval($t) if ($session->errorHandler->canShowPerformanceIndicators());
return $output; return $output;
} }
return undef; return;
} else { } else {
my $i18n = WebGUI::International->new($session, 'Macro_AssetProxy'); my $i18n = WebGUI::International->new($session, 'Macro_AssetProxy');
return $i18n->get('invalid url'); return $i18n->get('invalid url');

View file

@ -50,7 +50,7 @@ sub process {
$randomAsset->prepareView; $randomAsset->prepareView;
return $randomAsset->view; return $randomAsset->view;
} }
return undef; return;
} else { } else {
return $i18n->get('childless'); return $i18n->get('childless');
} }

View file

@ -37,7 +37,7 @@ sub process {
if (my $image = WebGUI::Asset::File::Image->newByUrl($session,$url)) { if (my $image = WebGUI::Asset::File::Image->newByUrl($session,$url)) {
return $image->getThumbnailUrl; return $image->getThumbnailUrl;
} else { } else {
return undef; return;
} }
} }

View file

@ -77,11 +77,11 @@ sub connect {
my $pop = Net::POP3->new($params->{server}, Timeout => 60); my $pop = Net::POP3->new($params->{server}, Timeout => 60);
unless (defined $pop) { unless (defined $pop) {
$session->errorHandler->error("Couldn't connect to POP3 server ". $params->{server}); $session->errorHandler->error("Couldn't connect to POP3 server ". $params->{server});
return undef; return;
} }
unless ($pop->login($params->{account}, $params->{password})) { unless ($pop->login($params->{account}, $params->{password})) {
$session->errorHandler->error("Couldn't log in to POP3 server ".$params->{server}." as ".$params->{account}); $session->errorHandler->error("Couldn't log in to POP3 server ".$params->{server}." as ".$params->{account});
return undef; return;
} }
my $messageNumbers = $pop->list; my $messageNumbers = $pop->list;
my @ids = (); my @ids = ();
@ -150,7 +150,7 @@ Retrieves the next available message from the server. Returns undef if there are
sub getNextMessage { sub getNextMessage {
my $self = shift; my $self = shift;
my $id = pop(@{$self->{_ids}}); my $id = pop(@{$self->{_ids}});
return undef unless $id; return unless $id;
my $rawMessage = $self->{_pop}->get($id); my $rawMessage = $self->{_pop}->get($id);
my $parser = MIME::Parser->new; my $parser = MIME::Parser->new;
$parser->output_to_core(1); $parser->output_to_core(1);
@ -159,7 +159,7 @@ sub getNextMessage {
$self->{_pop}->delete($id); $self->{_pop}->delete($id);
} else { } else {
$self->session->errorHandler->error("Could not parse POP3 message $id"); $self->session->errorHandler->error("Could not parse POP3 message $id");
return undef; return;
} }
my $head = $parsedMessage->head; my $head = $parsedMessage->head;
my $type = $head->get("Content-Type"); my $type = $head->get("Content-Type");

View file

@ -394,9 +394,9 @@ sub retrieve {
my $class = shift; my $class = shift;
my $session = shift; my $session = shift;
my $messageId = shift; my $messageId = shift;
return undef unless $messageId; return unless $messageId;
my $data = $session->db->getRow("mailQueue","messageId", $messageId); my $data = $session->db->getRow("mailQueue","messageId", $messageId);
return undef unless $data->{messageId}; return unless $data->{messageId};
$session->db->deleteRow("mailQueue","messageId", $messageId); $session->db->deleteRow("mailQueue","messageId", $messageId);
my $parser = MIME::Parser->new; my $parser = MIME::Parser->new;
$parser->output_to_core(1); $parser->output_to_core(1);

View file

@ -54,7 +54,7 @@ Handles a click on an advertisement.
sub www_clickAd { sub www_clickAd {
my $session = shift; my $session = shift;
my $id = $session->form->param("id"); my $id = $session->form->param("id");
return undef unless $id; return unless $id;
my $url = WebGUI::AdSpace->countClick($session, $id); my $url = WebGUI::AdSpace->countClick($session, $id);
$session->http->setRedirect($url); $session->http->setRedirect($url);
return "Redirecting to $url"; return "Redirecting to $url";

View file

@ -157,7 +157,7 @@ sub _get {
} }
else { else {
$session->errorHandler->warn("Unable to load help for $namespace -> $id"); $session->errorHandler->warn("Unable to load help for $namespace -> $id");
return undef; return;
} }
} }

View file

@ -45,7 +45,7 @@ sub www_ssoViaSessionId {
} }
} }
} }
return undef; return;
} }

View file

@ -41,12 +41,12 @@ An instanciated session object.
sub _getSpeller { sub _getSpeller {
my ($baseDir, $userDir, $homeDir); my ($baseDir, $userDir, $homeDir);
my $session = shift; my $session = shift;
return undef unless Text::Aspell->can('new'); return unless Text::Aspell->can('new');
my $speller = Text::Aspell->new; my $speller = Text::Aspell->new;
# Get language # Get language
my $lang = $session->form->process('lang'); my $lang = $session->form->process('lang');
return undef unless (isIn($lang, map {m/^.*?:([^:]*):.*?$/} $speller->list_dictionaries)); return unless (isIn($lang, map {m/^.*?:([^:]*):.*?$/} $speller->list_dictionaries));
# User homedir # User homedir
my $userId = $session->user->userId; my $userId = $session->user->userId;

View file

@ -537,7 +537,7 @@ sub www_setWorkingVersionTag () {
$tag->setWorking(); $tag->setWorking();
} }
if ($session->form->param("backToSite")) { if ($session->form->param("backToSite")) {
return undef; return;
} }
return www_manageVersions($session); return www_manageVersions($session);
} }

View file

@ -73,7 +73,7 @@ sub delete {
$self->session->db->write("delete from productVariants where productId=".$self->session->db->quote($self->get('productId'))); $self->session->db->write("delete from productVariants where productId=".$self->session->db->quote($self->get('productId')));
$self->session->db->write("delete from products where productId=".$self->session->db->quote($self->get('productId'))); $self->session->db->write("delete from products where productId=".$self->session->db->quote($self->get('productId')));
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -87,7 +87,7 @@ sub deleteParameter {
$self->updateVariants; $self->updateVariants;
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -110,7 +110,7 @@ sub deleteOption {
$self->updateVariants; $self->updateVariants;
return undef; return;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -136,7 +136,7 @@ sub getByOptionId {
($productId) = $session->db->quickArray("select productId from productParameters as t1, productParameterOptions as t2 ". ($productId) = $session->db->quickArray("select productId from productParameters as t1, productParameterOptions as t2 ".
"where t1.parameterId=t2.parameterId and t2.optionId=".$session->db->quote($optionId)); "where t1.parameterId=t2.parameterId and t2.optionId=".$session->db->quote($optionId));
return undef unless ($productId); return unless ($productId);
return WebGUI::Product->new($session,$productId); return WebGUI::Product->new($session,$productId);
} }

View file

@ -278,7 +278,7 @@ sub new {
my $class = shift; my $class = shift;
my $session = shift; my $session = shift;
my $id = shift; my $id = shift;
return undef unless ($id); return unless ($id);
my $properties = $session->db->getRow("userProfileCategory","profileCategoryId",$id); my $properties = $session->db->getRow("userProfileCategory","profileCategoryId",$id);
bless {_session=>$session, _properties=>$properties}, $class; bless {_session=>$session, _properties=>$properties}, $class;
} }

View file

@ -109,8 +109,8 @@ sub create {
"select count(*) from userProfileField where fieldName=?", "select count(*) from userProfileField where fieldName=?",
[$fieldName] [$fieldName]
); );
return undef if $fieldNameExists; return if $fieldNameExists;
return undef if $class->isReservedFieldName($fieldName); return if $class->isReservedFieldName($fieldName);
### Data okay, create the field ### Data okay, create the field
# Add the record # Add the record
@ -553,11 +553,11 @@ sub new {
my $class = shift; my $class = shift;
my $session = shift; my $session = shift;
my $id = shift; my $id = shift;
return undef unless ($id); return unless ($id);
return undef if $class->isReservedFieldName($id); return if $class->isReservedFieldName($id);
my $properties = $session->db->getRow("userProfileField","fieldName",$id); my $properties = $session->db->getRow("userProfileField","fieldName",$id);
# Reject properties that don't exist. # Reject properties that don't exist.
return undef unless scalar keys %$properties; return unless scalar keys %$properties;
bless {_session=>$session, _properties=>$properties}, $class; bless {_session=>$session, _properties=>$properties}, $class;
} }
@ -731,10 +731,10 @@ The unique ID of a category to assign this field to.
sub setCategory { sub setCategory {
my $self = shift; my $self = shift;
my $categoryId = shift; my $categoryId = shift;
return undef unless ($categoryId); return unless ($categoryId);
my $currentCategoryId = $self->get("profileCategoryId"); my $currentCategoryId = $self->get("profileCategoryId");
return undef if ($categoryId eq $currentCategoryId); return if ($categoryId eq $currentCategoryId);
my ($sequenceNumber) = $self->session->db->quickArray("select max(sequenceNumber) from userProfileField where profileCategoryId=".$self->session->db->quote($categoryId)); my ($sequenceNumber) = $self->session->db->quickArray("select max(sequenceNumber) from userProfileField where profileCategoryId=".$self->session->db->quote($categoryId));
$self->session->db->setRow("userProfileField","fieldName",{fieldName=>$self->getId, profileCategoryId=>$categoryId, sequenceNumber=>$sequenceNumber+1}); $self->session->db->setRow("userProfileField","fieldName",{fieldName=>$self->getId, profileCategoryId=>$categoryId, sequenceNumber=>$sequenceNumber+1});

View file

@ -323,7 +323,7 @@ sub connect {
unless (defined $dbh) { unless (defined $dbh) {
$session->errorHandler->error("Couldn't connect to database: $dsn"); $session->errorHandler->error("Couldn't connect to database: $dsn");
return undef; return;
} }
##Set specific attributes for this database. ##Set specific attributes for this database.

View file

@ -313,7 +313,7 @@ sub unconditionalRead {
$sth->execute(@$placeholders) or $errorHandler->warn("Unconditional read failed: ".$sql." : ".$sth->errstr); $sth->execute(@$placeholders) or $errorHandler->warn("Unconditional read failed: ".$sql." : ".$sth->errstr);
bless {_sql=>$sql, _db=>$db, _sth=>$sth}, $class; bless {_sql=>$sql, _db=>$db, _sth=>$sth}, $class;
} else { } else {
return undef; return;
} }
} }

View file

@ -422,7 +422,7 @@ An integer ranging from 1-7 representing the day of the week (Sunday is 1 and Sa
sub getDayName { sub getDayName {
my $self = shift; my $self = shift;
my $day = shift; my $day = shift;
return undef unless ($day >= 1 && $day <= 7); return unless ($day >= 1 && $day <= 7);
my $i18n = WebGUI::International->new($self->session,'DateTime'); my $i18n = WebGUI::International->new($self->session,'DateTime');
return $i18n->get((qw/monday tuesday wednesday thursday friday saturday sunday/)[$day-1]); return $i18n->get((qw/monday tuesday wednesday thursday friday saturday sunday/)[$day-1]);
@ -552,7 +552,7 @@ An integer ranging from 1-12 representing the month.
sub getMonthName { sub getMonthName {
my $self = shift; my $self = shift;
my $month = shift; my $month = shift;
return undef unless ($month >= 1 && $month <= 12); return unless ($month >= 1 && $month <= 12);
my $i18n = WebGUI::International->new($self->session,'DateTime'); my $i18n = WebGUI::International->new($self->session,'DateTime');
return $i18n->get((qw/january february march april may june return $i18n->get((qw/january february march april may june
@ -734,7 +734,7 @@ sub mailToEpoch {
my $dt = eval {$parser->parse_datetime($date)}; my $dt = eval {$parser->parse_datetime($date)};
if ($@) { if ($@) {
$self->session->errorHandler->warn($date." is not a valid date for email, and is so poorly formatted, we can't even guess what it is."); $self->session->errorHandler->warn($date." is not a valid date for email, and is so poorly formatted, we can't even guess what it is.");
return undef; return;
} }
return $dt->epoch; return $dt->epoch;
} }
@ -909,7 +909,7 @@ A string in the format of YYYY-MM-DD or YYYY-MM-DD HH:MM:SS.
sub setToEpoch { sub setToEpoch {
my $self = shift; my $self = shift;
my $set = shift; my $set = shift;
return undef unless $set; return unless $set;
my $time_zone = $self->getTimeZone(); my $time_zone = $self->getTimeZone();
my $parser = DateTime::Format::Strptime->new(pattern=>'%Y-%m-%d %H:%M:%S', time_zone=>$time_zone); my $parser = DateTime::Format::Strptime->new(pattern=>'%Y-%m-%d %H:%M:%S', time_zone=>$time_zone);
my $dt = $parser->parse_datetime($set); my $dt = $parser->parse_datetime($set);

View file

@ -110,7 +110,7 @@ sub param {
@data = $self->session->request->param($field); @data = $self->session->request->param($field);
return wantarray ? @data : $data[0]; return wantarray ? @data : $data[0];
} else { } else {
return undef; return;
} }
} else { } else {
if ($self->session->request) { if ($self->session->request) {
@ -123,7 +123,7 @@ sub param {
} }
return keys %params; return keys %params;
} else { } else {
return undef; return;
} }
} }
} }

View file

@ -264,11 +264,11 @@ Generates and sends HTTP headers for a response.
sub sendHeader { sub sendHeader {
my $self = shift; my $self = shift;
return undef if ($self->{_http}{noHeader}); return if ($self->{_http}{noHeader});
return $self->_sendMinimalHeader unless defined $self->session->db(1); return $self->_sendMinimalHeader unless defined $self->session->db(1);
my ($request, $datetime, $config, $var) = $self->session->quick(qw(request datetime config var)); my ($request, $datetime, $config, $var) = $self->session->quick(qw(request datetime config var));
return undef unless $request; return unless $request;
my $userId = $var->get("userId"); my $userId = $var->get("userId");
# send webgui session cookie # send webgui session cookie
@ -508,7 +508,7 @@ sub setRedirect {
my $self = shift; my $self = shift;
my $url = shift; my $url = shift;
my @params = $self->session->form->param; my @params = $self->session->form->param;
return undef if ($url eq $self->session->url->page() && scalar(@params) < 1); # prevent redirecting to self return if ($url eq $self->session->url->page() && scalar(@params) < 1); # prevent redirecting to self
$self->session->errorHandler->info("Redirecting to $url"); $self->session->errorHandler->info("Redirecting to $url");
$self->{_http}{location} = $url; $self->{_http}{location} = $url;
$self->setStatus("302", "Redirect"); $self->setStatus("302", "Redirect");

View file

@ -60,7 +60,7 @@ The name of the scratch variable.
sub delete { sub delete {
my $self = shift; my $self = shift;
my $name = shift; my $name = shift;
return undef unless ($name); return unless ($name);
my $value = delete $self->{_data}{$name}; my $value = delete $self->{_data}{$name};
$self->session->db->write("delete from userSessionScratch where name=? and sessionId=?", [$name, $self->session->getId]); $self->session->db->write("delete from userSessionScratch where name=? and sessionId=?", [$name, $self->session->getId]);
return $value; return $value;
@ -97,7 +97,7 @@ The name of the scratch variable.
sub deleteName { sub deleteName {
my $self = shift; my $self = shift;
my $name = shift; my $name = shift;
return undef unless ($name); return unless ($name);
delete $self->{_data}{$name}; delete $self->{_data}{$name};
$self->session->db->write("delete from userSessionScratch where name=?", [$name]); $self->session->db->write("delete from userSessionScratch where name=?", [$name]);
} }
@ -122,7 +122,7 @@ sub deleteNameByValue {
my $self = shift; my $self = shift;
my $name = shift; my $name = shift;
my $value = shift; my $value = shift;
return undef unless ($name and defined $value); return unless ($name and defined $value);
delete $self->{_data}{$name} if ($self->{_data}{$name} eq $value); delete $self->{_data}{$name} if ($self->{_data}{$name} eq $value);
$self->session->db->write("delete from userSessionScratch where name=? and value=?", [$name,$value]); $self->session->db->write("delete from userSessionScratch where name=? and value=?", [$name,$value]);
} }
@ -215,7 +215,7 @@ sub set {
my $self = shift; my $self = shift;
my $name = shift; my $name = shift;
my $value = shift; my $value = shift;
return undef unless ($name); return unless ($name);
$self->{_data}{$name} = $value; $self->{_data}{$name} = $value;
$self->session->db->write("insert into userSessionScratch (sessionId, name, value) values (?,?,?) on duplicate key update value=VALUES(value)", [$self->session->getId, $name, $value]); $self->session->db->write("insert into userSessionScratch (sessionId, name, value) values (?,?,?) on duplicate key update value=VALUES(value)", [$self->session->getId, $name, $value]);
} }

View file

@ -58,7 +58,7 @@ The name of the stow variable.
sub delete { sub delete {
my $self = shift; my $self = shift;
my $name = shift; my $name = shift;
return undef unless ($name); return unless ($name);
delete $self->{_data}{$name}; delete $self->{_data}{$name};
} }
@ -108,7 +108,7 @@ The name of the variable.
sub get { sub get {
my $self = shift; my $self = shift;
my $var = shift; my $var = shift;
return undef if $self->session->config->get("disableCache"); return if $self->session->config->get("disableCache");
return $self->{_data}{$var}; return $self->{_data}{$var};
} }
@ -167,7 +167,7 @@ sub set {
if $self->session->config->get("disableCache"); if $self->session->config->get("disableCache");
my $name = shift; my $name = shift;
my $value = shift; my $value = shift;
return undef unless ($name); return unless ($name);
$self->{_data}{$name} = $value; $self->{_data}{$name} = $value;
} }

View file

@ -280,7 +280,7 @@ sub setLink {
my $url = shift; my $url = shift;
my $params = shift; my $params = shift;
$params = {} unless (defined $params and ref $params eq 'HASH'); $params = {} unless (defined $params and ref $params eq 'HASH');
return undef if ($self->{_link}{$url}); return if ($self->{_link}{$url});
my $tag = '<link href="'.$url.'"'; my $tag = '<link href="'.$url.'"';
foreach my $name (keys %{$params}) { foreach my $name (keys %{$params}) {
$tag .= ' '.$name.'="'.$params->{$name}.'"'; $tag .= ' '.$name.'="'.$params->{$name}.'"';
@ -390,7 +390,7 @@ sub setScript {
my $self = shift; my $self = shift;
my $url = shift; my $url = shift;
my $params = shift; my $params = shift;
return undef if ($self->{_javascript}{$url}); return if ($self->{_javascript}{$url});
my $tag = '<script src="'.$url.'"'; my $tag = '<script src="'.$url.'"';
foreach my $name (keys %{$params}) { foreach my $name (keys %{$params}) {
$tag .= ' '.$name.'="'.$params->{$name}.'"'; $tag .= ' '.$name.'="'.$params->{$name}.'"';
@ -438,7 +438,7 @@ sub userStyle {
if (defined $output) { if (defined $output) {
return $self->process($output,$self->session->setting->get("userFunctionStyleId")); return $self->process($output,$self->session->setting->get("userFunctionStyleId"));
} else { } else {
return undef; return;
} }
} }

View file

@ -230,12 +230,12 @@ Returns the URL of the page this request was refered from (no gateway, no query
sub getRefererUrl { sub getRefererUrl {
my $self = shift; my $self = shift;
my $referer = $self->session->env->get("HTTP_REFERER"); my $referer = $self->session->env->get("HTTP_REFERER");
return undef unless ($referer); return unless ($referer);
my $url = $referer; my $url = $referer;
my $gateway = $self->session->config->get("gateway"); my $gateway = $self->session->config->get("gateway");
$url =~ s{https?://[A-Za-z0-9\.-]+$gateway/*([^?]*)\??.*$}{$1}; $url =~ s{https?://[A-Za-z0-9\.-]+$gateway/*([^?]*)\??.*$}{$1};
if ($url eq $referer) { ##s/// failed if ($url eq $referer) { ##s/// failed
return undef; return;
} else { } else {
return $url; return $url;
} }
@ -252,7 +252,7 @@ Returns the URL of the page requested (no gateway, no query params, just the pag
sub getRequestedUrl { sub getRequestedUrl {
my $self = shift; my $self = shift;
return undef unless ($self->session->request); return unless ($self->session->request);
unless ($self->{_requestedUrl}) { unless ($self->{_requestedUrl}) {
$self->{_requestedUrl} = $self->session->request->uri; $self->{_requestedUrl} = $self->session->request->uri;
my $gateway = $self->session->config->get("gateway"); my $gateway = $self->session->config->get("gateway");

View file

@ -486,7 +486,7 @@ a:visited { color: '.$form->get("visitedLinkColor").'; }
# remove init state # remove init state
$session->setting->remove('specialState'); $session->setting->remove('specialState');
$session->http->setRedirect($session->url->gateway("?setup=complete")); $session->http->setRedirect($session->url->gateway("?setup=complete"));
return undef; return;
} }
else { else {
$legend = "Admin Acccount"; $legend = "Admin Acccount";

View file

@ -227,11 +227,11 @@ sub addFileFromFormPost {
close($file); close($file);
} else { } else {
$self->_addError("Couldn't open file ".$self->getPath($filename)." for writing due to error: ".$!); $self->_addError("Couldn't open file ".$self->getPath($filename)." for writing due to error: ".$!);
return undef; return;
} }
} }
return $filename if $filename; return $filename if $filename;
return undef; return;
} }
@ -465,7 +465,7 @@ it doesn't.
sub deleteFile { sub deleteFile {
my $self = shift; my $self = shift;
my $filename = shift; my $filename = shift;
return undef if $filename =~ m{\.\./}; ##prevent deleting files outside of this object return if $filename =~ m{\.\./}; ##prevent deleting files outside of this object
unlink($self->getPath($filename)); unlink($self->getPath($filename));
} }
@ -490,7 +490,7 @@ sub get {
my $class = shift; my $class = shift;
my $session = shift; my $session = shift;
my $id = shift; my $id = shift;
return undef unless $id; return unless $id;
my $guid = $id; my $guid = $id;
my $self; my $self;
@ -762,7 +762,7 @@ sub getPath {
unless ($self->session->config->get("uploadsPath") && $self->{_part1} && $self->{_part2} && $id) { unless ($self->session->config->get("uploadsPath") && $self->{_part1} && $self->{_part2} && $id) {
$self->_addError("storage object malformed"); $self->_addError("storage object malformed");
return undef; return;
} }
my $path = $self->session->config->get("uploadsPath") my $path = $self->session->config->get("uploadsPath")
. '/' . '/'

View file

@ -559,8 +559,8 @@ sub newByEmail {
my $email = shift; my $email = shift;
my ($id) = $session->dbSlave->quickArray("select userId from userProfileData where email=?",[$email]); my ($id) = $session->dbSlave->quickArray("select userId from userProfileData where email=?",[$email]);
my $user = $class->new($session, $id); my $user = $class->new($session, $id);
return undef if ($user->userId eq "1"); # visitor is never valid for this method return if ($user->userId eq "1"); # visitor is never valid for this method
return undef unless $user->username; return unless $user->username;
return $user; return $user;
} }
@ -588,8 +588,8 @@ sub newByUsername {
my $username = shift; my $username = shift;
my ($id) = $session->dbSlave->quickArray("select userId from users where username=?",[$username]); my ($id) = $session->dbSlave->quickArray("select userId from users where username=?",[$username]);
my $user = $class->new($session, $id); my $user = $class->new($session, $id);
return undef if ($user->userId eq "1"); # visitor is never valid for this method return if ($user->userId eq "1"); # visitor is never valid for this method
return undef unless $user->username; return unless $user->username;
return $user; return $user;
} }
@ -617,7 +617,7 @@ sub profileField {
my $db = $self->session->db; my $db = $self->session->db;
if (!exists $self->{_profile}{$fieldName} && !$self->session->db->quickScalar("SELECT COUNT(*) FROM userProfileField WHERE fieldName = ?", [$fieldName]) ) { if (!exists $self->{_profile}{$fieldName} && !$self->session->db->quickScalar("SELECT COUNT(*) FROM userProfileField WHERE fieldName = ?", [$fieldName]) ) {
$self->session->errorHandler->warn("No such profile field: $fieldName"); $self->session->errorHandler->warn("No such profile field: $fieldName");
return undef; return;
} }
if (defined $value) { if (defined $value) {
$self->uncache; $self->uncache;

View file

@ -182,13 +182,13 @@ sub isInSubnet {
for my $cidr ( @{ $subnets } ) { for my $cidr ( @{ $subnets } ) {
my @parts = $cidr =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)\/(\d+)$/; my @parts = $cidr =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)\/(\d+)$/;
unless ( 5 == @parts ) { # cidr has 5 parts unless ( 5 == @parts ) { # cidr has 5 parts
return undef; return;
} }
unless ( 4 == grep { $_ <= 255 } @parts[0..3] ) { # each octet needs to be between 0 and 255 unless ( 4 == grep { $_ <= 255 } @parts[0..3] ) { # each octet needs to be between 0 and 255
return undef; return;
} }
unless ( $parts[4] <= 32 ) { # the subnet needs to be less than or equal to 32, as 32 represents only 1 ip address unless ( $parts[4] <= 32 ) { # the subnet needs to be less than or equal to 32, as 32 represents only 1 ip address
return undef; return;
} }
} }
my $net = Net::Subnets->new; my $net = Net::Subnets->new;

View file

@ -328,7 +328,7 @@ sub getWorking {
$session->stow->set("versionTag",$tag); $session->stow->set("versionTag",$tag);
return $tag; return $tag;
} elsif ($noCreate) { } elsif ($noCreate) {
return undef; return;
} else { } else {
my $tag = $class->create($session); my $tag = $class->create($session);
$tag->setWorking; $tag->setWorking;
@ -375,7 +375,7 @@ sub new {
my $session = shift; my $session = shift;
my $tagId = shift; my $tagId = shift;
my $data = $session->db->getRow("assetVersionTag","tagId", $tagId); my $data = $session->db->getRow("assetVersionTag","tagId", $tagId);
return undef unless $data->{tagId}; return unless $data->{tagId};
bless {_session=>$session, _id=>$tagId, _data=>$data}, $class; bless {_session=>$session, _id=>$tagId, _data=>$data}, $class;
} }

View file

@ -417,7 +417,7 @@ sub new {
my $session = shift; my $session = shift;
my $workflowId = shift; my $workflowId = shift;
my $data = $session->db->getRow("Workflow","workflowId", $workflowId); my $data = $session->db->getRow("Workflow","workflowId", $workflowId);
return undef unless $data->{workflowId}; return unless $data->{workflowId};
bless {_session=>$session, _id=>$workflowId, _data=>$data}, $class; bless {_session=>$session, _id=>$workflowId, _data=>$data}, $class;
} }

View file

@ -295,12 +295,12 @@ sub new {
my $session = shift; my $session = shift;
my $activityId = shift; my $activityId = shift;
my $main = $session->db->getRow("WorkflowActivity","activityId", $activityId); my $main = $session->db->getRow("WorkflowActivity","activityId", $activityId);
return undef unless $main->{activityId}; return unless $main->{activityId};
$class = $main->{className}; $class = $main->{className};
(my $module = "$class.pm") =~ s{'|::}{/}g; (my $module = "$class.pm") =~ s{'|::}{/}g;
unless (eval { require $module; 1 }) { unless (eval { require $module; 1 }) {
$session->errorHandler->error("Couldn't compile workflow activity package: ".$class.". Root cause: ".$@); $session->errorHandler->error("Couldn't compile workflow activity package: ".$class.". Root cause: ".$@);
return undef; return;
} }
my $sub = $session->db->buildHashRef("select name,value from WorkflowActivityData where activityId=?",[$activityId]); my $sub = $session->db->buildHashRef("select name,value from WorkflowActivityData where activityId=?",[$activityId]);
my %data = (%{$main}, %{$sub}); my %data = (%{$main}, %{$sub});
@ -334,14 +334,14 @@ sub newByPropertyHashRef {
my $class = shift; my $class = shift;
my $session = shift; my $session = shift;
my $properties = shift; my $properties = shift;
return undef unless defined $properties; return unless defined $properties;
return undef unless exists $properties->{className}; return unless exists $properties->{className};
my $className = $properties->{className}; my $className = $properties->{className};
my $cmd = "use ".$className; my $cmd = "use ".$className;
eval ($cmd); eval ($cmd);
if ($@) { if ($@) {
$session->errorHandler->warn("Couldn't compile activity package: ".$className.". Root cause: ".$@); $session->errorHandler->warn("Couldn't compile activity package: ".$className.". Root cause: ".$@);
return undef; return;
} }
bless {_session=>$session, _id=>$properties->{activityId}, _data => $properties}, $className; bless {_session=>$session, _id=>$properties->{activityId}, _data => $properties}, $className;
} }

View file

@ -176,7 +176,7 @@ sub new {
my $session = shift; my $session = shift;
my $taskId = shift; my $taskId = shift;
my $data = $session->db->getRow("WorkflowSchedule","taskId", $taskId); my $data = $session->db->getRow("WorkflowSchedule","taskId", $taskId);
return undef unless $data->{taskId}; return unless $data->{taskId};
bless {_session=>$session, _id=>$taskId, _data=>$data}, $class; bless {_session=>$session, _id=>$taskId, _data=>$data}, $class;
} }

View file

@ -68,7 +68,7 @@ sub create {
? JSON::objToJson({parameters => $properties->{parameters}}, {pretty => 1, indent => 4, autoconv=>0, skipinvalid=>1}) ? JSON::objToJson({parameters => $properties->{parameters}}, {pretty => 1, indent => 4, autoconv=>0, skipinvalid=>1})
: undef; : undef;
my ($count) = $session->db->quickArray("select count(*) from WorkflowInstance where workflowId=? and parameters=?",[$properties->{workflowId},$params]); my ($count) = $session->db->quickArray("select count(*) from WorkflowInstance where workflowId=? and parameters=?",[$properties->{workflowId},$params]);
return undef if ($isSingleton && $count); return if ($isSingleton && $count);
# create instance # create instance
my $instanceId = $session->db->setRow("WorkflowInstance","instanceId",{instanceId=>"new", runningSince=>time()}); my $instanceId = $session->db->setRow("WorkflowInstance","instanceId",{instanceId=>"new", runningSince=>time()});
@ -203,7 +203,7 @@ Returns a reference to the next activity in this workflow from the current posit
sub getNextActivity { sub getNextActivity {
my $self = shift; my $self = shift;
my $workflow = $self->getWorkflow; my $workflow = $self->getWorkflow;
return undef unless defined $workflow; return unless defined $workflow;
return $workflow->getNextActivity($self->get("currentActivityId")); return $workflow->getNextActivity($self->get("currentActivityId"));
} }
@ -261,7 +261,7 @@ sub new {
my $session = shift; my $session = shift;
my $instanceId = shift; my $instanceId = shift;
my $data = $session->db->getRow("WorkflowInstance","instanceId", $instanceId); my $data = $session->db->getRow("WorkflowInstance","instanceId", $instanceId);
return undef unless $data->{instanceId}; return unless $data->{instanceId};
bless {_session=>$session, _id=>$instanceId, _data=>$data}, $class; bless {_session=>$session, _id=>$instanceId, _data=>$data}, $class;
} }