replaced return; with return undef;

This commit is contained in:
JT Smith 2008-01-24 21:58:15 +00:00
parent ffa90c5fbd
commit fa09c41598
113 changed files with 287 additions and 286 deletions

View file

@ -298,7 +298,7 @@ sub getDateTimeStart {
#$self->session->errorHandler->warn($self->getId.":: Date: $date -- Time: $time");
if (!$date) {
$self->session->errorHandler->warn("Event::getDateTimeStart -- This event (".$self->get("assetId").") has no start date.");
return;
return undef;
}
if ($time) {
@ -337,7 +337,7 @@ sub getDateTimeEnd {
#$self->session->errorHandler->warn($self->getId.":: Date: $date -- Time: $time");
if (!$date) {
$self->session->errorHandler->warn("Event::getDateTimeEnd -- This event (".$self->get("assetId").") has no end date.");
return;
return undef;
}
if ($time) {
@ -405,7 +405,7 @@ sub getEventNext {
});
return unless $events->[0];
return undef unless $events->[0];
return WebGUI::Asset->newByDynamicClass($self->session,$events->[0]);
}
@ -461,7 +461,7 @@ sub getEventPrev {
limit => 1,
});
return unless $events->[0];
return undef unless $events->[0];
return WebGUI::Asset->newByDynamicClass($self->session,$events->[0]);
}
@ -711,7 +711,7 @@ sub getRecurrenceDates {
my %date;
my $recur = {$self->getRecurrence};
return unless $recur->{recurType};
return undef unless $recur->{recurType};
my %dayNames = (
monday => "m",
@ -1650,7 +1650,7 @@ sub processPropertiesFromFormPost {
delete $self->{_storageLocation};
$self->requestAutoCommit;
return;
return undef;
}
#-------------------------------------------------------------------
@ -1691,7 +1691,7 @@ sub setRecurrence {
my $self = shift;
my $vars = shift;
my $type = $vars->{recurType} || return;
my $type = $vars->{recurType} || return undef;
my $pattern;
if ($type eq "daily" || $type eq "weekday") {
@ -1794,7 +1794,7 @@ sub setRelatedLinks {
}
}
return;
return undef;
}
####################################################################

View file

@ -230,7 +230,7 @@ sub getFileUrl {
#-------------------------------------------------------------------
sub getFileIconUrl {
my $self = shift;
return unless $self->get("filename"); ## Why do I have to do this when creating new Files?
return undef unless $self->get("filename"); ## Why do I have to do this when creating new Files?
return $self->getStorageLocation->getFileIconUrl($self->get("filename"));
}
@ -337,7 +337,7 @@ sub processPropertiesFromFormPost {
$storage->delete;
}
return;
return undef;
}
@ -483,7 +483,7 @@ sub updatePropertiesFromStorage {
$self->update({
filename => $filename,
});
return;
return undef;
}
#-------------------------------------------------------------------

View file

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

View file

@ -677,7 +677,7 @@ sub updateExifDataFromFile {
my $self = shift;
my $storage = $self->getStorageLocation;
return;
return undef;
my $info = ImageInfo( $storage->getPath( $self->get('filename') ) );
use Data::Dumper; $self->session->errorHandler->info( Dumper $info );
$self->update({

View file

@ -167,20 +167,20 @@ sub processPropertiesFromFormPost {
my $file = $self->get("filename");
#return unless $file;
#return undef unless $file;
my $i18n = WebGUI::International->new($self->session, 'Asset_ZipArchive');
unless ($self->session->form->process("showPage")) {
$storage->delete;
$self->session->db->write("update FileAsset set filename=NULL where assetId=".$self->session->db->quote($self->getId));
$self->session->scratch->set("za_error",$i18n->get("za_show_error"));
return;
return undef;
}
unless ($file =~ m/\.tar/i || $file =~ m/\.zip/i) {
$storage->delete;
$self->session->db->write("update FileAsset set filename=NULL where assetId=".$self->session->db->quote($self->getId));
$self->session->scratch->set("za_error",$i18n->get("za_error"));
return;
return undef;
}
unless ($self->unzip($storage,$self->get("filename"))) {

View file

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

View file

@ -86,7 +86,7 @@ sub duplicateBranch {
#-------------------------------------------------------------------
sub createSubscriptionGroup {
my $self = shift;
return if ($self->get("subscriptionGroupId"));
return undef if ($self->get("subscriptionGroupId"));
my $group = WebGUI::Group->new($self->session, "new");
$group->name($self->getId);
$group->description("The group to store subscriptions for the thread ".$self->getId);
@ -167,7 +167,7 @@ sub definition {
sub DESTROY {
my $self = shift;
return unless defined $self;
return undef unless defined $self;
$self->{_next}->DESTROY if (defined $self->{_next});
$self->{_previous}->DESTROY if (defined $self->{_previous});
$self->SUPER::DESTROY;
@ -594,8 +594,8 @@ An integer between 1 and 5 (5 being best) to rate this post with.
sub rate {
my $self = shift;
my $rating = shift;
return unless ($rating == -1 || $rating == 1);
return if $self->hasRated;
return undef unless ($rating == -1 || $rating == 1);
return undef if $self->hasRated;
$self->SUPER::rate($rating);
##Thread specific karma adjustment for CS

View file

@ -144,7 +144,7 @@ sub processPropertiesFromFormPost {
$self->_ensureRssFromParentAbsent;
}
return;
return undef;
}
#-------------------------------------------------------------------
@ -159,7 +159,7 @@ if there is no such feed.
sub getRssUrl {
my $self = shift;
my $rssFromParentId = $self->get('rssCapableRssFromParentId');
return unless defined $rssFromParentId;
return undef unless defined $rssFromParentId;
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 {
my $self = shift;
return if ($self->getToolbarState);
return undef if ($self->getToolbarState);
return $self->SUPER::getToolbar();
}

View file

@ -365,7 +365,7 @@ sub getOverridesList {
$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>';
my $shortcut = $self->getShortcutOriginal;
return unless defined $shortcut;
return undef unless defined $shortcut;
foreach my $definition (@{$shortcut->definition($self->session)}) {
foreach my $prop (keys %{$definition->{properties}}) {
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 {
my $self = shift;
return if ($self->getToolbarState);
return undef if ($self->getToolbarState);
return '<p>'.$self->SUPER::getToolbar().'</p>';
}

View file

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

View file

@ -267,7 +267,7 @@ sub addChild {
if ($properties->{className} ne "WebGUI::Asset::Event") {
$self->session->errorHandler->security("add a ".$properties->{className}." to a ".$self->get("className"));
return;
return undef;
}
return $self->SUPER::addChild($properties, @other);
@ -360,7 +360,7 @@ sub createSubscriptionGroup {
groupIdSubscription => $group->getId
});
return;
return undef;
}
@ -579,7 +579,7 @@ this Calendar.
sub getEvent {
my $self = shift;
my $assetId = shift;
# Warn and return if no assetId
# Warn and return undef if no assetId
$self->session->errorHandler->warn("WebGUI::Asset::Wobject::Calendar->getEvent :: No asset ID."), return
unless $assetId;
@ -632,10 +632,10 @@ sub getEventsIn {
my $tz = $self->session->user->profileField("timeZone");
# Warn and return if no startDate or endDate
# Warn and return undef if no startDate or endDate
unless ($start && $end) {
$self->session->errorHandler->warn("WebGUI::Asset::Wobject::Calendar->getEventsIn() called with not enough arguments at ".join('::',(caller)[1,2]));
return;
return undef;
}
# Create objects and adjust for timezone

View file

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

View file

@ -264,11 +264,11 @@ sub addToScratchCart {
my $scratchCart = $self->session->scratch->get('EMS_scratch_cart');
my @eventsInCart = split("\n",$scratchCart);
my ($isApproved) = $self->session->db->quickArray("select approved from EventManagementSystem_products where productId = ?",[$event]);
return unless $isApproved;
return undef unless $isApproved;
unless (scalar(@eventsInCart) || $scratchCart) {
# 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]);
return if $isChild;
return undef if $isChild;
$self->session->scratch->set('currentMainEvent',$event);
$self->session->scratch->set('EMS_scratch_cart', $event);
return $event;
@ -276,7 +276,7 @@ sub addToScratchCart {
# 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 ($maxAttendees) = $self->session->db->quickArray("select maximumAttendees from EventManagementSystem_products where productId=?",[$event]);
return unless ($self->canApproveEvents || ($maxAttendees > $numberRegistered));
return undef unless ($self->canApproveEvents || ($maxAttendees > $numberRegistered));
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]):();
@ -1397,7 +1397,7 @@ sub verifyPrerequisitesForm {
my %var;
#If there is no missing event data, return nothing
return unless scalar(@$missingEventMessageLoop);
return undef unless scalar(@$missingEventMessageLoop);
my $i18n = WebGUI::International->new($self->session, 'Asset_EventManagementSystem');

View file

@ -102,7 +102,7 @@ sub addAlbumFromCollaboration {
$class->addAlbumFromThread( $gallery, $thread );
}
return;
return undef;
}
#----------------------------------------------------------------------------
@ -126,7 +126,7 @@ sub addAlbumFromFilesystem {
# TODO!!!
return;
return undef;
}
#----------------------------------------------------------------------------
@ -198,7 +198,7 @@ sub addAlbumFromThread {
}
}
return;
return undef;
}
1;

View file

@ -141,7 +141,7 @@ sub addArchive {
});
$versionTag->requestCommit;
return;
return undef;
}
#----------------------------------------------------------------------------

View file

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

View file

@ -299,7 +299,7 @@ sub getGraphConfig {
my $self = shift;
my $config = $self->get("graphConfiguration");
return unless $config;
return undef unless $config;
return $self->thawGraphConfig($config);
}

View file

@ -57,7 +57,7 @@ sub _clobberImproperDependants {
my $self = shift;
my $projectId = shift;
my @nondependTaskIds = $self->session->db->buildArray("SELECT sequenceNumber FROM PM_task WHERE projectId = ? AND taskType <> 'timed'", [$projectId]);
return unless @nondependTaskIds;
return undef unless @nondependTaskIds;
$self->session->db->write("UPDATE PM_task SET dependants = NULL WHERE projectId = ? AND dependants IN (".join(', ', ('?') x @nondependTaskIds).")", [$projectId, @nondependTaskIds]);
}
@ -444,12 +444,12 @@ sub getProjectInstance {
my $session = shift;
my $db = $session->db;
my $projectId = $_[0];
return unless $projectId;
return undef unless $projectId;
my ($assetId) = $db->quickArray("select assetId from PM_project where projectId=?",[$projectId]);
if($assetId) {
return WebGUI::Asset->newByDynamicClass($session,$assetId);
}
return;
return undef;
}
#-------------------------------------------------------------------

View file

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

View file

@ -286,7 +286,7 @@ sub getEditForm {
function toggleQuery(Id) {
queryClass = "query" + Id;
var tr = document.getElementsByTagName("tr");
if (tr == null) return;
if (tr == null) return undef;
for (i=0; i < tr.length; i++) {
if(tr[i].className == queryClass) {
if(tr[i].style.display == 'none') {
@ -384,7 +384,7 @@ sub download {
my $self = shift;
# Instead of going through some costly exercises...
return if ($self->getValue("downloadType") eq "none");
return undef if ($self->getValue("downloadType") eq "none");
# Initiate an empty debug loop
$self->{_debug_loop} = [] ;
@ -419,7 +419,7 @@ sub download {
}
else {
# I don't know what to do
return;
return undef;
}
}
@ -705,7 +705,7 @@ sub www_download {
my $self = shift;
# Only allow if download type is not "none"
return if $self->getValue("downloadType") eq "none";
return undef if $self->getValue("downloadType") eq "none";
# Only allow users in appropriate group
return $self->session->privilege->noAccess()

View file

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

View file

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

View file

@ -376,7 +376,7 @@ sub view {
# hashref
} elsif (ref $return eq 'HASH') {
@result = $return;
@result = $return undef;
# blessed object, to be stripped with Data::Structure::Util
} elsif ( ref $return) {