Fix: les bookmarks taient encore visible lorsque le module tait dsactiv

This commit is contained in:
Regis Houssin 2007-04-05 07:11:17 +00:00
parent ac79749abd
commit 2396455da7
2 changed files with 30 additions and 24 deletions

View File

@ -231,20 +231,22 @@ if ($conf->commande->enabled)
* Bookmark
*
*/
$sql = "SELECT s.idp, s.nom,b.rowid as bid";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."bookmark as b";
$sql .= " WHERE b.fk_soc = s.idp AND b.fk_user = ".$user->id;
if ($socid)
{
$sql .= " AND s.idp = $socid";
}
$sql .= " ORDER BY lower(s.nom) ASC";
if ($conf->bookmark->enabled)
{
$sql = "SELECT s.idp, s.nom,b.rowid as bid";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."bookmark as b";
$sql .= " WHERE b.fk_soc = s.idp AND b.fk_user = ".$user->id;
if ($socid)
{
$sql .= " AND s.idp = $socid";
}
$sql .= " ORDER BY lower(s.nom) ASC";
if ( $db->query($sql) )
{
$num = $db->num_rows();
if ( $db->query($sql) )
{
$num = $db->num_rows();
if ($num)
if ($num)
{
$i = 0;
@ -256,19 +258,20 @@ if ( $db->query($sql) )
$var=true;
while ($i < $num)
{
$obj = $db->fetch_object();
$var = !$var;
print "<tr $bc[$var]>";
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.$obj->nom.'</a></td>';
print '<td align="right"><a href="index.php?action=del_bookmark&bid='.$obj->bid.'">';
print img_delete();
print '</a></td>';
print '</tr>';
$i++;
}
{
$obj = $db->fetch_object();
$var = !$var;
print "<tr $bc[$var]>";
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.$obj->nom.'</a></td>';
print '<td align="right"><a href="index.php?action=del_bookmark&bid='.$obj->bid.'">';
print img_delete();
print '</a></td>';
print '</tr>';
$i++;
}
print '</table>';
}
}
}
print '</td><td valign="top" width="70%" class="notopnoleftnoright">';

View File

@ -2,7 +2,8 @@
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Xavier Dutoit <doli@sydesy.com>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2005-2007 Regis Houssin <regis.houssin@cap-networks.com>
* Copyright (C) 2006 Jean Heimburger <jean@tiaris.info>
*
* 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
@ -151,6 +152,8 @@ class Conf
// Module bookmark4u
$this->bookmark4u->enabled=defined('MAIN_MODULE_BOOKMARK4U')?MAIN_MODULE_BOOKMARK4U:0;
// Module bookmark
$this->bookmark->enabled=defined('MAIN_MODULE_BOOKMARK')?MAIN_MODULE_BOOKMARK:0;
// Module deplacement