From 748d76914016c06ffe00b1d5dfb6c69bc8043653 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Mar 2014 15:50:26 +0100 Subject: [PATCH] Fix: [ bug #1280 ] service with not end of date was tagged as expired. --- ChangeLog | 1 + htdocs/contrat/class/contrat.class.php | 6 +++--- htdocs/contrat/fiche.php | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3a4c465c3e7..3683cb01472 100644 --- a/ChangeLog +++ b/ChangeLog @@ -39,6 +39,7 @@ Fix: [ bug #1206 ] PMP price is bad calculated. Fix: [ bug #520 ] Product statistics and detailed lists are wrong. Fix: [ bug #1240 ] traduction. Fix: [ bug #1238 ] When creating accompte with a %, free product are used for calculation. +Fix: [ bug #1280 ] service with not end of date was tagged as expired. ***** ChangeLog for 3.5 compared to 3.4.* ***** For users: diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 61e41356b6b..a2856794837 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -569,7 +569,7 @@ class Contrat extends CommonObject if ($line->statut == 0) $this->nbofserviceswait++; if ($line->statut == 4 && (empty($line->date_fin_prevue) || $line->date_fin_prevue >= $now)) $this->nbofservicesopened++; - if ($line->statut == 4 && $line->date_fin_prevue < $now) $this->nbofservicesexpired++; + if ($line->statut == 4 && (! empty($line->date_fin_prevue) && $line->date_fin_prevue < $now)) $this->nbofservicesexpired++; if ($line->statut == 5) $this->nbofservicesclosed++; $total_ttc+=$objp->total_ttc; // TODO Not saved into database @@ -654,7 +654,7 @@ class Contrat extends CommonObject if ($line->statut == 0) $this->nbofserviceswait++; if ($line->statut == 4 && (empty($line->date_fin_prevue) || $line->date_fin_prevue >= $now)) $this->nbofservicesopened++; - if ($line->statut == 4 && $line->date_fin_prevue < $now) $this->nbofservicesexpired++; + if ($line->statut == 4 && (! empty($line->date_fin_prevue) && $line->date_fin_prevue < $now)) $this->nbofservicesexpired++; if ($line->statut == 5) $this->nbofservicesclosed++; $this->lines[] = $line; @@ -1799,7 +1799,7 @@ class ContratLigne */ function getLibStatut($mode) { - return $this->LibStatut($this->statut,$mode,(isset($this->date_fin_validite)?($this->date_fin_validite < dol_now()?1:0):-1)); + return $this->LibStatut($this->statut,$mode,((! empty($this->date_fin_validite))?($this->date_fin_validite < dol_now()?1:0):-1)); } /** diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 613b235826e..4dde02ce33d 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -241,7 +241,7 @@ if ($action == 'add' && $user->rights->contrat->creer) for ($i=0;$i<$num;$i++) { $product_type=($lines[$i]->product_type?$lines[$i]->product_type:0); - + if ($product_type == 1) { //only services // TODO Exclude also deee // service prédéfini if ($lines[$i]->fk_product > 0) @@ -929,7 +929,7 @@ else { $result=$object->fetch($id,$ref); if ($result < 0) dol_print_error($db,$object->error); - $result=$object->fetch_lines(); + $result=$object->fetch_lines(); // This also init $this->nbofserviceswait, $this->nbofservicesopened, $this->nbofservicesexpired=, $this->nbofservicesclosed if ($result < 0) dol_print_error($db,$object->error); $result=$object->fetch_thirdparty(); if ($result < 0) dol_print_error($db,$object->error);