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>';
}
$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))
{

View File

@ -2300,12 +2300,15 @@ if ($action == 'create' && $user->rights->commande->creer)
$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');

View File

@ -142,49 +142,54 @@ else {
<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')
$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 '<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)
$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':'').'> ';
@ -590,6 +595,13 @@ jQuery(document).ready(function() {
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()