Fix: add sql error
This commit is contained in:
parent
bc6fa60287
commit
7ee06a68bc
@ -85,6 +85,10 @@ if((isset($_POST['field']) && ! empty($_POST['field']))
|
|||||||
|
|
||||||
$return['value'] = $value;
|
$return['value'] = $value;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$return['error'] = $object->error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
|
|||||||
@ -627,6 +627,8 @@ abstract class CommonObject
|
|||||||
function setValueFrom($table, $id, $field, $value)
|
function setValueFrom($table, $id, $field, $value)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$table." SET ";
|
$sql = "UPDATE ".MAIN_DB_PREFIX.$table." SET ";
|
||||||
$sql.= $field." = '".$this->db->escape($value)."'";
|
$sql.= $field." = '".$this->db->escape($value)."'";
|
||||||
@ -636,11 +638,13 @@ abstract class CommonObject
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
$this->error=$this->db->lasterror();
|
||||||
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user