Fix: Postgres compatibility

This commit is contained in:
Laurent Destailleur 2010-03-24 13:06:29 +00:00
parent d9334847d8
commit 49600d1423
3 changed files with 15 additions and 9 deletions

View File

@ -40,7 +40,7 @@ $def = array();
$lastexternalrss=0;
// positionne la variable pour le nombre de rss externes
$sql ="select MAX(name) name from ".MAIN_DB_PREFIX."const";
$sql ="select MAX(name) as name from ".MAIN_DB_PREFIX."const";
$sql.=" WHERE name like 'EXTERNAL_RSS_URLRSS_%'";
$result=$db->query($sql);
if ($result)

View File

@ -35,7 +35,7 @@ $def = array();
$lastftpentry=0;
// Positionne la variable pour le nombre de rss externes
$sql ="select MAX(name) name from ".MAIN_DB_PREFIX."const";
$sql ="select MAX(name) as name from ".MAIN_DB_PREFIX."const";
$sql.=" WHERE name like 'FTP_SERVER_%'";
$result=$db->query($sql);
if ($result)
@ -56,19 +56,19 @@ if ($_POST["action"] == 'add' || $_POST["modify"])
$error=0;
$mesg='';
if (empty($_POST[$ftp_name]))
{
$error=1;
$mesg.='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Label")).'</div>';
}
if (empty($_POST[$ftp_server]))
{
$error=1;
$mesg.='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Server")).'</div>';
}
if (! $error)
{
$ftp_port = "FTP_PORT_" . $_POST["numero_entry"];
@ -143,7 +143,7 @@ if (! function_exists('ftp_connect'))
else
{
if ($mesg) print $mesg;
// Formulaire ajout
print '<form name="ftpconfig" action="ftpclient.php" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';

View File

@ -264,6 +264,8 @@ class modSociete extends DolibarrModules
*/
function init($options='')
{
global $conf;
require_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
// Prevent pb of modules not correctly disabled
@ -273,9 +275,13 @@ class modSociete extends DolibarrModules
create_exdir($dirodt);
dol_copy(DOL_DOCUMENT_ROOT.'/install/odttemplates/thirdparties/template_thirdparty.odt',$dirodt,0,0);
$sql = array(
array('sql'=>"INSERT INTO ".MAIN_DB_PREFIX."const set name='COMPANY_ADDON_PDF_ODT_PATH', value='DOL_DATA_ROOT/odttemplates/thirdparties'",'ignoreerror'=>1)
);
$sql = array();
if ($this->db->type != 'pgsql') // TODO For the moment, we can't execute SQL that may fail with Postgres
{
$sql=array(
array('sql'=>"INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible,entity) VALUES ('COMPANY_ADDON_PDF_ODT_PATH', 'DOL_DATA_ROOT/odttemplates/thirdparties', 0, '".$conf->entity."')",'ignoreerror'=>1)
);
}
return $this->_init($sql,$options);
}