Skip to content

Commit

Permalink
Fixed: Status was not visible if selected.
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jan 28, 2015
1 parent ffde00d commit ad6af14
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
43 changes: 22 additions & 21 deletions htdocs/core/class/html.formprojet.class.php
Expand Up @@ -51,7 +51,7 @@ function __construct($db)
* @param int $maxlength Maximum length of label
* @param int $option_only Return only html options lines without the select tag
* @param int $show_empty Add an empty line
* @param int $discard_closed Discard closed projects
* @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable)
* @return int Nber of project if OK, <0 if KO
*/
function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlength=16, $option_only=0, $show_empty=1, $discard_closed=0)
Expand Down Expand Up @@ -105,7 +105,7 @@ function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlen
}
else
{
if ($discard_closed && $obj->fk_statut == 2)
if ($discard_closed == 1 && $obj->fk_statut == 2)
{
$i++;
continue;
Expand All @@ -114,30 +114,31 @@ function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlen
$labeltoshow=dol_trunc($obj->ref,18);
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
//else $labeltoshow.=' ('.$langs->trans("Private").')';
$labeltoshow.=' '.dol_trunc($obj->title,$maxlength);

$disabled=0;
if ($obj->fk_statut == 0)
{
$disabled=1;
$labeltoshow.=' - '.$langs->trans("Draft");
}
else if ($obj->fk_statut == 2)
{
if ($discard_close == 2) $disabled=1;
$labeltoshow.=' - '.$langs->trans("Closed");
}
else if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid))
{
$disabled=1;
$labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany");
}

if (!empty($selected) && $selected == $obj->rowid && $obj->fk_statut > 0)
{
$out.= '<option value="'.$obj->rowid.'" selected="selected">'.$labeltoshow.' '.dol_trunc($obj->title,$maxlength).'</option>';
$out.= '<option value="'.$obj->rowid.'" selected="selected">'.$labeltoshow.'</option>';
}
else
{
$disabled=0;
$labeltoshow.=' '.dol_trunc($obj->title,$maxlength);
if ($obj->fk_statut == 0)
{
$disabled=1;
$labeltoshow.=' - '.$langs->trans("Draft");
}
else if ($obj->fk_statut == 2)
{
$disabled=1;
$labeltoshow.=' - '.$langs->trans("Closed");
}
else if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid))
{
$disabled=1;
$labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany");
}

if ($hideunselectables && $disabled)
{
$resultat='';
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/lib/agenda.lib.php
Expand Up @@ -114,7 +114,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '<td class="nowrap">';
print $langs->trans("Project").' &nbsp; ';
print '</td><td class="nowrap maxwidthonsmartphone">';
$formproject->select_projects($socid?$socid:-1, $pid, 'projectid', 64);
$formproject->select_projects($socid?$socid:-1, $pid, 'projectid');
print '</td></tr>';
}

Expand Down

0 comments on commit ad6af14

Please sign in to comment.