*Fix bug.

This commit is contained in:
zhengrunyu
2021-12-30 18:21:26 +08:00
parent f122870e36
commit eaf5bd6c50
5 changed files with 11 additions and 11 deletions
-2
View File
@@ -7,8 +7,6 @@
*/
function changeDate(planID)
{
$("input[name='end[" + planID + "]']").val('');
$("input[name='begin[" + planID + "]']").val('');
if($("#future"+planID).prop('checked'))
{
$("input[name='begin[" + planID + "]']").attr('disabled', 'disabled');
+2 -2
View File
@@ -96,8 +96,8 @@ $('#future').on('change', function()
{
if($(this).prop('checked'))
{
$('#begin').attr('disabled', 'disabled').val('');
$('#end').val('').parents('tr').hide();
$('#begin').attr('disabled', 'disabled');
$('#end').parents('tr').hide();
}
else
{
+6 -2
View File
@@ -676,6 +676,9 @@ class productplanModel extends model
$plan->end = $data->end[$planID] == '' ? '2030-01-01' : $data->end[$planID];
$plan->status = $data->status[$planID];
if($plan->status == 'wait' and !isset($data->future[$planID])) $data->future[$planID] = 'on';
$isFuture = isset($data->future[$planID]) ? 1 : 0;
if($oldPlans[$planID]->parent > 0)
{
$parentPlan = $this->getByID($oldPlans[$planID]->parent);
@@ -690,10 +693,11 @@ class productplanModel extends model
}
if(empty($plan->title))die(js::alert(sprintf($this->lang->productplan->errorNoTitle, $planID)));
if($plan->begin == '2030-01-01' and $plan->status != 'wait') die(js::alert(sprintf($this->lang->productplan->errorNoBegin, $planID)));
if($plan->end == '2030-01-01' and $plan->status != 'wait') die(js::alert(sprintf($this->lang->productplan->errorNoEnd, $planID)));
if(!$isFuture and $plan->begin == '2030-01-01') die(js::alert(sprintf($this->lang->productplan->errorNoBegin, $planID)));
if(!$isFuture and $plan->end == '2030-01-01') die(js::alert(sprintf($this->lang->productplan->errorNoEnd, $planID)));
if($plan->begin > $plan->end and ($plan->begin != '2030-01-01' and $plan->end != '2030-01-01')) die(js::alert(sprintf($this->lang->productplan->beginGeEnd, $planID)));
foreach($extendFields as $extendField)
{
$plan->{$extendField->field} = $this->post->{$extendField->field}[$planID];
+2 -3
View File
@@ -53,8 +53,7 @@
<?php if($plan->parent != -1):?>
<td><?php echo html::select("status[$plan->id]", array_slice($lang->productplan->statusList,($plan->status == 'wait' ? 0 : 1)), $plan->status, "class='form-control chosen' onchange='setPlanStatus($plan->id, this.value)'");?></td>
<?php else:?>
<td><?php echo zget($lang->productplan->statusList, $plan->status);?></td>
<?php echo html::hidden("status[$plan->id]", $plan->status);?>
<td><?php echo html::select("status[$plan->id]", array_slice($lang->productplan->statusList,($plan->status == 'wait' ? 0 : 1)), $plan->status, "class='form-control chosen' disabled onchange='setPlanStatus($plan->id, this.value)'");?></td>
<?php endif;?>
<?php $required = $plan->status != 'wait' ? 'required' : '' ;?>
<?php $disabled = ($plan->begin == '2030-01-01' || $plan->end == '2030-01-01') ? 'disabled="disabled"' : '';?>
@@ -63,7 +62,7 @@
<td class=<?php echo $required;?>><?php echo html::input("begin[$plan->id]", $plan->begin, "class='form-control form-date' $disabled");?></td>
<td class=<?php echo $required;?>><?php echo html::input("end[$plan->id]", $plan->end, "class='form-control form-date' $disabled");?></td>
<?php $hidden = $plan->status != 'wait' ? 'hidden' : '';?>
<td><div class='checkbox-primary <?php echo $hidden;?>'><input type='checkbox' id="future<?php echo $plan->id; ?>" name='future<?php echo $plan->id; ?>' <?php echo $isChecked;?> onclick="changeDate(<?php echo $plan->id;?>);"/><label for='future<?php echo $plan->id; ?>'><?php echo $lang->productplan->future;?></label></div></td>
<td><div class='checkbox-primary <?php echo $hidden;?>'><input type='checkbox' id="future<?php echo $plan->id; ?>" name='future[<?php echo $plan->id; ?>]' <?php echo $isChecked;?> onclick="changeDate(<?php echo $plan->id;?>);"/><label for='future<?php echo $plan->id; ?>'><?php echo $lang->productplan->future;?></label></div></td>
<?php foreach($extendFields as $extendField) echo "<td" . (($extendField->control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->loadModel('flow')->getFieldControl($extendField, $plan, $extendField->field . "[{$plan->id}]") . "</td>";?>
</tr>
<?php endforeach;?>
+1 -2
View File
@@ -43,8 +43,7 @@
<?php if($plan->parent != -1):?>
<td><?php echo html::select('status', array_slice($lang->productplan->statusList,($plan->status == 'wait' ? 0 : 1)), $plan->status, "class='form-control chosen' onchange='setPlanStatus()'");?></td>
<?php else:?>
<td><?php echo zget($lang->productplan->statusList, $plan->status);?></td>
<?php echo html::hidden('status', $plan->status);?>
<td><?php echo html::select('status', array_slice($lang->productplan->statusList,($plan->status == 'wait' ? 0 : 1)), $plan->status, "class='form-control chosen' disabled onchange='setPlanStatus()'");?></td>
<?php endif;?>
</tr>
<tr>