Merge pull request #11276 from atm-maxime/fix_db_table_prefix
Fix : remove hardcoded llx_ prefix
This commit is contained in:
commit
b40041146b
@ -138,8 +138,8 @@ class modReceiptPrinter extends DolibarrModules
|
||||
// Clean before activation
|
||||
$this->remove($options);
|
||||
$sql = array(
|
||||
"CREATE TABLE IF NOT EXISTS llx_printer_receipt (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), fk_type integer, fk_profile integer, parameter varchar(128), entity integer) ENGINE=innodb;",
|
||||
"CREATE TABLE IF NOT EXISTS llx_printer_receipt_template (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), template text, entity integer) ENGINE=innodb;",
|
||||
"CREATE TABLE IF NOT EXISTS ".MAIN_DB_PREFIX."printer_receipt (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), fk_type integer, fk_profile integer, parameter varchar(128), entity integer) ENGINE=innodb;",
|
||||
"CREATE TABLE IF NOT EXISTS ".MAIN_DB_PREFIX."printer_receipt_template (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), template text, entity integer) ENGINE=innodb;",
|
||||
);
|
||||
return $this->_init($sql,$options);
|
||||
}
|
||||
|
||||
@ -274,7 +274,7 @@ class modStock extends DolibarrModules
|
||||
'ps.fk_product'=>"PREF123456",'ps.fk_entrepot'=>"ALM001",'ps.reel'=>"10"
|
||||
);
|
||||
$this->import_run_sql_after_array[$r]=array( // Because we may change data that are denormalized, we must update dernormalized data after.
|
||||
'UPDATE llx_product p SET p.stock= (SELECT SUM(ps.reel) FROM llx_product_stock ps WHERE ps.fk_product = p.rowid);'
|
||||
'UPDATE '.MAIN_DB_PREFIX.'product p SET p.stock= (SELECT SUM(ps.reel) FROM '.MAIN_DB_PREFIX.'product_stock ps WHERE ps.fk_product = p.rowid);'
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@ -774,7 +774,7 @@ if ($ok && GETPOST('clean_product_stock_batch','alpha'))
|
||||
if ($resql2)
|
||||
{
|
||||
// We update product_stock, so we must field stock into product too.
|
||||
$sql3='UPDATE llx_product p SET p.stock= (SELECT SUM(ps.reel) FROM llx_product_stock ps WHERE ps.fk_product = p.rowid)';
|
||||
$sql3='UPDATE '.MAIN_DB_PREFIX.'product p SET p.stock= (SELECT SUM(ps.reel) FROM '.MAIN_DB_PREFIX.'product_stock ps WHERE ps.fk_product = p.rowid)';
|
||||
$resql3=$db->query($sql3);
|
||||
if (! $resql3)
|
||||
{
|
||||
|
||||
@ -660,8 +660,8 @@ function migrate_paiements_orphelins_1($db,$langs,$conf)
|
||||
$sql = "SELECT distinct p.rowid, p.datec, p.amount as pamount, bu.fk_bank, b.amount as bamount,";
|
||||
$sql.= " bu2.url_id as socid";
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."bank_url as bu, ".MAIN_DB_PREFIX."bank as b)";
|
||||
$sql.= " LEFT JOIN llx_paiement_facture as pf ON pf.fk_paiement = p.rowid";
|
||||
$sql.= " LEFT JOIN llx_bank_url as bu2 ON (bu.fk_bank=bu2.fk_bank AND bu2.type = 'company')";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON pf.fk_paiement = p.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu2 ON (bu.fk_bank=bu2.fk_bank AND bu2.type = 'company')";
|
||||
$sql.= " WHERE pf.rowid IS NULL AND (p.rowid=bu.url_id AND bu.type='payment') AND bu.fk_bank = b.rowid";
|
||||
$sql.= " AND b.rappro = 1";
|
||||
$sql.= " AND (p.fk_facture = 0 OR p.fk_facture IS NULL)";
|
||||
@ -787,8 +787,8 @@ function migrate_paiements_orphelins_2($db,$langs,$conf)
|
||||
$sql = "SELECT distinct p.rowid, p.datec, p.amount as pamount, bu.fk_bank, b.amount as bamount,";
|
||||
$sql.= " bu2.url_id as socid";
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."bank_url as bu, ".MAIN_DB_PREFIX."bank as b)";
|
||||
$sql.= " LEFT JOIN llx_paiement_facture as pf ON pf.fk_paiement = p.rowid";
|
||||
$sql.= " LEFT JOIN llx_bank_url as bu2 ON (bu.fk_bank = bu2.fk_bank AND bu2.type = 'company')";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON pf.fk_paiement = p.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu2 ON (bu.fk_bank = bu2.fk_bank AND bu2.type = 'company')";
|
||||
$sql.= " WHERE pf.rowid IS NULL AND (p.fk_bank = bu.fk_bank AND bu.type = 'payment') AND bu.fk_bank = b.rowid";
|
||||
$sql.= " AND (p.fk_facture = 0 OR p.fk_facture IS NULL)";
|
||||
|
||||
@ -1104,7 +1104,7 @@ function migrate_contracts_date1($db,$langs,$conf)
|
||||
print '<br>';
|
||||
print '<b>'.$langs->trans('MigrationContractsEmptyDatesUpdate')."</b><br>\n";
|
||||
|
||||
$sql="update llx_contrat set date_contrat=tms where date_contrat is null";
|
||||
$sql="update ".MAIN_DB_PREFIX."contrat set date_contrat=tms where date_contrat is null";
|
||||
dolibarr_install_syslog("upgrade2::migrate_contracts_date1");
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql) dol_print_error($db);
|
||||
@ -1113,7 +1113,7 @@ function migrate_contracts_date1($db,$langs,$conf)
|
||||
else
|
||||
print $langs->trans('MigrationContractsEmptyDatesNothingToUpdate')."<br>\n";
|
||||
|
||||
$sql="update llx_contrat set datec=tms where datec is null";
|
||||
$sql="update ".MAIN_DB_PREFIX."contrat set datec=tms where datec is null";
|
||||
dolibarr_install_syslog("upgrade2::migrate_contracts_date1");
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql) dol_print_error($db);
|
||||
@ -1204,7 +1204,7 @@ function migrate_contracts_date3($db,$langs,$conf)
|
||||
print '<br>';
|
||||
print '<b>'.$langs->trans('MigrationContractsIncoherentCreationDateUpdate')."</b><br>\n";
|
||||
|
||||
$sql="update llx_contrat set datec=date_contrat where datec is null or datec > date_contrat";
|
||||
$sql="update ".MAIN_DB_PREFIX."contrat set datec=date_contrat where datec is null or datec > date_contrat";
|
||||
dolibarr_install_syslog("upgrade2::migrate_contracts_date3");
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql) dol_print_error($db);
|
||||
@ -1231,7 +1231,7 @@ function migrate_contracts_open($db,$langs,$conf)
|
||||
print '<br>';
|
||||
print '<b>'.$langs->trans('MigrationReopeningContracts')."</b><br>\n";
|
||||
|
||||
$sql = "SELECT c.rowid as cref FROM llx_contrat as c, llx_contratdet as cd";
|
||||
$sql = "SELECT c.rowid as cref FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
$sql.= " WHERE cd.statut = 4 AND c.statut=2 AND c.rowid=cd.fk_contrat";
|
||||
dolibarr_install_syslog("upgrade2::migrate_contracts_open");
|
||||
$resql = $db->query($sql);
|
||||
@ -1964,7 +1964,7 @@ function migrate_modeles($db,$langs,$conf)
|
||||
if (count($modellist)==0)
|
||||
{
|
||||
// Aucun model par defaut.
|
||||
$sql=" insert into llx_document_model(nom,type) values('crabe','invoice')";
|
||||
$sql=" insert into ".MAIN_DB_PREFIX."document_model(nom,type) values('crabe','invoice')";
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql) dol_print_error($db);
|
||||
}
|
||||
@ -1977,7 +1977,7 @@ function migrate_modeles($db,$langs,$conf)
|
||||
if (count($modellist)==0)
|
||||
{
|
||||
// Aucun model par defaut.
|
||||
$sql=" insert into llx_document_model(nom,type) values('einstein','order')";
|
||||
$sql=" insert into ".MAIN_DB_PREFIX."document_model(nom,type) values('einstein','order')";
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql) dol_print_error($db);
|
||||
}
|
||||
@ -1990,7 +1990,7 @@ function migrate_modeles($db,$langs,$conf)
|
||||
if (count($modellist)==0)
|
||||
{
|
||||
// Aucun model par defaut.
|
||||
$sql=" insert into llx_document_model(nom,type) values('rouget','shipping')";
|
||||
$sql=" insert into ".MAIN_DB_PREFIX."document_model(nom,type) values('rouget','shipping')";
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql) dol_print_error($db);
|
||||
}
|
||||
|
||||
@ -850,7 +850,7 @@ class Website extends CommonObject
|
||||
}
|
||||
foreach($listofpages as $pageid => $objectpageold)
|
||||
{
|
||||
$line = 'INSERT INTO llx_website_page(rowid, fk_page, fk_website, pageurl, title, description, keyword, status, date_creation, tms, lang, import_key, grabbed_from, content)';
|
||||
$line = 'INSERT INTO '.MAIN_DB_PREFIX.'website_page(rowid, fk_page, fk_website, pageurl, title, description, keyword, status, date_creation, tms, lang, import_key, grabbed_from, content)';
|
||||
$line.= " VALUES(";
|
||||
$line.= $objectpageold->newid."+__MAXROWID__, ";
|
||||
$line.= ($objectpageold->newfk_page ? $this->db->escape($objectpageold->newfk_page)."+__MAXROWID__" : "null").", ";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user