diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index f6ae06b1f7f..4d59a75fb1b 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -1165,7 +1165,7 @@ if ($object->id > 0) { $late = ''; foreach ($contrat->lines as $line) { if ($contrat->statut == Contrat::STATUS_VALIDATED && $line->statut == ContratLigne::STATUS_OPEN) { - if (((!empty($line->date_fin_validite) ? $line->date_fin_validite : 0) + $conf->contrat->services->expires->warning_delay) < $now) { + if (((!empty($line->date_end) ? $line->date_end : 0) + $conf->contrat->services->expires->warning_delay) < $now) { $late = img_warning($langs->trans("Late")); } } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 47cd50fa163..d9b7147fefa 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2110,11 +2110,11 @@ class Propal extends CommonObject * Define end validity date * * @param User $user Object user that modify - * @param int $date_fin_validite End of validity date + * @param int $date_end_validity End of validity date * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - public function set_echeance($user, $date_fin_validite, $notrigger = 0) + public function set_echeance($user, $date_end_validity, $notrigger = 0) { // phpcs:enable if (!empty($user->rights->propal->creer)) { @@ -2122,8 +2122,8 @@ class Propal extends CommonObject $this->db->begin(); - $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fin_validite = ".($date_fin_validite != '' ? "'".$this->db->idate($date_fin_validite)."'" : 'null'); - $sql .= " WHERE rowid = ".((int) $this->id)." AND fk_statut = ".self::STATUS_DRAFT; + $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fin_validite = ".($date_end_validity != '' ? "'".$this->db->idate($date_end_validity)."'" : 'null'); + $sql .= " WHERE rowid = ".((int) $this->id)." AND fk_statut = ".((int) self::STATUS_DRAFT); dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); @@ -2135,7 +2135,7 @@ class Propal extends CommonObject if (!$error) { $this->oldcopy = clone $this; - $this->fin_validite = $date_fin_validite; + $this->fin_validite = $date_end_validity; } if (!$notrigger && empty($error)) { diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 47dccff8ca9..4dd26d5d6a2 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -3338,41 +3338,41 @@ class ContratLigne extends CommonObjectLine // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET"; - $sql .= " fk_contrat=".((int) $this->fk_contrat).","; - $sql .= " fk_product=".($this->fk_product ? "'".$this->db->escape($this->fk_product)."'" : 'null').","; - $sql .= " statut=".((int) $this->statut).","; - $sql .= " label='".$this->db->escape($this->label)."',"; - $sql .= " description='".$this->db->escape($this->description)."',"; - $sql .= " date_commande=".($this->date_commande != '' ? "'".$this->db->idate($this->date_commande)."'" : "null").","; - $sql .= " date_ouverture_prevue=".($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : "null").","; - $sql .= " date_ouverture=".($this->date_start_real != '' ? "'".$this->db->idate($this->date_start_real)."'" : "null").","; - $sql .= " date_fin_validite=".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : "null").","; - $sql .= " date_cloture=".($this->date_end_real != '' ? "'".$this->db->idate($this->date_end_real)."'" : "null").","; - $sql .= " vat_src_code='".$this->db->escape($this->vat_src_code)."',"; - $sql .= " tva_tx=".price2num($this->tva_tx).","; - $sql .= " localtax1_tx=".price2num($this->localtax1_tx).","; - $sql .= " localtax2_tx=".price2num($this->localtax2_tx).","; - $sql .= " qty=".price2num($this->qty).","; - $sql .= " remise_percent=".price2num($this->remise_percent).","; - $sql .= " remise=".($this->remise ?price2num($this->remise) : "null").","; - $sql .= " fk_remise_except=".($this->fk_remise_except > 0 ? $this->fk_remise_except : "null").","; - $sql .= " subprice=".($this->subprice != '' ? $this->subprice : "null").","; - $sql .= " price_ht=".($this->price_ht != '' ? $this->price_ht : "null").","; - $sql .= " total_ht=".$this->total_ht.","; - $sql .= " total_tva=".$this->total_tva.","; - $sql .= " total_localtax1=".$this->total_localtax1.","; - $sql .= " total_localtax2=".$this->total_localtax2.","; - $sql .= " total_ttc=".$this->total_ttc.","; - $sql .= " fk_product_fournisseur_price=".(!empty($this->fk_fournprice) ? $this->fk_fournprice : "NULL").","; - $sql .= " buy_price_ht='".price2num($this->pa_ht)."',"; - $sql .= " info_bits='".$this->db->escape($this->info_bits)."',"; - $sql .= " fk_user_author=".($this->fk_user_author >= 0 ? $this->fk_user_author : "NULL").","; - $sql .= " fk_user_ouverture=".($this->fk_user_ouverture > 0 ? $this->fk_user_ouverture : "NULL").","; - $sql .= " fk_user_cloture=".($this->fk_user_cloture > 0 ? $this->fk_user_cloture : "NULL").","; - $sql .= " commentaire='".$this->db->escape($this->commentaire)."',"; - $sql .= " fk_unit=".(!$this->fk_unit ? 'NULL' : $this->fk_unit).","; - $sql .= " rang=".(empty($this->rang) ? '0' : (int) $this->rang); - $sql .= " WHERE rowid=".((int) $this->id); + $sql .= " fk_contrat = ".((int) $this->fk_contrat).","; + $sql .= " fk_product = ".($this->fk_product ? ((int) $this->fk_product) : 'null').","; + $sql .= " statut = ".((int) $this->statut).","; + $sql .= " label = '".$this->db->escape($this->label)."',"; + $sql .= " description = '".$this->db->escape($this->description)."',"; + $sql .= " date_commande = ".($this->date_commande != '' ? "'".$this->db->idate($this->date_commande)."'" : "null").","; + $sql .= " date_ouverture_prevue = ".($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : "null").","; + $sql .= " date_ouverture = ".($this->date_start_real != '' ? "'".$this->db->idate($this->date_start_real)."'" : "null").","; + $sql .= " date_fin_validite = ".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : "null").","; + $sql .= " date_cloture = ".($this->date_end_real != '' ? "'".$this->db->idate($this->date_end_real)."'" : "null").","; + $sql .= " vat_src_code = '".$this->db->escape($this->vat_src_code)."',"; + $sql .= " tva_tx = ".price2num($this->tva_tx).","; + $sql .= " localtax1_tx = ".price2num($this->localtax1_tx).","; + $sql .= " localtax2_tx = ".price2num($this->localtax2_tx).","; + $sql .= " qty = ".price2num($this->qty).","; + $sql .= " remise_percent = ".price2num($this->remise_percent).","; + $sql .= " remise = ".($this->remise ?price2num($this->remise) : "null").","; + $sql .= " fk_remise_except = ".($this->fk_remise_except > 0 ? $this->fk_remise_except : "null").","; + $sql .= " subprice = ".($this->subprice != '' ? $this->subprice : "null").","; + $sql .= " price_ht = ".($this->price_ht != '' ? $this->price_ht : "null").","; + $sql .= " total_ht = ".$this->total_ht.","; + $sql .= " total_tva = ".$this->total_tva.","; + $sql .= " total_localtax1 = ".$this->total_localtax1.","; + $sql .= " total_localtax2 = ".$this->total_localtax2.","; + $sql .= " total_ttc = ".$this->total_ttc.","; + $sql .= " fk_product_fournisseur_price = ".(!empty($this->fk_fournprice) ? $this->fk_fournprice : "NULL").","; + $sql .= " buy_price_ht = '".price2num($this->pa_ht)."',"; + $sql .= " info_bits = '".$this->db->escape($this->info_bits)."',"; + $sql .= " fk_user_author = ".($this->fk_user_author >= 0 ? $this->fk_user_author : "NULL").","; + $sql .= " fk_user_ouverture = ".($this->fk_user_ouverture > 0 ? $this->fk_user_ouverture : "NULL").","; + $sql .= " fk_user_cloture = ".($this->fk_user_cloture > 0 ? $this->fk_user_cloture : "NULL").","; + $sql .= " commentaire = '".$this->db->escape($this->commentaire)."',"; + $sql .= " fk_unit = ".(!$this->fk_unit ? 'NULL' : $this->fk_unit).","; + $sql .= " rang = ".(empty($this->rang) ? '0' : (int) $this->rang); + $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php index 979782e61a5..9083b643900 100644 --- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php +++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php @@ -108,7 +108,7 @@ class mailing_thirdparties_services_expired extends MailingTargets $now = dol_now(); // La requete doit retourner: id, email, name - $sql = "SELECT s.rowid as id, s.email, s.nom as name, cd.rowid as cdid, cd.date_ouverture, cd.date_fin_validite, cd.fk_contrat"; + $sql = "SELECT s.rowid as id, s.email, s.nom as name, cd.rowid as cdid, cd.date_ouverture as date_start_real, cd.date_fin_validite as date_end, cd.fk_contrat"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c"; $sql .= ", ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."product as p"; $sql .= " WHERE s.entity IN (".getEntity('societe').")"; @@ -135,8 +135,8 @@ class mailing_thirdparties_services_expired extends MailingTargets 'lastname' => $obj->name, // For thirdparties, lastname must be name 'firstname' => '', // For thirdparties, firstname is '' 'other' => - ('DateStart='.dol_print_date($this->db->jdate($obj->date_ouverture), 'day')).';'. - ('DateEnd='.dol_print_date($this->db->jdate($obj->date_fin_validite), 'day')).';'. + ('DateStart='.dol_print_date($this->db->jdate($obj->date_start_real), 'day')).';'. // date start real + ('DateEnd='.dol_print_date($this->db->jdate($obj->date_end), 'day')).';'. // date end planned ('Contract='.$obj->fk_contrat).';'. ('ContactLine='.$obj->cdid), 'source_url' => $this->url($obj->id), diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 2e830a8241b..0941446b4fc 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1361,10 +1361,6 @@ if ($source == 'contractline') { if ($contractline->description) { $text .= '
'.dol_htmlentitiesbr($contractline->description); } - //if ($contractline->date_fin_validite) { - // $text.='
'.$langs->trans("DateEndPlanned").': '; - // $text.=dol_print_date($contractline->date_fin_validite); - //} if ($contractline->date_end) { $text .= '
'.$langs->trans("ExpiredSince").': '.dol_print_date($contractline->date_end); }