Clean code

This commit is contained in:
Laurent Destailleur 2021-08-18 00:10:48 +02:00
parent c001fb9555
commit 33b9787ea1

View File

@ -703,7 +703,7 @@ class Holiday extends CommonObject
// Update status
$sql = "UPDATE ".MAIN_DB_PREFIX."holiday SET";
if (!empty($this->statut) && is_numeric($this->statut)) {
$sql .= " statut = ".$this->statut.",";
$sql .= " statut = ".((int) $this->statut).",";
} else {
$error++;
}
@ -771,9 +771,9 @@ class Holiday extends CommonObject
} else {
$error++;
}
$sql .= " halfday = ".$this->halfday.",";
$sql .= " halfday = ".((int) $this->halfday).",";
if (!empty($this->statut) && is_numeric($this->statut)) {
$sql .= " statut = ".$this->statut.",";
$sql .= " statut = ".((int) $this->statut).",";
} else {
$error++;
}
@ -817,7 +817,6 @@ class Holiday extends CommonObject
} else {
$sql .= " detail_refuse = NULL";
}
$sql .= " WHERE rowid= ".$this->id;
$this->db->begin();
@ -2181,12 +2180,12 @@ class Holiday extends CommonObject
$this->id = 0;
$this->specimen = 1;
$this->fk_user = 1;
$this->fk_user = $user->id;
$this->description = 'SPECIMEN description';
$this->date_debut = dol_now();
$this->date_fin = dol_now() + (24 * 3600);
$this->date_valid = dol_now();
$this->fk_validator = 1;
$this->fk_validator = $user->id;
$this->halfday = 0;
$this->fk_type = 1;
$this->statut = Holiday::STATUS_VALIDATED;