From 81df5e669248e28d8cd3be6037e36a6d07ae1bc8 Mon Sep 17 00:00:00 2001 From: Nightfly Date: Wed, 10 Feb 2021 13:49:32 +0200 Subject: [PATCH] additional checks on task renderer --- RELEASE | 2 +- modules/general/taskman/index.php | 103 ++++++++++++++++-------------- 2 files changed, 57 insertions(+), 48 deletions(-) diff --git a/RELEASE b/RELEASE index 64ba8d755..38c003b82 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -1.1.4 rev 7874 +1.1.4 rev 7875 diff --git a/modules/general/taskman/index.php b/modules/general/taskman/index.php index e2540c028..a552d0b5b 100755 --- a/modules/general/taskman/index.php +++ b/modules/general/taskman/index.php @@ -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; @@ -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 {