Fix bad selection of progress when not known
This commit is contained in:
parent
1a1b27d68c
commit
0b52c43e05
@ -274,15 +274,17 @@ class FormOther
|
|||||||
* @param int $increment increment value
|
* @param int $increment increment value
|
||||||
* @param int $start start value
|
* @param int $start start value
|
||||||
* @param int $end end value
|
* @param int $end end value
|
||||||
|
* @param int $showempty Add also an empty line
|
||||||
* @return string HTML select string
|
* @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':'').'>';
|
$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)
|
for ($i = $start ; $i <= $end ; $i += $increment)
|
||||||
{
|
{
|
||||||
if ($selected == $i)
|
if ($selected != '' && (int) $selected == $i)
|
||||||
{
|
{
|
||||||
$return.= '<option value="'.$i.'" selected>';
|
$return.= '<option value="'.$i.'" selected>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -128,7 +128,7 @@ class Task extends CommonObject
|
|||||||
$sql.= ", ".($this->date_start!=''?"'".$this->db->idate($this->date_start)."'":'null');
|
$sql.= ", ".($this->date_start!=''?"'".$this->db->idate($this->date_start)."'":'null');
|
||||||
$sql.= ", ".($this->date_end!=''?"'".$this->db->idate($this->date_end)."'":'null');
|
$sql.= ", ".($this->date_end!=''?"'".$this->db->idate($this->date_end)."'":'null');
|
||||||
$sql.= ", ".($this->planned_workload!=''?$this->planned_workload:0);
|
$sql.= ", ".($this->planned_workload!=''?$this->planned_workload:0);
|
||||||
$sql.= ", ".($this->progress!=''?$this->progress:0);
|
$sql.= ", ".(($this->progress!='' && $this->progress >= 0)?$this->progress:'null');
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
$this->db->begin();
|
$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.= " 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.= " dateo=".($this->date_start!=''?"'".$this->db->idate($this->date_start)."'":'null').",";
|
||||||
$sql.= " datee=".($this->date_end!=''?"'".$this->db->idate($this->date_end)."'":'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.= " rang=".((!empty($this->rang))?$this->rang:"0");
|
||||||
$sql.= " WHERE rowid=".$this->id;
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
|
|||||||
@ -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 $form->select_date(($date_end?$date_end:-1),'datee',1,1,0,'',1,1,1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// planned workload
|
// Planned workload
|
||||||
print '<tr><td>'.$langs->trans("PlannedWorkload").'</td><td>';
|
print '<tr><td>'.$langs->trans("PlannedWorkload").'</td><td>';
|
||||||
print $form->select_duration('planned_workload', $planned_workload?$planned_workload : $object->planned_workload,0,'text');
|
print $form->select_duration('planned_workload', $planned_workload?$planned_workload : $object->planned_workload,0,'text');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Progress
|
// Progress
|
||||||
print '<tr><td>'.$langs->trans("ProgressDeclared").'</td><td colspan="3">';
|
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>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
|
|||||||
@ -391,12 +391,12 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
// Planned workload
|
// Planned workload
|
||||||
print '<tr><td>'.$langs->trans("PlannedWorkload").'</td><td>';
|
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>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Progress declared
|
// Progress declared
|
||||||
print '<tr><td>'.$langs->trans("ProgressDeclared").'</td><td colspan="3">';
|
print '<tr><td>'.$langs->trans("ProgressDeclared").'</td><td>';
|
||||||
print $formother->select_percent($object->progress,'progress');
|
print $formother->select_percent($object->progress,'progress',0,5,0,100,1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user