diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php
index f978a436354..2a96880e04a 100644
--- a/htdocs/core/tpl/objectline_create.tpl.php
+++ b/htdocs/core/tpl/objectline_create.tpl.php
@@ -678,10 +678,10 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
/* When changing predefined product, we reload list of supplier prices required for margin combo */
$("#idprod, #idprodfournprice").change(function()
{
- console.log("Call method change() after change on #idprod or #idprodfournprice (senderissupplier=). this.val = "+$(this).val());
+ 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) {
{ 'id': $(this).val(), 'socid': socid; ?> },
function(data) {
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");
+ }else{
+ jQuery("#date_start").css("background-color","#FFF");
+ jQuery("#date_end").css("background-color","#FFF");
+ }
+
jQuery("#price_ht").val(data.price_ht);
global->PRODUIT_AUTOFILL_DESC) && $conf->global->PRODUIT_AUTOFILL_DESC == 1) {
@@ -984,6 +999,10 @@ 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");
jQuery("#select_type").val(-1);
diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php
index 9094daaa2d1..ea6133f8684 100644
--- a/htdocs/core/tpl/objectline_edit.tpl.php
+++ b/htdocs/core/tpl/objectline_edit.tpl.php
@@ -333,9 +333,19 @@ $coldisplay++;
if (isset($conf->global->MAIN_DEFAULT_DATE_START_HOUR)) {
print 'jQuery("#date_starthour").val("'.$conf->global->MAIN_DEFAULT_DATE_START_HOUR.'");';
}
+
+
if (isset($conf->global->MAIN_DEFAULT_DATE_START_MIN)) {
print 'jQuery("#date_startmin").val("'.$conf->global->MAIN_DEFAULT_DATE_START_MIN.'");';
}
+
+ $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");';
+ }
+ }
}
if (!$line->date_end) {
if (isset($conf->global->MAIN_DEFAULT_DATE_END_HOUR)) {
@@ -344,6 +354,14 @@ $coldisplay++;
if (isset($conf->global->MAIN_DEFAULT_DATE_END_MIN)) {
print 'jQuery("#date_endmin").val("'.$conf->global->MAIN_DEFAULT_DATE_END_MIN.'");';
}
+
+ $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_end").css("background-color","#f2cf87");';
+ }
+ }
}
print ''
?>
diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php
index 3e8ef7ea411..50575c19dc2 100644
--- a/htdocs/core/tpl/objectline_view.tpl.php
+++ b/htdocs/core/tpl/objectline_view.tpl.php
@@ -180,7 +180,22 @@ if (($line->info_bits & 2) == 2) {
} else {
if ($line->date_start || $line->date_end) {
print '