2004-10-20 23:06:45 +02:00
< ? php
2003-06-30 18:05:17 +02:00
/* Copyright ( C ) 2003 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2004-10-31 14:32:01 +01:00
* Copyright ( C ) 2004 Laurent Destailleur < eldy @ users . sourceforge . net >
2003-06-30 18:05:17 +02:00
*
* 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
* the Free Software Foundation ; either version 2 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* 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 $
* $Source $
*/
require ( " ./pre.inc.php " );
/*
* S<EFBFBD> curit<EFBFBD> acc<EFBFBD> s client
*/
if ( $user -> societe_id > 0 )
{
$action = '' ;
$socid = $user -> societe_id ;
}
llxHeader ();
if ( $sortorder == " " )
{
$sortorder = " ASC " ;
}
if ( $sortfield == " " )
{
$sortfield = " s.nom " ;
}
if ( $page == - 1 ) { $page = 0 ; }
$offset = $conf -> liste_limit * $page ;
$pageprev = $page - 1 ;
$pagenext = $page + 1 ;
/*
* Mode Liste
*
*
*
*/
2004-07-30 12:13:11 +02:00
print_barre_liste ( " Liste des societes " , $page , " index.php " );
2003-06-30 18:05:17 +02:00
2004-02-01 02:33:59 +01:00
$sql = " SELECT s.nom, s.idp, c.name, c.firstname, a.titre,n.rowid FROM " . MAIN_DB_PREFIX . " socpeople as c, " . MAIN_DB_PREFIX . " action_def as a, " . MAIN_DB_PREFIX . " notify_def as n, " . MAIN_DB_PREFIX . " societe as s " ;
2003-06-30 18:05:17 +02:00
$sql .= " WHERE n.fk_contact = c.idp AND a.rowid = n.fk_action " ;
$sql .= " AND n.fk_soc = s.idp " ;
if ( $socid > 0 ) {
$sql .= " AND s.idp = " . $user -> societe_id ;
}
$sql .= " ORDER BY $sortfield $sortorder " . $db -> plimit ( $conf -> liste_limit , $offset );
$result = $db -> query ( $sql );
if ( $result )
{
$num = $db -> num_rows ();
$i = 0 ;
2004-10-31 14:32:01 +01:00
print " <table class= \n oborder \" width= \" 100% \" > " ;
print '<tr class="liste_titre">' ;
print_liste_field_titre ( $langs -> trans ( " Company " ), " index.php " , " s.nom " , " " , " " , 'valign=\"center\"' );
print_liste_field_titre ( $langs -> trans ( " Contact " ), " index.php " , " c.name " );
print_liste_field_titre ( $langs -> trans ( " Action " ), " index.php " , " a.titre " );
print " </tr> \n " ;
2003-06-30 18:05:17 +02:00
$var = True ;
while ( $i < $num )
{
$obj = $db -> fetch_object ( $i );
$var =! $var ;
2004-10-31 14:32:01 +01:00
print " <tr $bc[$var] > " ;
print " <td><a href= \" fiche.php?socid= $obj->idp\ " > $obj -> nom </ A ></ td > \n " ;
2003-06-30 18:05:17 +02:00
print " <td> " . $obj -> firstname . " " . $obj -> name . " </td> \n " ;
print " <td> " . $obj -> titre . " </td> \n " ;
print " </tr> \n " ;
$i ++ ;
}
2004-10-31 14:32:01 +01:00
print " </table> " ;
2003-06-30 18:05:17 +02:00
$db -> free ();
}
else
{
print $db -> error () . ' ' . $sql ;
}
$db -> close ();
llxFooter ( " <em>Dernière modification $Date $ révision $Revision $ </em> " );
?>