* code for task #83737.

This commit is contained in:
wangyidong
2023-02-13 15:23:46 +08:00
parent 1470d9d851
commit 6b0a919b6f
12 changed files with 126 additions and 50 deletions
+1 -1
View File
@@ -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['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['user'] = array('dept', 'company', 'user', 'group');
$config->admin->menuGroup['switch'] = array('admin|setmodule'); $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['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['template'] = array('custom|set', 'baseline');
$config->admin->menuGroup['message'] = array('mail', 'webhook', 'sms', 'message'); $config->admin->menuGroup['message'] = array('mail', 'webhook', 'sms', 'message');
+2 -2
View File
@@ -75,7 +75,7 @@ $lang->admin->menuList->switch['subMenu']['setmodule'] = array('link' => "{$lang
$lang->admin->menuList->switch['menuOrder']['5'] = 'setmodule'; $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']['scrum'] = array('link' => "{$lang->scrumModel}|auditcl|scrumbrowse|", 'subModule' => 'auditcl');
$lang->admin->menuList->model['subMenu']['waterfall'] = array('link' => "{$lang->waterfallModel}|stage|settype|", 'subModule' => 'stage'); $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']['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']['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']['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']['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']['5'] = 'project';
$lang->admin->menuList->model['tabMenu']['menuOrder']['common']['10'] = 'build'; $lang->admin->menuList->model['tabMenu']['menuOrder']['common']['10'] = 'build';
+22 -2
View File
@@ -863,17 +863,37 @@ class custom extends control
$this->display(); $this->display();
} }
public function hours() /**
* Set hours and weekend
*
* @access public
* @return void
*/
public function hours($type = 'hours')
{ {
if($_POST) 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->app->loadConfig('execution');
$this->view->title = $this->lang->workingHour; $this->view->title = $this->lang->workingHour;
$this->view->type = $type;
$this->view->weekend = $this->config->execution->weekend; $this->view->weekend = $this->config->execution->weekend;
$this->view->workhours = $this->config->execution->defaultWorkhours; $this->view->workhours = $this->config->execution->defaultWorkhours;
$this->view->restDay = zget($this->config->execution, 'restDay', 0);
$this->display(); $this->display();
} }
} }
+16
View File
@@ -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)
})
})
+4 -2
View File
@@ -219,9 +219,11 @@ $lang->custom->setHours = 'Setting Hours';
$lang->custom->setWeekend = 'Setting Weekend'; $lang->custom->setWeekend = 'Setting Weekend';
$lang->custom->setHoliday = 'Setting Holiday'; $lang->custom->setHoliday = 'Setting Holiday';
$lang->custom->workingHours = 'hours/day'; $lang->custom->workingHours = 'hours/day';
$lang->custom->weekend = 'Weekend'; $lang->custom->weekendRole = 'Role';
$lang->custom->weekendList[2] = '2-Day Off';
$lang->custom->weekendList[1] = '1-Day Off'; $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; global $config;
$lang->custom->sprintConceptList[0] = 'Program Product Iteration'; $lang->custom->sprintConceptList[0] = 'Program Product Iteration';
+4 -2
View File
@@ -219,9 +219,11 @@ $lang->custom->setHours = 'Setting Hours';
$lang->custom->setWeekend = 'Setting Weekend'; $lang->custom->setWeekend = 'Setting Weekend';
$lang->custom->setHoliday = 'Setting Holiday'; $lang->custom->setHoliday = 'Setting Holiday';
$lang->custom->workingHours = 'Hours/Day'; $lang->custom->workingHours = 'Hours/Day';
$lang->custom->weekend = 'Weekend'; $lang->custom->weekendRole = 'Role';
$lang->custom->weekendList[2] = '2-Day Off';
$lang->custom->weekendList[1] = '1-Day Off'; $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; global $config;
$lang->custom->sprintConceptList[0] = 'Program Product Iteration'; $lang->custom->sprintConceptList[0] = 'Program Product Iteration';
+4 -2
View File
@@ -219,9 +219,11 @@ $lang->custom->setHours = 'Setting Hours';
$lang->custom->setWeekend = 'Setting Weekend'; $lang->custom->setWeekend = 'Setting Weekend';
$lang->custom->setHoliday = 'Setting Holiday'; $lang->custom->setHoliday = 'Setting Holiday';
$lang->custom->workingHours = 'Heures/Jour'; $lang->custom->workingHours = 'Heures/Jour';
$lang->custom->weekend = 'Weekend'; $lang->custom->weekendRole = 'Role';
$lang->custom->weekendList[2] = '2-Jour';
$lang->custom->weekendList[1] = '1-Jour'; $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; global $config;
$lang->custom->sprintConceptList[0] = 'Program Product Iteration'; $lang->custom->sprintConceptList[0] = 'Program Product Iteration';
+4 -2
View File
@@ -219,9 +219,11 @@ $lang->custom->setHours = '工时设置';
$lang->custom->setWeekend = '休息日设置'; $lang->custom->setWeekend = '休息日设置';
$lang->custom->setHoliday = '节假日设置'; $lang->custom->setHoliday = '节假日设置';
$lang->custom->workingHours = '每天可用工时'; $lang->custom->workingHours = '每天可用工时';
$lang->custom->weekend = '休息日'; $lang->custom->weekendRole = '规则设置';
$lang->custom->weekendList[2] = '双休';
$lang->custom->weekendList[1] = '单休'; $lang->custom->weekendList[1] = '单休';
$lang->custom->weekendList[2] = '双休';
$lang->custom->restDayList[6] = '周六休息';
$lang->custom->restDayList[0] = '周天休息';
global $config; global $config;
$lang->custom->sprintConceptList[0] = '项目 产品 迭代'; $lang->custom->sprintConceptList[0] = '项目 产品 迭代';
+38 -20
View File
@@ -15,35 +15,53 @@
<div class='side-col' id='sidebar'> <div class='side-col' id='sidebar'>
<div class='cell'> <div class='cell'>
<div class='nav list-group tab-menu'> <div class='nav list-group tab-menu'>
<a href="#hoursContent" data-toggle="tab" class="active"><?php echo $lang->custom->setHours;?></a> <a href="#hoursContent" data-toggle="tab" class="hours <?php if($type == 'hours') echo 'active'?>"><?php echo $lang->custom->setHours;?></a>
<a href="#weekendContent" data-toggle="tab" class=""><?php echo $lang->custom->setWeekend;?></a> <a href="#weekendContent" data-toggle="tab" class="weekend <?php if($type == 'weekend') echo 'active'?>"><?php echo $lang->custom->setWeekend;?></a>
<?php echo html::a($this->createLink('holiday', 'browse'), $lang->custom->setHoliday);?> <?php echo html::a($this->createLink('holiday', 'browse'), $lang->custom->setHoliday);?>
</div> </div>
</div> </div>
</div> </div>
<div class='main-col main-content'> <div class='main-col main-content'>
<form class="load-indicator main-form form-ajax" method='post'> <form class="load-indicator main-form form-ajax" method='post'>
<div class='main-header'> <div class='tab-content'>
<div class='heading'> <div class='tab-pane <?php if($type == 'hours') echo 'active'?>' id='hoursContent'>
<strong><?php echo $lang->workingHour?></strong> <div class='main-header'>
<div class='heading'>
<strong><?php echo $lang->custom->setHours?></strong>
</div>
</div>
<table class='table table-form mw-600px'>
<tr>
<th class='w-150px'><?php echo $lang->custom->workingHours;?></th>
<td><?php echo html::input('defaultWorkhours', $workhours, "class='form-control w-80px'");?></td>
<td></td>
</tr>
</table>
</div>
<div class='tab-pane <?php if($type == 'weekend') echo 'active'?>' id='weekendContent'>
<div class='main-header'>
<div class='heading'>
<strong><?php echo $lang->custom->setWeekend?></strong>
</div>
</div>
<table class='table table-form mw-600px'>
<tr>
<th class='w-150px'><?php echo $lang->custom->weekendRole;?></th>
<td class='w-200px'><?php echo html::radio('weekend', $lang->custom->weekendList, $weekend);?></td>
<td></td>
</tr>
<tr id='restDayBox' class='hidden'>
<th><?php echo $lang->custom->setWeekend;?></th>
<td><?php echo html::select('restDay', $lang->custom->restDayList, $restDay, "class='form-control chosen'");?></td>
</tr>
</table>
</div> </div>
</div> </div>
<table class='table table-form mw-600px'> <div class='table-footer text-center'>
<tr> <?php echo html::submitButton();?>
<th class='w-150px'><?php echo $lang->custom->workingHours;?></th> <?php echo html::hidden('type', $type);?>
<td><?php echo html::input('defaultWorkhours', $workhours, "class='form-control w-80px'");?></td> </div>
<td></td>
</tr>
<tr>
<th><?php echo $lang->custom->weekend;?></th>
<td><?php echo html::radio('weekend', $lang->custom->weekendList, $weekend);?></td>
</tr>
<tr>
<td colspan='2' class='text-center'><?php echo html::submitButton();?></td>
</tr>
</table>
</form> </form>
</div> </div>
</div> </div>
<?php include '../../common/view/footer.html.php';?> <?php include '../../common/view/footer.html.php';?>
-1
View File
@@ -1,7 +1,6 @@
.tree .active{font-weight: bold;} .tree .active{font-weight: bold;}
.with-side .side {position: absolute; width: 130px;} .with-side .side {position: absolute; width: 130px;}
.with-side .main {padding-left: 145px; float: left;} .with-side .main {padding-left: 145px; float: left;}
.side-col {width: 160px;}
.panel-sm .panel-body {padding: 10px;} .panel-sm .panel-body {padding: 10px;}
#mainMenu .input-control {display: flex; width: 200px;} #mainMenu .input-control {display: flex; width: 200px;}
#mainMenu .input-control .form-name {margin: 8px 10px; white-space: pre;} #mainMenu .input-control .form-name {margin: 8px 10px; white-space: pre;}
+11 -5
View File
@@ -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(); if(empty($begin) or empty($end) or $begin == '0000-00-00' or $end == '0000-00-00') return array();
$this->app->loadConfig('execution'); $this->app->loadConfig('execution');
$actualDays = array(); $actualDays = array();
$currentDay = $begin; $currentDay = $begin;
@@ -262,7 +263,7 @@ class holidayModel extends model
$days = ($endTime - $beginTime) / 86400; $days = ($endTime - $beginTime) / 86400;
$dateList = array(); $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; return $dateList;
} }
@@ -313,10 +314,13 @@ class holidayModel extends model
{ {
$updateProjectList = $this->dao->select('id, begin, end') $updateProjectList = $this->dao->select('id, begin, end')
->from(TABLE_PROJECT) ->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('end')->between($beginDate, $endDate)
->orWhere("(begin < '$beginDate' AND end > '$endDate')") ->orWhere("(begin < '$beginDate' AND end > '$endDate')")
->andWhere('status')->ne('done') ->markRight(1)
->fetchAll(); ->fetchAll();
foreach($updateProjectList as $project) foreach($updateProjectList as $project)
@@ -340,10 +344,12 @@ class holidayModel extends model
{ {
$updateProjectList = $this->dao->select('id, realBegan, realEnd') $updateProjectList = $this->dao->select('id, realBegan, realEnd')
->from(TABLE_PROJECT) ->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('realEnd')->between($beginDate, $endDate)
->orWhere("(realBegan < '$beginDate' AND realEnd > '$endDate')") ->orWhere("(realBegan < '$beginDate' AND realEnd > '$endDate')")
->andWhere('status')->ne('done') ->markRight(1)
->fetchAll(); ->fetchAll();
foreach($updateProjectList as $project) foreach($updateProjectList as $project)
+20 -11
View File
@@ -11,19 +11,28 @@
*/ */
?> ?>
<?php include '../../common/view/header.html.php';?> <?php include '../../common/view/header.html.php';?>
<div id='mainMenu' class='clearfix'> <div id='mainContent' class='main-row'>
<div class='pull-left btn-toolbar'> <div class='side-col' id='sidebar'>
<div class='input-control'> <div class='cell'>
<span class="form-name"><strong><?php echo $lang->holiday->checkYear;?></strong></span> <div class='nav list-group tab-menu'>
<?php echo html::select('year', $yearList, $currentYear, "class='form-control chosen'");?> <a href="<?php echo $this->createLink('custom', 'hours', 'type=hours')?>"><?php echo $lang->custom->setHours;?></a>
<a href="<?php echo $this->createLink('custom', 'hours', 'type=weekend')?>"><?php echo $lang->custom->setWeekend;?></a>
<?php echo html::a($this->createLink('holiday', 'browse'), $lang->custom->setHoliday, '', "class='active'");?>
</div>
</div> </div>
</div> </div>
<div class='pull-right'> <div class='main-col main-content'>
<?php common::printLink('holiday', 'create', "", "<i class='icon icon-plus'> </i>" . $lang->holiday->create, '', "class='btn btn-primary iframe'", '', true)?> <div id='mainMenu' class='clearfix'>
</div> <div class='pull-left btn-toolbar'>
</div> <div class='input-control'>
<div id='mainContent' class='main-row fade in'> <span class="form-name"><strong><?php echo $lang->holiday->checkYear;?></strong></span>
<div class='main-col main-table'> <?php echo html::select('year', $yearList, $currentYear, "class='form-control chosen'");?>
</div>
</div>
<div class='pull-right'>
<?php common::printLink('holiday', 'create', "", "<i class='icon icon-plus'> </i>" . $lang->holiday->create, '', "class='btn btn-primary iframe'", '', true)?>
</div>
</div>
<?php if(!empty($holidays)):?> <?php if(!empty($holidays)):?>
<table class='table has-sort-head'> <table class='table has-sort-head'>
<thead> <thead>