Skip to content

Commit

Permalink
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
eldy committed Feb 3, 2018
2 parents 833c768 + e982e1d commit f3f39fb
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 35 deletions.
16 changes: 16 additions & 0 deletions htdocs/comm/propal/card.php
Expand Up @@ -2130,6 +2130,22 @@
print '</tr>';
}

$tmparray=$object->getTotalWeightVolume();
$totalWeight=$tmparray['weight'];
$totalVolume=$tmparray['volume'];
if ($totalWeight) {
print '<tr><td>' . $langs->trans("CalculatedWeight") . '</td>';
print '<td>';
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no');
print '</td></tr>';
}
if ($totalVolume) {
print '<tr><td>' . $langs->trans("CalculatedVolume") . '</td>';
print '<td>';
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
print '</td></tr>';
}

// Incoterms
if (!empty($conf->incoterm->enabled))
{
Expand Down
5 changes: 4 additions & 1 deletion htdocs/commande/card.php
Expand Up @@ -2300,12 +2300,15 @@
$tmparray=$object->getTotalWeightVolume();
$totalWeight=$tmparray['weight'];
$totalVolume=$tmparray['volume'];
if ($totalWeight || $totalVolume)
if ($totalWeight)
{
print '<tr><td>'.$langs->trans("CalculatedWeight").'</td>';
print '<td>';
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no');
print '</td></tr>';
}
if ($totalVolume)
{
print '<tr><td>'.$langs->trans("CalculatedVolume").'</td>';
print '<td>';
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
Expand Down
80 changes: 46 additions & 34 deletions htdocs/core/tpl/objectline_create.tpl.php
Expand Up @@ -142,49 +142,54 @@
<td class="nobottom linecoldescription minwidth500imp">

<?php

$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) && 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 '<span class="prod_entry_mode_free">';
// Show radio free line
if ($forceall >= 0 && (! empty($conf->product->enabled) || ! empty($conf->service->enabled)))

$freelines = false;
if (empty($conf->global->MAIN_DISABLE_FREE_LINES))
{
echo '<label for="prod_entry_mode_free">';
echo '<input type="radio" class="prod_entry_mode_free" name="prod_entry_mode" id="prod_entry_mode_free" value="free"';
//echo (GETPOST('prod_entry_mode')=='free' ? ' checked' : ((empty($forceall) && (empty($conf->product->enabled) || empty($conf->service->enabled)))?' checked':'') );
echo (GETPOST('prod_entry_mode')=='free' ? ' checked' : '');
echo '> ';
// Show type selector
echo $langs->trans("FreeLineOfType");
echo '</label>';
echo ' ';
}
else
{
echo '<input type="hidden" id="prod_entry_mode_free" name="prod_entry_mode" value="free">';
// 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 '<span class="prod_entry_mode_free">';
// Show radio free line
if ($forceall >= 0 && (! empty($conf->product->enabled) || ! empty($conf->service->enabled)))
{
echo '<label for="prod_entry_mode_free">';
echo '<input type="radio" class="prod_entry_mode_free" name="prod_entry_mode" id="prod_entry_mode_free" value="free"';
//echo (GETPOST('prod_entry_mode')=='free' ? ' checked' : ((empty($forceall) && (empty($conf->product->enabled) || empty($conf->service->enabled)))?' checked':'') );
echo (GETPOST('prod_entry_mode')=='free' ? ' checked' : '');
echo '> ';
// Show type selector
echo $langs->trans("FreeLineOfType");
echo '</label>';
echo ' ';
}
else
{
echo '<input type="hidden" id="prod_entry_mode_free" name="prod_entry_mode" value="free">';
// 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 '</span>';
}

echo $form->select_type_of_lines(isset($_POST["type"])?GETPOST("type",'alpha',2):-1,'type',1,1,$forceall);

echo '</span>';

// Predefined product/service
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 '<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':'').'> ';
Expand Down Expand Up @@ -590,6 +595,13 @@ function checkFreeLine(e, npRate)
setforpredef();
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 */
$("#idprod, #idprodfournprice").change(function()
Expand Down

0 comments on commit f3f39fb

Please sign in to comment.