Skip to content
Snippets Groups Projects
Commit 2f9cc1c9 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix avoid errors with postgresql

parent d186aed9
No related branches found
No related tags found
No related merge requests found
......@@ -219,12 +219,22 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
if ($success)
{
// Insert MAIN_VERSION_FIRST_INSTALL in a dedicated transaction. So if it fails (when first install was already done), we can do other following requests.
$db->begin();
dolibarr_install_syslog('step5: set MAIN_VERSION_FIRST_INSTALL const to ' . $targetversion, LOG_DEBUG);
$resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_VERSION_FIRST_INSTALL',1).",".$db->encrypt($targetversion,1).",'chaine',0,'Dolibarr version when first install',0)");
//if (! $resql) dol_print_error($db,'Error in setup program'); // We ignore errors. Key may already exists
$conf->global->MAIN_VERSION_FIRST_INSTALL=$targetversion;
if ($resql)
{
$conf->global->MAIN_VERSION_FIRST_INSTALL=$targetversion;
$db->commit();
}
else
{
//if (! $resql) dol_print_error($db,'Error in setup program'); // We ignore errors. Key may already exists
$db->commit();
}
$db->begin();
dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_INSTALL const to ' . $targetversion, LOG_DEBUG);
$resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_VERSION_LAST_INSTALL'");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment