diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index ecd8a47fc86..34b6fe9ec44 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -716,8 +716,6 @@ if (!empty($usemargins) && $user->rights->margins->creer) { // service and we setted mandatory_period to true if (data.mandatory_period == 1 && data.type == 1 ) { - console.log("we are good to color date input"); - jQuery("#date_start").addClass("error"); jQuery("#date_end").addClass("error"); }else{ diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 642bb90403d..e15c489a5b6 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -341,7 +341,7 @@ $coldisplay++; $res = $line->fetch_product(); if ($res > 0 ) { - if ($line->product->isMandatoryPeriod() && $line->product->isService()) { + if ( $line->product->isMandatoryPeriod() && $line->product->isService()) { print 'jQuery("#date_start").addClass("error");'; } } diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 45b5e87121d..4b5e178733d 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -106,6 +106,7 @@ $accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha'); $accountancy_code_buy_intra = GETPOST('accountancy_code_buy_intra', 'alpha'); $accountancy_code_buy_export = GETPOST('accountancy_code_buy_export', 'alpha'); +$checkmandatory = GETPOST('accountancy_code_buy_export', 'alpha'); // by default 'alphanohtml' (better security); hidden conf MAIN_SECURITY_ALLOW_UNSECURED_LABELS_WITH_HTML allows basic html $label_security_check = empty($conf->global->MAIN_SECURITY_ALLOW_UNSECURED_LABELS_WITH_HTML) ? 'alphanohtml' : 'restricthtml'; @@ -264,7 +265,7 @@ if (empty($reshook)) { $object->ref = $ref; $object->label = GETPOST('label', $label_security_check); $object->price_base_type = GETPOST('price_base_type', 'aZ09'); - + $object->mandatory_period = !empty(GETPOST("mandatoryperiod",'alpha')) ? 1 : 0; if ($object->price_base_type == 'TTC') { $object->price_ttc = GETPOST('price'); } else { @@ -1401,6 +1402,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print $form->load_tva("tva_tx", $defaultva, $mysoc, $mysoc, 0, 0, '', false, 1); print ''; + if (!empty($conf->service->enabled)){ + if ($object->isService()){ + // Mandatory period + print '