Merge pull request #8061 from fappels/7.0_fix_module_builder
7.0 fix module builder
This commit is contained in:
commit
193dfec29e
@ -6221,7 +6221,7 @@ abstract class CommonObject
|
|||||||
if (! empty($this->fields[$key]['foreignkey']) && $values[$key] == '-1') $values[$key]='';
|
if (! empty($this->fields[$key]['foreignkey']) && $values[$key] == '-1') $values[$key]='';
|
||||||
|
|
||||||
//var_dump($key.'-'.$values[$key].'-'.($this->fields[$key]['notnull'] == 1));
|
//var_dump($key.'-'.$values[$key].'-'.($this->fields[$key]['notnull'] == 1));
|
||||||
if ($this->fields[$key]['notnull'] == 1 && empty($values[$key]))
|
if ($this->fields[$key]['notnull'] == 1 && ! isset($values[$key]))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$this->errors[]=$langs->trans("ErrorFieldRequired", $this->fields[$key]['label']);
|
$this->errors[]=$langs->trans("ErrorFieldRequired", $this->fields[$key]['label']);
|
||||||
@ -6299,23 +6299,15 @@ abstract class CommonObject
|
|||||||
$res = $this->db->query($sql);
|
$res = $this->db->query($sql);
|
||||||
if ($res)
|
if ($res)
|
||||||
{
|
{
|
||||||
if ($obj = $this->db->fetch_object($res))
|
$obj = $this->db->fetch_object($res);
|
||||||
|
if ($obj)
|
||||||
{
|
{
|
||||||
if ($obj)
|
$this->setVarsFromFetchObj($obj);
|
||||||
{
|
return $this->id;
|
||||||
$this->setVarsFromFetchObj($obj);
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error = $this->db->lasterror();
|
return 0;
|
||||||
$this->errors[] = $this->error;
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -254,7 +254,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='',
|
|||||||
|
|
||||||
$type = $val['type'];
|
$type = $val['type'];
|
||||||
$type = preg_replace('/:.*$/', '', $type); // For case type = 'integer:Societe:societe/class/societe.class.php'
|
$type = preg_replace('/:.*$/', '', $type); // For case type = 'integer:Societe:societe/class/societe.class.php'
|
||||||
|
if ($type == 'html') $type = 'text'; // html modulebuilder type is a text type in database
|
||||||
$texttoinsert.= "\t".$key." ".$type;
|
$texttoinsert.= "\t".$key." ".$type;
|
||||||
if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY';
|
if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY';
|
||||||
if ($key == 'entity') $texttoinsert.= ' DEFAULT 1';
|
if ($key == 'entity') $texttoinsert.= ' DEFAULT 1';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user