From 12d211815bc019a1a95a070106e74c8f2b1d5d9a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Oct 2021 21:38:36 +0200 Subject: [PATCH] Debug v15 --- htdocs/comm/propal/card.php | 9 ++-- htdocs/commande/card.php | 64 ++++++++++++------------- htdocs/core/class/html.form.class.php | 3 +- htdocs/core/lib/functions.lib.php | 18 +++---- htdocs/core/lib/product.lib.php | 10 ++-- htdocs/expedition/shipment.php | 68 +++++++++++++-------------- 6 files changed, 88 insertions(+), 84 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index cff5c5d0e35..4e3f0e6ffde 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2192,9 +2192,10 @@ if ($action == 'create') { // Delivery delay print ''; print ''; if ($action != 'editavailability' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) { @@ -2356,13 +2357,13 @@ if ($action == 'create') { if ($totalWeight) { print ''; print ''; } if ($totalVolume) { print ''; print ''; } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 2195f88f13c..8aef94d2a7c 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1646,13 +1646,19 @@ if ($action == 'create' && $usercancreate) { print "\n"; print ''; + // Delivery delay + print ''; + // Terms of the settlement print ''; - // Mode de reglement + // Payment mode print ''; } - // Delivery delay - print ''; - // Shipping Method if (!empty($conf->expedition->enabled)) { print ''; print ''; + // Delivery delay + print ''; + // Shipping Method if (!empty($conf->expedition->enabled)) { print ''; } + // Source reason (why we have an order) + print ''; + // Terms of payment print ''; - - // Source reason (why we have an ordrer) - print ''; - // TODO Order mode (how we receive order). Not yet implemented /* print ''; print ''; @@ -394,6 +394,23 @@ if ($id > 0 || !empty($ref)) { //print ''; print ''; + // Delivery delay + print ''; + // Shipping Method print '
'; - print $langs->trans('AvailabilityPeriod'); if (!empty($conf->commande->enabled)) { - print ' ('.$langs->trans('AfterOrder').')'; + print $form->textwithpicto($langs->trans('AvailabilityPeriod'), $langs->trans('AvailabilityPeriod').' ('.$langs->trans('AfterOrder').')'); + } else { + print $langs->trans('AvailabilityPeriod'); } print '
'.$langs->trans("CalculatedWeight").''; - 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', 0); print '
'.$langs->trans("CalculatedVolume").''; - 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', 0); print '
'.$langs->trans('AvailabilityPeriod').''; + print img_picto('', 'clock', 'class="pictofixedwidth"'); + $form->selectAvailabilityDelay($availability_id, 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx'); + print '
'.$langs->trans('PaymentConditionsShort').''; print img_picto('', 'paiment'); $form->select_conditions_paiements($cond_reglement_id, 'cond_reglement_id', - 1, 1); print '
'.$langs->trans('PaymentMode').''; print img_picto('', 'bank', 'class="pictofixedwidth"'); $form->select_types_paiements($mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx'); @@ -1665,12 +1671,6 @@ if ($action == 'create' && $usercancreate) { print '
'.$langs->trans('AvailabilityPeriod').''; - print img_picto('', 'clock', 'class="pictofixedwidth"'); - $form->selectAvailabilityDelay($availability_id, 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx'); - print '
'.$langs->trans('SendingMethod').''; @@ -2148,7 +2148,7 @@ if ($action == 'create' && $usercancreate) { print ''; } else { print $object->date ? dol_print_date($object->date, 'day') : ' '; - if ($object->hasDelay()) { + if ($object->hasDelay() && empty($object->delivery_date)) { // If there is a delivery date planned, warning should be on this date print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } } @@ -2176,6 +2176,18 @@ if ($action == 'create' && $usercancreate) { print '
'; + $editenable = $usercancreate; + print $form->editfieldkey("AvailabilityPeriod", 'availability', '', $object, $editenable); + print ''; + if ($action == 'editavailability') { + $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'availability_id', 1); + } else { + $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'none', 1); + } + print '
'; @@ -2209,6 +2221,18 @@ if ($action == 'create' && $usercancreate) { print '
'; + $editenable = $usercancreate; + print $form->editfieldkey("Source", 'demandreason', '', $object, $editenable); + print ''; + if ($action == 'editdemandreason') { + $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'demand_reason_id', 1); + } else { + $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'none'); + } + print '
'; $editenable = $usercancreate; @@ -2274,30 +2298,6 @@ if ($action == 'create' && $usercancreate) { } } - // Delivery delay - print '
'; - $editenable = $usercancreate; - print $form->editfieldkey("AvailabilityPeriod", 'availability', '', $object, $editenable); - print ''; - if ($action == 'editavailability') { - $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'availability_id', 1); - } else { - $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'none', 1); - } - print '
'; - $editenable = $usercancreate; - print $form->editfieldkey("Channel", 'demandreason', '', $object, $editenable); - print ''; - if ($action == 'editdemandreason') { - $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'demand_reason_id', 1); - } else { - $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'none'); - } - print '
'; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c479b59cbde..aa940e1f03a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5159,7 +5159,8 @@ class Form print ''; print ''; $this->selectAvailabilityDelay($selected, $htmlname, -1, $addempty); - print ''; + print ''; + print ''; print ''; } else { if ($selected) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 14021292428..235b76aa885 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5418,15 +5418,16 @@ function price2num($amount, $rounding = '', $option = 0) /** * Output a dimension with best unit * - * @param float $dimension Dimension - * @param int $unit Unit scale of dimension (Example: 0=kg, -3=g, -6=mg, 98=ounce, 99=pound, ...) - * @param string $type 'weight', 'volume', ... - * @param Translate $outputlangs Translate language object - * @param int $round -1 = non rounding, x = number of decimal + * @param float $dimension Dimension + * @param int $unit Unit scale of dimension (Example: 0=kg, -3=g, -6=mg, 98=ounce, 99=pound, ...) + * @param string $type 'weight', 'volume', ... + * @param Translate $outputlangs Translate language object + * @param int $round -1 = non rounding, x = number of decimal * @param string $forceunitoutput 'no' or numeric (-3, -6, ...) compared to $unit (In most case, this value is value defined into $conf->global->MAIN_WEIGHT_DEFAULT_UNIT) - * @return string String to show dimensions + * @param int $use_short_label 1=Use short label ('g' instead of 'gram'). Short labels are not translated. + * @return string String to show dimensions */ -function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round = -1, $forceunitoutput = 'no') +function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round = -1, $forceunitoutput = 'no', $use_short_label = 0) { require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; @@ -5456,7 +5457,8 @@ function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round $unit = $forceunitoutput; }*/ - $ret = price($dimension, 0, $outputlangs, 0, 0, $round).' '.measuringUnitString(0, $type, $unit); + $ret = price($dimension, 0, $outputlangs, 0, 0, $round); + $ret .= ' '.measuringUnitString(0, $type, $unit, $use_short_label, $outputlangs); return $ret; } diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 64cc72a8879..10c838b4c43 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -589,12 +589,12 @@ function measuring_units_string($scale = '', $measuring_style = '', $unit = 0, $ /** * Return translation label of a unit key * - * @param int $unit ID of unit (rowid in llx_c_units table) - * @param string $measuring_style Style of unit: 'weight', 'volume', ..., '' = 'net_measure' for option PRODUCT_ADD_NET_MEASURE - * @param string $scale Scale of unit: '0', '-3', '6', ... - * @param int $use_short_label 1=Use short label ('g' instead of 'gram'). Short labels are not translated. + * @param int $unit ID of unit (rowid in llx_c_units table) + * @param string $measuring_style Style of unit: 'weight', 'volume', ..., '' = 'net_measure' for option PRODUCT_ADD_NET_MEASURE + * @param string $scale Scale of unit: '0', '-3', '6', ... + * @param int $use_short_label 1=Use short label ('g' instead of 'gram'). Short labels are not translated. * @param Translate $outputlangs Language object - * @return string Unit string + * @return string Unit string * @see formproduct->selectMeasuringUnits() */ function measuringUnitString($unit, $measuring_style = '', $scale = '', $use_short_label = 0, $outputlangs = null) diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index b8814450030..66546523f11 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -357,7 +357,7 @@ if ($id > 0 || !empty($ref)) { print '
'.$langs->trans('Date').''; print dol_print_date($object->date, 'day'); - if ($object->hasDelay() && empty($object->delivery_date)) { + if ($object->hasDelay() && empty($object->delivery_date)) { // If there is a delivery date planned, warning should be on this date print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } print '
'; + print ''; + if ($action != 'editavailability') { + print ''; + } + print '
'; + print $langs->trans('AvailabilityPeriod'); + print 'id.'">'.img_edit($langs->trans('SetAvailability'), 1).'
'; + print '
'; + if ($action == 'editavailability') { + $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'availability_id', 1); + } else { + $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'none', 1); + } + print '
'; print ''; } + // Source reason (why we have an order) + print '';*/ - // Availability - print ''; - - // Source - print '
'; @@ -434,6 +451,22 @@ if ($id > 0 || !empty($ref)) { print '
'; + print ''; + if ($action != 'editdemandreason') { + print ''; + } + print '
'; + print $langs->trans('Source'); + print 'id.'">'.img_edit($langs->trans('SetDemandReason'), 1).'
'; + print '
'; + if ($action == 'editdemandreason') { + $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'demand_reason_id', 1); + } else { + $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'none'); + } + // Terms of payment /* print '
'; @@ -472,39 +505,6 @@ if ($id > 0 || !empty($ref)) { } print '
'; - print ''; - if ($action != 'editavailability') { - print ''; - } - print '
'; - print $langs->trans('AvailabilityPeriod'); - print 'id.'">'.img_edit($langs->trans('SetAvailability'), 1).'
'; - print '
'; - if ($action == 'editavailability') { - $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'availability_id', 1); - } else { - $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'none', 1); - } - print '
'; - print ''; - if ($action != 'editdemandreason') { - print ''; - } - print '
'; - print $langs->trans('Source'); - print 'id.'">'.img_edit($langs->trans('SetDemandReason'), 1).'
'; - print '
'; - if ($action == 'editdemandreason') { - $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'demand_reason_id', 1); - } else { - $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'none'); - } - $tmparray = $object->getTotalWeightVolume(); $totalWeight = $tmparray['weight']; $totalVolume = $tmparray['volume'];