diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php
index 2a96880e04a..ecd8a47fc86 100644
--- a/htdocs/core/tpl/objectline_create.tpl.php
+++ b/htdocs/core/tpl/objectline_create.tpl.php
@@ -674,6 +674,15 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
+ $("#date_start, #date_end").focusout(function()
+ {
+
+ if ( $(this).val() == '' && !$(this).hasClass("error") ) {
+ $(this).addClass('error');
+ }else{
+ $(this).removeClass('error');
+ }
+ });
/* When changing predefined product, we reload list of supplier prices required for margin combo */
$("#idprod, #idprodfournprice").change(function()
@@ -681,7 +690,6 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
console.log("Call method change() 1 after change on #idprod or #idprodfournprice (senderissupplier=). this.val = "+$(this).val());
setforpredef(); // TODO Keep vat combo visible and set it to first entry into list that match result of get_default_tva
- setColorToDateSelector($(this).val());
jQuery('#trlinefordates').show();
rights->margins->creer) {
console.log("Load unit price end, we got value "+data.price_ht);
- console.log(data);
- console.log(jQuery("#date_start").val());
- console.log(jQuery("#date_end").val());
+
// 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").css("background-color","#f2cf87");
- jQuery("#date_end").css("background-color","#f2cf87");
+
+ jQuery("#date_start").addClass("error");
+ jQuery("#date_end").addClass("error");
}else{
- jQuery("#date_start").css("background-color","#FFF");
- jQuery("#date_end").css("background-color","#FFF");
+ jQuery("#date_start").removeClass("error");
+ jQuery("#date_end").removeClass("error");
}
jQuery("#price_ht").val(data.price_ht);
@@ -733,6 +740,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) { ?>
if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined")
{
+ var editor = CKEDITOR.instances['dp_desc'];
var editor = CKEDITOR.instances['dp_desc'];
if (editor) {
editor.setData(proddesc);
@@ -999,9 +1007,6 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").show();
jQuery("#fournprice_predef").hide();
}
- function setColorToDateSelector(val){
- console.log("from function "+val);
- }
function setforpredef() {
console.log("Call setforpredef. We hide some fields and show dates");
diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php
index ea6133f8684..8ef08b60660 100644
--- a/htdocs/core/tpl/objectline_edit.tpl.php
+++ b/htdocs/core/tpl/objectline_edit.tpl.php
@@ -340,10 +340,9 @@ $coldisplay++;
}
$res = $line->fetch_product();
- // on doit fetch le product là !!! pour connaître le type
if ($res > 0 ){
if ($line->product->isMandatoryPeriod() && $line->product->isService()) {
- print 'jQuery("#date_start").css("background-color","#f2cf87");';
+ print 'jQuery("#date_start").addClass("error");';
}
}
}
@@ -359,7 +358,7 @@ $coldisplay++;
// on doit fetch le product là !!! pour connaître le type
if ($res > 0 ){
if ($line->product->isMandatoryperiod() && $line->product->isService()) {
- print 'jQuery("#date_end").css("background-color","#f2cf87");';
+ print 'jQuery("#date_end").addClass("error");';
}
}
}
@@ -469,6 +468,15 @@ jQuery(document).ready(function()
}
});
+ $("#date_start, #date_end").focusout(function()
+ {
+
+ if ( $(this).val() == '' && !$(this).hasClass("error") ) {
+ $(this).addClass('error');
+ }else{
+ $(this).removeClass('error');
+ }
+ });
margin->enabled)) {
?>
diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php
index 50575c19dc2..42453df6e31 100644
--- a/htdocs/core/tpl/objectline_view.tpl.php
+++ b/htdocs/core/tpl/objectline_view.tpl.php
@@ -182,13 +182,13 @@ if (($line->info_bits & 2) == 2) {
print '