From c5c6327271a0461b39f571fb3d780c8b3377324e Mon Sep 17 00:00:00 2001 From: liugang Date: Wed, 26 Apr 2023 02:53:55 +0000 Subject: [PATCH] * Change the redirect url when toggle year or dept or account in annual data page - fix bug #34836. --- module/report/control.php | 31 ++++++++++---------------- module/report/css/annualdata.css | 2 +- module/report/js/annualdata.js | 11 ++++----- module/report/view/annualdata.html.php | 14 ++++++------ module/screen/control.php | 2 +- 5 files changed, 27 insertions(+), 33 deletions(-) diff --git a/module/report/control.php b/module/report/control.php index 005dbbb828..eab359d5f2 100644 --- a/module/report/control.php +++ b/module/report/control.php @@ -118,11 +118,11 @@ class report extends control * * @param string $year * @param string $dept - * @param string $userID + * @param string $account * @access public * @return void */ - public function annualData($year = '', $dept = '', $userID = '') + public function annualData($year = '', $dept = '', $account = '') { $this->app->loadLang('story'); $this->app->loadLang('task'); @@ -154,19 +154,14 @@ class report extends control } /* Get users and depts. */ - $accounts = array(); - if($userID) + if($account) { - $user = $this->user->getById($userID, 'id'); - $dept = $user->dept; - $users = array('' => $this->lang->report->annualData->allUser) + $this->dept->getDeptUserPairs($dept, 'id'); - $accounts = array($user->account => ($user->realname ? $user->realname : $user->account)); - } - else - { - $users = array('' => $this->lang->report->annualData->allUser) + $this->dept->getDeptUserPairs($dept, 'id'); - $accounts = $this->dept->getDeptUserPairs($dept); + $user = $this->user->getByID($account); + $dept = $user->dept; } + $userPairs = $this->dept->getDeptUserPairs($dept); + $accounts = !empty($user) ? array($user->account) : array_keys($userPairs); + $users = array('' => $this->lang->report->annualData->allUser) + $userPairs; $noDepartment = array('0' => '/' . $this->lang->dept->noDepartment); $depts = $this->dept->getOptionMenu(); @@ -182,11 +177,9 @@ class report extends control $depts += $noDepartment; } - if($accounts) $accounts = array_keys($accounts); - /* Get annual data. */ $data = array(); - if(!$userID) + if(!$account) { $data['users'] = $dept ? count($accounts) : (count($users) - 1); } @@ -208,7 +201,7 @@ class report extends control $yearEfforts = $this->report->getUserYearEfforts($accounts, $year); $data['consumed'] = $yearEfforts->consumed; - if(empty($dept) and empty($userID)) $data['statusStat'] = $this->report->getAllTimeStatusStat(); + if(empty($dept) and empty($account)) $data['statusStat'] = $this->report->getAllTimeStatusStat(); $contributionGroups = array(); $maxCount = 0; @@ -240,14 +233,14 @@ class report extends control } } - $this->view->title = sprintf($this->lang->report->annualData->title, ($userID ? zget($users, $userID, '') : (($dept !== '') ? substr($depts[$dept], strrpos($depts[$dept], '/') + 1) : '')), $year); + $this->view->title = sprintf($this->lang->report->annualData->title, ($account ? zget($users, $account, '') : (($dept !== '') ? substr($depts[$dept], strrpos($depts[$dept], '/') + 1) : '')), $year); $this->view->data = $data; $this->view->year = $year; $this->view->users = $users; $this->view->depts = $depts; $this->view->years = $years; $this->view->dept = $dept; - $this->view->userID = $userID; + $this->view->account = $account; $this->view->months = $this->report->getYearMonths($year); $this->view->contributionGroups = $contributionGroups; $this->view->radarData = $contributionGroups[$year]; diff --git a/module/report/css/annualdata.css b/module/report/css/annualdata.css index 3e4034a566..20f328139e 100644 --- a/module/report/css/annualdata.css +++ b/module/report/css/annualdata.css @@ -17,7 +17,7 @@ body {height: 100vh; padding: 0;} #toolbar #year {width: 70px; display: inline-block; margin-right: 5px; padding-top: 5px; border-color: #1a77a5; background-color: transparent; color: #fff;} #toolbar #year option {background: #141414;} #toolbar #dept, #dept_chosen, #dept_chosen > .chosen-single {width: 100px !important; display: inline-block; margin-right: 5px; padding-top: 0px; border-color: #1a77a5; background-color: transparent; color: #fff;} -#toolbar #userID, #userID_chosen, #userID_chosen > .chosen-single, #toolbar .picker-single {width: 100px !important; display: inline-block; margin-right: 5px; padding-top: 0px; border-color: #1a77a5; background-color: transparent; color: #fff;} +#toolbar #account, #account_chosen, #account_chosen > .chosen-single, #toolbar .picker-single {width: 100px !important; display: inline-block; margin-right: 5px; padding-top: 0px; border-color: #1a77a5; background-color: transparent; color: #fff;} .chosen-container > .chosen-single > span {padding-top: 5px; height: 28px;} .chosen-container .chosen-drop {background: #141414; text-align: left;} diff --git a/module/report/js/annualdata.js b/module/report/js/annualdata.js index 67fa201cc7..b4c68daa34 100644 --- a/module/report/js/annualdata.js +++ b/module/report/js/annualdata.js @@ -196,12 +196,13 @@ $(function() exportAnnualImage(); }); - $('select#year, select#dept, select#userID').change(function() + $('select#year, select#dept, select#account').change(function() { - var dept = $('select#dept').val(); - var userID = $('select#userID').val(); - if($(this).attr('id') == 'dept') userID = 0; - location.href = createLink('report', 'annualData', 'year=' + $('select#year').val() + '&dept=' + dept + '&userID=' + userID); + var year = $('select#year').val(); + var dept = $('select#dept').val(); + var account = $('select#account').val(); + if($(this).attr('id') == 'dept') account = ''; + location.href = createLink('screen', 'view', 'screenID=3&year=' + year + '&dept=' + dept + '&account=' + account); }); $('#actionData > div > ul > li').mouseenter(function(e) diff --git a/module/report/view/annualdata.html.php b/module/report/view/annualdata.html.php index 4f25586c36..058d1c1a3f 100644 --- a/module/report/view/annualdata.html.php +++ b/module/report/view/annualdata.html.php @@ -17,7 +17,7 @@ scope;?> - +
@@ -29,8 +29,8 @@
  • - logins : ($dept !== '' ? $annualDataLang->deptUsers : $annualDataLang->companyUsers);?> - + logins : ($dept !== '' ? $annualDataLang->deptUsers : $annualDataLang->companyUsers);?> +
  • actions;?> @@ -50,7 +50,7 @@
  • todoStatus['done'];?>done;?>
- +
  • contributions;?> @@ -60,7 +60,7 @@
  • -

    actionData :$annualDataLang->contributionData) . $soFar;?>

    +

    actionData :$annualDataLang->contributionData) . $soFar;?>

      objectTypeList as $objectType => $objectName):?> @@ -192,7 +192,7 @@
    - +

    statusStat;?>

    @@ -360,7 +360,7 @@ $(function() story->statusList['']);?> bug->statusList['']);?> task->statusList['']);?> - + $objectStatusStat):?> fetch('report', 'annualData'); + echo $this->fetch('report', 'annualData', "year=$year&dept=$dept&account=$account"); return; }