diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php
index 0bccdd61e79..d26a31b3cd2 100644
--- a/htdocs/core/tpl/objectline_create.tpl.php
+++ b/htdocs/core/tpl/objectline_create.tpl.php
@@ -142,49 +142,54 @@ else {
element == 'contrat')
+
+ $freelines = false;
+ if (empty($conf->global->MAIN_DISABLE_FREE_LINES))
{
- if (empty($conf->product->enabled) && empty($conf->service->enabled) && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall=-1; // With contract, by default, no choice at all, except if CONTRACT_SUPPORT_PRODUCTS is set
- else $forceall=0;
- }
-
- // Free line
- echo '';
- // Show radio free line
- if ($forceall >= 0 && (! empty($conf->product->enabled) || ! empty($conf->service->enabled)))
- {
- echo '';
- echo ' ';
- }
- else
- {
- echo '';
- // Show type selector
- if ($forceall >= 0)
+ $freelines = true;
+ $forceall=1; // We always force all type for free lines (module product or service means we use predefined product or service)
+ if ($object->element == 'contrat')
{
- if (empty($conf->product->enabled) || empty($conf->service->enabled)) echo $langs->trans("Type");
- else echo $langs->trans("FreeLineOfType");
+ if (empty($conf->product->enabled) && empty($conf->service->enabled) && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall=-1; // With contract, by default, no choice at all, except if CONTRACT_SUPPORT_PRODUCTS is set
+ else $forceall=0;
+ }
+
+ // Free line
+ echo '';
+ // Show radio free line
+ if ($forceall >= 0 && (! empty($conf->product->enabled) || ! empty($conf->service->enabled)))
+ {
+ echo '';
echo ' ';
}
+ else
+ {
+ echo '';
+ // Show type selector
+ if ($forceall >= 0)
+ {
+ if (empty($conf->product->enabled) || empty($conf->service->enabled)) echo $langs->trans("Type");
+ else echo $langs->trans("FreeLineOfType");
+ echo ' ';
+ }
+ }
+
+ echo $form->select_type_of_lines(isset($_POST["type"])?GETPOST("type",'alpha',2):-1,'type',1,1,$forceall);
+
+ echo '';
}
- echo $form->select_type_of_lines(isset($_POST["type"])?GETPOST("type",'alpha',2):-1,'type',1,1,$forceall);
-
- echo '';
-
// Predefined product/service
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
{
- if ($forceall >= 0) echo ' ';
+ if ($forceall >= 0 && $freelines) echo ' ';
echo '';
echo ' |