Start to fix [ bug #1711 ] Projet cloturé toujours visible dans les

autres module pour affectation but it is a too important change.
This commit is contained in:
Laurent Destailleur 2014-11-20 15:32:10 +01:00
parent 0f5203b384
commit 95de38e102
2 changed files with 13 additions and 7 deletions

View File

@ -3102,7 +3102,7 @@ class Form
* @param string $htmlname Name of select field * @param string $htmlname Name of select field
* @return void * @return void
*/ */
function form_project($page, $socid, $selected='', $htmlname='projectid') function form_project($page, $socid, $selected='', $htmlname='projectid', $discard_closed=0)
{ {
global $langs; global $langs;
@ -3119,8 +3119,7 @@ class Form
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">'; print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
print '<tr><td>'; print '<tr><td>';
//print "$socid,$selected,$htmlname"; $formproject->select_projects($socid,$selected,$htmlname,20,0,1,$discard_closed);
$formproject->select_projects($socid,$selected,$htmlname);
print '</td>'; print '</td>';
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>'; print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr></table></form>'; print '</tr></table></form>';

View File

@ -49,11 +49,12 @@ class FormProjets
* @param int $selected Id project preselected * @param int $selected Id project preselected
* @param string $htmlname Nom de la zone html * @param string $htmlname Nom de la zone html
* @param int $maxlength Maximum length of label * @param int $maxlength Maximum length of label
* @param int $option_only Option only * @param int $option_only Return only html options lines without the select tag
* @param int $show_empty Add an empty line * @param int $show_empty Add an empty line
* @param int $discard_closed Discard closed projects
* @return int Nber of project if OK, <0 if KO * @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) function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlength=16, $option_only=0, $show_empty=1, $discard_closed=0)
{ {
global $user,$conf,$langs; global $user,$conf,$langs;
@ -104,6 +105,12 @@ class FormProjets
} }
else else
{ {
if ($discard_closed && $obj->fk_statut == 2)
{
$i++;
continue;
}
$labeltoshow=dol_trunc($obj->ref,18); $labeltoshow=dol_trunc($obj->ref,18);
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')'; //if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
//else $labeltoshow.=' ('.$langs->trans("Private").')'; //else $labeltoshow.=' ('.$langs->trans("Private").')';