[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * 19 * $Id: prospects.php,v 1.37 2005/10/31 23:50:56 eldy Exp $ 20 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/comm/prospect/prospects.php,v $ 21 */ 22 23 /** 24 \file htdocs/comm/prospect/prospects.php 25 \ingroup prospect 26 \brief Page de la liste des prospects 27 \version $Revision: 1.37 $ 28 */ 29 30 require ("./pre.inc.php"); 31 32 $langs->load("propal"); 33 34 $user->getrights('propale'); 35 $user->getrights('fichinter'); 36 $user->getrights('commande'); 37 $user->getrights('projet'); 38 39 // Sécurité accés client 40 $socidp=0; 41 if ($user->societe_id > 0) 42 { 43 $action = ''; 44 $socidp = $user->societe_id; 45 } 46 47 $socname=isset($_GET["socname"])?$_GET["socname"]:$_POST["socname"]; 48 $stcomm=isset($_GET["stcomm"])?$_GET["stcomm"]:$_POST["stcomm"]; 49 $sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"]; 50 $sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; 51 $page=isset($_GET["page"])?$_GET["page"]:$_POST["page"]; 52 if (! $sortorder) $sortorder="ASC"; 53 if (! $sortfield) $sortfield="s.nom"; 54 55 $page = $user->page_param["page"]; 56 if ($page == -1) { $page = 0 ; } 57 58 $offset = $conf->liste_limit * $page ; 59 $pageprev = $page - 1; 60 $pagenext = $page + 1; 61 62 63 64 /* 65 * Actions 66 */ 67 if ($_GET["action"] == 'cstc') 68 { 69 $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm = ".$_GET["pstcomm"]; 70 $sql .= " WHERE idp = ".$_GET["pid"]; 71 $db->query($sql); 72 } 73 74 75 /* 76 * Affichage liste 77 */ 78 79 $sql = "SELECT s.idp, s.nom, s.ville, ".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, st.libelle as stcomm, s.prefix_comm, s.fk_stcomm "; 80 $sql .= ", d.nom as departement"; 81 $sql .= " FROM ".MAIN_DB_PREFIX."c_stcomm as st, ".MAIN_DB_PREFIX."societe as s"; 82 $sql .= " LEFT join ".MAIN_DB_PREFIX."c_departements as d on d.rowid = s.fk_departement"; 83 $sql .= " WHERE s.fk_stcomm = st.id AND s.client=2"; 84 85 if (isset($_GET["stcomm"])) 86 { 87 $sql .= " AND s.fk_stcomm=".$_GET["stcomm"]; 88 } 89 90 if ($user->societe_id) 91 { 92 $sql .= " AND s.idp = " .$user->societe_id; 93 } 94 95 if ($_GET["search_nom"]) 96 { 97 $sql .= " AND lower(s.nom) like '%".strtolower($_GET["search_nom"])."%'"; 98 } 99 100 if ($_GET["search_ville"]) 101 { 102 $sql .= " AND lower(s.ville) like '%".strtolower($_GET["search_ville"])."%'"; 103 } 104 105 if ($socname) 106 { 107 $sql .= " AND lower(s.nom) like '%".strtolower($socname)."%'"; 108 $sortfield = "lower(s.nom)"; 109 $sortorder = "ASC"; 110 } 111 112 $sql .= " ORDER BY $sortfield $sortorder, s.nom ASC "; 113 $sql .= $db->plimit($conf->liste_limit+1, $offset); 114 115 $resql = $db->query($sql); 116 if ($resql) 117 { 118 $num = $db->num_rows($resql); 119 120 if ($num == 1 && $socname) 121 { 122 $obj = $db->fetch_object($resql); 123 Header("Location: fiche.php?socid=".$obj->idp); 124 exit; 125 } 126 else 127 { 128 llxHeader(); 129 } 130 131 $urladd="page=$page"; 132 if (isset($stcomm)) $urladd.="&stcomm=".$stcomm; 133 134 print_barre_liste($langs->trans("ListOfProspects"), $page, "prospects.php",'&stcomm='.$_GET["stcomm"],"","",'',$num); 135 136 $i = 0; 137 138 print '<table class="liste" width="100%">'; 139 print '<tr class="liste_titre">'; 140 print_liste_field_titre($langs->trans("Company"),"prospects.php","s.nom","","","valign=\"center\"",$sortfield); 141 print_liste_field_titre($langs->trans("Town"),"prospects.php","s.ville","","","",$sortfield); 142 print_liste_field_titre($langs->trans("State"),"prospects.php","s.fk_departement","","","align=\"center\"",$sortfield); 143 print_liste_field_titre($langs->trans("DateCreation"),"prospects.php","s.datec","","","align=\"center\"",$sortfield); 144 print_liste_field_titre($langs->trans("Status"),"prospects.php","s.fk_stcomm","","","align=\"center\"",$sortfield); 145 print '<td class="liste_titre" colspan="4"> </td>'; 146 print "</tr>\n"; 147 148 print '<form method="get" action="prospects.php">'; 149 print '<tr class="liste_titre">'; 150 print '<td class="liste_titre" valign="right">'; 151 print '<input type="text" class="flat" name="search_nom" value="'.$_GET["search_nom"].'">'; 152 print '</td><td class="liste_titre">'; 153 print '<input type="text" class="flat" name="search_ville" size="12" value="'.$_GET["search_ville"].'">'; 154 print '</td>'; 155 print '<td class="liste_titre" colspan="7" align="right">'; 156 print '<input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">'; 157 print '</td>'; 158 159 print "</tr>\n"; 160 161 $var=true; 162 163 while ($i < min($num,$conf->liste_limit)) 164 { 165 $obj = $db->fetch_object($resql); 166 167 $var=!$var; 168 169 print "<tr $bc[$var]>"; 170 print '<td><a href="'.DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$obj->idp.'">'; 171 print img_object($langs->trans("ShowProspect"),"company"); 172 print ' '.dolibarr_trunc($obj->nom,44).'</a></td>'; 173 print "<td>".$obj->ville." </td>"; 174 print "<td align=\"center\">$obj->departement</td>"; 175 // Date création 176 print "<td align=\"center\">".dolibarr_print_date($obj->datec)."</td>"; 177 // Statut 178 print "<td align=\"center\">"; 179 $transcode=$langs->trans("StatusProspect".$obj->fk_stcomm); 180 $libelle=($transcode!="StatusProspect".$obj->fk_stcomm?$transcode:$obj->stcomm); 181 print $libelle; 182 print "</td>"; 183 184 $sts = array(-1,0,1,2,3); 185 print '<td align="right" nowrap>'; 186 foreach ($sts as $key => $value) 187 { 188 if ($value <> $obj->fk_stcomm) 189 { 190 print '<a href="prospects.php?pid='.$obj->idp.'&pstcomm='.$value.'&action=cstc&'.$urladd.'">'; 191 print img_action(0,$value); 192 print '</a> '; 193 } 194 } 195 print '</td>'; 196 197 print "</tr>\n"; 198 $i++; 199 } 200 print "</table>"; 201 $db->free($resql); 202 } 203 else 204 { 205 dolibarr_print_error($db); 206 } 207 208 $db->close(); 209 210 llxFooter('$Date: 2005/10/31 23:50:56 $ - $Revision: 1.37 $'); 211 ?>
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 |
![]() |