diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index 3c0d8dd9a28..1c83e7ed962 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -1958,8 +1958,24 @@ if ($action == 'create') {
$notify = new Notify($db);
$text .= '
';
$text .= $notify->confirmMessage('PROPAL_VALIDATE', $object->socid, $object);
+
}
+ // mandatoryPeriod
+ $nbMandated = 0;
+ foreach ($object->lines as $line){
+ $res = $line->fetch_product();
+ if ($res > 0 ){
+ if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end) )){
+ $nbMandated++;
+ break;
+ }
+ }
+ }
+ if ($nbMandated > 0 ) $text .= '
'.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'
';
+
+
+
if (!$error) {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate', '', 0, 1);
}
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 8420a5e7f87..f6ecf217a0d 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -1910,6 +1910,21 @@ if ($action == 'create' && $usercancreate) {
);
}
+ // mandatoryPeriod
+ $nbMandated = 0;
+ foreach ($object->lines as $line){
+ $res = $line->fetch_product();
+ if ($res > 0 ){
+ if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end) )){
+ $nbMandated++;
+ break;
+ }
+ }
+ }
+ if ($nbMandated > 0 ) $text .= ''.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'
';
+
+
+
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1, 220);
}
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 699a10d3ef5..60f025efbae 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -4001,6 +4001,21 @@ if ($action == 'create') {
if ($object->type != Facture::TYPE_CREDIT_NOTE && $object->total_ttc < 0) { // Can happen only if $conf->global->FACTURE_ENABLE_NEGATIVE is on
$text .= '
'.img_warning().' '.$langs->trans("ErrorInvoiceOfThisTypeMustBePositive");
}
+
+ // mandatoryPeriod
+ $nbMandated = 0;
+ foreach ($object->lines as $line){
+ $res = $line->fetch_product();
+ if ($res > 0 ){
+ if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end) )){
+ $nbMandated++;
+ break;
+ }
+ }
+ }
+ if ($nbMandated > 0 ) $text .= ''.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'
';
+
+
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ValidateBill'), $text, 'confirm_valid', $formquestion, (($object->type != Facture::TYPE_CREDIT_NOTE && $object->total_ttc < 0) ? "no" : "yes"), 2);
}
diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang
index bf34efe3f79..5a24c2d56f8 100644
--- a/htdocs/langs/en_US/products.lang
+++ b/htdocs/langs/en_US/products.lang
@@ -399,3 +399,6 @@ ProductSupplierExtraFields=Additional Attributes (Supplier Prices)
DeleteLinkedProduct=Delete the child product linked to the combination
PMPValue=Weighted average price
PMPValueShort=WAP
+mandatoryperiod=Mandatory periods
+mandatoryPeriodNeedTobeSet=Attention periods not entered and mandatory
+mandatoryPeriodNeedTobeSetMsgValidate=A service requires a start and end period
diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang
index 168bdf07fcf..aa8b5a5c462 100644
--- a/htdocs/langs/fr_FR/products.lang
+++ b/htdocs/langs/fr_FR/products.lang
@@ -401,3 +401,4 @@ PMPValue=Prix moyen pondéré (PMP)
PMPValueShort=PMP
mandatoryperiod=Périodes obligatoires
mandatoryPeriodNeedTobeSet=Attention périodes non saisies et obligatoires
+mandatoryPeriodNeedTobeSetMsgValidate=Un service nécessite une période de début et de fin