From 08e506874a514145877a9bad03c47bb2fded0b88 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Fri, 25 Mar 2016 19:42:14 +0100 Subject: [PATCH] FIX If thirdparty module not enabled, we must hide thirdparty info. --- htdocs/projet/card.php | 44 ++++++++++++++++++++++++------------------ htdocs/projet/list.php | 2 +- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 4b929fea438..1c6db9a50fa 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -462,19 +462,22 @@ if ($action == 'create' && $user->rights->projet->creer) print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td><td><input size="80" type="text" name="title" value="'.GETPOST("title").'"></td></tr>'; // Thirdparty - print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>'; - $filteronlist=''; - if (! empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist=$conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST; - $text=$form->select_thirdparty_list(GETPOST('socid','int'),'socid',$filteronlist,'SelectThirdParty',1); - if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile)) + if ($conf->societe->enabled) { - $texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty"); - print $form->textwithtooltip($text.' '.img_help(),$texthelp,1); + print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>'; + $filteronlist=''; + if (! empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist=$conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST; + $text=$form->select_thirdparty_list(GETPOST('socid','int'), 'socid', $filteronlist, 'SelectThirdParty', 1, 0, array(), '', 0, 0, 'minwidth300'); + if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile)) + { + $texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty"); + print $form->textwithtooltip($text.' '.img_help(),$texthelp,1); + } + else print $text; + print ' <a href="'.DOL_URL_ROOT.'/societe/soc.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>'; + print '</td></tr>'; } - else print $text; - print ' <a href="'.DOL_URL_ROOT.'/societe/soc.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>'; - print '</td></tr>'; - + // Status if ($status != '') { @@ -657,14 +660,17 @@ else print '<td><input size="80" name="title" value="'.$object->title.'"></td></tr>'; // Thirdparty - print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>'; - $filteronlist=''; - if (! empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist=$conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST; - $text=$form->select_thirdparty_list($object->thirdparty->id, 'socid', $filteronlist, 1, 1); - $texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty"); - print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1, 0, '', '', 2); - print '</td></tr>'; - + if ($conf->societe->enabled) + { + print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>'; + $filteronlist=''; + if (! empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist=$conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST; + $text=$form->select_thirdparty_list($object->thirdparty->id, 'socid', $filteronlist, 'SelectThirdParty', 1, 0, array(), '', 0, 0, 'minwidth300'); + $texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty"); + print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1, 0, '', '', 2); + print '</td></tr>'; + } + // Visibility print '<tr><td>'.$langs->trans("Visibility").'</td><td>'; $array=array(0 => $langs->trans("PrivateProject"),1 => $langs->trans("SharedProject")); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index f3905d5af5e..9f1cc038cc5 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -113,7 +113,7 @@ if (empty($user->socid)) $fieldstosearchall["p.note_private"]="NotePrivate"; $arrayfields=array( 'p.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), 'p.title'=>array('label'=>$langs->trans("Label"), 'checked'=>1), - 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), + 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'enabled'=>$conf->societe->enabled), 'commercial'=>array('label'=>$langs->trans("SalesRepresentative"), 'checked'=>1), 'p.dateo'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1, 'position'=>100), 'p.datee'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1, 'position'=>101), -- GitLab