Skip to content

Commit

Permalink
additional checks on task renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
nightflyza committed Feb 10, 2021
1 parent 8d14c7c commit 81df5e6
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 48 deletions.
2 changes: 1 addition & 1 deletion RELEASE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.4 rev 7874
1.1.4 rev 7875
103 changes: 56 additions & 47 deletions modules/general/taskman/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@

//start task body rendering
$taskData = ts_GetTaskData(ubRouting::get('edittask'));
if (!empty($taskData)) {
$taskExistsFlag = true;
} else {
$taskExistsFlag = false;
}

//access restrictions here
$taskAccess = true;
Expand All @@ -235,67 +240,71 @@
}
}

if ($taskAccess) {
//display task change form aka task profile
ts_TaskChangeForm($_GET['edittask']);

//Task States support
if (@$altCfg['TASKSTATES_ENABLED']) {
//existing task?
if (!empty($taskData)) {
$taskState = $taskData['status'];
$taskStates = new TaskStates();
show_window(__('Task state'), $taskStates->renderStatePanel(ubRouting::get('edittask'), $taskState));
if (ubRouting::checkGet('changestate', 'edittask')) {
$newStateSetResult = $taskStates->setTaskState(ubRouting::get('edittask'), ubRouting::get('changestate'));
if (empty($newStateSetResult)) {
die($taskStates->renderStatePanel(ubRouting::get('edittask'), $taskState));
} else {
$messages = new UbillingMessageHelper();
die($messages->getStyledMessage($newStateSetResult, 'error'));
if ($taskExistsFlag) {
if ($taskAccess) {
//display task change form aka task profile
ts_TaskChangeForm($_GET['edittask']);

//Task States support
if (@$altCfg['TASKSTATES_ENABLED']) {
//existing task?
if (!empty($taskData)) {
$taskState = $taskData['status'];
$taskStates = new TaskStates();
show_window(__('Task state'), $taskStates->renderStatePanel(ubRouting::get('edittask'), $taskState));
if (ubRouting::checkGet('changestate', 'edittask')) {
$newStateSetResult = $taskStates->setTaskState(ubRouting::get('edittask'), ubRouting::get('changestate'));
if (empty($newStateSetResult)) {
die($taskStates->renderStatePanel(ubRouting::get('edittask'), $taskState));
} else {
$messages = new UbillingMessageHelper();
die($messages->getStyledMessage($newStateSetResult, 'error'));
}
}
} else {
show_error(__('Something went wrong') . ': TASKID_NOT_EXISTS [' . ubRouting::get('edittask') . ']');
}
} else {
show_error(__('Something went wrong') . ': TASKID_NOT_EXISTS [' . ubRouting::get('edittask') . ']');
}
}


//photostorage integration
if ($altCfg['PHOTOSTORAGE_ENABLED']) {
$photoStorage = new PhotoStorage('TASKMAN', ubRouting::get('edittask'));
$renderPhotoControlFlag = true;
if (@$altCfg['TASKSTATES_ENABLED']) {
if (isset($taskState)) {
if ($taskState) {
//task already closed
//photostorage integration
if ($altCfg['PHOTOSTORAGE_ENABLED']) {
$photoStorage = new PhotoStorage('TASKMAN', ubRouting::get('edittask'));
$renderPhotoControlFlag = true;
if (@$altCfg['TASKSTATES_ENABLED']) {
if (isset($taskState)) {
if ($taskState) {
//task already closed
$renderPhotoControlFlag = false;
}
} else {
//task not exists
$renderPhotoControlFlag = false;
}
}

if ($renderPhotoControlFlag) {
$photostorageControl = wf_Link('?module=photostorage&scope=TASKMAN&mode=list&itemid=' . ubRouting::get('edittask'), wf_img('skins/photostorage.png') . ' ' . __('Upload images'), false, 'ubButton');
$photostorageControl .= wf_delimiter();
} else {
//task not exists
$renderPhotoControlFlag = false;
$messages = new UbillingMessageHelper();
$photostorageControl = $messages->getStyledMessage(__('You cant attach images for already closed task'), 'warning') . wf_delimiter();
}
$photosList = $photoStorage->renderImagesRaw();
show_window(__('Photostorage'), $photostorageControl . $photosList);
}

if ($renderPhotoControlFlag) {
$photostorageControl = wf_Link('?module=photostorage&scope=TASKMAN&mode=list&itemid=' . ubRouting::get('edittask'), wf_img('skins/photostorage.png') . ' ' . __('Upload images'), false, 'ubButton');
$photostorageControl .= wf_delimiter();
} else {
$messages = new UbillingMessageHelper();
$photostorageControl = $messages->getStyledMessage(__('You cant attach images for already closed task'), 'warning') . wf_delimiter();
//additional comments
if ($altCfg['ADCOMMENTS_ENABLED']) {
$adcomments = new ADcomments('TASKMAN');
show_window(__('Additional comments'), $adcomments->renderComments($_GET['edittask']));
}
$photosList = $photoStorage->renderImagesRaw();
show_window(__('Photostorage'), $photostorageControl . $photosList);
}

//additional comments
if ($altCfg['ADCOMMENTS_ENABLED']) {
$adcomments = new ADcomments('TASKMAN');
show_window(__('Additional comments'), $adcomments->renderComments($_GET['edittask']));
} else {
show_error(__('Access denied'));
log_register('TASKMAN TASK ACCESS FAIL [' . ubRouting::get('edittask') . '] ADMIN {' . whoami() . '}');
}
} else {
show_error(__('Access denied'));
log_register('TASKMAN TASK ACCESS FAIL [' . ubRouting::get('edittask') . '] ADMIN {' . whoami() . '}');
show_error(__('Something went wrong') . ': ' . __('Task') . ' [' . ubRouting::get('edittask') . ']' . ' ' . __('Not exists'));
}
}
} else {
Expand Down

0 comments on commit 81df5e6

Please sign in to comment.