From d9b7886ef953584b9e5ce2dbfdb05c257a17942c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 28 Feb 2013 18:47:38 +0100 Subject: [PATCH 1/2] Fix: try to fix regression, stored the last id created in a session variable in order to be used to find out information in the "ref_ext" in order to differentiate automatic actions. --- .../core/triggers/interface_50_modAgenda_ActionsAuto.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 600f09468ab..19fc4a618ff 100755 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -583,6 +583,7 @@ class InterfaceActionsAuto $ret=$actioncomm->add($user); // User qui saisit l'action if ($ret > 0) { + $_SESSION['LAST_ACTION_CREATED'] = $ret; return 1; } else From 16ad99f8c5f4fecf855e38b7c32dbb694a86b9c9 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 28 Feb 2013 19:41:44 +0100 Subject: [PATCH 2/2] Fix: to force id field name --- htdocs/core/class/commonobject.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 34a68f58fc4..1b1466a664c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -722,9 +722,10 @@ abstract class CommonObject * @param string $table To force other table element or element line * @param int $id To force other object id * @param string $format Data format ('text' by default, 'date') + * @param string $id_field To force rowid field name * @return int <0 if KO, >0 if OK */ - function setValueFrom($field, $value, $table='', $id='', $format='text') + function setValueFrom($field, $value, $table='', $id='', $format='text', $id_field='rowid') { global $conf; @@ -736,7 +737,7 @@ abstract class CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX.$table." SET "; if ($format == 'text') $sql.= $field." = '".$this->db->escape($value)."'"; else if ($format == 'date') $sql.= $field." = '".$this->db->idate($value)."'"; - $sql.= " WHERE rowid = ".$id; + $sql.= " WHERE ".$id_field." = ".$id; dol_syslog(get_class($this)."::setValueFrom sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql);