diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index cab71ac6685..e088f764040 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4147,7 +4147,11 @@ function setEventMessages($mesg, $mesgs, $style='mesgs') { if (! in_array((string) $style, array('mesgs','warnings','errors'))) dol_print_error('','Bad parameter for setEventMessage'); if (empty($mesgs)) setEventMessage($mesg, $style); - else setEventMessage($mesgs, $style); + else + { + if (! empty($mesg) && ! in_array($mesg, $mesgs)) setEventMessage($mesg, $style); // Add message string if not already into array + setEventMessage($mesgs, $style); + } } /** diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 13360110310..62052ebaa29 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -285,8 +285,8 @@ class Task extends CommonObject $sql.= " description=".(isset($this->description)?"'".$this->db->escape($this->description)."'":"null").","; $sql.= " duration_effective=".(isset($this->duration_effective)?$this->duration_effective:"null").","; $sql.= " planned_workload=".(isset($this->planned_workload)?$this->planned_workload:"0").","; - $sql.= " dateo=".($this->date_start!=''?$this->db->idate($this->date_start):'null').","; - $sql.= " datee=".($this->date_end!=''?$this->db->idate($this->date_end):'null').","; + $sql.= " dateo=".($this->date_start!=''?"'".$this->db->idate($this->date_start)."'":'null').","; + $sql.= " datee=".($this->date_end!=''?"'".$this->db->idate($this->date_end)."'":'null').","; $sql.= " progress=".$this->progress.","; $sql.= " rang=".((!empty($this->rang))?$this->rang:"0"); $sql.= " WHERE rowid=".$this->id; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index d1d5092628e..7aea9314e5a 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 8e5b664759e..da200d565b6 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -58,9 +58,11 @@ $projectstatic = new Project($db); // fetch optionals attributes and labels $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); + + /* * Actions -*/ + */ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer) { @@ -91,11 +93,10 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer) $ret = $extrafields->setOptionalsFromPost($extralabels,$object); $result=$object->update($user); - + if ($result < 0) { - setEventMessage($object->error,'errors'); - setEventMessage($object->errors,'errors'); + setEventMessages($object->error,$object->errors,'errors'); } } else @@ -121,8 +122,7 @@ if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->projet->s } else { - $langs->load("errors"); - setEventMessage($langs->trans($object->error), 'errors'); + setEventMessages($object->error,$object->errors,'errors'); $action=''; } }