diff --git a/module/productplan/control.php b/module/productplan/control.php index 6518c73f6c..7b6e144c77 100644 --- a/module/productplan/control.php +++ b/module/productplan/control.php @@ -21,6 +21,7 @@ class productplan extends control public function commonAction($productID, $branch = 0) { $this->loadModel('product'); + $this->app->loadConfig('project'); $product = $this->product->getById($productID); $this->view->product = $product; $this->view->branch = $branch; diff --git a/module/productplan/js/create.js b/module/productplan/js/create.js index b8f03d41ec..fda792d52f 100644 --- a/module/productplan/js/create.js +++ b/module/productplan/js/create.js @@ -25,6 +25,13 @@ function computeEndDate(delta) beginDate = $('#begin').val(); if(!beginDate) return; - endDate = convertStringToDate(beginDate).addDays(parseInt(delta)).toString('yyyy-MM-dd'); + delta = parseInt(delta); + beginDate = convertStringToDate(beginDate); + if((delta == 7 || delta == 14) && (beginDate.getDay() == 1)) + { + delta = (weekend == 2) ? (delta - 2) : (delta - 1); + } + + endDate = beginDate.addDays(delta - 1).toString('yyyy-MM-dd'); $('#end').val(endDate); } diff --git a/module/productplan/js/edit.js b/module/productplan/js/edit.js index b8f03d41ec..fda792d52f 100644 --- a/module/productplan/js/edit.js +++ b/module/productplan/js/edit.js @@ -25,6 +25,13 @@ function computeEndDate(delta) beginDate = $('#begin').val(); if(!beginDate) return; - endDate = convertStringToDate(beginDate).addDays(parseInt(delta)).toString('yyyy-MM-dd'); + delta = parseInt(delta); + beginDate = convertStringToDate(beginDate); + if((delta == 7 || delta == 14) && (beginDate.getDay() == 1)) + { + delta = (weekend == 2) ? (delta - 2) : (delta - 1); + } + + endDate = beginDate.addDays(delta - 1).toString('yyyy-MM-dd'); $('#end').val(endDate); } diff --git a/module/productplan/view/create.html.php b/module/productplan/view/create.html.php index 32d4f80ad9..33753a5092 100644 --- a/module/productplan/view/create.html.php +++ b/module/productplan/view/create.html.php @@ -13,6 +13,7 @@ +project->weekend);?>
diff --git a/module/productplan/view/edit.html.php b/module/productplan/view/edit.html.php index b434123019..cff0002730 100644 --- a/module/productplan/view/edit.html.php +++ b/module/productplan/view/edit.html.php @@ -13,6 +13,7 @@ +project->weekend);?>
diff --git a/module/project/js/common.js b/module/project/js/common.js index 28752fcc81..3c382bfeb7 100644 --- a/module/project/js/common.js +++ b/module/project/js/common.js @@ -103,8 +103,14 @@ function computeEndDate(delta) beginDate = $('#begin').val(); if(!beginDate) return; - endDate = convertStringToDate(beginDate).addDays(parseInt(delta)); - endDate = endDate.toString('yyyy-MM-dd'); + delta = parseInt(delta); + beginDate = convertStringToDate(beginDate); + if((delta == 7 || delta == 14) && (beginDate.getDay() == 1)) + { + delta = (weekend == 2) ? (delta - 2) : (delta - 1); + } + + endDate = beginDate.addDays(delta - 1).toString('yyyy-MM-dd'); $('#end').val(endDate); computeWorkDays(); } diff --git a/module/project/view/create.html.php b/module/project/view/create.html.php index e02eaad36e..3f04eb6285 100644 --- a/module/project/view/create.html.php +++ b/module/project/view/create.html.php @@ -31,6 +31,7 @@ +project->weekend);?> project->placeholder);?>
diff --git a/module/project/view/edit.html.php b/module/project/view/edit.html.php index ef85b8c651..adf511dc02 100644 --- a/module/project/view/edit.html.php +++ b/module/project/view/edit.html.php @@ -37,7 +37,7 @@
begin, "class='form-control form-date' onchange='computeWorkDays()' placeholder='" . $lang->project->begin . "'");?> - project->to;?> + project->to;?> end, "class='form-control form-date' onchange='computeWorkDays()' placeholder='" . $lang->project->end . "'");?>
diff --git a/www/theme/default/style.css b/www/theme/default/style.css index 48ce33e4ee..aefe568763 100644 --- a/www/theme/default/style.css +++ b/www/theme/default/style.css @@ -585,7 +585,7 @@ body {color:#141414; padding-bottom: 40px;} .outer .table tbody td > a:visited, #crumbs > a:visited, .side > a:visited {color: #551A8B} /* Querybox */ -#querybox {margin: 35px -10px -7px; background-color: #fff; height: 0; border-top: 1px solid #ddd; position: relative; z-index: 1000; overflow: visible; display: none;} +#querybox {margin: 5px -10px -7px; background-color: #fff; height: 0; border-top: 1px solid #ddd; position: relative; z-index: 1000; overflow: visible; display: none; width: 100%; float: left;} #querybox form {padding: 10px} #querybox.show {display: block; height: auto} #titlebar #querybox {margin: 5px -20px -10px}