diff --git a/module/admin/config.php b/module/admin/config.php index 6a4ce7c360..fb72b41f47 100755 --- a/module/admin/config.php +++ b/module/admin/config.php @@ -10,7 +10,7 @@ if(!isset($config->safe->weak)) $config->safe->weak = '123456,password,12345,123 $config->admin->menuGroup['system'] = array('custom|mode', 'backup', 'cron', 'action|trash', 'admin|xuanxuan', 'setting|xuanxuan', 'admin|license', 'admin|checkweak', 'admin|resetpwdsetting', 'admin|safe', 'custom|timezone', 'search|buildindex', 'admin|tableengine', 'ldap', 'custom|libreoffice', 'conference', 'client'); $config->admin->menuGroup['user'] = array('dept', 'company', 'user', 'group'); $config->admin->menuGroup['switch'] = array('admin|setmodule'); -$config->admin->menuGroup['model'] = array('auditcl', 'stage', 'design', 'cmcl', 'reviewcl', 'custom|required', 'custom|set', 'custom|flow', 'custom|code', 'custom|estimate', 'custom|hours', 'subject', 'process', 'activity', 'zoutput', 'classify'); +$config->admin->menuGroup['model'] = array('auditcl', 'stage', 'design', 'cmcl', 'reviewcl', 'custom|required', 'custom|set', 'custom|flow', 'custom|code', 'custom|estimate', 'custom|hours', 'subject', 'process', 'activity', 'zoutput', 'classify', 'holiday'); $config->admin->menuGroup['feature'] = array('custom|set', 'custom|product', 'custom|execution', 'custom|required', 'custom|kanban', 'approvalflow', 'measurement', 'meetingroom', 'custom|browsestoryconcept', 'custom|kanban', 'sqlbuilder', 'report'); $config->admin->menuGroup['template'] = array('custom|set', 'baseline'); $config->admin->menuGroup['message'] = array('mail', 'webhook', 'sms', 'message'); diff --git a/module/admin/lang/menu.php b/module/admin/lang/menu.php index aa016db203..ace5759629 100644 --- a/module/admin/lang/menu.php +++ b/module/admin/lang/menu.php @@ -75,7 +75,7 @@ $lang->admin->menuList->switch['subMenu']['setmodule'] = array('link' => "{$lang $lang->admin->menuList->switch['menuOrder']['5'] = 'setmodule'; -$lang->admin->menuList->model['subMenu']['common'] = array('link' => "{$lang->globalSetting}|custom|required|module=project", 'subModule' => 'custom,subject'); +$lang->admin->menuList->model['subMenu']['common'] = array('link' => "{$lang->globalSetting}|custom|required|module=project", 'subModule' => 'custom,subject,holiday'); $lang->admin->menuList->model['subMenu']['scrum'] = array('link' => "{$lang->scrumModel}|auditcl|scrumbrowse|", 'subModule' => 'auditcl'); $lang->admin->menuList->model['subMenu']['waterfall'] = array('link' => "{$lang->waterfallModel}|stage|settype|", 'subModule' => 'stage'); @@ -87,7 +87,7 @@ $lang->admin->menuList->model['tabMenu']['common']['project'] = array('link' => $lang->admin->menuList->model['tabMenu']['common']['build'] = array('link' => "{$lang->build->common}|custom|required|module=build", 'alias' => 'set', 'exclude' => 'custom'); $lang->admin->menuList->model['tabMenu']['common']['flow'] = array('link' => "{$lang->custom->flow}|custom|flow|", 'divider' => true); $lang->admin->menuList->model['tabMenu']['common']['code'] = array('link' => "{$lang->code}|custom|code|"); -$lang->admin->menuList->model['tabMenu']['common']['hours'] = array('link' => "{$lang->workingHour}|custom|hours|"); +$lang->admin->menuList->model['tabMenu']['common']['hours'] = array('link' => "{$lang->workingHour}|custom|hours|", 'subModule' => 'holiday'); $lang->admin->menuList->model['tabMenu']['waterfall']['stage'] = array('link' => "{$lang->stage->common}|stage|settype|", 'subModule' => 'stage'); $lang->admin->menuList->model['tabMenu']['menuOrder']['common']['5'] = 'project'; $lang->admin->menuList->model['tabMenu']['menuOrder']['common']['10'] = 'build'; diff --git a/module/custom/control.php b/module/custom/control.php index 7cee237ff5..db2f282831 100644 --- a/module/custom/control.php +++ b/module/custom/control.php @@ -863,17 +863,37 @@ class custom extends control $this->display(); } - public function hours() + /** + * Set hours and weekend + * + * @access public + * @return void + */ + public function hours($type = 'hours') { if($_POST) { - $this->loadModel('setting')->setItems('system.execution', fixer::input('post')->get()); + $data = fixer::input('post')->get(); + $type = $data->type; + + unset($data->type); + if($data->weekend != 1) unset($data->restDay); + + $this->loadModel('setting')->setItems('system.execution', $data); + + $response = new stdclass(); + $response->result = 'success'; + $response->locate = inLink('hours', "type=$type"); + $response->message = $this->lang->saveSuccess; + return $this->send($response); } $this->app->loadConfig('execution'); $this->view->title = $this->lang->workingHour; + $this->view->type = $type; $this->view->weekend = $this->config->execution->weekend; $this->view->workhours = $this->config->execution->defaultWorkhours; + $this->view->restDay = zget($this->config->execution, 'restDay', 0); $this->display(); } } diff --git a/module/custom/js/hours.js b/module/custom/js/hours.js new file mode 100644 index 0000000000..27c93ca508 --- /dev/null +++ b/module/custom/js/hours.js @@ -0,0 +1,16 @@ +$(function() +{ + $("#sidebar .nav [data-toggle='tab']").click(function() + { + $(this).parent().find('a').removeClass('active'); + $(this).addClass('active'); + var type = $(this).hasClass('hours') ? 'hours' : 'weekend'; + $('#type').val(type); + }); + + $('#restDayBox').toggleClass('hidden', $('[name=weekend]:checked').val() != 1) + $('[name=weekend]').change(function() + { + $('#restDayBox').toggleClass('hidden', $(this).val() != 1) + }) +}) diff --git a/module/custom/lang/de.php b/module/custom/lang/de.php index 703d9b25f8..c50057573e 100644 --- a/module/custom/lang/de.php +++ b/module/custom/lang/de.php @@ -219,9 +219,11 @@ $lang->custom->setHours = 'Setting Hours'; $lang->custom->setWeekend = 'Setting Weekend'; $lang->custom->setHoliday = 'Setting Holiday'; $lang->custom->workingHours = 'hours/day'; -$lang->custom->weekend = 'Weekend'; -$lang->custom->weekendList[2] = '2-Day Off'; +$lang->custom->weekendRole = 'Role'; $lang->custom->weekendList[1] = '1-Day Off'; +$lang->custom->weekendList[2] = '2-Day Off'; +$lang->custom->restDayList[6] = 'Saturday rest'; +$lang->custom->restDayList[0] = 'Sunday rest'; global $config; $lang->custom->sprintConceptList[0] = 'Program Product Iteration'; diff --git a/module/custom/lang/en.php b/module/custom/lang/en.php index a58fbcdefc..b650794ae8 100644 --- a/module/custom/lang/en.php +++ b/module/custom/lang/en.php @@ -219,9 +219,11 @@ $lang->custom->setHours = 'Setting Hours'; $lang->custom->setWeekend = 'Setting Weekend'; $lang->custom->setHoliday = 'Setting Holiday'; $lang->custom->workingHours = 'Hours/Day'; -$lang->custom->weekend = 'Weekend'; -$lang->custom->weekendList[2] = '2-Day Off'; +$lang->custom->weekendRole = 'Role'; $lang->custom->weekendList[1] = '1-Day Off'; +$lang->custom->weekendList[2] = '2-Day Off'; +$lang->custom->restDayList[6] = 'Saturday rest'; +$lang->custom->restDayList[0] = 'Sunday rest'; global $config; $lang->custom->sprintConceptList[0] = 'Program Product Iteration'; diff --git a/module/custom/lang/fr.php b/module/custom/lang/fr.php index 8f6b0598f8..6b6be4b13d 100644 --- a/module/custom/lang/fr.php +++ b/module/custom/lang/fr.php @@ -219,9 +219,11 @@ $lang->custom->setHours = 'Setting Hours'; $lang->custom->setWeekend = 'Setting Weekend'; $lang->custom->setHoliday = 'Setting Holiday'; $lang->custom->workingHours = 'Heures/Jour'; -$lang->custom->weekend = 'Weekend'; -$lang->custom->weekendList[2] = '2-Jour'; +$lang->custom->weekendRole = 'Role'; $lang->custom->weekendList[1] = '1-Jour'; +$lang->custom->weekendList[2] = '2-Jour'; +$lang->custom->restDayList[6] = 'Saturday rest'; +$lang->custom->restDayList[0] = 'Sunday rest'; global $config; $lang->custom->sprintConceptList[0] = 'Program Product Iteration'; diff --git a/module/custom/lang/zh-cn.php b/module/custom/lang/zh-cn.php index c043869f9a..8571ef1a50 100644 --- a/module/custom/lang/zh-cn.php +++ b/module/custom/lang/zh-cn.php @@ -219,9 +219,11 @@ $lang->custom->setHours = '工时设置'; $lang->custom->setWeekend = '休息日设置'; $lang->custom->setHoliday = '节假日设置'; $lang->custom->workingHours = '每天可用工时'; -$lang->custom->weekend = '休息日'; -$lang->custom->weekendList[2] = '双休'; +$lang->custom->weekendRole = '规则设置'; $lang->custom->weekendList[1] = '单休'; +$lang->custom->weekendList[2] = '双休'; +$lang->custom->restDayList[6] = '周六休息'; +$lang->custom->restDayList[0] = '周天休息'; global $config; $lang->custom->sprintConceptList[0] = '项目 产品 迭代'; diff --git a/module/custom/view/hours.html.php b/module/custom/view/hours.html.php index 7d3a50f5bf..6b81b11caa 100644 --- a/module/custom/view/hours.html.php +++ b/module/custom/view/hours.html.php @@ -15,35 +15,53 @@
-
-
- workingHour?> +
+
' id='hoursContent'> +
+
+ custom->setHours?> +
+
+ + + + + + +
custom->workingHours;?>
+
+
' id='weekendContent'> +
+
+ custom->setWeekend?> +
+
+ + + + + + + + + + +
custom->weekendRole;?>custom->weekendList, $weekend);?>
- - - - - - - - - - - - - -
custom->workingHours;?>
custom->weekend;?>custom->weekendList, $weekend);?>
+
- diff --git a/module/holiday/css/browse.css b/module/holiday/css/browse.css index 9c76821f51..42943f6cf8 100644 --- a/module/holiday/css/browse.css +++ b/module/holiday/css/browse.css @@ -1,7 +1,6 @@ .tree .active{font-weight: bold;} .with-side .side {position: absolute; width: 130px;} .with-side .main {padding-left: 145px; float: left;} -.side-col {width: 160px;} .panel-sm .panel-body {padding: 10px;} #mainMenu .input-control {display: flex; width: 200px;} #mainMenu .input-control .form-name {margin: 8px 10px; white-space: pre;} diff --git a/module/holiday/model.php b/module/holiday/model.php index 3b6e66f1e1..b2f72dc38d 100644 --- a/module/holiday/model.php +++ b/module/holiday/model.php @@ -199,6 +199,7 @@ class holidayModel extends model if(empty($begin) or empty($end) or $begin == '0000-00-00' or $end == '0000-00-00') return array(); $this->app->loadConfig('execution'); + $actualDays = array(); $currentDay = $begin; @@ -262,7 +263,7 @@ class holidayModel extends model $days = ($endTime - $beginTime) / 86400; $dateList = array(); - for($i = 0; $i <= $days; $i ++) $dateList[] = date('Y-m-d', $beginTime + ($i *24 *3600)); + for($i = 0; $i <= $days; $i ++) $dateList[] = date('Y-m-d', $beginTime + ($i * 24 * 3600)); return $dateList; } @@ -313,10 +314,13 @@ class holidayModel extends model { $updateProjectList = $this->dao->select('id, begin, end') ->from(TABLE_PROJECT) - ->where('begin')->between($beginDate, $endDate) + ->where('status')->ne('done') + ->andWhere('type')->ne('program') + ->andWhere('end')->ne(LONG_TIME) + ->andWhere('begin', true)->between($beginDate, $endDate) ->orWhere('end')->between($beginDate, $endDate) ->orWhere("(begin < '$beginDate' AND end > '$endDate')") - ->andWhere('status')->ne('done') + ->markRight(1) ->fetchAll(); foreach($updateProjectList as $project) @@ -340,10 +344,12 @@ class holidayModel extends model { $updateProjectList = $this->dao->select('id, realBegan, realEnd') ->from(TABLE_PROJECT) - ->where('realBegan')->between($beginDate, $endDate) + ->where('status')->ne('done') + ->andWhere('type')->ne('program') + ->andwhere('realBegan', true)->between($beginDate, $endDate) ->orWhere('realEnd')->between($beginDate, $endDate) ->orWhere("(realBegan < '$beginDate' AND realEnd > '$endDate')") - ->andWhere('status')->ne('done') + ->markRight(1) ->fetchAll(); foreach($updateProjectList as $project) diff --git a/module/holiday/view/browse.html.php b/module/holiday/view/browse.html.php index 073878af8e..f4127b3779 100644 --- a/module/holiday/view/browse.html.php +++ b/module/holiday/view/browse.html.php @@ -11,19 +11,28 @@ */ ?> -