first round of Perl::Critic cleanups. Do not use return undef, use a bare return instead
This commit is contained in:
parent
75041656ee
commit
96178fd70c
92 changed files with 209 additions and 209 deletions
|
|
@ -374,7 +374,7 @@ sub getNextInstance {
|
|||
return $instance;
|
||||
}
|
||||
$self->debug("Didn't see any workflow instances to run.");
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -349,7 +349,7 @@ sub tryAssetMethod {
|
|||
my $asset = shift;
|
||||
my $method = shift;
|
||||
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);
|
||||
my $methodToTry = "www_".$method;
|
||||
my $output = eval{$asset->$methodToTry()};
|
||||
|
|
|
|||
|
|
@ -76,9 +76,9 @@ sub create {
|
|||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $properties = shift || {};
|
||||
return undef unless $properties->{name};
|
||||
return unless $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 $self = $class->new($session, $id);
|
||||
$self->set($properties);
|
||||
|
|
@ -236,7 +236,7 @@ sub new {
|
|||
my $session = shift;
|
||||
my $id = shift;
|
||||
my $properties = $session->db->getRow("adSpace","adSpaceId",$id);
|
||||
return undef unless $properties->{adSpaceId};
|
||||
return unless $properties->{adSpaceId};
|
||||
bless {_session=>$session, _properties=>$properties}, $class;
|
||||
}
|
||||
|
||||
|
|
@ -261,7 +261,7 @@ sub newByName {
|
|||
my $session = shift;
|
||||
my $name = shift;
|
||||
my $properties = $session->db->getRow("adSpace","name",$name);
|
||||
return undef unless $properties->{adSpaceId};
|
||||
return unless $properties->{adSpaceId};
|
||||
bless {_session=>$session, _properties=>$properties}, $class;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ sub new {
|
|||
my $session = shift;
|
||||
my $id = shift;
|
||||
my $properties = $session->db->getRow("advertisement","adId",$id);
|
||||
return undef unless $properties->{adId};
|
||||
return unless $properties->{adId};
|
||||
bless {_session=>$session, _properties=>$properties}, $class;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ The missing URL.
|
|||
sub addMissing {
|
||||
my $self = shift;
|
||||
my $assetUrl = shift;
|
||||
return undef unless ($self->session->var->isAdminOn);
|
||||
return unless ($self->session->var->isAdminOn);
|
||||
my $ac = $self->getAdminConsole;
|
||||
my $i18n = WebGUI::International->new($self->session, "Asset");
|
||||
my $output = $i18n->get("missing page query");
|
||||
|
|
@ -295,7 +295,7 @@ sub checkView {
|
|||
return $notFound->www_view;
|
||||
}
|
||||
$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 {
|
||||
my $self = shift;
|
||||
return undef unless $self->canEdit;
|
||||
return unless $self->canEdit;
|
||||
return $self->{_toolbar} if (exists $self->{_toolbar});
|
||||
my $userUiLevel = $self->session->user->profileField("uiLevel");
|
||||
my $uiLevels = $self->session->config->get("assetToolbarUiLevel");
|
||||
|
|
@ -1308,7 +1308,7 @@ sub getValue {
|
|||
}
|
||||
return $self->{_propertyDefinitions}{$key}{defaultValue};
|
||||
}
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1563,7 +1563,7 @@ sub manageAssets {
|
|||
</div>
|
||||
';
|
||||
$self->session->output->print($output);
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -1590,7 +1590,7 @@ sub manageAssetsSearch {
|
|||
$output .= WebGUI::Form::formFooter($self->session);
|
||||
$self->session->output->print($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 $assets = WebGUI::Search->new($self->session,0)->search({
|
||||
keywords=>$self->session->form->get("keywords"),
|
||||
|
|
@ -1655,7 +1655,7 @@ sub manageAssetsSearch {
|
|||
//]]>
|
||||
</script> <div class="adminConsoleSpacer"> </div>';
|
||||
$self->session->output->print($output);
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -1691,23 +1691,23 @@ sub new {
|
|||
|
||||
unless (defined $assetId) {
|
||||
$session->errorHandler->error("Asset constructor new() requires an assetId.");
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
my $revisionDate = shift || $class->getCurrentRevisionDate($session, $assetId);
|
||||
return undef unless ($revisionDate);
|
||||
return unless ($revisionDate);
|
||||
|
||||
unless ($class ne 'WebGUI::Asset' or defined $className) {
|
||||
($className) = $session->db->quickArray("select className from asset where assetId=?", [$assetId]);
|
||||
unless ($className) {
|
||||
$session->errorHandler->error("Couldn't instantiate asset: ".$assetId. ": couldn't find class name");
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($className) {
|
||||
$class = $class->loadModule($session, $className);
|
||||
return undef unless (defined $class);
|
||||
return unless (defined $class);
|
||||
}
|
||||
|
||||
my $cache = WebGUI::Cache->new($session, ["asset",$assetId,$revisionDate]);
|
||||
|
|
@ -1718,7 +1718,7 @@ sub new {
|
|||
$properties = WebGUI::Asset->assetDbProperties($session, $assetId, $class, $revisionDate);
|
||||
unless (exists $properties->{assetId}) {
|
||||
$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);
|
||||
}
|
||||
|
|
@ -1727,7 +1727,7 @@ sub new {
|
|||
bless $object, $class;
|
||||
return $object;
|
||||
}
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -1755,7 +1755,7 @@ sub newByDynamicClass {
|
|||
my $session = shift;
|
||||
my $assetId = shift;
|
||||
my $revisionDate = shift;
|
||||
return undef unless defined $assetId;
|
||||
return unless defined $assetId;
|
||||
my $assetClass = $session->stow->get("assetClass");
|
||||
my $className = $assetClass->{$assetId};
|
||||
unless ($className) {
|
||||
|
|
@ -1763,7 +1763,7 @@ sub newByDynamicClass {
|
|||
$assetClass->{$assetId} = $className;
|
||||
$session->stow->set("assetClass",$assetClass);
|
||||
}
|
||||
return undef unless ($className);
|
||||
return unless ($className);
|
||||
return WebGUI::Asset->new($session,$assetId,$className,$revisionDate);
|
||||
}
|
||||
|
||||
|
|
@ -1788,10 +1788,10 @@ sub newByPropertyHashRef {
|
|||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $properties = shift;
|
||||
return undef unless defined $properties;
|
||||
return undef unless exists $properties->{className};
|
||||
return unless defined $properties;
|
||||
return unless exists $properties->{className};
|
||||
my $className = $class->loadModule($session, $properties->{className});
|
||||
return undef unless (defined $className);
|
||||
return unless (defined $className);
|
||||
bless {_session=>$session, _properties => $properties}, $className;
|
||||
}
|
||||
|
||||
|
|
@ -1832,7 +1832,7 @@ sub newByUrl {
|
|||
return WebGUI::Asset->new($session,$id, $class, $revisionDate);
|
||||
} else {
|
||||
$session->errorHandler->warn("The URL $url was requested, but does not exist in your asset tree.");
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
}
|
||||
return WebGUI::Asset->getDefault($session);
|
||||
|
|
@ -2205,7 +2205,7 @@ sub www_add {
|
|||
my $self = shift;
|
||||
my %prototypeProperties;
|
||||
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));
|
||||
if ($self->session->form->process('prototype')) {
|
||||
my $prototype = WebGUI::Asset->new($self->session, $self->session->form->process("prototype"),$class);
|
||||
|
|
@ -2303,7 +2303,7 @@ sub www_changeUrlConfirm {
|
|||
return 'redirect';
|
||||
}
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -2468,7 +2468,7 @@ sub www_view {
|
|||
return $check if (defined $check);
|
||||
$self->prepareView;
|
||||
$self->session->output->print($self->view);
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -704,7 +704,7 @@ sub getRecurrenceDates {
|
|||
|
||||
my %date;
|
||||
my $recur = {$self->getRecurrence};
|
||||
return undef unless $recur->{recurType};
|
||||
return unless $recur->{recurType};
|
||||
|
||||
my %dayNames = (
|
||||
monday => "m",
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ Returns a toolbar with a set of icons that hyperlink to functions that delete, e
|
|||
|
||||
sub getToolbar {
|
||||
my $self = shift;
|
||||
return undef if ($self->getToolbarState);
|
||||
return if ($self->getToolbarState);
|
||||
return $self->SUPER::getToolbar();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 undef;
|
||||
return;
|
||||
}
|
||||
return $self->SUPER::addChild($properties, @other);
|
||||
}
|
||||
|
|
@ -371,7 +371,7 @@ sub getEditUrl {
|
|||
#-------------------------------------------------------------------
|
||||
sub getImageUrl {
|
||||
my $self = shift;
|
||||
return undef if ($self->get("storageId") eq "");
|
||||
return 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 undef if ($self->get("storageId") eq "");
|
||||
return 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 undef unless ($rating == -1 || $rating == 1);
|
||||
return undef if $self->hasRated;
|
||||
return unless ($rating == -1 || $rating == 1);
|
||||
return 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 undef unless ($rating == -1 || $rating == 1);
|
||||
return undef if $self->hasRated;
|
||||
return unless ($rating == -1 || $rating == 1);
|
||||
return if $self->hasRated;
|
||||
$self->insertUserPostRating($rating);
|
||||
$self->recalculatePostRating();
|
||||
$self->getThread->updateThreadRating();
|
||||
|
|
|
|||
|
|
@ -584,8 +584,8 @@ An integer between 1 and 5 (5 being best) to rate this post with.
|
|||
sub rate {
|
||||
my $self = shift;
|
||||
my $rating = shift;
|
||||
return undef unless ($rating == -1 || $rating == 1);
|
||||
return undef if $self->hasRated;
|
||||
return unless ($rating == -1 || $rating == 1);
|
||||
return if $self->hasRated;
|
||||
$self->SUPER::rate($rating);
|
||||
|
||||
##Thread specific karma adjustment for CS
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ if there is no such feed.
|
|||
sub getRssUrl {
|
||||
my $self = shift;
|
||||
my $rssFromParentId = $self->get('rssCapableRssFromParentId');
|
||||
return undef unless defined $rssFromParentId;
|
||||
return unless defined $rssFromParentId;
|
||||
WebGUI::Asset->newByDynamicClass($self->session, $rssFromParentId)->getUrl;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 undef if ($self->getToolbarState);
|
||||
return if ($self->getToolbarState);
|
||||
return $self->SUPER::getToolbar();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -364,7 +364,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 undef unless defined $shortcut;
|
||||
return unless defined $shortcut;
|
||||
foreach my $definition (@{$shortcut->definition($self->session)}) {
|
||||
foreach my $prop (keys %{$definition->{properties}}) {
|
||||
next if $definition->{properties}{$prop}{fieldType} eq 'hidden';
|
||||
|
|
|
|||
|
|
@ -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 undef if ($self->getToolbarState);
|
||||
return if ($self->getToolbarState);
|
||||
return '<p>'.$self->SUPER::getToolbar().'</p>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ You can't add children to a wiki page.
|
|||
=cut
|
||||
|
||||
sub addChild {
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -185,7 +185,7 @@ sub getEditForm {
|
|||
sub getWiki {
|
||||
my $self = shift;
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ sub addChild {
|
|||
|
||||
if ($properties->{className} ne "WebGUI::Asset::Event") {
|
||||
$self->session->errorHandler->security("add a ".$properties->{className}." to a ".$self->get("className"));
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
return $self->SUPER::addChild($properties, @other);
|
||||
|
|
|
|||
|
|
@ -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 undef;
|
||||
return;
|
||||
}
|
||||
return $self->SUPER::addChild($properties, @other);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 undef unless $isApproved;
|
||||
return 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 undef if $isChild;
|
||||
return 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 undef unless ($self->canApproveEvents || ($maxAttendees > $numberRegistered));
|
||||
return 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]):();
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ sub definition {
|
|||
#-------------------------------------------------------------------
|
||||
sub duplicate {
|
||||
# Buggo: how do we duplicate these?
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -444,12 +444,12 @@ sub getProjectInstance {
|
|||
my $session = shift;
|
||||
my $db = $session->db;
|
||||
my $projectId = $_[0];
|
||||
return undef unless $projectId;
|
||||
return unless $projectId;
|
||||
my ($assetId) = $db->quickArray("select assetId from PM_project where projectId=?",[$projectId]);
|
||||
if($assetId) {
|
||||
return WebGUI::Asset->newByDynamicClass($session,$assetId);
|
||||
}
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -824,8 +824,8 @@ recent revision will be fetched.
|
|||
sub _getFileFromDatabase {
|
||||
my ($constraint, $dbLink);
|
||||
my $self = shift;
|
||||
my $recordId = shift || return undef;
|
||||
my $fieldName = shift || return undef;
|
||||
my $recordId = shift || return;
|
||||
my $fieldName = shift || return;
|
||||
my $revision = shift;
|
||||
|
||||
$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';
|
||||
|
||||
return undef if (!@constraints);
|
||||
return if (!@constraints);
|
||||
|
||||
# Construct the search query
|
||||
my $sortField = @sortClauses ? ('('.join('+', @sortClauses).') AS sqlform_orderby') : '1 AS sqlform_orderby';
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ sub _convertToEpoch {
|
|||
my $time = $_[1];
|
||||
|
||||
unless ($date =~ m{^\d+/\d+/\d+} and $time =~ m{^\d+:\d+}) {
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
my ($month,$day,$year) = split("/",$date);
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ sub _find_record {
|
|||
}
|
||||
}
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -348,7 +348,7 @@ sub _get_rss_data {
|
|||
if (!$response->is_success()) {
|
||||
$session->errorHandler->warn("Error retrieving url '$url': " .
|
||||
$response->status_line());
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
my $xml = $response->content();
|
||||
|
||||
|
|
@ -380,7 +380,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 undef;
|
||||
return;
|
||||
}
|
||||
|
||||
# make sure that the {channel} points to the channel
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ Removes asset from lineage, places it in clipboard state. The "gap" in the linea
|
|||
|
||||
sub cut {
|
||||
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->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]);
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ sub importPackage {
|
|||
$self->session->http->setRedirect($self->getUrl("op=commitVersionTag;tagId=".WebGUI::VersionTag->getWorking($self->session)->getId));
|
||||
}
|
||||
}
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ Removes asset from lineage, places it in trash state. The "gap" in the lineage i
|
|||
|
||||
sub trash {
|
||||
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})}) {
|
||||
$asset->_invokeWorkflowOnExportedFiles($self->session->setting->get('trashWorkflow'), 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ Override this method in your asset if you want your asset to automatically run i
|
|||
=cut
|
||||
|
||||
sub getAutoCommitWorkflowId {
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -536,9 +536,9 @@ sub www_purgeRevision {
|
|||
my $session = $self->session;
|
||||
return $session->privilege->insufficient() unless $self->canEdit;
|
||||
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);
|
||||
return undef if ($asset->get('revisionDate') != $revisionDate);
|
||||
return if ($asset->get('revisionDate') != $revisionDate);
|
||||
my $parent = $asset->getParent;
|
||||
$asset->purgeRevision;
|
||||
if ($session->form->process("proceed") eq "manageRevisionsInTag") {
|
||||
|
|
|
|||
|
|
@ -304,7 +304,7 @@ sub createAccountSave {
|
|||
);
|
||||
}
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -364,7 +364,7 @@ sub deactivateAccountConfirm {
|
|||
#});
|
||||
|
||||
$self->logout;
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -680,7 +680,7 @@ sub login {
|
|||
$self->session->errorHandler->warn($error) if $error;
|
||||
}
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -705,7 +705,7 @@ sub logout {
|
|||
$self->session->errorHandler->warn($error) if $error;
|
||||
}
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ sub createAccountSave {
|
|||
$self->logout;
|
||||
return $self->displayLogin($i18n->get('check email for validation','AuthWebGUI'));
|
||||
}
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ Retrieve content from the filesystem cache.
|
|||
|
||||
sub get {
|
||||
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
|
||||
my $dbh = $self->session->db->dbh;
|
||||
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;
|
||||
$sth->finish;
|
||||
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.
|
||||
return ${thaw($content)};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,12 +105,12 @@ Retrieve content from the filesystem cache.
|
|||
|
||||
sub get {
|
||||
my $self = shift;
|
||||
return undef if ($self->session->config->get("disableCache"));
|
||||
return if ($self->session->config->get("disableCache"));
|
||||
my $folder = $self->getFolder;
|
||||
if (-e $folder."/expires" && -e $folder."/cache" && open(my $FILE,"<",$folder."/expires")) {
|
||||
my $expires = <$FILE>;
|
||||
close($FILE);
|
||||
return undef if ($expires < $self->session->datetime->time());
|
||||
return if ($expires < $self->session->datetime->time());
|
||||
my $value;
|
||||
eval {$value = retrieve($folder."/cache")};
|
||||
if (ref $value eq "SCALAR") {
|
||||
|
|
@ -119,7 +119,7 @@ sub get {
|
|||
return $value;
|
||||
}
|
||||
}
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ undef if it's not recurring.
|
|||
=cut
|
||||
|
||||
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
|
||||
|
||||
sub handler {
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ You only need to override this method if your gateway uses a webbased contacting
|
|||
=cut
|
||||
|
||||
sub confirmRecurringTransaction {
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -277,7 +277,7 @@ The term number you want the status of.
|
|||
=cut
|
||||
|
||||
sub getRecurringPaymentStatus {
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -383,7 +383,7 @@ A hashref containing:
|
|||
=cut
|
||||
|
||||
sub normalTransaction {
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -408,7 +408,7 @@ A hashref containing:
|
|||
=cut
|
||||
|
||||
sub recurringTransaction {
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ our @ISA = qw(WebGUI::Commerce::Payment);
|
|||
#-------------------------------------------------------------------
|
||||
sub connectionError {
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ sub connectionError {
|
|||
$self = shift;
|
||||
|
||||
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));
|
||||
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.");
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
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} = 0 if $transactionData->{status} eq 'OK';
|
||||
} else {
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
return \%paymentHistory;
|
||||
|
|
@ -350,7 +350,7 @@ sub errorCode {
|
|||
|
||||
$resultCode = $self->{_response}->{Status};
|
||||
return $resultCode unless ($resultCode eq 'OK');
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -607,7 +607,7 @@ sub transactionError {
|
|||
|
||||
$resultCode = $self->resultCode;
|
||||
return $self->resultMessage if ($resultCode ne 'OK');
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -401,7 +401,7 @@ you'll have to overload this method. Defaults to undef.
|
|||
=cut
|
||||
|
||||
sub trackingNumber {
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -414,7 +414,7 @@ info of his package. Overload this method if your plugin supports tracking. Defa
|
|||
=cut
|
||||
|
||||
sub trackingUrl {
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ sub cancelTransaction {
|
|||
|
||||
$self->status('Canceled');
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -293,7 +293,7 @@ sub getByGatewayId {
|
|||
" and gateway=".$self->session->db->quote($paymentGateway));
|
||||
|
||||
return WebGUI::Commerce::Transaction->new($self->session, $transactionId) if $transactionId;
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ sub db {
|
|||
} else {
|
||||
$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}))
|
||||
{
|
||||
$session->errorHandler->warn("Could not find database link '".$databaseLinkId."'");
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
bless {_session=>$session, _databaseLink => \%databaseLink }, $class;
|
||||
|
|
|
|||
|
|
@ -548,7 +548,7 @@ A string representing the output format for the date. Defaults to '%z %Z'. You c
|
|||
sub webguiDate {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
return undef unless ($session);
|
||||
return unless ($session);
|
||||
my $format = shift || "%z %Z";
|
||||
my $temp;
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ sub AUTOLOAD {
|
|||
eval ($cmd);
|
||||
if ($@) {
|
||||
$session->errorHandler->error("Couldn't compile form control: ".$name.". Root cause: ".$@);
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
my $class = "WebGUI::Form::".$name;
|
||||
return $class->new($session,@params)->toHtml;
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ A class method that returns a value to be used as the autogenerated ID for this
|
|||
=cut
|
||||
|
||||
sub generateIdParameter {
|
||||
return undef
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -112,7 +112,7 @@ sub getValueFromPost {
|
|||
if (defined $formValue) {
|
||||
return $formValue;
|
||||
} else {
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ An optional value to use instead of POST input.
|
|||
sub getValueFromPost {
|
||||
my $self = shift;
|
||||
my $color = @_ ? shift : $self->session->form->param($self->get("name"));
|
||||
return undef unless $color =~ /\#\w{6}/;
|
||||
return unless $color =~ /\#\w{6}/;
|
||||
return $color;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ sub getValueFromPost {
|
|||
$self->session->errorHandler->warn("Date value: $value");
|
||||
|
||||
# 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}/);
|
||||
|
||||
# Fix time zone
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ sub new {
|
|||
eval ($load);
|
||||
if ($@) {
|
||||
$session->errorHandler->error("Couldn't compile form control: ".$fieldType.". Root cause: ".$@);
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
my $formObj = $cmd->new($session, $param);
|
||||
if ($formObj->isa('WebGUI::Form::List')) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
return $value;
|
||||
}
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -220,14 +220,14 @@ sub getValueFromPost {
|
|||
my @files = @{ $storage->getFiles };
|
||||
if (scalar(@files) < 1) {
|
||||
$storage->delete;
|
||||
return undef;
|
||||
return;
|
||||
} else {
|
||||
my $id = $storage->getId;
|
||||
$self->set("value", $id);
|
||||
return $id;
|
||||
}
|
||||
}
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ A class method that returns a value to be used as the autogenerated ID for this
|
|||
=cut
|
||||
|
||||
sub generateIdParameter {
|
||||
return undef
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ sub getValueFromPost {
|
|||
@files = @images;
|
||||
}
|
||||
|
||||
return undef unless @files;
|
||||
return unless @files;
|
||||
$storage->generateThumbnail($_) for @images; # Make a thumbnail for each filename in @images
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ sub getValueFromPost {
|
|||
if ($value =~ /^[x\d \.\-\+\(\)]+$/ and $value =~ /\d/) {
|
||||
return $value;
|
||||
}
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ A class method that returns a value to be used as the autogenerated ID for this
|
|||
=cut
|
||||
|
||||
sub generateIdParameter {
|
||||
return undef
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ Returns undef.
|
|||
=cut
|
||||
|
||||
sub getValueFromPost {
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -103,7 +103,7 @@ Outputs nothing.
|
|||
=cut
|
||||
|
||||
sub toHtmlAsHidden {
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ sub getSliderValue {
|
|||
return $i if $keys[$i] eq $self->get('value')->[0];
|
||||
}
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ sub getValueFromPost {
|
|||
return $value
|
||||
}
|
||||
else {
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -147,7 +147,7 @@ sub getValueFromPost {
|
|||
} else {
|
||||
# Mysql format
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ sub getValueFromPost {
|
|||
if ($value =~ /^[A-Z\d\s\-]+$/) {
|
||||
return $value;
|
||||
}
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ sub AUTOLOAD {
|
|||
eval ($cmd);
|
||||
if ($@) {
|
||||
$self->session->errorHandler->error("Couldn't compile form control: ".$name.". Root cause: ".$@);
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
my $class = "WebGUI::Form::".$name;
|
||||
return $class->new($self->session, $params)->getValueFromPost(@args);
|
||||
|
|
@ -177,7 +177,7 @@ sub process {
|
|||
return $default;
|
||||
}
|
||||
if ($value =~ /^[\s]+$/) {
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1024,7 +1024,7 @@ sub new {
|
|||
unless ($groupExists) {
|
||||
$self->{_session}->errorHandler->warn('WebGUI::Group->new called with a non-existant groupId:'
|
||||
.'['.$self->{_groupId}.']');
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ sub AUTOLOAD {
|
|||
eval ($cmd);
|
||||
if ($@) {
|
||||
$self->session->errorHandler->error("Couldn't compile form control: ".$name.". Root cause: ".$@);
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
my $class = "WebGUI::Form::".$name;
|
||||
$self->{_data} .= $class->new($self->session,%params)->toHtmlWithWrapper;
|
||||
|
|
|
|||
|
|
@ -602,12 +602,12 @@ sub processConfigurationForm {
|
|||
my $class = shift;
|
||||
my $session = shift;
|
||||
|
||||
return undef unless ($class->getPluginList($session));
|
||||
return unless ($class->getPluginList($session));
|
||||
|
||||
my $namespace = "WebGUI::Image::".$session->form->process('graphingPlugin');
|
||||
$namespace =~ s/_/::/g;
|
||||
|
||||
return undef unless (isIn($namespace, @{$class->getPluginList($session)}));
|
||||
return unless (isIn($namespace, @{$class->getPluginList($session)}));
|
||||
|
||||
my $graph = $class->load($session, $namespace);
|
||||
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ sub getColorIndex {
|
|||
return $index if ($self->getColor($index)->getId eq $color->getId);
|
||||
}
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -372,7 +372,7 @@ sub removeColor {
|
|||
my $self = shift;
|
||||
my $paletteIndex = shift;
|
||||
|
||||
return undef unless (defined $paletteIndex);
|
||||
return unless (defined $paletteIndex);
|
||||
|
||||
my $color = $self->getColor($paletteIndex);
|
||||
|
||||
|
|
@ -426,10 +426,10 @@ sub setColor {
|
|||
my $index = shift;
|
||||
my $color = shift;
|
||||
|
||||
return undef if ($index >= $self->getNumberOfColors);
|
||||
return undef if ($index < 0);
|
||||
return undef unless (defined $index);
|
||||
return undef unless (defined $color);
|
||||
return if ($index >= $self->getNumberOfColors);
|
||||
return if ($index < 0);
|
||||
return unless (defined $index);
|
||||
return unless (defined $color);
|
||||
|
||||
$color->save;
|
||||
|
||||
|
|
@ -484,7 +484,7 @@ sub setPaletteIndex {
|
|||
my $self = shift;
|
||||
my $index = shift;
|
||||
|
||||
return undef unless (defined $index);
|
||||
return unless (defined $index);
|
||||
|
||||
$index = ($self->getNumberOfColors - 1) if ($index >= $self->getNumberOfColors);
|
||||
$index = 0 if ($index < 0);
|
||||
|
|
|
|||
|
|
@ -72,10 +72,10 @@ sub addPrivateMessage {
|
|||
|
||||
my $userId = $messageData->{userId};
|
||||
my $sentBy = $messageData->{sentBy} || $self->session->user->userId;
|
||||
return undef unless $userId;
|
||||
return unless $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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ sub new {
|
|||
my $class = shift;
|
||||
my $session = shift;
|
||||
$ldapLinkId = shift;
|
||||
return undef unless $ldapLinkId;
|
||||
return unless $ldapLinkId;
|
||||
$ldapLink = $session->db->quickHashRef("select * from ldapLink where ldapLinkId=?",[$ldapLinkId]);
|
||||
bless {_session=>$session, _ldapLinkId=>$ldapLinkId, _ldapLink=>$ldapLink }, $class;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ sub process {
|
|||
return "[AD:".$name."]";
|
||||
}
|
||||
my $adSpace = WebGUI::AdSpace->newByName($session, $name);
|
||||
return undef unless defined $adSpace;
|
||||
return unless defined $adSpace;
|
||||
return $adSpace->displayImpression;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ sub process {
|
|||
$output .= "AssetProxy:".Time::HiRes::tv_interval($t) if ($session->errorHandler->canShowPerformanceIndicators());
|
||||
return $output;
|
||||
}
|
||||
return undef;
|
||||
return;
|
||||
} else {
|
||||
my $i18n = WebGUI::International->new($session, 'Macro_AssetProxy');
|
||||
return $i18n->get('invalid url');
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ sub process {
|
|||
$randomAsset->prepareView;
|
||||
return $randomAsset->view;
|
||||
}
|
||||
return undef;
|
||||
return;
|
||||
} else {
|
||||
return $i18n->get('childless');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ sub process {
|
|||
if (my $image = WebGUI::Asset::File::Image->newByUrl($session,$url)) {
|
||||
return $image->getThumbnailUrl;
|
||||
} else {
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,11 +77,11 @@ sub connect {
|
|||
my $pop = Net::POP3->new($params->{server}, Timeout => 60);
|
||||
unless (defined $pop) {
|
||||
$session->errorHandler->error("Couldn't connect to POP3 server ". $params->{server});
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
unless ($pop->login($params->{account}, $params->{password})) {
|
||||
$session->errorHandler->error("Couldn't log in to POP3 server ".$params->{server}." as ".$params->{account});
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
my $messageNumbers = $pop->list;
|
||||
my @ids = ();
|
||||
|
|
@ -150,7 +150,7 @@ Retrieves the next available message from the server. Returns undef if there are
|
|||
sub getNextMessage {
|
||||
my $self = shift;
|
||||
my $id = pop(@{$self->{_ids}});
|
||||
return undef unless $id;
|
||||
return unless $id;
|
||||
my $rawMessage = $self->{_pop}->get($id);
|
||||
my $parser = MIME::Parser->new;
|
||||
$parser->output_to_core(1);
|
||||
|
|
@ -159,7 +159,7 @@ sub getNextMessage {
|
|||
$self->{_pop}->delete($id);
|
||||
} else {
|
||||
$self->session->errorHandler->error("Could not parse POP3 message $id");
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
my $head = $parsedMessage->head;
|
||||
my $type = $head->get("Content-Type");
|
||||
|
|
|
|||
|
|
@ -394,9 +394,9 @@ sub retrieve {
|
|||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $messageId = shift;
|
||||
return undef unless $messageId;
|
||||
return unless $messageId;
|
||||
my $data = $session->db->getRow("mailQueue","messageId", $messageId);
|
||||
return undef unless $data->{messageId};
|
||||
return unless $data->{messageId};
|
||||
$session->db->deleteRow("mailQueue","messageId", $messageId);
|
||||
my $parser = MIME::Parser->new;
|
||||
$parser->output_to_core(1);
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ Handles a click on an advertisement.
|
|||
sub www_clickAd {
|
||||
my $session = shift;
|
||||
my $id = $session->form->param("id");
|
||||
return undef unless $id;
|
||||
return unless $id;
|
||||
my $url = WebGUI::AdSpace->countClick($session, $id);
|
||||
$session->http->setRedirect($url);
|
||||
return "Redirecting to $url";
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ sub _get {
|
|||
}
|
||||
else {
|
||||
$session->errorHandler->warn("Unable to load help for $namespace -> $id");
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ sub www_ssoViaSessionId {
|
|||
}
|
||||
}
|
||||
}
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -41,12 +41,12 @@ An instanciated session object.
|
|||
sub _getSpeller {
|
||||
my ($baseDir, $userDir, $homeDir);
|
||||
my $session = shift;
|
||||
return undef unless Text::Aspell->can('new');
|
||||
return unless Text::Aspell->can('new');
|
||||
my $speller = Text::Aspell->new;
|
||||
|
||||
# Get language
|
||||
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
|
||||
my $userId = $session->user->userId;
|
||||
|
|
|
|||
|
|
@ -537,7 +537,7 @@ sub www_setWorkingVersionTag () {
|
|||
$tag->setWorking();
|
||||
}
|
||||
if ($session->form->param("backToSite")) {
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
return www_manageVersions($session);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 products where productId=".$self->session->db->quote($self->get('productId')));
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -87,7 +87,7 @@ sub deleteParameter {
|
|||
|
||||
$self->updateVariants;
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -110,7 +110,7 @@ sub deleteOption {
|
|||
|
||||
$self->updateVariants;
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -136,7 +136,7 @@ sub getByOptionId {
|
|||
($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));
|
||||
|
||||
return undef unless ($productId);
|
||||
return unless ($productId);
|
||||
|
||||
return WebGUI::Product->new($session,$productId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ sub new {
|
|||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $id = shift;
|
||||
return undef unless ($id);
|
||||
return unless ($id);
|
||||
my $properties = $session->db->getRow("userProfileCategory","profileCategoryId",$id);
|
||||
bless {_session=>$session, _properties=>$properties}, $class;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,8 +109,8 @@ sub create {
|
|||
"select count(*) from userProfileField where fieldName=?",
|
||||
[$fieldName]
|
||||
);
|
||||
return undef if $fieldNameExists;
|
||||
return undef if $class->isReservedFieldName($fieldName);
|
||||
return if $fieldNameExists;
|
||||
return if $class->isReservedFieldName($fieldName);
|
||||
|
||||
### Data okay, create the field
|
||||
# Add the record
|
||||
|
|
@ -553,11 +553,11 @@ sub new {
|
|||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $id = shift;
|
||||
return undef unless ($id);
|
||||
return undef if $class->isReservedFieldName($id);
|
||||
return unless ($id);
|
||||
return if $class->isReservedFieldName($id);
|
||||
my $properties = $session->db->getRow("userProfileField","fieldName",$id);
|
||||
# Reject properties that don't exist.
|
||||
return undef unless scalar keys %$properties;
|
||||
return unless scalar keys %$properties;
|
||||
bless {_session=>$session, _properties=>$properties}, $class;
|
||||
}
|
||||
|
||||
|
|
@ -731,10 +731,10 @@ The unique ID of a category to assign this field to.
|
|||
sub setCategory {
|
||||
my $self = shift;
|
||||
my $categoryId = shift;
|
||||
return undef unless ($categoryId);
|
||||
return unless ($categoryId);
|
||||
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));
|
||||
$self->session->db->setRow("userProfileField","fieldName",{fieldName=>$self->getId, profileCategoryId=>$categoryId, sequenceNumber=>$sequenceNumber+1});
|
||||
|
|
|
|||
|
|
@ -323,7 +323,7 @@ sub connect {
|
|||
|
||||
unless (defined $dbh) {
|
||||
$session->errorHandler->error("Couldn't connect to database: $dsn");
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
##Set specific attributes for this database.
|
||||
|
|
|
|||
|
|
@ -313,7 +313,7 @@ sub unconditionalRead {
|
|||
$sth->execute(@$placeholders) or $errorHandler->warn("Unconditional read failed: ".$sql." : ".$sth->errstr);
|
||||
bless {_sql=>$sql, _db=>$db, _sth=>$sth}, $class;
|
||||
} else {
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -422,7 +422,7 @@ An integer ranging from 1-7 representing the day of the week (Sunday is 1 and Sa
|
|||
sub getDayName {
|
||||
my $self = 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');
|
||||
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 {
|
||||
my $self = 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');
|
||||
return $i18n->get((qw/january february march april may june
|
||||
|
|
@ -734,7 +734,7 @@ sub mailToEpoch {
|
|||
my $dt = eval {$parser->parse_datetime($date)};
|
||||
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.");
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
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 {
|
||||
my $self = shift;
|
||||
my $set = shift;
|
||||
return undef unless $set;
|
||||
return unless $set;
|
||||
my $time_zone = $self->getTimeZone();
|
||||
my $parser = DateTime::Format::Strptime->new(pattern=>'%Y-%m-%d %H:%M:%S', time_zone=>$time_zone);
|
||||
my $dt = $parser->parse_datetime($set);
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ sub param {
|
|||
@data = $self->session->request->param($field);
|
||||
return wantarray ? @data : $data[0];
|
||||
} else {
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if ($self->session->request) {
|
||||
|
|
@ -123,7 +123,7 @@ sub param {
|
|||
}
|
||||
return keys %params;
|
||||
} else {
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -264,11 +264,11 @@ Generates and sends HTTP headers for a response.
|
|||
|
||||
sub sendHeader {
|
||||
my $self = shift;
|
||||
return undef if ($self->{_http}{noHeader});
|
||||
return if ($self->{_http}{noHeader});
|
||||
return $self->_sendMinimalHeader unless defined $self->session->db(1);
|
||||
|
||||
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");
|
||||
|
||||
# send webgui session cookie
|
||||
|
|
@ -508,7 +508,7 @@ sub setRedirect {
|
|||
my $self = shift;
|
||||
my $url = shift;
|
||||
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->{_http}{location} = $url;
|
||||
$self->setStatus("302", "Redirect");
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ The name of the scratch variable.
|
|||
sub delete {
|
||||
my $self = shift;
|
||||
my $name = shift;
|
||||
return undef unless ($name);
|
||||
return unless ($name);
|
||||
my $value = delete $self->{_data}{$name};
|
||||
$self->session->db->write("delete from userSessionScratch where name=? and sessionId=?", [$name, $self->session->getId]);
|
||||
return $value;
|
||||
|
|
@ -97,7 +97,7 @@ The name of the scratch variable.
|
|||
sub deleteName {
|
||||
my $self = shift;
|
||||
my $name = shift;
|
||||
return undef unless ($name);
|
||||
return unless ($name);
|
||||
delete $self->{_data}{$name};
|
||||
$self->session->db->write("delete from userSessionScratch where name=?", [$name]);
|
||||
}
|
||||
|
|
@ -122,7 +122,7 @@ sub deleteNameByValue {
|
|||
my $self = shift;
|
||||
my $name = 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);
|
||||
$self->session->db->write("delete from userSessionScratch where name=? and value=?", [$name,$value]);
|
||||
}
|
||||
|
|
@ -215,7 +215,7 @@ sub set {
|
|||
my $self = shift;
|
||||
my $name = shift;
|
||||
my $value = shift;
|
||||
return undef unless ($name);
|
||||
return unless ($name);
|
||||
$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]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ The name of the stow variable.
|
|||
sub delete {
|
||||
my $self = shift;
|
||||
my $name = shift;
|
||||
return undef unless ($name);
|
||||
return unless ($name);
|
||||
delete $self->{_data}{$name};
|
||||
}
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ The name of the variable.
|
|||
sub get {
|
||||
my $self = shift;
|
||||
my $var = shift;
|
||||
return undef if $self->session->config->get("disableCache");
|
||||
return if $self->session->config->get("disableCache");
|
||||
return $self->{_data}{$var};
|
||||
}
|
||||
|
||||
|
|
@ -167,7 +167,7 @@ sub set {
|
|||
if $self->session->config->get("disableCache");
|
||||
my $name = shift;
|
||||
my $value = shift;
|
||||
return undef unless ($name);
|
||||
return unless ($name);
|
||||
$self->{_data}{$name} = $value;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@ sub setLink {
|
|||
my $url = shift;
|
||||
my $params = shift;
|
||||
$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.'"';
|
||||
foreach my $name (keys %{$params}) {
|
||||
$tag .= ' '.$name.'="'.$params->{$name}.'"';
|
||||
|
|
@ -390,7 +390,7 @@ sub setScript {
|
|||
my $self = shift;
|
||||
my $url = shift;
|
||||
my $params = shift;
|
||||
return undef if ($self->{_javascript}{$url});
|
||||
return if ($self->{_javascript}{$url});
|
||||
my $tag = '<script src="'.$url.'"';
|
||||
foreach my $name (keys %{$params}) {
|
||||
$tag .= ' '.$name.'="'.$params->{$name}.'"';
|
||||
|
|
@ -438,7 +438,7 @@ sub userStyle {
|
|||
if (defined $output) {
|
||||
return $self->process($output,$self->session->setting->get("userFunctionStyleId"));
|
||||
} else {
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -230,12 +230,12 @@ Returns the URL of the page this request was refered from (no gateway, no query
|
|||
sub getRefererUrl {
|
||||
my $self = shift;
|
||||
my $referer = $self->session->env->get("HTTP_REFERER");
|
||||
return undef unless ($referer);
|
||||
return unless ($referer);
|
||||
my $url = $referer;
|
||||
my $gateway = $self->session->config->get("gateway");
|
||||
$url =~ s{https?://[A-Za-z0-9\.-]+$gateway/*([^?]*)\??.*$}{$1};
|
||||
if ($url eq $referer) { ##s/// failed
|
||||
return undef;
|
||||
return;
|
||||
} else {
|
||||
return $url;
|
||||
}
|
||||
|
|
@ -252,7 +252,7 @@ Returns the URL of the page requested (no gateway, no query params, just the pag
|
|||
|
||||
sub getRequestedUrl {
|
||||
my $self = shift;
|
||||
return undef unless ($self->session->request);
|
||||
return unless ($self->session->request);
|
||||
unless ($self->{_requestedUrl}) {
|
||||
$self->{_requestedUrl} = $self->session->request->uri;
|
||||
my $gateway = $self->session->config->get("gateway");
|
||||
|
|
|
|||
|
|
@ -486,7 +486,7 @@ a:visited { color: '.$form->get("visitedLinkColor").'; }
|
|||
# remove init state
|
||||
$session->setting->remove('specialState');
|
||||
$session->http->setRedirect($session->url->gateway("?setup=complete"));
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$legend = "Admin Acccount";
|
||||
|
|
|
|||
|
|
@ -227,11 +227,11 @@ sub addFileFromFormPost {
|
|||
close($file);
|
||||
} else {
|
||||
$self->_addError("Couldn't open file ".$self->getPath($filename)." for writing due to error: ".$!);
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
}
|
||||
return $filename if $filename;
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -465,7 +465,7 @@ it doesn't.
|
|||
sub deleteFile {
|
||||
my $self = 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));
|
||||
}
|
||||
|
||||
|
|
@ -490,7 +490,7 @@ sub get {
|
|||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $id = shift;
|
||||
return undef unless $id;
|
||||
return unless $id;
|
||||
my $guid = $id;
|
||||
my $self;
|
||||
|
||||
|
|
@ -762,7 +762,7 @@ sub getPath {
|
|||
|
||||
unless ($self->session->config->get("uploadsPath") && $self->{_part1} && $self->{_part2} && $id) {
|
||||
$self->_addError("storage object malformed");
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
my $path = $self->session->config->get("uploadsPath")
|
||||
. '/'
|
||||
|
|
|
|||
|
|
@ -559,8 +559,8 @@ sub newByEmail {
|
|||
my $email = shift;
|
||||
my ($id) = $session->dbSlave->quickArray("select userId from userProfileData where email=?",[$email]);
|
||||
my $user = $class->new($session, $id);
|
||||
return undef if ($user->userId eq "1"); # visitor is never valid for this method
|
||||
return undef unless $user->username;
|
||||
return if ($user->userId eq "1"); # visitor is never valid for this method
|
||||
return unless $user->username;
|
||||
return $user;
|
||||
}
|
||||
|
||||
|
|
@ -588,8 +588,8 @@ sub newByUsername {
|
|||
my $username = shift;
|
||||
my ($id) = $session->dbSlave->quickArray("select userId from users where username=?",[$username]);
|
||||
my $user = $class->new($session, $id);
|
||||
return undef if ($user->userId eq "1"); # visitor is never valid for this method
|
||||
return undef unless $user->username;
|
||||
return if ($user->userId eq "1"); # visitor is never valid for this method
|
||||
return unless $user->username;
|
||||
return $user;
|
||||
}
|
||||
|
||||
|
|
@ -617,7 +617,7 @@ sub profileField {
|
|||
my $db = $self->session->db;
|
||||
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");
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
if (defined $value) {
|
||||
$self->uncache;
|
||||
|
|
|
|||
|
|
@ -182,13 +182,13 @@ sub isInSubnet {
|
|||
for my $cidr ( @{ $subnets } ) {
|
||||
my @parts = $cidr =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)\/(\d+)$/;
|
||||
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
|
||||
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
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
}
|
||||
my $net = Net::Subnets->new;
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ sub getWorking {
|
|||
$session->stow->set("versionTag",$tag);
|
||||
return $tag;
|
||||
} elsif ($noCreate) {
|
||||
return undef;
|
||||
return;
|
||||
} else {
|
||||
my $tag = $class->create($session);
|
||||
$tag->setWorking;
|
||||
|
|
@ -375,7 +375,7 @@ sub new {
|
|||
my $session = shift;
|
||||
my $tagId = shift;
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -417,7 +417,7 @@ sub new {
|
|||
my $session = shift;
|
||||
my $workflowId = shift;
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -295,12 +295,12 @@ sub new {
|
|||
my $session = shift;
|
||||
my $activityId = shift;
|
||||
my $main = $session->db->getRow("WorkflowActivity","activityId", $activityId);
|
||||
return undef unless $main->{activityId};
|
||||
return unless $main->{activityId};
|
||||
$class = $main->{className};
|
||||
(my $module = "$class.pm") =~ s{'|::}{/}g;
|
||||
unless (eval { require $module; 1 }) {
|
||||
$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 %data = (%{$main}, %{$sub});
|
||||
|
|
@ -334,14 +334,14 @@ sub newByPropertyHashRef {
|
|||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $properties = shift;
|
||||
return undef unless defined $properties;
|
||||
return undef unless exists $properties->{className};
|
||||
return unless defined $properties;
|
||||
return unless exists $properties->{className};
|
||||
my $className = $properties->{className};
|
||||
my $cmd = "use ".$className;
|
||||
eval ($cmd);
|
||||
if ($@) {
|
||||
$session->errorHandler->warn("Couldn't compile activity package: ".$className.". Root cause: ".$@);
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
bless {_session=>$session, _id=>$properties->{activityId}, _data => $properties}, $className;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ sub new {
|
|||
my $session = shift;
|
||||
my $taskId = shift;
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ sub create {
|
|||
? JSON::objToJson({parameters => $properties->{parameters}}, {pretty => 1, indent => 4, autoconv=>0, skipinvalid=>1})
|
||||
: undef;
|
||||
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
|
||||
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 {
|
||||
my $self = shift;
|
||||
my $workflow = $self->getWorkflow;
|
||||
return undef unless defined $workflow;
|
||||
return unless defined $workflow;
|
||||
return $workflow->getNextActivity($self->get("currentActivityId"));
|
||||
}
|
||||
|
||||
|
|
@ -261,7 +261,7 @@ sub new {
|
|||
my $session = shift;
|
||||
my $instanceId = shift;
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue