Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2018-02-03 17:37:51 +01:00
commit f3f39fb1ee
3 changed files with 66 additions and 35 deletions

View File

@ -2130,6 +2130,22 @@ if ($action == 'create')
print '</tr>'; 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 // Incoterms
if (!empty($conf->incoterm->enabled)) if (!empty($conf->incoterm->enabled))
{ {

View File

@ -2300,12 +2300,15 @@ if ($action == 'create' && $user->rights->commande->creer)
$tmparray=$object->getTotalWeightVolume(); $tmparray=$object->getTotalWeightVolume();
$totalWeight=$tmparray['weight']; $totalWeight=$tmparray['weight'];
$totalVolume=$tmparray['volume']; $totalVolume=$tmparray['volume'];
if ($totalWeight || $totalVolume) if ($totalWeight)
{ {
print '<tr><td>'.$langs->trans("CalculatedWeight").'</td>'; print '<tr><td>'.$langs->trans("CalculatedWeight").'</td>';
print '<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 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>'; print '</td></tr>';
}
if ($totalVolume)
{
print '<tr><td>'.$langs->trans("CalculatedVolume").'</td>'; print '<tr><td>'.$langs->trans("CalculatedVolume").'</td>';
print '<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 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');

View File

@ -143,48 +143,53 @@ else {
<?php <?php
$forceall=1; // We always force all type for free lines (module product or service means we use predefined product or service) $freelines = false;
if ($object->element == 'contrat') 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 $freelines = true;
else $forceall=0; $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')
// 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"); 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 echo $langs->trans("FreeLineOfType"); 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 ' '; 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 // 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()
{ {