FIX : travis feedback
This commit is contained in:
parent
70648477a7
commit
59f5f9b0c6
@ -433,7 +433,7 @@ class modStockTransfer extends DolibarrModules
|
||||
*/
|
||||
public function init($options = '')
|
||||
{
|
||||
global $db, $conf, $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
$result = $this->_load_tables('/stocktransfer/sql/');
|
||||
if ($result < 0) return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
|
||||
@ -485,17 +485,17 @@ class modStockTransfer extends DolibarrModules
|
||||
}
|
||||
|
||||
// Rôles
|
||||
$resql = $db->query('SELECT rowid FROM '.MAIN_DB_PREFIX.'c_type_contact WHERE code = "STDEST" AND element = "StockTransfer" AND source = "internal"');
|
||||
$res = $db->fetch_object($resql);
|
||||
if (empty($res)) $db->query('INSERT INTO '.MAIN_DB_PREFIX.'c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES('.$this->getNextId().', "StockTransfer", "internal", "STRESP", "Responsable du transfert de stocks", 1, NULL, 0)');
|
||||
$resql = $this->db->query('SELECT rowid FROM '.MAIN_DB_PREFIX.'c_type_contact WHERE code = "STDEST" AND element = "StockTransfer" AND source = "internal"');
|
||||
$res = $this->db->fetch_object($resql);
|
||||
if (empty($res)) $this->db->query('INSERT INTO '.MAIN_DB_PREFIX.'c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES('.$this->getNextId().', "StockTransfer", "internal", "STRESP", "Responsable du transfert de stocks", 1, NULL, 0)');
|
||||
|
||||
$resql = $db->query('SELECT rowid FROM '.MAIN_DB_PREFIX.'c_type_contact WHERE code = "STFROM" AND element = "StockTransfer" AND source = "external"');
|
||||
$res = $db->fetch_object($resql);
|
||||
if (empty($res)) $db->query('INSERT INTO '.MAIN_DB_PREFIX.'c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES('.$this->getNextId().', "StockTransfer", "external", "STFROM", "Contact expéditeur transfert de stocks", 1, NULL, 0)');
|
||||
$resql = $this->db->query('SELECT rowid FROM '.MAIN_DB_PREFIX.'c_type_contact WHERE code = "STFROM" AND element = "StockTransfer" AND source = "external"');
|
||||
$res = $this->db->fetch_object($resql);
|
||||
if (empty($res)) $this->db->query('INSERT INTO '.MAIN_DB_PREFIX.'c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES('.$this->getNextId().', "StockTransfer", "external", "STFROM", "Contact expéditeur transfert de stocks", 1, NULL, 0)');
|
||||
|
||||
$resql = $db->query('SELECT rowid FROM '.MAIN_DB_PREFIX.'c_type_contact WHERE code = "STDEST" AND element = "StockTransfer" AND source = "external"');
|
||||
$res = $db->fetch_object($resql);
|
||||
if (empty($res)) $db->query('INSERT INTO '.MAIN_DB_PREFIX.'c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES('.$this->getNextId().', "StockTransfer", "external", "STDEST", "Contact destinataire transfert de stocks", 1, NULL, 0)');
|
||||
$resql = $this->db->query('SELECT rowid FROM '.MAIN_DB_PREFIX.'c_type_contact WHERE code = "STDEST" AND element = "StockTransfer" AND source = "external"');
|
||||
$res = $this->db->fetch_object($resql);
|
||||
if (empty($res)) $this->db->query('INSERT INTO '.MAIN_DB_PREFIX.'c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES('.$this->getNextId().', "StockTransfer", "external", "STDEST", "Contact destinataire transfert de stocks", 1, NULL, 0)');
|
||||
|
||||
return $this->_init($sql, $options);
|
||||
}
|
||||
@ -506,17 +506,15 @@ class modStockTransfer extends DolibarrModules
|
||||
*/
|
||||
public function getNextId()
|
||||
{
|
||||
global $db;
|
||||
|
||||
// Get free id for insert
|
||||
$newid = 0;
|
||||
$sql = "SELECT max(rowid) newid from ".MAIN_DB_PREFIX."c_type_contact";
|
||||
$result = $db->query($sql);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$obj = $db->fetch_object($result);
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$newid = ($obj->newid + 1);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
return $newid;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user