rename variables for consistency
This commit is contained in:
parent
199c4e4960
commit
f57ce0c9a6
8 changed files with 103 additions and 103 deletions
|
|
@ -431,7 +431,7 @@ sub view {
|
|||
my $absoluteDepthOfFirstPage; # Will set on first iteration of loop, below
|
||||
my %lastChildren;
|
||||
my $previousPageData = undef;
|
||||
my $eh = $self->session->log;
|
||||
my $log = $self->session->log;
|
||||
while ( 1 ) {
|
||||
my $asset;
|
||||
eval { $asset = $assetIter->() };
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ property groupToAdd => (
|
|||
sub _addDaysForMonth {
|
||||
my $self = shift;
|
||||
my $dt = $self->session->datetime;
|
||||
my $eh = $self->session->log;
|
||||
my $log = $self->session->log;
|
||||
|
||||
my $days_loop = $_[0];
|
||||
my $hash = $_[1];
|
||||
|
|
@ -108,13 +108,13 @@ sub _addDaysForMonth {
|
|||
while ($monday < $monthEnd) {
|
||||
my $hash = {};
|
||||
$hash->{'day.number'} = $dt->epochToHuman($monday,"%d");
|
||||
#$eh->warn($hash->{'day.number'});
|
||||
#$log->warn($hash->{'day.number'});
|
||||
$monday += 604800; # Add one week to the first monday of the month
|
||||
push(@{$days_loop},$hash);
|
||||
$colCount++;
|
||||
}
|
||||
$hash->{'month.colspan'} = $colCount;
|
||||
#$eh->warn($dt->epochToHuman($firstMonday));
|
||||
#$log->warn($dt->epochToHuman($firstMonday));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -655,7 +655,7 @@ sub setSessionVars {
|
|||
sub updateProjectTask {
|
||||
my $self = shift;
|
||||
my $db = $self->session->db;
|
||||
my $eh = $self->session->log;
|
||||
my $log = $self->session->log;
|
||||
|
||||
my $taskId = $_[0];
|
||||
my $projectId = $_[1];
|
||||
|
|
@ -726,7 +726,7 @@ sub view {
|
|||
|
||||
my ($session,$privilege,$form,$db,$datetime,$i18n,$user) = $self->setSessionVars;
|
||||
my $config = $session->config;
|
||||
my $eh = $session->log;
|
||||
my $log = $session->log;
|
||||
|
||||
$var->{'extras'} = $session->url->make_urlmap_work($config->get("extrasURL"))."/wobject/ProjectManager";
|
||||
$var->{'project.create'} = $self->getUrl("func=editProject;projectId=new");
|
||||
|
|
@ -839,18 +839,18 @@ sub www_deleteTask {
|
|||
#Reorder dependants and tasks
|
||||
my $tasks = $db->buildArrayRefOfHashRefs("select * from PM_task where projectId=? order by sequenceNumber",[$projectId]);
|
||||
my $taskLen = scalar(@{$tasks});
|
||||
#$eh->warn("Task Length = $taskLen");
|
||||
#$log->warn("Task Length = $taskLen");
|
||||
foreach my $tsk (@{$tasks}) {
|
||||
my $seqNum = $tsk->{sequenceNumber};
|
||||
next unless ($seqNum >= $taskRank);
|
||||
#$eh->warn("Fixing task $seqNum");
|
||||
#$log->warn("Fixing task $seqNum");
|
||||
my $dependant = $tsk->{dependants};
|
||||
#$eh->warn("Dependant is $dependant");
|
||||
#$log->warn("Dependant is $dependant");
|
||||
#Only decrement the dependant if it's greater than the rank point of the deleted task
|
||||
if($dependant >= $taskRank){
|
||||
$dependant--;
|
||||
}
|
||||
#$eh->warn("New dependant is $dependant");
|
||||
#$log->warn("New dependant is $dependant");
|
||||
$db->write("update PM_task set dependants=? where taskId=?",[$dependant,$tsk->{taskId}]);
|
||||
}
|
||||
$self->reorderCollateral("PM_task","taskId","projectId",$projectId);
|
||||
|
|
@ -871,7 +871,7 @@ sub www_drawGanttChart {
|
|||
my ($session,$privilege,$form,$db,$dt,$i18n,$user) = $self->setSessionVars;
|
||||
my $config = $session->config;
|
||||
my $style = $session->style;
|
||||
my $eh = $session->log;
|
||||
my $log = $session->log;
|
||||
|
||||
#Set up some the task data
|
||||
my $projectId = $_[0];
|
||||
|
|
@ -908,7 +908,7 @@ sub www_drawGanttChart {
|
|||
($startMonth) = $db->quickArray("select min(startDate) from PM_task where projectId=".$db->quote($projectId));
|
||||
($endMonth) = $db->quickArray("select max(endDate) from PM_task where projectId=".$db->quote($projectId));
|
||||
|
||||
#$eh->warn("Interval is: ".$dt->getDaysInInterval($startMonth,$endMonth));
|
||||
#$log->warn("Interval is: ".$dt->getDaysInInterval($startMonth,$endMonth));
|
||||
if($dt->getDaysInInterval($startMonth,$endMonth) < 60) {
|
||||
$endMonth = $dt->addToDate($startMonth,0,3);
|
||||
}
|
||||
|
|
@ -917,8 +917,8 @@ sub www_drawGanttChart {
|
|||
$endMonth = $dt->addToDate($startMonth,0,3);
|
||||
}
|
||||
|
||||
#$eh->warn($dt->epochToSet($startMonth));
|
||||
#$eh->warn($dt->epochToSet($endMonth));
|
||||
#$log->warn($dt->epochToSet($startMonth));
|
||||
#$log->warn($dt->epochToSet($endMonth));
|
||||
#Build the loops of weeks and days
|
||||
my @monthsLoop = ();
|
||||
my @daysLoop = ();
|
||||
|
|
@ -939,8 +939,8 @@ sub www_drawGanttChart {
|
|||
$i18n->get("friday label"),
|
||||
$i18n->get("saturday label"),
|
||||
);
|
||||
#$eh->warn($dt->epochToSet($sundayOfFirstWeek));
|
||||
#$eh->warn($dt->epochToSet($endMonth));
|
||||
#$log->warn($dt->epochToSet($sundayOfFirstWeek));
|
||||
#$log->warn($dt->epochToSet($endMonth));
|
||||
my $datecounter = $startMonth;
|
||||
my $counter = 0;
|
||||
while($datecounter <= $endMonth || $counter++ == 1000) {
|
||||
|
|
@ -952,7 +952,7 @@ sub www_drawGanttChart {
|
|||
foreach (@days) {
|
||||
push(@daysLoop,{'day.number' => $_ });
|
||||
}
|
||||
#$eh->warn($dt->epochToSet($datecounter));
|
||||
#$log->warn($dt->epochToSet($datecounter));
|
||||
$datecounter = $dt->addToDateTime($datecounter,0,0,7);
|
||||
}
|
||||
|
||||
|
|
@ -1053,15 +1053,15 @@ sub www_drawGanttChart {
|
|||
|
||||
my $daysFromStart = $dt->getDaysInInterval($startMonth,$startDate);
|
||||
#Add day part of predecessor if necessary
|
||||
#$eh->warn("Task $seq is currently $daysFromStart days from the first day on ".$dt->epochToHuman($startDate));
|
||||
#$log->warn("Task $seq is currently $daysFromStart days from the first day on ".$dt->epochToHuman($startDate));
|
||||
my $daysLeft = $daysFromStart;
|
||||
#Only adjust for predecessor if the start date of the task falls on the same day as it's predecessors end date
|
||||
if($startDate eq $predEndDate) {
|
||||
$daysLeft += $predDayPart;
|
||||
#$eh->warn("Adjusting this by $predDayPart days");
|
||||
#$log->warn("Adjusting this by $predDayPart days");
|
||||
}
|
||||
$hash->{'task.div.left'} = int(($daysLeft * $pixelSize)); #Each day is 23 pixels so calculate the days and round
|
||||
#$eh->warn("Starts at: $daysLeft * $pixelSize :".$hash->{'task.div.left'});
|
||||
#$log->warn("Starts at: $daysLeft * $pixelSize :".$hash->{'task.div.left'});
|
||||
|
||||
# Buggo. Refactor.
|
||||
$hash->{'task.isUntimed'} = ($task->{taskType} ne 'timed');
|
||||
|
|
@ -1075,7 +1075,7 @@ sub www_drawGanttChart {
|
|||
my $rduration = $task->{duration};
|
||||
|
||||
#Adjust duration of days to only include the part of the day used
|
||||
#$eh->warn("day part is being set to: $duration - ".floor($duration)." : ".($duration-floor($duration)));
|
||||
#$log->warn("day part is being set to: $duration - ".floor($duration)." : ".($duration-floor($duration)));
|
||||
$duration = $duration - floor($duration);
|
||||
|
||||
$hash->{'task.div.percentComplete'} = $task->{percentComplete} || 0;
|
||||
|
|
@ -1236,7 +1236,7 @@ sub www_editProjectSave {
|
|||
my $self = shift;
|
||||
#Set Method Helpers
|
||||
my ($session,$privilege,$form,$db,$dt,$i18n,$user) = $self->setSessionVars;
|
||||
my $eh = $session->log;
|
||||
my $log = $session->log;
|
||||
|
||||
#Check Privileges
|
||||
return $privilege->insufficient unless $self->_userCanManageProjectList($user);
|
||||
|
|
@ -1509,7 +1509,7 @@ sub www_editTaskSave {
|
|||
#Set Method Helpers
|
||||
my ($session,$privilege,$form,$db,$dt,$i18n,$user) = $self->setSessionVars;
|
||||
my $config = $session->config;
|
||||
my $eh = $session->log;
|
||||
my $log = $session->log;
|
||||
|
||||
my $projectId = $form->get("projectId");
|
||||
my $project = $db->quickHashRef("select * from PM_project where projectId=".$db->quote($projectId));
|
||||
|
|
@ -1560,26 +1560,26 @@ sub www_editTaskSave {
|
|||
#Reorder tasks if task is inserted
|
||||
my $insertAt = $form->get("insertAt");
|
||||
if($insertAt) {
|
||||
#$eh->warn("Inserting at $insertAt");
|
||||
#$log->warn("Inserting at $insertAt");
|
||||
my $tasks = $db->buildArrayRefOfHashRefs("select * from PM_task where projectId=? order by sequenceNumber",[$projectId]);
|
||||
my $taskLen = scalar(@{$tasks});
|
||||
#$eh->warn("Task Length = $taskLen");
|
||||
#$log->warn("Task Length = $taskLen");
|
||||
foreach my $task (@{$tasks}) {
|
||||
my $seqNum = $task->{sequenceNumber};
|
||||
next unless ($seqNum >= $insertAt);
|
||||
#$eh->warn("Fixing task $seqNum");
|
||||
#$log->warn("Fixing task $seqNum");
|
||||
my $newSeq = $seqNum + 1;
|
||||
if($seqNum eq $taskLen) {
|
||||
$newSeq = $insertAt;
|
||||
}
|
||||
#$eh->warn("New seqNum is $newSeq");
|
||||
#$log->warn("New seqNum is $newSeq");
|
||||
my $dependant = $task->{dependants};
|
||||
#$eh->warn("Dependant is $dependant");
|
||||
#$log->warn("Dependant is $dependant");
|
||||
#Only increment the dependant if it's greater than or equal to the insertAt point
|
||||
if($dependant >= $insertAt){
|
||||
$dependant++;
|
||||
}
|
||||
#$eh->warn("New dependant is $dependant");
|
||||
#$log->warn("New dependant is $dependant");
|
||||
$db->write("update PM_task set sequenceNumber=?, dependants=? where taskId=?",[$newSeq,$dependant,$task->{taskId}]);
|
||||
}
|
||||
$self->reorderCollateral("PM_task","taskId","projectId",$projectId);
|
||||
|
|
@ -1706,7 +1706,7 @@ sub www_viewProject {
|
|||
my $user = $session->user;
|
||||
my $config = $session->config;
|
||||
my $style = $session->style;
|
||||
my $eh = $session->log;
|
||||
my $log = $session->log;
|
||||
my $projectId = shift || $form->get("projectId");
|
||||
|
||||
#Check Privileges
|
||||
|
|
|
|||
|
|
@ -71,10 +71,10 @@ sub addField {
|
|||
my $dbDataType = shift || $self->_getDbDataType($field->{fieldType});
|
||||
my $session = $self->session;
|
||||
my $db = $session->db;
|
||||
my $error = $session->log;
|
||||
my $log = $session->log;
|
||||
my ($oldFieldId, $newFieldId,$useAssetId,$useSequence);
|
||||
|
||||
$error->info("Adding Field, label: ".$field->{label}.", fieldId: ".$field->{fieldId}.",thingId: ".$field->{thingId});
|
||||
$log->info("Adding Field, label: ".$field->{label}.", fieldId: ".$field->{fieldId}.",thingId: ".$field->{thingId});
|
||||
|
||||
if ($isImport){
|
||||
$oldFieldId = $field->{fieldId};
|
||||
|
|
@ -125,10 +125,10 @@ sub addThing {
|
|||
my $thing = shift;
|
||||
my $isImport = shift;
|
||||
my $db = $self->session->db;
|
||||
my $error = $self->session->log;
|
||||
my $log = $self->session->log;
|
||||
my ($oldThingId, $newThingId,$useAssetId);
|
||||
|
||||
$error->info("Adding Thing, label: ".$thing->{label}.", id: ".$thing->{thingId});
|
||||
$log->info("Adding Thing, label: ".$thing->{label}.", id: ".$thing->{thingId});
|
||||
|
||||
if ($isImport){
|
||||
$oldThingId = $thing->{thingId};
|
||||
|
|
@ -376,7 +376,7 @@ sub deleteField {
|
|||
my $thingId = shift;
|
||||
my $keepSequenceNumbers = shift;
|
||||
my $db = $self->session->db;
|
||||
my $error = $self->session->log;
|
||||
my $log = $self->session->log;
|
||||
my $deletedSequenceNumber;
|
||||
|
||||
if ($keepSequenceNumbers ne "1"){
|
||||
|
|
@ -395,7 +395,7 @@ sub deleteField {
|
|||
$db->write("ALTER TABLE ".$db->quote_identifier("Thingy_".$thingId)." DROP "
|
||||
.$db->quote_identifier("field_".$fieldId));
|
||||
}
|
||||
$error->info("Deleted field: $fieldId in thing: $thingId.");
|
||||
$log->info("Deleted field: $fieldId in thing: $thingId.");
|
||||
return undef;
|
||||
}
|
||||
|
||||
|
|
@ -521,13 +521,13 @@ sub deleteThing {
|
|||
my $self = shift;
|
||||
my $thingId = shift;
|
||||
my $session = $self->session;
|
||||
my $error = $session->log;
|
||||
my $log = $session->log;
|
||||
|
||||
$self->deleteCollateral("Thingy_things","thingId",$thingId);
|
||||
$self->deleteCollateral("Thingy_fields","thingId",$thingId);
|
||||
$session->db->write("drop table if exists ".$session->db->quote_identifier("Thingy_".$thingId));
|
||||
|
||||
$error->info("Deleted thing: $thingId.");
|
||||
$log->info("Deleted thing: $thingId.");
|
||||
return undef;
|
||||
}
|
||||
|
||||
|
|
@ -1260,14 +1260,14 @@ sub importAssetCollateralData {
|
|||
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $error = $session->log;
|
||||
my $log = $session->log;
|
||||
my $data = shift;
|
||||
my $id = $data->{properties}{assetId};
|
||||
my $class = $data->{properties}{className};
|
||||
my $version = $data->{properties}{revisionDate};
|
||||
my $assetExists = WebGUI::Asset->newById($self->session, $id, $version);
|
||||
|
||||
$error->info("Importing Things for Thingy ".$data->{properties}{title});
|
||||
$log->info("Importing Things for Thingy ".$data->{properties}{title});
|
||||
my @importThings;
|
||||
foreach my $thing (@{$data->{things}}) {
|
||||
push(@importThings,$thing->{thingId});
|
||||
|
|
@ -1275,7 +1275,7 @@ sub importAssetCollateralData {
|
|||
[$thing->{thingId}]);
|
||||
if ($assetExists && $thingIdExists){
|
||||
# update existing thing
|
||||
$error->info("Updating Thing, label: ".$thing->{label}.", id: ".$thing->{thingId});
|
||||
$log->info("Updating Thing, label: ".$thing->{label}.", id: ".$thing->{thingId});
|
||||
$self->setCollateral("Thingy_things","thingId",$thing,0,0);
|
||||
}
|
||||
else{
|
||||
|
|
@ -1299,7 +1299,7 @@ sub importAssetCollateralData {
|
|||
my ($fieldIdExists) = $session->db->quickArray("select fieldId from Thingy_fields where fieldId = ? and thingId = ? ",[$field->{fieldId},$field->{thingId}]);
|
||||
if ($assetExists && $fieldIdExists){
|
||||
# update existing field
|
||||
$error->info("Updating Field, label: ".$field->{label}.", id: ".$field->{fieldId}.",seq :"
|
||||
$log->info("Updating Field, label: ".$field->{label}.", id: ".$field->{fieldId}.",seq :"
|
||||
.$field->{sequenceNumber});
|
||||
$self->_updateFieldType($field->{fieldType},$field->{fieldId},$field->{thingId},$field->{assetId},$dbDataType);
|
||||
$self->setCollateral("Thingy_fields","fieldId",$field,1,0,"","",1);
|
||||
|
|
@ -1433,7 +1433,7 @@ sub _updateFieldType {
|
|||
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $error = $session->log;
|
||||
my $log = $session->log;
|
||||
|
||||
my $newFieldType = shift;
|
||||
my $fieldId = shift;
|
||||
|
|
@ -1449,7 +1449,7 @@ sub _updateFieldType {
|
|||
if($newFieldType ne $fieldType){
|
||||
my $thingyTableName = "Thingy_".$thingId;
|
||||
my $columnName = "field_".$fieldId;
|
||||
$error->info("changing column: $columnName, table: $thingyTableName");
|
||||
$log->info("changing column: $columnName, table: $thingyTableName");
|
||||
$self->session->db->write(
|
||||
"ALTER TABLE ".$db->quote_identifier($thingyTableName).
|
||||
" CHANGE ".$db->quote_identifier($columnName)." "
|
||||
|
|
@ -2789,7 +2789,7 @@ sub www_import {
|
|||
push(@insertColumns, $field) if ($session->form->process("fileContains_".$field->{fieldId}));
|
||||
}
|
||||
|
||||
my $error = $self->session->log;
|
||||
my $log = $self->session->log;
|
||||
my $storage = WebGUI::Storage->createTemp($self->session);
|
||||
$handleDuplicates = $session->form->process("handleDuplicates");
|
||||
|
||||
|
|
@ -2797,7 +2797,7 @@ sub www_import {
|
|||
foreach my $file (sort(@{$storage->getFiles})) {
|
||||
next unless ($storage->getFileExtension($file) eq "csv");
|
||||
|
||||
$error->info("Found import file $file");
|
||||
$log->info("Found import file $file");
|
||||
open my $importFile,"<:raw:eol(NATIVE)",$storage->getPath($file);
|
||||
my $lineNumber = 0;
|
||||
my @data = ();
|
||||
|
|
@ -2805,10 +2805,10 @@ sub www_import {
|
|||
while ( my $row = WebGUI::Text::readCSV($importFile) ) {
|
||||
if ($lineNumber == 0 && $session->form->process('ignoreFirstLine')){
|
||||
$lineNumber++;
|
||||
$error->info("Skipping first line");
|
||||
$log->info("Skipping first line");
|
||||
next;
|
||||
}
|
||||
$error->info("Reading line $lineNumber: @{ $row }");
|
||||
$log->info("Reading line $lineNumber: @{ $row }");
|
||||
$lineNumber++;
|
||||
@data = @{ $row };
|
||||
|
||||
|
|
@ -2834,7 +2834,7 @@ sub www_import {
|
|||
$query .= " limit 1";
|
||||
($foundDuplicateId) = $session->db->quickArray($query);
|
||||
if ($foundDuplicateId){
|
||||
$error->info("found duplicate record: ".$foundDuplicateId." for data: ". @{ $row });
|
||||
$log->info("found duplicate record: ".$foundDuplicateId." for data: ". @{ $row });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2864,14 +2864,14 @@ sub www_import {
|
|||
}
|
||||
if ($foundDuplicateId && $handleDuplicates eq "overwrite"){
|
||||
$thingData{thingDataId} = $foundDuplicateId;
|
||||
$error->info("Overwriting, thingDataId = ".$thingData{thingDataId});
|
||||
$log->info("Overwriting, thingDataId = ".$thingData{thingDataId});
|
||||
}
|
||||
elsif ($foundDuplicateId eq ""){
|
||||
$thingData{thingDataId} = "new";
|
||||
$error->info("Importing new line");
|
||||
$log->info("Importing new line");
|
||||
}
|
||||
else{
|
||||
$error->info("Skipping line");
|
||||
$log->info("Skipping line");
|
||||
next;
|
||||
}
|
||||
$thingData{lastUpdated} = time();
|
||||
|
|
@ -3038,13 +3038,13 @@ sub www_moveFieldConfirm {
|
|||
my $session = $self->session;
|
||||
return $session->privilege->insufficient() unless $self->canEdit;
|
||||
|
||||
my $error = $self->session->log;
|
||||
my $log = $self->session->log;
|
||||
my $direction = $session->form->process('direction');
|
||||
my $assetId = $self->getId;
|
||||
my $fieldId = $session->form->process('fieldId');
|
||||
my $targetFieldId = $session->form->process('targetFieldId');
|
||||
|
||||
$error->info("moving $fieldId to target $targetFieldId, direction: $direction");
|
||||
$log->info("moving $fieldId to target $targetFieldId, direction: $direction");
|
||||
|
||||
my ($thingId,$originalRank) = $session->db->quickArray(
|
||||
"select thingId, sequenceNumber from Thingy_fields where fieldId = ".$session->db->quote($fieldId)." and assetId = ".$session->db->quote($assetId));
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ sub getDaysInWeek {
|
|||
my $week = $_[0];
|
||||
return [] unless $week;
|
||||
|
||||
my ($session,$dt,$eh) = $self->getSessionVars("datetime","log");
|
||||
my ($session,$dt,$log) = $self->getSessionVars("datetime","log");
|
||||
my $i18n = WebGUI::International->new($session,'Asset_TimeTracking');
|
||||
|
||||
#Week View Below
|
||||
|
|
@ -169,7 +169,7 @@ sub view {
|
|||
my $self = shift;
|
||||
my $var = $self->get;
|
||||
|
||||
my ($session,$privilege,$form,$db,$dt,$user,$eh,$config) = $self->getSessionVars("privilege","form","db","datetime","user","log","config");
|
||||
my ($session,$privilege,$form,$db,$dt,$user,$log,$config) = $self->getSessionVars("privilege","form","db","datetime","user","log","config");
|
||||
my $i18n = WebGUI::International->new($session,'Asset_TimeTracking');
|
||||
$var->{'extras'} = $session->url->make_urlmap_work($config->get("extrasURL"))."/wobject/TimeTracking";
|
||||
|
||||
|
|
@ -210,7 +210,7 @@ sub view {
|
|||
|
||||
sub www_editTimeEntrySave {
|
||||
my $self = shift;
|
||||
my ($session,$privilege,$form,$db,$user,$eh,$dt) = $self->getSessionVars("privilege","form","db","user","log","datetime");
|
||||
my ($session,$privilege,$form,$db,$user,$log,$dt) = $self->getSessionVars("privilege","form","db","user","log","datetime");
|
||||
|
||||
return $privilege->insufficient unless ($self->canView);
|
||||
|
||||
|
|
@ -289,7 +289,7 @@ sub www_editTimeEntrySave {
|
|||
|
||||
sub www_deleteProject {
|
||||
my $self = shift;
|
||||
my ($session,$privilege,$form,$db,$user,$eh,$config) = $self->getSessionVars("privilege","form","db","user","log","config");
|
||||
my ($session,$privilege,$form,$db,$user,$log,$config) = $self->getSessionVars("privilege","form","db","user","log","config");
|
||||
my $i18n = WebGUI::International->new($session,'Asset_TimeTracking');
|
||||
|
||||
#Check Privileges
|
||||
|
|
@ -316,7 +316,7 @@ sub www_deleteProject {
|
|||
|
||||
sub www_editProject {
|
||||
my $self = shift;
|
||||
my ($session,$privilege,$form,$db,$user,$eh,$config) = $self->getSessionVars("privilege","form","db","user","log","config");
|
||||
my ($session,$privilege,$form,$db,$user,$log,$config) = $self->getSessionVars("privilege","form","db","user","log","config");
|
||||
my $i18n = WebGUI::International->new($session,'Asset_TimeTracking');
|
||||
|
||||
#Check Privileges
|
||||
|
|
@ -421,7 +421,7 @@ sub www_editProject {
|
|||
|
||||
sub www_editProjectSave {
|
||||
my $self = shift;
|
||||
my ($session,$privilege,$form,$db,$dt,$user,$eh) = $self->getSessionVars("privilege","form","db","datetime","user","log");
|
||||
my ($session,$privilege,$form,$db,$dt,$user,$log) = $self->getSessionVars("privilege","form","db","datetime","user","log");
|
||||
my $i18n = WebGUI::International->new($session,'Asset_TimeTracking');
|
||||
|
||||
#Check Privileges
|
||||
|
|
@ -486,7 +486,7 @@ sub www_editProjectSave {
|
|||
|
||||
sub www_manageProjects {
|
||||
my $self = shift;
|
||||
my ($session,$privilege,$form,$db,$dt,$user,$eh,$config) = $self->getSessionVars("privilege","form","db","datetime","user","log","config");
|
||||
my ($session,$privilege,$form,$db,$dt,$user,$log,$config) = $self->getSessionVars("privilege","form","db","datetime","user","log","config");
|
||||
my $i18n = WebGUI::International->new($session,'Asset_TimeTracking');
|
||||
|
||||
#Check Privileges
|
||||
|
|
@ -615,7 +615,7 @@ sub www_buildTimeTable {
|
|||
my $viewVar = $_[0];
|
||||
my $var = {};
|
||||
$var->{'extras'} = $viewVar->{'extras'};
|
||||
my ($session,$dt,$eh,$form,$db,$user,$privilege) = $self->getSessionVars("datetime","log","form","db","user","privilege");
|
||||
my ($session,$dt,$log,$form,$db,$user,$privilege) = $self->getSessionVars("datetime","log","form","db","user","privilege");
|
||||
my $i18n = WebGUI::International->new($session,'Asset_TimeTracking');
|
||||
|
||||
return $privilege->insufficient unless ($self->canView);
|
||||
|
|
@ -715,7 +715,7 @@ sub www_buildTimeTable {
|
|||
#Build Report Info
|
||||
my $report = $db->quickHashRef("select * from TT_report where resourceId=? and assetId=? and startDate=? and endDate=?",[$resourceId,$self->getId,$weekStart,$weekEnd]);
|
||||
my $reportId = $report->{reportId};
|
||||
#$eh->warn($reportId);
|
||||
#$log->warn($reportId);
|
||||
#Add Report Stuff to form header
|
||||
$viewVar->{'form.header'} .= WebGUI::Form::hidden($session, {
|
||||
-name=>"reportId",
|
||||
|
|
@ -785,7 +785,7 @@ sub www_buildTimeTable {
|
|||
|
||||
sub _buildRow {
|
||||
my $self = shift;
|
||||
my ($session,$dt,$eh,$form,$db,$user) = $self->getSessionVars("datetime","log","form","db","user");
|
||||
my ($session,$dt,$log,$form,$db,$user) = $self->getSessionVars("datetime","log","form","db","user");
|
||||
my $i18n = WebGUI::International->new($session,'Asset_TimeTracking');
|
||||
|
||||
my $entry = $_[0] || {};
|
||||
|
|
@ -825,7 +825,7 @@ sub _buildRow {
|
|||
else {
|
||||
%taskHash = %{$taskList->{$projectId}};
|
||||
}
|
||||
#$eh->warn($projectId);
|
||||
#$log->warn($projectId);
|
||||
}
|
||||
my $chooseLabel = $i18n->get("Choose One");
|
||||
%taskHash = (""=>$chooseLabel,%taskHash);
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ sub importAssetData {
|
|||
my $session = $self->session;
|
||||
my $data = shift;
|
||||
my $options = shift || {};
|
||||
my $error = $session->log;
|
||||
my $log = $session->log;
|
||||
my $id = $data->{properties}{assetId};
|
||||
my $class = $data->{properties}{className};
|
||||
my $version = $options->{overwriteLatest} ? time : $data->{properties}{revisionDate};
|
||||
|
|
@ -207,11 +207,11 @@ sub importAssetData {
|
|||
$asset = WebGUI::Asset->newPending($session, $id);
|
||||
};
|
||||
if (! Exception::Class->caught()) { # create a new revision of an existing asset
|
||||
$error->info("Creating a new revision of asset $id");
|
||||
$log->info("Creating a new revision of asset $id");
|
||||
$asset = $asset->addRevision(\%properties, $version, {skipAutoCommitWorkflows => 1});
|
||||
}
|
||||
else { # add an entirely new asset
|
||||
$error->info("Adding $id that didn't previously exist.");
|
||||
$log->info("Adding $id that didn't previously exist.");
|
||||
$asset = $self->addChild(\%properties, $id, $version, {skipAutoCommitWorkflows => 1});
|
||||
}
|
||||
}
|
||||
|
|
@ -264,12 +264,12 @@ sub importPackage {
|
|||
return undef
|
||||
if $storage->getErrorCount;
|
||||
my $package = undef; # The asset package
|
||||
my $error = $self->session->log;
|
||||
my $log = $self->session->log;
|
||||
|
||||
# The debug output for long requests would be too long, and we'd have to
|
||||
# keep it all in memory.
|
||||
$error->preventDebugOutput();
|
||||
$error->info("Importing package.");
|
||||
$log->preventDebugOutput();
|
||||
$log->info("Importing package.");
|
||||
|
||||
# Your parent is on this stack somewhere because we're going through these
|
||||
# assets depth-first. This way we only have to keep one branch in-memory
|
||||
|
|
@ -279,15 +279,15 @@ sub importPackage {
|
|||
|
||||
foreach my $file (sort(@{$decompressed->getFiles})) {
|
||||
next unless ($decompressed->getFileExtension($file) eq "json");
|
||||
$error->info("Found data file $file");
|
||||
$log->info("Found data file $file");
|
||||
my $data = eval {
|
||||
$json->decode($decompressed->getFileContentsAsScalar($file))
|
||||
};
|
||||
if ($@ || $data->{properties}{assetId} eq "" || $data->{properties}{className} eq "" || $data->{properties}{revisionDate} eq "") {
|
||||
$error->error("package corruption: ".$@) if ($@);
|
||||
$log->error("package corruption: ".$@) if ($@);
|
||||
return "corrupt";
|
||||
}
|
||||
$error->info("Data file $file is valid and represents asset ".$data->{properties}{assetId});
|
||||
$log->info("Data file $file is valid and represents asset ".$data->{properties}{assetId});
|
||||
foreach my $storageId (@{$data->{storage}}) {
|
||||
my $assetStorage = WebGUI::Storage->get($self->session, $storageId);
|
||||
$decompressed->untar($storageId.".storage", $assetStorage);
|
||||
|
|
|
|||
|
|
@ -66,19 +66,19 @@ See WebGUI::Workflow::Activity::execute() for details.
|
|||
|
||||
sub execute {
|
||||
my $self = shift;
|
||||
my ($db,$eh) = $self->session->quick(qw(db log));
|
||||
my ($db,$log) = $self->session->quick(qw(db log));
|
||||
|
||||
my $time = time();
|
||||
my $newsletter = undef;
|
||||
|
||||
$eh->info("Getting subscriptions");
|
||||
$log->info("Getting subscriptions");
|
||||
my $subscriptionResultSet = $db->read("select assetId, userId, subscriptions, lastTimeSent
|
||||
from Newsletter_subscriptions where lastTimeSent < unix_timestamp() - 60*60*23
|
||||
order by assetId, userId"); # only sending to people who haven't been sent to in the past 23 hours
|
||||
while (my ($assetId, $userId, $subscriptions, $lastTimeSent) = $subscriptionResultSet->array) {
|
||||
|
||||
# get user object
|
||||
$eh->info("Getting user $userId");
|
||||
$log->info("Getting user $userId");
|
||||
my $user = WebGUI::User->new($self->session, $userId);
|
||||
next if ($user->isVisitor);
|
||||
my $emailAddress = $user->get("email");
|
||||
|
|
@ -87,18 +87,18 @@ sub execute {
|
|||
|
||||
# get newsletter asset
|
||||
unless (defined $newsletter && $newsletter->getId eq $assetId) { # cache newsletter object
|
||||
$eh->info("Getting newsletter asset $assetId");
|
||||
$log->info("Getting newsletter asset $assetId");
|
||||
$newsletter = WebGUI::Asset->newById($self->session, $assetId);
|
||||
}
|
||||
|
||||
# find matching threads
|
||||
my @threads = ();
|
||||
my %foundThreads;
|
||||
$eh->info("Find threads in $assetId matching $userId subscriptions.");
|
||||
$log->info("Find threads in $assetId matching $userId subscriptions.");
|
||||
foreach my $subscription (split("\n", $subscriptions)) {
|
||||
$eh->info("Found subscription $subscription");
|
||||
$log->info("Found subscription $subscription");
|
||||
my ($fieldId, $value) = split("~", $subscription);
|
||||
$eh->info("Searching for threads that match $subscription");
|
||||
$log->info("Searching for threads that match $subscription");
|
||||
my $matchingThreads = $db->read("select metaData_values.assetId from metaData_values
|
||||
left join asset using (assetId) where fieldId=? and value like ? and creationDate > ?
|
||||
and className like ? and lineage like ? and state = ?",
|
||||
|
|
@ -108,22 +108,22 @@ sub execute {
|
|||
if $foundThreads{$threadId};
|
||||
my $thread = eval { WebGUI::Asset->newById($self->session, $threadId); };
|
||||
if (! Exception::Class->caught()) {
|
||||
$eh->info("Found thread $threadId");
|
||||
$log->info("Found thread $threadId");
|
||||
push(@threads, $thread);
|
||||
$foundThreads{$threadId} = 1;
|
||||
}
|
||||
else {
|
||||
$eh->error("Couldn't instanciate thread $threadId: $@");
|
||||
$log->error("Couldn't instanciate thread $threadId: $@");
|
||||
}
|
||||
}
|
||||
}
|
||||
unless (scalar(@threads)) { # don't send a message if there aren't matching threads
|
||||
$eh->info("No threads found matching $userId subscriptions.");
|
||||
$log->info("No threads found matching $userId subscriptions.");
|
||||
next;
|
||||
}
|
||||
|
||||
# build newsletter
|
||||
$eh->info("Building newsletter for $userId.");
|
||||
$log->info("Building newsletter for $userId.");
|
||||
my $siteurl = $self->session->url->getSiteURL();
|
||||
my @threadLoop = ();
|
||||
foreach my $thread (@threads) {
|
||||
|
|
@ -145,7 +145,7 @@ sub execute {
|
|||
my $content = $template->process(\%var);
|
||||
|
||||
# send newsletter
|
||||
$eh->info("Sending newsletter for $userId.");
|
||||
$log->info("Sending newsletter for $userId.");
|
||||
my $setting = $self->session->setting;
|
||||
my $returnAddress = $setting->get("mailReturnPath");
|
||||
my $companyAddress = $setting->get("companyEmail");
|
||||
|
|
@ -185,12 +185,12 @@ sub execute {
|
|||
$mail->queue;
|
||||
|
||||
# mark sent
|
||||
$eh->info("Email sent.");
|
||||
$log->info("Email sent.");
|
||||
$db->write("update Newsletter_subscriptions set lastTimeSent = ?", [time()]);
|
||||
|
||||
# timeout if we're taking too long
|
||||
if (time() - $time > $self->getTTL ) {
|
||||
$eh->info("Oops. Ran out of time. Will continue building newsletters in a bit.");
|
||||
$log->info("Oops. Ran out of time. Will continue building newsletters in a bit.");
|
||||
$subscriptionResultSet->finish;
|
||||
return $self->WAITING(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ sub notify {
|
|||
my $self = shift;
|
||||
my $module = shift;
|
||||
my $params = shift;
|
||||
my ($config, $error) = $self->session->quick("config", "log");
|
||||
my ($config, $log) = $self->session->quick("config", "log");
|
||||
my $remote = create_ikc_client(
|
||||
port=>$config->get("spectrePort"),
|
||||
ip=>$config->get("spectreIp"),
|
||||
|
|
@ -67,12 +67,12 @@ sub notify {
|
|||
if (defined $remote) {
|
||||
my $result = $remote->post($module, $params);
|
||||
unless (defined $result) {
|
||||
$error->warn("Couldn't send command to Spectre because ".$POE::Component::IKC::ClientLite::error);
|
||||
$log->warn("Couldn't send command to Spectre because ".$POE::Component::IKC::ClientLite::error);
|
||||
}
|
||||
$remote->disconnect;
|
||||
undef $remote;
|
||||
} else {
|
||||
$error->warn("Couldn't connect to Spectre because ".$POE::Component::IKC::ClientLite::error);
|
||||
$log->warn("Couldn't connect to Spectre because ".$POE::Component::IKC::ClientLite::error);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue