Fix: Avoid duplicate error message

Fix: pgsql syntax error
This commit is contained in:
Laurent Destailleur 2014-10-08 15:35:39 +02:00
parent 4c4485d0ee
commit de5005ca54
4 changed files with 14 additions and 10 deletions

View File

@ -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 (! in_array((string) $style, array('mesgs','warnings','errors'))) dol_print_error('','Bad parameter for setEventMessage');
if (empty($mesgs)) setEventMessage($mesg, $style); 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);
}
} }
/** /**

View File

@ -285,8 +285,8 @@ class Task extends CommonObject
$sql.= " description=".(isset($this->description)?"'".$this->db->escape($this->description)."'":"null").","; $sql.= " description=".(isset($this->description)?"'".$this->db->escape($this->description)."'":"null").",";
$sql.= " duration_effective=".(isset($this->duration_effective)?$this->duration_effective:"null").","; $sql.= " duration_effective=".(isset($this->duration_effective)?$this->duration_effective:"null").",";
$sql.= " planned_workload=".(isset($this->planned_workload)?$this->planned_workload:"0").","; $sql.= " planned_workload=".(isset($this->planned_workload)?$this->planned_workload:"0").",";
$sql.= " dateo=".($this->date_start!=''?$this->db->idate($this->date_start):'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.= " datee=".($this->date_end!=''?"'".$this->db->idate($this->date_end)."'":'null').",";
$sql.= " progress=".$this->progress.","; $sql.= " progress=".$this->progress.",";
$sql.= " rang=".((!empty($this->rang))?$this->rang:"0"); $sql.= " rang=".((!empty($this->rang))?$this->rang:"0");
$sql.= " WHERE rowid=".$this->id; $sql.= " WHERE rowid=".$this->id;

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify

View File

@ -58,9 +58,11 @@ $projectstatic = new Project($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
/* /*
* Actions * Actions
*/ */
if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer) 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); $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
$result=$object->update($user); $result=$object->update($user);
if ($result < 0) if ($result < 0)
{ {
setEventMessage($object->error,'errors'); setEventMessages($object->error,$object->errors,'errors');
setEventMessage($object->errors,'errors');
} }
} }
else else
@ -121,8 +122,7 @@ if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->projet->s
} }
else else
{ {
$langs->load("errors"); setEventMessages($object->error,$object->errors,'errors');
setEventMessage($langs->trans($object->error), 'errors');
$action=''; $action='';
} }
} }