Fix: Update of planed end date not working

This commit is contained in:
Laurent Destailleur 2008-12-31 14:55:20 +00:00
parent 836de30d6b
commit c4575c4302
2 changed files with 5 additions and 5 deletions

View File

@ -226,7 +226,7 @@ foreach($property as $key => $prop)
$varprop.="\t\t\$sql.= \" ";
if ($prop['istime'])
{
$varprop.='".(! isset($this->'.$prop['field'].') || strval($this->'.$prop['field'].')==\'\'?\'NULL\':$this->db->idate(';
$varprop.='".(! isset($this->'.$prop['field'].') || strlen($this->'.$prop['field'].')==0?\'NULL\':$this->db->idate(';
$varprop.="\$this->".$prop['field']."";
$varprop.='))."';
if ($i < sizeof($property)) $varprop.=",";
@ -267,8 +267,8 @@ foreach($property as $key => $prop)
$varprop.=$prop['field'].'=';
if ($prop['istime'])
{
// (strval($this->datep)!='' ? "'".$this->db->idate($this->datep)."'" : 'null')
$varprop.='".(strval($this->'.$prop['field'].')!=\'\' ? "\'".$this->db->idate(';
// (strlen($this->datep)!=0 ? "'".$this->db->idate($this->datep)."'" : 'null')
$varprop.='".(strlen($this->'.$prop['field'].')!=0 ? "\'".$this->db->idate(';
$varprop.='$this->'.$prop['field'];
$varprop.=')."\'" : \'null\').';
$varprop.='"';

View File

@ -100,8 +100,8 @@ class Contrat extends CommonObject
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET statut = 4,";
$sql.= " date_ouverture = '".$this->db->idate($date)."',";
if ($date_end) $sql.= " date_fin_validite = '".$this->db->idate($date_end)."',";
$sql.= " date_ouverture = ".(strlen($date)!=0?"'".$this->db->idate($date)."'":"null").",";
$sql.= " date_fin_validite = ".(strlen($date_end)!=0?"'".$this->db->idate($date_end)."'":"null").",";
$sql.= " fk_user_ouverture = ".$user->id.",";
$sql.= " date_cloture = null";
$sql.= " WHERE rowid = ".$line_id . " AND (statut = 0 OR statut = 3 OR statut = 5)";