[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?PHP 2 /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 * 18 * $Id: liste.php,v 1.7 2005/09/02 15:13:54 rodolphe Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/ligne/liste.php,v $ 20 * 21 */ 22 require ("./pre.inc.php"); 23 24 if (!$user->rights->telephonie->lire) accessforbidden(); 25 26 $page = $_GET["page"]; 27 $sortorder = $_GET["sortorder"]; 28 $sortfield = $_GET["sortfield"]; 29 30 llxHeader('','Telephonie - Ligne - Liste'); 31 /* 32 * Sécurité accés client 33 */ 34 if ($user->societe_id > 0) 35 { 36 $action = ''; 37 $socidp = $user->societe_id; 38 } 39 40 if ($sortorder == "") { 41 $sortorder="ASC"; 42 } 43 if ($sortfield == "") { 44 $sortfield="l.statut"; 45 } 46 47 /* 48 * Recherche 49 * 50 * 51 */ 52 53 if ($page == -1) { $page = 0 ; } 54 55 $offset = $conf->liste_limit * $page ; 56 $pageprev = $page - 1; 57 $pagenext = $page + 1; 58 59 /* 60 * Mode Liste 61 * 62 * 63 * 64 */ 65 66 $sql = "SELECT s.idp as socidp, sf.idp as sfidp, sf.nom as nom_facture,s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, l.remise"; 67 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; 68 $sql .= ",".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; 69 $sql .= ",".MAIN_DB_PREFIX."societe as sf"; 70 $sql .= ",".MAIN_DB_PREFIX."telephonie_fournisseur as f"; 71 $sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; 72 $sql .= " WHERE l.fk_soc = s.idp AND l.fk_fournisseur = f.rowid"; 73 $sql .= " AND l.fk_soc_facture = sf.idp"; 74 $sql .= " AND l.fk_client_comm = sp.fk_soc"; 75 $sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; 76 77 if ($_GET["search_ligne"]) 78 { 79 $sel =urldecode($_GET["search_ligne"]); 80 $sel = ereg_replace("\.","",$sel); 81 $sel = ereg_replace(" ","",$sel); 82 $sql .= " AND l.ligne LIKE '%".$sel."%'"; 83 } 84 85 if ($_GET["search_client"]) 86 { 87 $sel =urldecode($_GET["search_client"]); 88 $sql .= " AND s.nom LIKE '%".$sel."%'"; 89 } 90 91 if ($_GET["commercial_suiv"]) 92 { 93 $sql .= " AND l.fk_commercial_suiv ='".$_GET["commercial_suiv"]."'"; 94 } 95 96 if ($_GET["commercial_sign"]) 97 { 98 $sql .= " AND l.fk_commercial_sign ='".$_GET["commercial_sign"]."'"; 99 } 100 101 102 if ($_GET["search_client_facture"]) 103 { 104 $sel =urldecode($_GET["search_client_facture"]); 105 $sql .= " AND sf.nom LIKE '%".$sel."%'"; 106 } 107 108 if (strlen($_GET["statut"])) 109 { 110 $sql .= " AND l.statut = ".$_GET["statut"]; 111 } 112 113 if ($_GET["fournisseur"]) 114 { 115 $sql .= " AND l.fk_fournisseur ='".$_GET["fournisseur"]."'"; 116 } 117 118 119 $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); 120 121 $result = $db->query($sql); 122 if ($result) 123 { 124 $num = $db->num_rows(); 125 $i = 0; 126 127 $urladd= "&statut=".$_GET["statut"]; 128 129 $titre = "Lignes"; 130 131 if ($_GET["commercial_suiv"]) 132 { 133 $cuser = new User($db, $_GET["commercial_suiv"]); 134 $cuser->fetch(); 135 $titre = "Lignes suivies par ".$cuser->fullname; 136 $urladd .= "&commercial_suiv=". $_GET["commercial_suiv"]; 137 } 138 139 if ($_GET["commercial_sign"]) 140 { 141 $cuser = new User($db, $_GET["commercial_sign"]); 142 $cuser->fetch(); 143 $titre = "Lignes signées par ".$cuser->fullname; 144 $urladd .= "&commercial_sign=". $_GET["commercial_sign"]; 145 } 146 147 print_barre_liste($titre, $page, "liste.php", $urladd, $sortfield, $sortorder, '', $num); 148 print"\n<!-- debut table -->\n"; 149 print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; 150 print '<tr class="liste_titre">'; 151 152 print_liste_field_titre("Ligne","liste.php","l.ligne"); 153 print_liste_field_titre("Client (Agence/Filiale)","liste.php","s.nom"); 154 155 //print '<td>Client facturé</td>'; 156 print '<td align="center">Statut</td>'; 157 158 if ($user->rights->telephonie->fournisseur->lire) 159 print '<td>Fournisseur</td>'; 160 161 print "</tr>\n"; 162 163 print '<tr class="liste_titre">'; 164 print '<form action="liste.php" method="GET">'; 165 print '<td><input type="text" name="search_ligne" value="'. $_GET["search_ligne"].'" size="10"></td>'; 166 print '<td><input type="text" name="search_client" value="'. $_GET["search_client"].'" size="10"></td>'; 167 //print '<td><input type="text" name="search_client_facture" value="'. $_GET["search_client_facture"].'" size="10"></td>'; 168 169 print '<td><input type="submit" class="button" value="'.$langs->trans("Search").'"></td>'; 170 171 172 if ($user->rights->telephonie->fournisseur->lire) 173 print '<td> </td>'; 174 175 print '</form>'; 176 print '</tr>'; 177 178 179 $var=True; 180 181 $ligne = new LigneTel($db); 182 183 while ($i < min($num,$conf->liste_limit)) 184 { 185 $obj = $db->fetch_object(); 186 $var=!$var; 187 188 print "<tr $bc[$var]><td>"; 189 190 print '<img src="./graph'.$obj->statut.'.png"> '; 191 192 print '<a href="'.DOL_URL_ROOT.'/telephonie/ligne/fiche.php?id='.$obj->rowid.'">'; 193 print img_file(); 194 print '</a> '; 195 196 print '<a href="fiche.php?id='.$obj->rowid.'">'.dolibarr_print_phone($obj->ligne)."</a></td>\n"; 197 198 print '<td><a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->socidp.'">'.stripslashes($obj->nom).'</a></td>'; 199 //print '<td><a href="'.DOL_URL_ROOT.'/soc.php?socid='.$obj->sfidp.'">'.stripslashes($obj->nom_facture).'</a></td>'; 200 201 print '<td align="center">'.$ligne->statuts[$obj->statut]."</td>\n"; 202 203 if ($user->rights->telephonie->fournisseur->lire) 204 print "<td>".$obj->fournisseur."</td>\n"; 205 print "</tr>\n"; 206 $i++; 207 } 208 print "</table>"; 209 $db->free(); 210 } 211 else 212 { 213 print $db->error() . ' ' . $sql; 214 } 215 216 $db->close(); 217 218 llxFooter("<em>Dernière modification $Date: 2005/09/02 15:13:54 $ révision $Revision: 1.7 $</em>"); 219 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |