diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 1c83e7ed962..5cf3c640563 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1958,15 +1958,14 @@ if ($action == 'create') { $notify = new Notify($db); $text .= '
'; $text .= $notify->confirmMessage('PROPAL_VALIDATE', $object->socid, $object); - } // mandatoryPeriod $nbMandated = 0; - foreach ($object->lines as $line){ + 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) )){ + if ($res > 0 ) { + if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end) )) { $nbMandated++; break; } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index f6ecf217a0d..4a8818113d5 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1912,10 +1912,10 @@ if ($action == 'create' && $usercancreate) { // mandatoryPeriod $nbMandated = 0; - foreach ($object->lines as $line){ + 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) )){ + if ($res > 0 ) { + if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end) )) { $nbMandated++; break; } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 60f025efbae..e4391b126b7 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4004,10 +4004,10 @@ if ($action == 'create') { // mandatoryPeriod $nbMandated = 0; - foreach ($object->lines as $line){ + 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) )){ + if ($res > 0 ) { + if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end) )) { $nbMandated++; break; } diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 8ef08b60660..642bb90403d 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -340,7 +340,7 @@ $coldisplay++; } $res = $line->fetch_product(); - if ($res > 0 ){ + if ($res > 0 ) { if ($line->product->isMandatoryPeriod() && $line->product->isService()) { print 'jQuery("#date_start").addClass("error");'; } @@ -356,7 +356,7 @@ $coldisplay++; $res = $line->fetch_product(); // on doit fetch le product là !!! pour connaître le type - if ($res > 0 ){ + if ($res > 0 ) { if ($line->product->isMandatoryperiod() && $line->product->isService()) { print 'jQuery("#date_end").addClass("error");'; } diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 42453df6e31..7d5e02f82ea 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -180,14 +180,13 @@ if (($line->info_bits & 2) == 2) { } else { if ($line->date_start || $line->date_end) { print '
'.get_date_range($line->date_start, $line->date_end, $format).'
'; - } - if (!$line->date_start || !$line->date_end){ + if (!$line->date_start || !$line->date_end) { // show warning under line // we need to fetch product associated to line for some test $res = $line->fetch_product(); - if ($res > 0 ){ - if ($line->product->isService() && $line->product->isMandatoryPeriod()){ + if ($res > 0 ) { + if ($line->product->isService() && $line->product->isMandatoryPeriod()) { print '
'.$langs->trans("mandatoryPeriodNeedTobeSet").'
'; } } diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 277fec6e78f..45b5e87121d 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -582,7 +582,7 @@ if (empty($reshook)) { } else { $object->accountancy_code_buy_export = $accountancy_code_buy_export; } - if ($object->isService()){ + if ($object->isService()) { $object->mandatory_period = (!empty($checkmandatory)) ? 1 : 0 ; } @@ -1993,9 +1993,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print 'mandatory_period == 1 ? ' checked="checked"' : '').' /> '; print ''; } - - - } } print ''; @@ -2287,7 +2284,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; - } else { if (empty($conf->global->PRODUCT_DISABLE_NATURE)) { // Nature