diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php
index 8501f1ca30f..74eb88393df 100644
--- a/htdocs/bom/tpl/objectline_create.tpl.php
+++ b/htdocs/bom/tpl/objectline_create.tpl.php
@@ -113,7 +113,7 @@ if ($conf->global->PRODUCT_USE_UNITS)
{
$coldisplay++;
print '
';
- print $form->selectUnits($line->fk_unit, "units");
+ print $form->selectUnits(empty($line->fk_unit) ? $conf->global->PRODUCT_USE_UNITS : $line->fk_unit, "units");
print ' | ';
}
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 00a8ea821e2..f1de8ba630e 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -3850,7 +3850,7 @@ function dol_print_error($db = '', $error = '', $errors = null)
{
$out .= "".$langs->trans("OS").": ".php_uname()."
\n";
}
- $out .= "".$langs->trans("UserAgent").": ".$_SERVER["HTTP_USER_AGENT"]."
\n";
+ $out .= "".$langs->trans("UserAgent").": ".dol_htmlentities($_SERVER["HTTP_USER_AGENT"], ENT_COMPAT, 'UTF-8')."
\n";
$out .= "
\n";
$out .= "".$langs->trans("RequestedUrl").": ".dol_htmlentities($_SERVER["REQUEST_URI"], ENT_COMPAT, 'UTF-8')."
\n";
$out .= "".$langs->trans("Referer").": ".(isset($_SERVER["HTTP_REFERER"]) ?dol_htmlentities($_SERVER["HTTP_REFERER"], ENT_COMPAT, 'UTF-8') : '')."
\n";
diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php
index 9bb792afbc7..305be25347d 100644
--- a/htdocs/core/tpl/objectline_create.tpl.php
+++ b/htdocs/core/tpl/objectline_create.tpl.php
@@ -362,7 +362,7 @@ if ($nolinesbefore) {
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
$coldisplay++;
print '';
- print $form->selectUnits($line->fk_unit, "units");
+ print $form->selectUnits(empty($line->fk_unit) ? $conf->global->PRODUCT_USE_UNITS : $line->fk_unit, "units");
print ' | ';
}
$remise_percent = $buyer->remise_percent;
@@ -423,6 +423,27 @@ if ((!empty($conf->service->enabled) || ($object->element == 'contrat')) && $dat
print '';
$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
$date_end = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
+
+ $prefillDates = false;
+
+ if(! empty($conf->global->MAIN_FILL_SERVICE_DATES_FROM_LAST_SERVICE_LINE) && ! empty($object->lines))
+ {
+ for($i = count($object->lines) - 1; $i >= 0; $i--)
+ {
+ $lastline = $object->lines[$i];
+
+ if($lastline->product_type == Product::TYPE_SERVICE && (! empty($lastline->date_start) || ! empty($lastline->date_end)))
+ {
+ $date_start_prefill = $lastline->date_start;
+ $date_end_prefill = $lastline->date_end;
+
+ $prefillDates = true;
+ break;
+ }
+ }
+ }
+
+
if (!empty($object->element) && $object->element == 'contrat')
{
print $langs->trans("DateStartPlanned").' ';
@@ -435,7 +456,33 @@ if ((!empty($conf->service->enabled) || ($object->element == 'contrat')) && $dat
print ' '.$langs->trans('to').' ';
print $form->selectDate($date_end, 'date_end', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, 1, "addproduct", 1, 0);
};
+
+ if($prefillDates)
+ {
+ echo ' ' . $langs->trans('FillWithLastServiceDates') . '';
+ }
+
print ' |