Skip to content

Commit

Permalink
Fix: avoid warning
Browse files Browse the repository at this point in the history
  • Loading branch information
hregis committed Aug 21, 2011
1 parent 2468b33 commit ca5b083
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 66 deletions.
10 changes: 5 additions & 5 deletions htdocs/admin/const.php
Expand Up @@ -21,7 +21,7 @@
* \file htdocs/admin/const.php
* \ingroup setup
* \brief Admin page to define miscellaneous constants
* \version $Id: const.php,v 1.70 2011/07/31 22:23:21 eldy Exp $
* \version $Id: const.php,v 1.71 2011/08/21 10:01:37 hregis Exp $
*/

require("../main.inc.php");
Expand Down Expand Up @@ -143,7 +143,7 @@
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Value").'</td>';
print '<td>'.$langs->trans("Comment").'</td>';
if ($conf->multicompany->enabled && !$user->entity) print '<td>'.$langs->trans("Entity").'</td>';
if (! empty($conf->multicompany->enabled) && !$user->entity) print '<td>'.$langs->trans("Entity").'</td>';
print '<td align="center">'.$langs->trans("Action").'</td>';
print "</tr>\n";

Expand All @@ -165,7 +165,7 @@
print '<input type="text" class="flat" size="40" name="constnote" value="">';
print '</td>';
// Limit to superadmin
if ($conf->multicompany->enabled && !$user->entity)
if (! empty($conf->multicompany->enabled) && !$user->entity)
{
print '<td>';
print '<input type="text" class="flat" size="1" name="entity" value="'.$conf->entity.'">';
Expand Down Expand Up @@ -231,7 +231,7 @@
print '</td>';

// Entity limit to superadmin
if ($conf->multicompany->enabled && !$user->entity)
if (! empty($conf->multicompany->enabled) && !$user->entity)
{
print '<td>';
print '<input type="text" class="flat" size="1" name="const['.$i.'][entity]" value="'.$obj->entity.'">';
Expand Down Expand Up @@ -279,5 +279,5 @@

$db->close();

llxFooter('$Date: 2011/07/31 22:23:21 $ - $Revision: 1.70 $');
llxFooter('$Date: 2011/08/21 10:01:37 $ - $Revision: 1.71 $');
?>
14 changes: 7 additions & 7 deletions htdocs/core/class/html.form.class.php
Expand Up @@ -31,7 +31,7 @@
* \file htdocs/core/class/html.form.class.php
* \ingroup core
* \brief File of class with all html predefined components
* \version $Id: html.form.class.php,v 1.203 2011/08/21 00:20:44 hregis Exp $
* \version $Id: html.form.class.php,v 1.204 2011/08/21 10:01:37 hregis Exp $
*/


Expand Down Expand Up @@ -799,12 +799,12 @@ function select_dolusers($selected='',$htmlname='userid',$show_empty=0,$exclude=

// On recherche les utilisateurs
$sql = "SELECT u.rowid, u.name, u.firstname, u.login, u.admin, u.entity";
if($conf->multicompany->enabled && $conf->entity == 1 && $user->admin && ! $user->entity)
if(! empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && ! $user->entity)
{
$sql.= ", e.label";
}
$sql.= " FROM ".MAIN_DB_PREFIX ."user as u";
if($conf->multicompany->enabled && $conf->entity == 1 && $user->admin && ! $user->entity)
if(! empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && ! $user->entity)
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX ."entity as e on e.rowid=u.entity";
if ($force_entity) $sql.= " WHERE u.entity IN (0,".$force_entity.")";
Expand Down Expand Up @@ -856,7 +856,7 @@ function select_dolusers($selected='',$htmlname='userid',$show_empty=0,$exclude=
}
$out.= $userstatic->getFullName($langs);

if($conf->multicompany->enabled && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity)
if(! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity)
{
if ($obj->admin && ! $obj->entity) $out.=" (".$langs->trans("AllEntities").")";
else $out.=" (".$obj->label.")";
Expand Down Expand Up @@ -3535,12 +3535,12 @@ function select_dolgroups($selected='',$htmlname='groupid',$show_empty=0,$exclud

// On recherche les groupes
$sql = "SELECT ug.rowid, ug.nom ";
if($conf->multicompany->enabled && $conf->entity == 1 && $user->admin && ! $user->entity)
if(! empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && ! $user->entity)
{
$sql.= ", e.label";
}
$sql.= " FROM ".MAIN_DB_PREFIX."usergroup as ug ";
if($conf->multicompany->enabled && $conf->entity == 1 && $user->admin && ! $user->entity)
if(! empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && ! $user->entity)
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."entity as e on e.rowid=ug.entity";
if ($force_entity) $sql.= " WHERE ug.entity IN (0,".$force_entity.")";
Expand Down Expand Up @@ -3580,7 +3580,7 @@ function select_dolgroups($selected='',$htmlname='groupid',$show_empty=0,$exclud
$out.= '>';

$out.= $obj->nom;
if($conf->multicompany->enabled && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1)
if(! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1)
{
$out.= " (".$obj->label.")";
}
Expand Down
10 changes: 5 additions & 5 deletions htdocs/lib/functions.lib.php
Expand Up @@ -28,7 +28,7 @@
* \file htdocs/lib/functions.lib.php
* \brief A set of functions for Dolibarr
* This file contains all frequently used functions.
* \version $Id: functions.lib.php,v 1.562 2011/08/20 20:53:31 eldy Exp $
* \version $Id: functions.lib.php,v 1.563 2011/08/21 10:01:37 hregis Exp $
*/

// For compatibility during upgrade
Expand Down Expand Up @@ -2224,7 +2224,7 @@ function restrictedArea($user, $features='societe', $objectid=0, $dbtablename=''
$sql = "SELECT dbt.".$dbt_select;
$sql.= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
$sql.= " WHERE dbt.".$dbt_select." = ".$objectid;
if (($feature == 'user' || $feature == 'usergroup') && $conf->multicompany->enabled && $conf->entity == 1 && $user->admin && ! $user->entity)
if (($feature == 'user' || $feature == 'usergroup') && ! empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && ! $user->entity)
{
$sql.= " AND dbt.entity IS NOT NULL";
}
Expand Down Expand Up @@ -2252,7 +2252,7 @@ function restrictedArea($user, $features='societe', $objectid=0, $dbtablename=''
$sql.= " AND s.entity IN (0,".(! empty($conf->entities[$dbtablename]) ? $conf->entities[$dbtablename] : $conf->entity).")";
}
// If multicompany and internal users with all permissions, check user is in correct entity
else if ($conf->multicompany->enabled)
else if (! empty($conf->multicompany->enabled))
{
$sql = "SELECT s.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
Expand Down Expand Up @@ -2281,7 +2281,7 @@ function restrictedArea($user, $features='societe', $objectid=0, $dbtablename=''
$sql.= " AND dbt.entity IN (0,".(! empty($conf->entities[$dbtablename]) ? $conf->entities[$dbtablename] : $conf->entity).")";
}
// If multicompany and internal users with all permissions, check user is in correct entity
else if ($conf->multicompany->enabled)
else if (! empty($conf->multicompany->enabled))
{
$sql = "SELECT dbt.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
Expand Down Expand Up @@ -2324,7 +2324,7 @@ function restrictedArea($user, $features='societe', $objectid=0, $dbtablename=''
$sql.= " AND sc.fk_user = ".$user->id;
}
// If multicompany and internal users with all permissions, check user is in correct entity
else if ($conf->multicompany->enabled)
else if (! empty($conf->multicompany->enabled))
{
$sql = "SELECT dbt.".$dbt_select;
$sql.= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
Expand Down
4 changes: 2 additions & 2 deletions htdocs/main.inc.php
Expand Up @@ -25,7 +25,7 @@
* \file htdocs/main.inc.php
* \ingroup core
* \brief File that defines environment for Dolibarr pages only (variables not required by scripts)
* \version $Id: main.inc.php,v 1.767 2011/08/19 15:06:28 cdelambert Exp $
* \version $Id: main.inc.php,v 1.768 2011/08/21 10:01:38 hregis Exp $
*/

@ini_set('memory_limit', '64M'); // This may be useless if memory is hard limited by your PHP
Expand Down Expand Up @@ -539,7 +539,7 @@ function analyse_sql_and_script(&$var,$get)
$_SESSION["dol_screenwidth"]=isset($dol_screenwidth)?$dol_screenwidth:'';
$_SESSION["dol_screenheight"]=isset($dol_screenheight)?$dol_screenheight:'';
$_SESSION["dol_company"]=$conf->global->MAIN_INFO_SOCIETE_NOM;
if ($conf->multicompany->enabled) $_SESSION["dol_entity"]=$conf->entity;
if (! empty($conf->multicompany->enabled)) $_SESSION["dol_entity"]=$conf->entity;
dol_syslog("This is a new started user session. _SESSION['dol_login']=".$_SESSION["dol_login"].' Session id='.session_id());

$db->begin();
Expand Down
4 changes: 2 additions & 2 deletions htdocs/user/class/user.class.php
Expand Up @@ -25,7 +25,7 @@
/**
* \file htdocs/user/class/user.class.php
* \brief Fichier de la classe utilisateur
* \version $Id: user.class.php,v 1.52 2011/08/21 00:20:43 hregis Exp $
* \version $Id: user.class.php,v 1.53 2011/08/21 10:01:37 hregis Exp $
*/

require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
Expand Down Expand Up @@ -146,7 +146,7 @@ function fetch($id='', $login='',$sid='',$loadpersonalconf=1)
$sql.= " u.openid as openid";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";

if($conf->multicompany->enabled && $conf->entity == 1)
if(! empty($conf->multicompany->enabled) && $conf->entity == 1)
{
$sql.= " WHERE u.entity IS NOT NULL";
}
Expand Down
10 changes: 5 additions & 5 deletions htdocs/user/class/usergroup.class.php
Expand Up @@ -21,7 +21,7 @@
* \file htdocs/user/class/usergroup.class.php
* \brief Fichier de la classe des groupes d'utilisateur
* \author Rodolphe Qiedeville
* \version $Id: usergroup.class.php,v 1.15 2011/08/21 00:20:43 hregis Exp $
* \version $Id: usergroup.class.php,v 1.16 2011/08/21 10:01:37 hregis Exp $
*/

require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
Expand Down Expand Up @@ -130,7 +130,7 @@ function listGroupsForUser($userid)
$sql.= " WHERE ug.fk_usergroup = g.rowid";
$sql.= " AND ug.fk_user = ".$userid;

if($conf->multicompany->enabled && $conf->entity == 1 && $user->admin && ! $user->entity)
if(! empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && ! $user->entity)
{
$sql.= " AND g.entity IS NOT NULL";
}
Expand Down Expand Up @@ -182,7 +182,7 @@ function listUsersForGroup()
$sql.= " WHERE ug.fk_user = u.rowid";
$sql.= " AND ug.fk_usergroup = ".$this->id;

if($conf->multicompany->enabled && $conf->entity == 1 && $user->admin && ! $user->entity)
if(! empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && ! $user->entity)
{
$sql.= " AND u.entity IS NOT NULL";
}
Expand Down Expand Up @@ -523,7 +523,7 @@ function create($notrigger=0)
$now=dol_now();

$entity=$conf->entity;
if($conf->multicompany->enabled && $conf->entity == 1)
if(! empty($conf->multicompany->enabled) && $conf->entity == 1)
{
$entity=$this->entity;
}
Expand Down Expand Up @@ -578,7 +578,7 @@ function update($notrigger=0)
$error=0;

$entity=$conf->entity;
if($conf->multicompany->enabled && $conf->entity == 1)
if(! empty($conf->multicompany->enabled) && $conf->entity == 1)
{
$entity=$this->entity;
}
Expand Down
24 changes: 12 additions & 12 deletions htdocs/user/fiche.php
Expand Up @@ -24,7 +24,7 @@
/**
* \file htdocs/user/fiche.php
* \brief Tab of user card
* \version $Id: fiche.php,v 1.280 2011/08/21 00:20:44 hregis Exp $
* \version $Id: fiche.php,v 1.281 2011/08/21 10:01:37 hregis Exp $
*/

require("../main.inc.php");
Expand All @@ -35,7 +35,7 @@
require_once(DOL_DOCUMENT_ROOT."/lib/usergroups.lib.php");
if ($conf->ldap->enabled) require_once(DOL_DOCUMENT_ROOT."/lib/ldap.class.php");
if ($conf->adherent->enabled) require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php");
if ($conf->multicompany->enabled) dol_include_once("/multicompany/class/actions_multicompany.class.php");
if (! empty($conf->multicompany->enabled)) dol_include_once("/multicompany/class/actions_multicompany.class.php");

// Define value to know what current user can do on users
$canadduser=($user->admin || $user->rights->user->user->creer);
Expand All @@ -51,7 +51,7 @@
}

//Multicompany in mode transversal
if($conf->multicompany->enabled && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)
if(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)
{
accessforbidden();
}
Expand Down Expand Up @@ -666,7 +666,7 @@
print '<td>';
print $form->selectyesno('admin',$_POST["admin"],1);

if ($conf->multicompany->enabled && ! $user->entity && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
if (! empty($conf->multicompany->enabled) && ! $user->entity && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
{
if ($conf->use_javascript_ajax)
{
Expand Down Expand Up @@ -704,7 +704,7 @@
}

//Multicompany
if ($conf->multicompany->enabled)
if (! empty($conf->multicompany->enabled))
{
if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity)
{
Expand Down Expand Up @@ -1039,7 +1039,7 @@
print '</td></tr>'."\n";

// Multicompany
if ($conf->multicompany->enabled && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity)
if (! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity)
{
print '<tr><td valign="top">'.$langs->trans("Entity").'</td><td width="75%" class="valeur">';
if ($fuser->admin && ! $fuser->entity)
Expand Down Expand Up @@ -1295,7 +1295,7 @@
print $form->select_dolgroups('','group',1,$exclude,0,'','',$fuser->entity);
print ' &nbsp; ';
// Multicompany
if ($conf->multicompany->enabled)
if (! empty($conf->multicompany->enabled))
{
if ($conf->entity == 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)
{
Expand Down Expand Up @@ -1325,7 +1325,7 @@
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td class="liste_titre" width="25%">'.$langs->trans("Groups").'</td>';
if($conf->multicompany->enabled && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity)
if(! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity)
{
print '<td class="liste_titre" width="25%">'.$langs->trans("Entity").'</td>';
}
Expand All @@ -1350,7 +1350,7 @@
print img_object($langs->trans("ShowGroup"),"group").' '.$group->nom;
}
print '</td>';
if($conf->multicompany->enabled && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity)
if(! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity)
{
$mc = new ActionsMulticompany($db);
$mc->getInfo($group->usergroup_entity);
Expand Down Expand Up @@ -1507,7 +1507,7 @@
{
print $form->selectyesno('admin',$fuser->admin,1);

if ($conf->multicompany->enabled && ! $user->entity && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
if (! empty($conf->multicompany->enabled) && ! $user->entity && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
{
if ($conf->use_javascript_ajax)
{
Expand Down Expand Up @@ -1563,7 +1563,7 @@
}

//Multicompany
if ($conf->multicompany->enabled)
if (! empty($conf->multicompany->enabled))
{
if(empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity)
{
Expand Down Expand Up @@ -1776,7 +1776,7 @@

$db->close();

llxFooter('$Date: 2011/08/21 00:20:44 $ - $Revision: 1.280 $');
llxFooter('$Date: 2011/08/21 10:01:37 $ - $Revision: 1.281 $');



Expand Down

0 comments on commit ca5b083

Please sign in to comment.