diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 66e624e96b940b2d6e31de39c809ac1663262a7b..2ee6b18a44f9fbc71c302d704c7d1de79448a73b 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -274,15 +274,17 @@ class FormOther * @param int $increment increment value * @param int $start start value * @param int $end end value + * @param int $showempty Add also an empty line * @return string HTML select string */ - function select_percent($selected=0,$htmlname='percent',$disabled=0,$increment=5,$start=0,$end=100) + function select_percent($selected=0,$htmlname='percent',$disabled=0,$increment=5,$start=0,$end=100,$showempty=0) { $return = '<select class="flat" name="'.$htmlname.'" '.($disabled?'disabled':'').'>'; + if ($showempty) $return.='<option value="-1"'.(($selected == -1 || $selected == '')?' selected':'').'> </option>'; for ($i = $start ; $i <= $end ; $i += $increment) { - if ($selected == $i) + if ($selected != '' && (int) $selected == $i) { $return.= '<option value="'.$i.'" selected>'; } diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 9a1819fc46c4d2ba80fc20fda5b83732f5d3dc89..dad46c96989b3292567278aff215688865c1a81a 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -100,7 +100,7 @@ class Task extends CommonObject // Clean parameters $this->label = trim($this->label); $this->description = trim($this->description); - + // Check parameters // Put here code to add control on parameters values @@ -128,7 +128,7 @@ class Task extends CommonObject $sql.= ", ".($this->date_start!=''?"'".$this->db->idate($this->date_start)."'":'null'); $sql.= ", ".($this->date_end!=''?"'".$this->db->idate($this->date_end)."'":'null'); $sql.= ", ".($this->planned_workload!=''?$this->planned_workload:0); - $sql.= ", ".($this->progress!=''?$this->progress:0); + $sql.= ", ".(($this->progress!='' && $this->progress >= 0)?$this->progress:'null'); $sql.= ")"; $this->db->begin(); @@ -300,7 +300,7 @@ class Task extends CommonObject $sql.= " planned_workload=".((isset($this->planned_workload) && $this->planned_workload != '')?$this->planned_workload:"null").","; $sql.= " dateo=".($this->date_start!=''?"'".$this->db->idate($this->date_start)."'":'null').","; $sql.= " datee=".($this->date_end!=''?"'".$this->db->idate($this->date_end)."'":'null').","; - $sql.= " progress=".$this->progress.","; + $sql.= " progress=".(($this->progress!='' && $this->progress >= 0)?$this->progress:'null').","; $sql.= " rang=".((!empty($this->rang))?$this->rang:"0"); $sql.= " WHERE rowid=".$this->id; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 35a7812d4fa6f6be212090764e15e881a64c90cc..06bd2c9c73052d5e2cfe99eef0b56fd9104e1223 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -391,14 +391,14 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print $form->select_date(($date_end?$date_end:-1),'datee',1,1,0,'',1,1,1); print '</td></tr>'; - // planned workload + // Planned workload print '<tr><td>'.$langs->trans("PlannedWorkload").'</td><td>'; print $form->select_duration('planned_workload', $planned_workload?$planned_workload : $object->planned_workload,0,'text'); print '</td></tr>'; // Progress print '<tr><td>'.$langs->trans("ProgressDeclared").'</td><td colspan="3">'; - print $formother->select_percent($progress,'progress'); + print $formother->select_percent($progress,'progress',0,5,0,100,1); print '</td></tr>'; // Description diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index f0a5551788165afc374950ddbbe37b44fb7ef9ed..603a69a07b0f8fdff8c4ce9e2ba5def656b3aa76 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -391,12 +391,12 @@ if ($id > 0 || ! empty($ref)) // Planned workload print '<tr><td>'.$langs->trans("PlannedWorkload").'</td><td>'; - print $form->select_duration('planned_workload',$object->planned_workload,0,'text'); + print $form->select_duration('planned_workload', $object->planned_workload, 0, 'text'); print '</td></tr>'; // Progress declared - print '<tr><td>'.$langs->trans("ProgressDeclared").'</td><td colspan="3">'; - print $formother->select_percent($object->progress,'progress'); + print '<tr><td>'.$langs->trans("ProgressDeclared").'</td><td>'; + print $formother->select_percent($object->progress,'progress',0,5,0,100,1); print '</td></tr>'; // Description