diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index 9e337a2f7af..7e10f691a4d 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2009 Laurent Destailleur * Copyright (C) 2007 Rodolphe Quiedeville * * This program is free software; you can redistribute it and/or modify @@ -37,19 +37,22 @@ $langs->load("other"); /* * Actions */ -if ($_POST["action"] == 'setlevel') +if (! empty($_POST["action"]) && $_POST["action"] == 'setlevel') { dolibarr_set_const($db,"SYSLOG_LEVEL",$_POST["level"]); dolibarr_syslog("admin/syslog: level ".$_POST["level"]); } -if ($_POST["action"] == 'set') +if (! empty($_POST["action"]) && $_POST["action"] == 'set') { $optionlogoutput=$_POST["optionlogoutput"]; if ($optionlogoutput == "syslog") { if (defined($_POST["facility"])) { + // Only LOG_USER supported on Windows + if (! empty($_SERVER["WINDIR"])) $_POST["facility"]='LOG_USER'; + dolibarr_del_const($db,"SYSLOG_FILE"); dolibarr_set_const($db,"SYSLOG_FACILITY",$_POST["facility"]); dolibarr_syslog("admin/syslog: facility ".$_POST["facility"]); @@ -110,11 +113,13 @@ print '\n"; $var=true; $var=!$var; -print " ".$langs->trans("SyslogSyslog").""; -print ''.$langs->trans("SyslogFacility").': '; +print " ".$langs->trans("SyslogSyslog").""; +print ''.$langs->trans("SyslogFacility").': '; +print ' '.img_info('Only LOG_USER supported on Windows'); +print ''; $var=!$var; -print " ".$langs->trans("SyslogSimpleFile").""; +print " ".$langs->trans("SyslogSimpleFile").""; print ''.$langs->trans("SyslogFilename").': '; print "\n"; diff --git a/htdocs/core/events.class.php b/htdocs/core/events.class.php index 403d9582f6e..34524e30877 100644 --- a/htdocs/core/events.class.php +++ b/htdocs/core/events.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2007-2009 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -43,28 +43,27 @@ class Events // extends CommonObject var $errors=array(); //!< To return several error codes (or messages) var $element='events'; //!< Id that identify managed objects var $table_element='events'; //!< Name of table without prefix where object is stored - + var $id; - + var $tms; var $type; var $dateevent; var $description; - - + /** * \brief Constructor * \param DB Database handler */ - function Events($DB) + function Events($DB) { $this->db = $DB; return 1; } - + /** * \brief Create in database * \param user User that create @@ -73,18 +72,17 @@ class Events // extends CommonObject function create($user) { global $conf, $langs; - + // Clean parameters $this->id=trim($this->id); - $this->fk_action=trim($this->fk_action); $this->description=trim($this->description); // Check parameters if (! $this->description) { $this->error='ErrorBadValueForParameter'; return -1; } - + // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."events("; - + $sql.= "type,"; $sql.= "ip,"; $sql.= "dateevent,"; @@ -92,7 +90,7 @@ class Events // extends CommonObject $sql.= "description"; $sql.= ") VALUES ("; - + $sql.= " '".$this->type."',"; $sql.= " '".$_SERVER['REMOTE_ADDR']."',"; $sql.= " ".$this->db->idate($this->dateevent).","; @@ -106,7 +104,7 @@ class Events // extends CommonObject if ($resql) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."events"); - + return $this->id; } else @@ -126,25 +124,25 @@ class Events // extends CommonObject function update($user=0, $notrigger=0) { global $conf, $langs; - + // Clean parameters - + $this->id=trim($this->id); $this->type=trim($this->type); $this->description=trim($this->description); - + // Check parameters // Put here code to add control on parameters values // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."events SET"; - + $sql.= " type='".$this->type."',"; $sql.= " dateevent=".$this->db->idate($this->dateevent).","; $sql.= " description='".addslashes($this->description)."'"; - + $sql.= " WHERE rowid=".$this->id; dolibarr_syslog("Events::update sql=".$sql, LOG_DEBUG); @@ -158,8 +156,8 @@ class Events // extends CommonObject return 1; } - - + + /* * \brief Load object in memory from database * \param id id object @@ -171,16 +169,16 @@ class Events // extends CommonObject global $langs; $sql = "SELECT"; $sql.= " t.rowid,"; - + $sql.= " ".$this->db->pdate('t.tms').","; $sql.= " t.type,"; $sql.= " ".$this->db->pdate('t.dateevent').","; $sql.= " t.description"; - + $sql.= " FROM ".MAIN_DB_PREFIX."events as t"; $sql.= " WHERE t.rowid = ".$id; - + dolibarr_syslog("Events::fetch sql=".$sql, LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -188,18 +186,18 @@ class Events // extends CommonObject if ($this->db->num_rows($resql)) { $obj = $this->db->fetch_object($resql); - + $this->id = $obj->rowid; - + $this->tms = $obj->tms; $this->type = $obj->type; $this->dateevent = $obj->dateevent; $this->description = $obj->description; - + } $this->db->free($resql); - + return 1; } else @@ -209,8 +207,8 @@ class Events // extends CommonObject return -1; } } - - + + /* * \brief Delete object in database * \param user User that delete @@ -219,10 +217,10 @@ class Events // extends CommonObject function delete($user) { global $conf, $langs; - + $sql = "DELETE FROM ".MAIN_DB_PREFIX."events"; $sql.= " WHERE rowid=".$this->id; - + dolibarr_syslog("Events::delete sql=".$sql); $resql = $this->db->query($sql); if (! $resql) @@ -231,11 +229,11 @@ class Events // extends CommonObject dolibarr_syslog("Events::delete ".$this->error, LOG_ERR); return -1; } - + return 1; } - + /** * \brief Initialise object with example values * \remarks id must be 0 if object instance is a specimen. @@ -243,7 +241,7 @@ class Events // extends CommonObject function initAsSpecimen() { $this->id=0; - + $this->tms=time(); $this->type=''; $this->dateevent=time(); diff --git a/htdocs/html.formadmin.class.php b/htdocs/html.formadmin.class.php index 93c92e82d18..15a1a8ac341 100644 --- a/htdocs/html.formadmin.class.php +++ b/htdocs/html.formadmin.class.php @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** @@ -41,10 +41,10 @@ class FormAdmin function FormAdmin($DB) { $this->db = $DB; - + return 1; } - + /** * \brief Retourne la liste déroulante des langues disponibles @@ -57,7 +57,7 @@ class FormAdmin global $langs; $langs_available=$langs->get_available_languages(); - + print ''; $oldprefix=''; @@ -133,7 +133,7 @@ class FormAdmin { $tab=split('_',$key); $newprefix=$tab[0]; - if ($conf->browser->firefox && $newprefix != $oldprefix) + if (! empty($conf->browser->firefox) && $newprefix != $oldprefix) // Add separators { // Affiche titre print ''; $oldprefix=$newprefix; } - print $val."\n"; + print $val."\n"; // Show menu entry } print ''; } @@ -157,7 +157,7 @@ class FormAdmin function select_menu_families($selected='',$htmlname,$dirmenu) { global $langs,$conf; - + $menuarray=array(); $handle=opendir($dirmenu); while (($file = readdir($handle))!==false) @@ -196,7 +196,7 @@ class FormAdmin print ''; } - + /** * \brief Retourne la liste d�roulante des menus disponibles (eldy) * \param selected Menu pr�-s�lectionn�e @@ -205,10 +205,10 @@ class FormAdmin function select_timezone($selected='',$htmlname) { global $langs,$conf; - + print ''; } - + /** * \brief Return colors list selector * \param selected Color pre-selected @@ -253,12 +253,12 @@ class FormAdmin function select_colors($selected='', $htmlname, $arrayofcolors='', $showcolorbox=1) { global $langs,$conf; - + if (! is_array($arrayofcolors)) $arrayofcolors=array('29527A','5229A3','A32929','7A367A','B1365F','0D7813'); //$selected=''; if ($showcolorbox) print '\n"; dolibarr_syslog('Admin.lib::run_sql Request '.($i+1).' sql='.$newsql, LOG_DEBUG); - + if (eregi('insert into ([^ ]+)',$newsql,$reg)) - { + { // It's an insert $cursorinsert++; } - + // Replace __x__ with rowid of insert nb x while (eregi('__([0-9]+)__',$newsql,$reg)) { @@ -217,12 +217,12 @@ function run_sql($sqlfile,$silent=1) $newsql=str_replace($from,$to,$newsql); dolibarr_syslog('Admin.lib::run_sql New Request '.($i+1).' sql='.$newsql, LOG_DEBUG); } - + $result=$db->query($newsql); if ($result) { if (eregi('insert into ([^ ]+)',$newsql,$reg)) - { + { // It's an insert $table=eregi_replace('[^a-zA-Z_]+','',$reg[1]); $insertedrowid=$db->last_insert_id($table); @@ -234,7 +234,7 @@ function run_sql($sqlfile,$silent=1) else { $errno=$db->errno(); - + $okerror=array( 'DB_ERROR_TABLE_ALREADY_EXISTS', 'DB_ERROR_COLUMN_ALREADY_EXISTS', 'DB_ERROR_KEY_NAME_ALREADY_EXISTS', @@ -291,7 +291,7 @@ function run_sql($sqlfile,$silent=1) function dolibarr_del_const($db, $name) { global $conf; - + $sql = "DELETE FROM llx_const"; $sql.=" WHERE name='".addslashes($name)."' or rowid='".addslashes($name)."'"; @@ -328,7 +328,7 @@ function dolibarr_get_const($db, $name) if ($resql) { $obj=$db->fetch_object($resql); - $value=$obj->value; + if ($obj) $value=$obj->value; } return $value; } @@ -356,7 +356,7 @@ function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $not } $db->begin(); - + //dolibarr_syslog("dolibarr_set_const name=$name, value=$value"); $sql = "DELETE FROM llx_const WHERE name = '".addslashes($name)."';"; dolibarr_syslog("admin.lib::dolibarr_set_const sql=".$sql, LOG_DEBUG); @@ -417,7 +417,7 @@ function security_prepare_head() $head[$h][1] = $langs->trans("Audit"); $head[$h][2] = 'audit'; $h++; - + return $head; } diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index be782e92ce8..e4242e79b7c 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -246,22 +246,16 @@ function dol_syslog($message, $level=LOG_INFO) { if (function_exists('openlog')) // This function does not exists on some ISP (Ex: Free in France) { + $facility = LOG_USER; + //define_syslog_variables(); already defined in master.inc.php - if (defined("MAIN_SYSLOG_FACILITY") && MAIN_SYSLOG_FACILITY) - { - $facility = constant("MAIN_SYSLOG_FACILITY"); - } - elseif (defined("SYSLOG_FACILITY") && SYSLOG_FACILITY) + if (defined("SYSLOG_FACILITY") && SYSLOG_FACILITY) { // Exemple: SYSLOG_FACILITY vaut LOG_USER qui vaut 8. On a besoin de 8 dans $facility. $facility = constant("SYSLOG_FACILITY"); } - else - { - $facility = LOG_USER; - } -unset ($facility); - openlog("dolibarr", LOG_PID | LOG_PERROR, $facility); + + openlog("dolibarr", LOG_PID | LOG_PERROR, (int) $facility); // (int) is required to avoid error parameter 3 expected to be long if (! $level) { diff --git a/htdocs/lib/security.lib.php b/htdocs/lib/security.lib.php index 47924bda57c..7b08c71233c 100644 --- a/htdocs/lib/security.lib.php +++ b/htdocs/lib/security.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2008-2009 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -45,7 +45,7 @@ function dol_loginfunction($langs,$conf,$mysoc) if (! empty($_REQUEST["urlfrom"])) $_SESSION["urlfrom"]=$_REQUEST["urlfrom"]; else unset($_SESSION["urlfrom"]); - + // Ce DTD est KO car inhibe document.body.scrollTop //print ''; // Ce DTD est OK @@ -149,8 +149,7 @@ function dol_loginfunction($langs,$conf,$mysoc) print ''."\n"; // Security graphical code - $disabled=! $conf->global->MAIN_SECURITY_ENABLECAPTCHA; - if (function_exists("imagecreatefrompng") && ! $disabled) + if (function_exists("imagecreatefrompng") && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) { //print "Info session: ".session_name().session_id();print_r($_SESSION); print ''; @@ -170,27 +169,27 @@ function dol_loginfunction($langs,$conf,$mysoc) print ''; print ''; - if (! $conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK) + if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)) { print ''; } print '
'; - + print '
'.$langs->trans("Request").' '.($i+1)." sql='".$newsql."'
 
  '.$langs->trans("SecurityCode").'
('.$langs->trans("PasswordForgotten").')
'; - + // Hidden fields print ''; - + print ''; // Message - if ($_SESSION["dol_loginmesg"]) + if (! empty($_SESSION["dol_loginmesg"])) { print '
'; print $_SESSION["dol_loginmesg"]; $_SESSION["dol_loginmesg"]=""; print '
'; } - if ($conf->global->MAIN_HOME) + if (! empty($conf->global->MAIN_HOME)) { print '
'; $i=0; @@ -204,8 +203,8 @@ function dol_loginfunction($langs,$conf,$mysoc) } print "\n"; - print ''; - + print ''; + // Fin entete html print "\n\n"; } @@ -242,7 +241,7 @@ function makesalt($type=CRYPT_SALT_LENGTH) /** * \brief Encode\decode database password in config file * \param level Encode level : 0 no enconding, 1 encoding - * \return int <0 if KO, >0 if OK + * \return int <0 if KO, >0 if OK */ function encodedecode_dbpassconf($level=0) { @@ -254,7 +253,7 @@ function encodedecode_dbpassconf($level=0) while(!feof($fp)) { $buffer = fgets($fp,4096); - + if (strstr($buffer,"\$dolibarr_main_db_encrypted_pass") && $level == 0) { $passwd = strstr($buffer,"$dolibarr_main_db_encrypted_pass="); @@ -275,7 +274,7 @@ function encodedecode_dbpassconf($level=0) } } fclose($fp); - + $file=DOL_DOCUMENT_ROOT.'/conf/conf.php'; if ($fp = @fopen($file,'w')) { @@ -283,7 +282,7 @@ function encodedecode_dbpassconf($level=0) fclose($fp); // It's config file, so we set permission for creator only // @chmod($file, octdec('0600')); - + return 1; } else diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index c479834a44a..07982c2f5a0 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -156,7 +156,7 @@ $sessionname="DOLSESSID_".$dolibarr_main_db_name; if (! empty($conf->global->MAIN_SESSION_TIMEOUT)) ini_set('session.gc_maxlifetime',$conf->global->MAIN_SESSION_TIMEOUT); session_name($sessionname); session_start(); -dolibarr_syslog("Start session name=".$sessionname." Session id()=".session_id().", _SESSION['dol_login']=".$_SESSION["dol_login"].", ".ini_get("session.gc_maxlifetime")); +dolibarr_syslog("Start session name=".$sessionname." Session id()=".session_id().", _SESSION['dol_login']=".(isset($_SESSION["dol_login"])?$_SESSION["dol_login"]:'').", ".ini_get("session.gc_maxlifetime")); // Disable modules (this must be after session_start) if (! empty($_REQUEST["disablemodules"])) $_SESSION["disablemodules"]=$_REQUEST["disablemodules"]; @@ -206,7 +206,7 @@ if (! isset($_SESSION["dol_login"])) // On est pas deja authentifie, on demande le login/mot de passe // Verification du code securite graphique - if ($test && isset($_POST["username"]) && $conf->global->MAIN_SECURITY_ENABLECAPTCHA) + if ($test && isset($_POST["username"]) && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) { require_once DOL_DOCUMENT_ROOT.'/../external-libs/Artichow/Artichow.cfg.php'; require_once ARTICHOW."/AntiSpam.class.php"; @@ -380,9 +380,10 @@ else // Est-ce une nouvelle session if (! isset($_SESSION["dol_login"])) { + $error=0; + // Nouvelle session pour ce login $_SESSION["dol_login"]=$user->login; - $_SESSION["dol_password"]=$user->pass_crypted; $_SESSION["dol_authmode"]=$conf->authmode; dolibarr_syslog("This is a new started user session. _SESSION['dol_login']=".$_SESSION["dol_login"].' Session id='.session_id()); @@ -410,7 +411,7 @@ if (! isset($_SESSION["dol_login"])) } // Module webcalendar - if ($conf->webcal->enabled && $user->webcal_login != "") + if (! empty($conf->webcal->enabled) && $user->webcal_login != "") { $domain=''; // Extract domain from url (Useless because only cookie on same domain are authorized by browser @@ -431,7 +432,7 @@ if (! isset($_SESSION["dol_login"])) } // Module Phenix - if ($conf->phenix->enabled && $user->phenix_login != "" && $conf->phenix->cookie) + if (! empty($conf->phenix->enabled) && $user->phenix_login != "" && $conf->phenix->cookie) { // Creation du cookie permettant la connexion automatique, valide jusqu'a la fermeture du browser if (!isset($HTTP_COOKIE_VARS[$conf->phenix->cookie])) @@ -1014,7 +1015,7 @@ function llxFooter($foot='',$limitIEbug=1) } // Juste pour eviter bug IE qui reorganise mal div precedents si celui-ci absent - if ($limitIEbug && ! $conf->browser->firefox) print "\n".'
 
'."\n"; + if ($limitIEbug && empty($conf->browser->firefox)) print "\n".'
 
'."\n"; // If there is some logs in buffer to show if (sizeof($conf->logbuffer)) diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 80cc00d1a39..94d6ef2570c 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -160,7 +160,7 @@ define('MAIN_DB_PREFIX',$dolibarr_main_db_prefix); // Detection browser if (isset($_SERVER["HTTP_USER_AGENT"])) { - if (eregi('firefox',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->firefox=1; + if (eregi('firefox',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->firefox=1; if (eregi('iceweasel',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->firefox=1; } diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 3097d91c50f..6228c043b41 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2007 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -29,7 +29,7 @@ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT.'/product.class.php'); if (!$user->rights->produit->lire) - accessforbidden(); +accessforbidden(); $staticproduct=new Product($db); @@ -86,21 +86,21 @@ print ''; print ''; if ($conf->produit->enabled) { - $statProducts = ""; - $statProducts.= ''; - $statProducts.= ""; - $statProducts.= ""; - $statProducts.= ''; - $statProducts.= ""; + $statProducts = ""; + $statProducts.= ''; + $statProducts.= ""; + $statProducts.= ""; + $statProducts.= ''; + $statProducts.= ""; } if ($conf->service->enabled) { - $statServices = ""; - $statServices.= ''; - $statServices.= ""; - $statServices.= ""; - $statServices.= ''; - $statServices.= ""; + $statServices = ""; + $statServices.= ''; + $statServices.= ""; + $statServices.= ""; + $statServices.= ''; + $statServices.= ""; } if (isset($_GET["type"]) && $_GET["type"] == 0) { @@ -130,8 +130,8 @@ $sql.= " ".$db->pdate("tms")." as datem"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; if ($conf->categorie->enabled && !$user->rights->categorie->voir) { - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid"; } $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_subproduct as sp ON p.rowid = sp.fk_product_subproduct"; $sql.= " WHERE sp.fk_product_subproduct IS NULL"; @@ -143,39 +143,39 @@ $result = $db->query($sql) ; if ($result) { - $num = $db->num_rows($result); - - $i = 0; - - if ($num > 0) - { - $transRecordedType = $langs->trans("LastModifiedProductsAndServices",$max); - if (isset($_GET["type"]) && $_GET["type"] == 0) $transRecordedType = $langs->trans("LastRecordedProducts",$max); - if (isset($_GET["type"]) && $_GET["type"] == 1) $transRecordedType = $langs->trans("LastRecordedServices",$max); - - print '
'.$langs->trans("Statistics").'
'.$langs->trans("ProductsNotOnSell").''.round($prodser[0][0]).'
'.$langs->trans("ProductsOnSell").''.round($prodser[0][1]).'
'.$langs->trans("ProductsNotOnSell").''.round($prodser[0][0]).'
'.$langs->trans("ProductsOnSell").''.round($prodser[0][1]).'
'.$langs->trans("ServicesNotOnSell").''.round($prodser[1][0]).'
'.$langs->trans("ServicesOnSell").''.round($prodser[1][1]).'
'.$langs->trans("ServicesNotOnSell").''.round($prodser[1][0]).'
'.$langs->trans("ServicesOnSell").''.round($prodser[1][1]).'
'; + $num = $db->num_rows($result); - print ''; - - $var=True; + $i = 0; - while ($i < $num) + if ($num > 0) { + $transRecordedType = $langs->trans("LastModifiedProductsAndServices",$max); + if (isset($_GET["type"]) && $_GET["type"] == 0) $transRecordedType = $langs->trans("LastRecordedProducts",$max); + if (isset($_GET["type"]) && $_GET["type"] == 1) $transRecordedType = $langs->trans("LastRecordedServices",$max); + + print '
'.$transRecordedType.'
'; + + print ''; + + $var=True; + + while ($i < $num) + { $objp = $db->fetch_object($result); - + //Multilangs if ($conf->global->MAIN_MULTILANGS) - { - $sql = "SELECT label FROM ".MAIN_DB_PREFIX."product_det"; - $sql.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'"; - $resultd = $db->query($sql); - if ($resultd) - { - $objtp = $db->fetch_object($resultd); - if ($objtp->label != '') $objp->label = $objtp->label; - } - } - + { + $sql = "SELECT label FROM ".MAIN_DB_PREFIX."product_det"; + $sql.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'"; + $resultd = $db->query($sql); + if ($resultd) + { + $objtp = $db->fetch_object($resultd); + if ($objtp && $objtp->label != '') $objp->label = $objtp->label; + } + } + $var=!$var; print ""; print '"; print "\n"; $i++; + } + + $db->free(); + + print "
'.$transRecordedType.'
'; @@ -193,16 +193,16 @@ if ($result) print "
"; } - - $db->free(); - - print "
"; - } } else { - dolibarr_print_error($db); + dolibarr_print_error($db); } print ''; diff --git a/htdocs/product/pre.inc.php b/htdocs/product/pre.inc.php index 93a114e3f7b..ba0c9c7f260 100644 --- a/htdocs/product/pre.inc.php +++ b/htdocs/product/pre.inc.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2007 Auguria SARL * * This program is free software; you can redistribute it and/or modify @@ -16,17 +16,14 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ */ /** - \file htdocs/product/pre.inc.php - \ingroup product,service - \brief Fichier gestionnaire du menu gauche des produits et services - \version $Revision$ - \todo Rodo - Gere les menus depuis les canvas -*/ + * \file htdocs/product/pre.inc.php + * \ingroup product,service + * \brief Fichier gestionnaire du menu gauche des produits et services + * \version $Id$ + */ require("../main.inc.php"); $langs->load("products"); @@ -44,7 +41,7 @@ function llxHeader($head = "", $urlp = "", $title="") { $menu->add(DOL_URL_ROOT."/product/index.php?type=0", $langs->trans("Products")); $menu->add_submenu(DOL_URL_ROOT."/product/liste.php?type=0", $langs->trans("List")); - + if ($user->societe_id == 0 && $user->rights->produit->creer) { $menu->add_submenu(DOL_URL_ROOT."/product/fiche.php?action=create&type=0", $langs->trans("NewProduct")); @@ -53,7 +50,7 @@ function llxHeader($head = "", $urlp = "", $title="") // Produit specifique $dir = DOL_DOCUMENT_ROOT . "/product/canvas/"; - if(is_dir($dir) && $conf->global->PRODUCT_CANVAS_ABILITY) + if(is_dir($dir) && ! empty($conf->global->PRODUCT_CANVAS_ABILITY)) { if ($handle = opendir($dir)) { @@ -62,10 +59,10 @@ function llxHeader($head = "", $urlp = "", $title="") if (substr($file, strlen($file) -10) == '.class.php' && substr($file,0,8) == 'product.') { $parts = explode('.',$file); - $classname = 'Product'.ucfirst($parts[1]); - require_once($dir.$file); + $classname = 'Product'.ucfirst($parts[1]); + require_once($dir.$file); $module = new $classname(); - + if ($module->active === '1' && $module->menu_add === 1) { $module->PersonnalizeMenu($menu); diff --git a/htdocs/user.class.php b/htdocs/user.class.php index 304e4dec5a1..e0e684df037 100644 --- a/htdocs/user.class.php +++ b/htdocs/user.class.php @@ -63,17 +63,18 @@ class User extends CommonObject var $admin; var $login; - //! Mot de passe en clair en memoire + //! Clear password in memory var $pass; - //! Mot de passe en clair en base (renseigne si DATABASE_PWD_ENCRYPTED=0) + //! Clear password in database (defined if DATABASE_PWD_ENCRYPTED=0) var $pass_indatabase; - //! Mot de passe crypte en base (toujours renseigne) + //! Encrypted password in database (always defined) var $pass_indatabase_crypted; var $datec; var $datem; var $societe_id; var $fk_member; + var $webcal_login; var $phenix_login; var $phenix_pass;