diff --git a/module/productplan/js/batchedit.js b/module/productplan/js/batchedit.js index 96528d7dbc..85178abb35 100644 --- a/module/productplan/js/batchedit.js +++ b/module/productplan/js/batchedit.js @@ -48,8 +48,8 @@ function setPlanStatus(planID, status) $('#future' + planID).closest('div').removeClass('hidden'); $("input[name='begin[" + planID + "]']").closest('td').removeClass('required'); $("input[name='end[" + planID + "]']").closest('td').removeClass('required'); - $("input[name='begin" + planID + "']").attr('disabled', 'disabled'); - $("input[name='end" + planID + "']").attr('disabled', 'disabled'); + $("input[name='begin" + planID + "']").attr('disabled', 'disabled').val(''); + $("input[name='end" + planID + "']").attr('disabled', 'disabled').val(''); } } diff --git a/module/productplan/js/edit.js b/module/productplan/js/edit.js index 4eadd396e1..f65ed0e4c5 100644 --- a/module/productplan/js/edit.js +++ b/module/productplan/js/edit.js @@ -96,7 +96,7 @@ $('#future').on('change', function() { if($(this).prop('checked')) { - $('#begin').attr('disabled', 'disabled'); + $('#begin').attr('disabled', 'disabled').val(''); $('#end').val('').parents('tr').hide(); } else diff --git a/module/productplan/model.php b/module/productplan/model.php index 2b8b027fca..31960e9330 100644 --- a/module/productplan/model.php +++ b/module/productplan/model.php @@ -393,11 +393,11 @@ class productplanModel extends model ->remove('delta,uid,future') ->get(); - if(!empty($plan->parentBegin)) + if($plan->parentBegin != '2030-01-01') { if($plan->begin < $plan->parentBegin) dao::$errors['begin'] = sprintf($this->lang->productplan->beginLetterParent, $plan->parentBegin); } - if(!empty($plan->parentEnd)) + if($plan->parentEnd != '2030-01-01') { if($plan->end !=='2030-01-01' and $plan->end > $plan->parentEnd) dao::$errors['end'] = sprintf($this->lang->productplan->endGreaterParent, $plan->parentEnd); } @@ -465,14 +465,17 @@ class productplanModel extends model ->remove('delta,uid,future') ->get(); - if($oldPlan->parent > 0) $parentPlan = $this->getByID($oldPlan->parent); - if(!empty($parentPlan->begin)) - { - if($plan->begin < $parentPlan->begin) dao::$errors['begin'] = sprintf($this->lang->productplan->beginLetterParent, $parentPlan->begin); - } - if(!empty($parentPlan->end)) + if($oldPlan->parent > 0) { - if($plan->end !=='2030-01-01' and $plan->end > $parentPlan->end) dao::$errors['end'] = sprintf($this->lang->productplan->endGreaterParent, $parentPlan->end); + $parentPlan = $this->getByID($oldPlan->parent); + if($parentPlan->begin != '2030-01-01') + { + if($plan->begin < $parentPlan->begin) dao::$errors['begin'] = sprintf($this->lang->productplan->beginLetterParent, $parentPlan->begin); + } + if($parentPlan->end != '2030-01-01') + { + if($plan->end !=='2030-01-01' and $plan->end > $parentPlan->end) dao::$errors['end'] = sprintf($this->lang->productplan->endGreaterParent, $parentPlan->end); + } } $requiredFields = $plan->status == 'wait' ? $this->config->productplan->edit->requiredFields : 'title, begin, end'; @@ -618,14 +621,17 @@ class productplanModel extends model $plan->end = $data->end[$planID] == '' ? '2030-01-01' : $data->end[$planID]; $plan->status = $data->status[$planID]; - if($oldPlans[$planID]->parent > 0) $parentPlan = $this->getByID($oldPlans[$planID]->parent); - if(!empty($parentPlan->begin)) + if($oldPlans[$planID]->parent > 0) { - if($plan->begin < $parentPlan->begin) dao::$errors['begin'] = sprintf($this->lang->productplan->beginLetterParent, $parentPlan->begin); - } - if(!empty($parentPlan->end)) - { - if($plan->end !=='2030-01-01' and $plan->end > $parentPlan->end) dao::$errors['end'] = sprintf($this->lang->productplan->endGreaterParent, $parentPlan->end); + $parentPlan = $this->getByID($oldPlans[$planID]->parent); + if($parentPlan->begin != '2030-01-01') + { + if($plan->begin < $parentPlan->begin) dao::$errors['begin'] = sprintf($this->lang->productplan->beginLetterParent, $parentPlan->begin); + } + if($parentPlan->end != '2030-01-01') + { + if($plan->end !='2030-01-01' and $plan->end > $parentPlan->end) dao::$errors['end'] = sprintf($this->lang->productplan->endGreaterParent, $parentPlan->end); + } } if(empty($plan->title))die(js::alert(sprintf($this->lang->productplan->errorNoTitle, $planID))); diff --git a/module/productplan/view/batchedit.html.php b/module/productplan/view/batchedit.html.php index c7b1262343..8814f21425 100644 --- a/module/productplan/view/batchedit.html.php +++ b/module/productplan/view/batchedit.html.php @@ -59,8 +59,8 @@ id]", $plan->status);?> status != 'wait' ? 'required' : '' ;?> - >id]", $plan->begin, "class='form-control form-date $hiddenInput'");echo html::input("begin$plan->id", '', "class='form-control $showInput' disabled='disabled'");?> - >id]", $plan->end, "class='form-control form-date $hiddenInput'");echo html::input("end$plan->id", '', "class='form-control $showInput' disabled='disabled'");?> + >id]", $plan->begin, "class='form-control form-date $hiddenInput'");echo html::input("begin$plan->id", '', "class='form-control form-date $showInput' disabled='disabled'");?> + >id]", $plan->end, "class='form-control form-date $hiddenInput'");echo html::input("end$plan->id", '', "class='form-control form-date $showInput' disabled='disabled'");?> status != 'wait' ? 'hidden' : '';?>
onclick="changeDate(id;?>);"/>
control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->loadModel('flow')->getFieldControl($extendField, $plan, $extendField->field . "[{$plan->id}]") . "";?> diff --git a/module/productplan/view/browsebylist.html.php b/module/productplan/view/browsebylist.html.php index e998ece3bb..e271775e94 100644 --- a/module/productplan/view/browsebylist.html.php +++ b/module/productplan/view/browsebylist.html.php @@ -155,7 +155,7 @@ common::printIcon('productplan', 'close', "planID=$plan->id", $plan, 'list', 'off', '', $class, false, $attr, $lang->productplan->close); } - $attr = ($plan->expired or $plan->status ==='done' or $plan->status ==='closed') ? "disabled='disabled'" : ''; + $attr = $plan->expired ? "disabled='disabled'" : ''; if(common::hasPriv('execution', 'create', $plan) and $plan->parent >= 0) { $disabled = '';