Skip to content

Commit

Permalink
debug : problèmes rencontré sur MAJ champs type=date lorsque vide
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffrey.girard committed Nov 18, 2014
1 parent 28b1925 commit c90f5b6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions includes/class/class.objet_std.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ function _set_vars_by_db(&$db){

foreach ($this->TChamps as $nom_champ=>$info) {
if($this->_is_date($info)){
$this->{$nom_champ} = strtotime($db->Get_field($nom_champ));
if($db->Get_field($nom_champ) === '0000-00-00 00:00:00')$this->{$nom_champ} = 0;
else $this->{$nom_champ} = strtotime($db->Get_field($nom_champ));
}
elseif($this->_is_tableau($info)){
//echo '<li>TABLEAU '.$nom_champ." ".$db->Get_field($nom_champ)." ".unserialize($db->Get_field($nom_champ));
Expand Down Expand Up @@ -224,7 +225,8 @@ function _init_vars($lst_chp=''){
}

function get_date($nom_champ,$format_date='d/m/Y') {
if($this->{$nom_champ}<=strtotime('0000-00-00 00:00:00')) return '';
if(empty($this->{$nom_champ})) return '';
elseif($this->{$nom_champ}<=strtotime('0000-00-00 00:00:00')) return '';
else {
return date($format_date, (int)$this->{$nom_champ});
}
Expand All @@ -234,7 +236,7 @@ function get_date($nom_champ,$format_date='d/m/Y') {
function set_date($nom_champ,$date){

if(empty($date)) {
$this->{$nom_champ} = strtotime('0000-00-00 00:00:00');
$this->{$nom_champ} = 0;//strtotime('0000-00-00 00:00:00');
}
else if(strpos($date,'/')===false){
$this->{$nom_champ} = strtotime($date);
Expand Down

0 comments on commit c90f5b6

Please sign in to comment.