From ad6af14edd20374a0d20a7747e2665de7a07cf20 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Jan 2015 19:27:56 +0100 Subject: [PATCH] Fixed: Status was not visible if selected. --- htdocs/core/class/html.formprojet.class.php | 43 +++++++++++---------- htdocs/core/lib/agenda.lib.php | 2 +- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index c09b7237496..4cdd31d3b4c 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -51,7 +51,7 @@ class FormProjets * @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) @@ -105,7 +105,7 @@ class FormProjets } else { - if ($discard_closed && $obj->fk_statut == 2) + if ($discard_closed == 1 && $obj->fk_statut == 2) { $i++; continue; @@ -114,30 +114,31 @@ class FormProjets $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.= ''; + $out.= ''; } 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=''; diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 80e556378c0..72c3214610a 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -114,7 +114,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print ''; print $langs->trans("Project").'   '; print ''; - $formproject->select_projects($socid?$socid:-1, $pid, 'projectid', 64); + $formproject->select_projects($socid?$socid:-1, $pid, 'projectid'); print ''; }