mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-07 18:18:18 +01:00
Clean method DDLCreateTable (used by modulebuilder only) #28996
This commit is contained in:
@@ -1288,12 +1288,12 @@ function createNewDictionnary($modulename, $file, $namedic, $dictionnaires = nul
|
||||
}
|
||||
|
||||
$columns = array(
|
||||
'rowid' => array('type' => 'integer(11)'),
|
||||
'code' => array('type' => 'varchar(255) NOT NULL'),
|
||||
'label' => array('type' => 'varchar(255) NOT NULL'),
|
||||
'position' => array('type' => 'integer(11) NULL'),
|
||||
'use_default' => array('type' => 'varchar(255) DEFAULT 1'),
|
||||
'active' => array('type' => 'integer')
|
||||
'rowid' => array('type' => 'integer', 'value' => 11),
|
||||
'code' => array('type' => 'varchar', 'value' => 255, 'null'=>'NOT NULL'),
|
||||
'label' => array('type' => 'varchar', 'value' => 255, 'null'=>'NOT NULL'),
|
||||
'position' => array('type' => 'integer', 'value' => 11, 'null'=>'NULL'),
|
||||
'use_default' => array('type' => 'varchar', 'value' => 11, 'default'=>'1'),
|
||||
'active' => array('type' => 'integer', 'value' => 3)
|
||||
);
|
||||
|
||||
|
||||
@@ -1309,13 +1309,13 @@ function createNewDictionnary($modulename, $file, $namedic, $dictionnaires = nul
|
||||
}
|
||||
}
|
||||
// check if tablename exist in Database and create it if not
|
||||
$query = "SHOW TABLES LIKE '" . MAIN_DB_PREFIX.strtolower($namedic) . "'";
|
||||
$query = "SHOW TABLES LIKE '" . $db->sanitize(MAIN_DB_PREFIX.strtolower($namedic)) . "'";
|
||||
$checkTable = $db->query($query);
|
||||
if ($checkTable && $db->num_rows($checkTable) > 0) {
|
||||
setEventMessages($langs->trans("ErrorTableExist", $namedic), null, 'errors');
|
||||
return;
|
||||
} else {
|
||||
$_results = $db->DDLCreateTable(MAIN_DB_PREFIX.strtolower($namedic), $columns, $primaryKey, "InnoDB");
|
||||
$_results = $db->DDLCreateTable(MAIN_DB_PREFIX.strtolower($namedic), $columns, $primaryKey, "");
|
||||
if ($_results < 0) {
|
||||
dol_print_error($db);
|
||||
$langs->load("errors");
|
||||
|
||||
Reference in New Issue
Block a user