Fix deprecated

This commit is contained in:
Laurent Destailleur 2022-10-16 21:01:05 +02:00
parent 34166084de
commit 2484fefa4d
5 changed files with 44 additions and 48 deletions

View File

@ -1165,7 +1165,7 @@ if ($object->id > 0) {
$late = ''; $late = '';
foreach ($contrat->lines as $line) { foreach ($contrat->lines as $line) {
if ($contrat->statut == Contrat::STATUS_VALIDATED && $line->statut == ContratLigne::STATUS_OPEN) { 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")); $late = img_warning($langs->trans("Late"));
} }
} }

View File

@ -2110,11 +2110,11 @@ class Propal extends CommonObject
* Define end validity date * Define end validity date
* *
* @param User $user Object user that modify * @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 * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK * @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 // phpcs:enable
if (!empty($user->rights->propal->creer)) { if (!empty($user->rights->propal->creer)) {
@ -2122,8 +2122,8 @@ class Propal extends CommonObject
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fin_validite = ".($date_fin_validite != '' ? "'".$this->db->idate($date_fin_validite)."'" : 'null'); $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 = ".self::STATUS_DRAFT; $sql .= " WHERE rowid = ".((int) $this->id)." AND fk_statut = ".((int) self::STATUS_DRAFT);
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -2135,7 +2135,7 @@ class Propal extends CommonObject
if (!$error) { if (!$error) {
$this->oldcopy = clone $this; $this->oldcopy = clone $this;
$this->fin_validite = $date_fin_validite; $this->fin_validite = $date_end_validity;
} }
if (!$notrigger && empty($error)) { if (!$notrigger && empty($error)) {

View File

@ -3339,7 +3339,7 @@ class ContratLigne extends CommonObjectLine
// Update request // Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET";
$sql .= " fk_contrat = ".((int) $this->fk_contrat).","; $sql .= " fk_contrat = ".((int) $this->fk_contrat).",";
$sql .= " fk_product=".($this->fk_product ? "'".$this->db->escape($this->fk_product)."'" : 'null').","; $sql .= " fk_product = ".($this->fk_product ? ((int) $this->fk_product) : 'null').",";
$sql .= " statut = ".((int) $this->statut).","; $sql .= " statut = ".((int) $this->statut).",";
$sql .= " label = '".$this->db->escape($this->label)."',"; $sql .= " label = '".$this->db->escape($this->label)."',";
$sql .= " description = '".$this->db->escape($this->description)."',"; $sql .= " description = '".$this->db->escape($this->description)."',";

View File

@ -108,7 +108,7 @@ class mailing_thirdparties_services_expired extends MailingTargets
$now = dol_now(); $now = dol_now();
// La requete doit retourner: id, email, name // 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 .= " 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 .= ", ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."product as p";
$sql .= " WHERE s.entity IN (".getEntity('societe').")"; $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 'lastname' => $obj->name, // For thirdparties, lastname must be name
'firstname' => '', // For thirdparties, firstname is '' 'firstname' => '', // For thirdparties, firstname is ''
'other' => 'other' =>
('DateStart='.dol_print_date($this->db->jdate($obj->date_ouverture), '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_fin_validite), 'day')).';'. ('DateEnd='.dol_print_date($this->db->jdate($obj->date_end), 'day')).';'. // date end planned
('Contract='.$obj->fk_contrat).';'. ('Contract='.$obj->fk_contrat).';'.
('ContactLine='.$obj->cdid), ('ContactLine='.$obj->cdid),
'source_url' => $this->url($obj->id), 'source_url' => $this->url($obj->id),

View File

@ -1361,10 +1361,6 @@ if ($source == 'contractline') {
if ($contractline->description) { if ($contractline->description) {
$text .= '<br>'.dol_htmlentitiesbr($contractline->description); $text .= '<br>'.dol_htmlentitiesbr($contractline->description);
} }
//if ($contractline->date_fin_validite) {
// $text.='<br>'.$langs->trans("DateEndPlanned").': ';
// $text.=dol_print_date($contractline->date_fin_validite);
//}
if ($contractline->date_end) { if ($contractline->date_end) {
$text .= '<br>'.$langs->trans("ExpiredSince").': '.dol_print_date($contractline->date_end); $text .= '<br>'.$langs->trans("ExpiredSince").': '.dol_print_date($contractline->date_end);
} }