From 5acdbfa8f00a7e0a316a7628c9a32762413d43ae Mon Sep 17 00:00:00 2001 From: fhenry Date: Fri, 17 May 2013 14:45:54 +0200 Subject: [PATCH] Fix error management and SQL resquest in action comm --- htdocs/comm/action/class/actioncomm.class.php | 4 ++-- htdocs/comm/action/fiche.php | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 9b15634945e..067b36f989c 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -188,8 +188,8 @@ class ActionComm extends CommonObject $sql.= (strval($this->datep)!=''?"'".$this->db->idate($this->datep)."'":"null").","; $sql.= (strval($this->datef)!=''?"'".$this->db->idate($this->datef)."'":"null").","; $sql.= (isset($this->durationp) && $this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null").","; - $sql.= " '".$this->type_id."',"; - $sql.= " '".$this->code."',"; + $sql.= (isset($this->type_id)?$this->type_id:"null"); + $sql.= (isset($this->code)?" '".$this->code."'":"null")."," ; $sql.= (isset($this->societe->id) && $this->societe->id > 0?" '".$this->societe->id."'":"null").","; $sql.= (isset($this->fk_project) && $this->fk_project > 0?" '".$this->fk_project."'":"null").","; $sql.= " '".$this->db->escape($this->note)."',"; diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 8b93bf23590..3a74a2881bf 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -243,6 +243,7 @@ if ($action == 'add_action') $db->rollback(); $langs->load("errors"); $error=$langs->trans($actioncomm->error); + setEventMessage($error,'errors'); $action = 'create'; } } @@ -251,6 +252,7 @@ if ($action == 'add_action') $db->rollback(); $langs->load("errors"); $error=$langs->trans($actioncomm->error); + setEventMessage($error,'errors'); $action = 'create'; } } @@ -277,6 +279,7 @@ if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes') else { $mesg=$actioncomm->error; + setEventMessage($mesg,'errors'); } } }