Merge pull request #8062 from atm-maxime/new_disable_freelines

NEW hidden option MAIN_DISABLE_FREE_LINES
This commit is contained in:
Laurent Destailleur 2018-02-03 17:02:05 +01:00 committed by GitHub
commit e982e1d28c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -143,6 +143,10 @@ else {
<?php <?php
$freelines = false;
if (empty($conf->global->MAIN_DISABLE_FREE_LINES))
{
$freelines = true;
$forceall=1; // We always force all type for free lines (module product or service means we use predefined product or service) $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 ($object->element == 'contrat')
{ {
@ -180,11 +184,12 @@ else {
echo $form->select_type_of_lines(isset($_POST["type"])?GETPOST("type",'alpha',2):-1,'type',1,1,$forceall); echo $form->select_type_of_lines(isset($_POST["type"])?GETPOST("type",'alpha',2):-1,'type',1,1,$forceall);
echo '</span>'; echo '</span>';
}
// Predefined product/service // Predefined product/service
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
{ {
if ($forceall >= 0) echo '<br>'; if ($forceall >= 0 && $freelines) echo '<br>';
echo '<span class="prod_entry_mode_predef">'; echo '<span class="prod_entry_mode_predef">';
echo '<label for="prod_entry_mode_predef">'; echo '<label for="prod_entry_mode_predef">';
echo '<input type="radio" class="prod_entry_mode_predef" name="prod_entry_mode" id="prod_entry_mode_predef" value="predef"'.(GETPOST('prod_entry_mode')=='predef'?' checked':'').'> '; echo '<input type="radio" class="prod_entry_mode_predef" name="prod_entry_mode" id="prod_entry_mode_predef" value="predef"'.(GETPOST('prod_entry_mode')=='predef'?' checked':'').'> ';
@ -591,6 +596,13 @@ jQuery(document).ready(function() {
jQuery('#trlinefordates').show(); jQuery('#trlinefordates').show();
}); });
<?php
if(!$freelines) { ?>
$("#prod_entry_mode_predef").click();
<?php
}
?>
/* When changing predefined product, we reload list of supplier prices required for margin combo */ /* When changing predefined product, we reload list of supplier prices required for margin combo */
$("#idprod, #idprodfournprice").change(function() $("#idprod, #idprodfournprice").change(function()
{ {