[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2001-2005 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: fiche.php,v 1.46 2005/09/24 22:28:19 eldy Exp $ 20 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/comm/prospect/fiche.php,v $ 21 */ 22 23 /** 24 \file htdocs/comm/prospect/fiche.php 25 \ingroup prospect 26 \brief Page de la fiche prospect 27 \version $Revision: 1.46 $ 28 */ 29 30 require_once ("./pre.inc.php"); 31 require_once (DOL_DOCUMENT_ROOT."/contact.class.php"); 32 require_once (DOL_DOCUMENT_ROOT."/actioncomm.class.php"); 33 34 $langs->load('companies'); 35 $langs->load('projects'); 36 $langs->load('propal'); 37 38 $user->getrights('propale'); 39 $user->getrights('fichinter'); 40 $user->getrights('commande'); 41 $user->getrights('projet'); 42 43 44 $socid = isset($_GET["id"])?$_GET["id"]:$_GET["socid"]; // Fonctionne si on passe id ou socid 45 46 if ($_GET["action"] == 'cstc') 47 { 48 $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm = ".$_GET["stcomm"]; 49 $sql .= " WHERE idp = ".$_GET["id"]; 50 $db->query($sql); 51 } 52 53 /* 54 * Sécurité si un client essaye d'accéder à une autre fiche que la sienne 55 */ 56 if ($user->societe_id > 0) 57 { 58 $socid = $user->societe_id; 59 } 60 61 62 llxHeader(); 63 64 /********************************************************************************* 65 * 66 * Mode fiche 67 * 68 * 69 *********************************************************************************/ 70 if ($socid > 0) 71 { 72 $societe = new Societe($db, $socid); 73 $result = $societe->fetch($socid); 74 if ($result < 0) 75 { 76 dolibarr_print_error($db); 77 exit; 78 } 79 80 81 /* TODO Finir verification PagesJaunes 82 * print '<form action="http://www.pagesjaunes.fr/pj.cgi" method="post" target="_blank">'; 83 * print '<input type="hidden" name="FRM_NOM" value="'.$societe->nom.'">'; 84 * print '<input type="hidden" name="FRM_LOCALITE" value="'.$societe->ville.'">'; 85 * print '<input type="submit">'; 86 * print '</form>'; 87 */ 88 89 $h=0; 90 $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$societe->id; 91 $head[$h][1] = $langs->trans("Company"); 92 $h++; 93 94 $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$societe->id; 95 $head[$h][1] = $langs->trans("Prospect"); 96 $hselected=$h; 97 $h++; 98 99 if (file_exists(DOL_DOCUMENT_ROOT.'/sl/')) 100 { 101 $head[$h][0] = DOL_URL_ROOT.'/sl/fiche.php?id='.$societe->id; 102 $head[$h][1] = 'Fiche catalogue'; 103 $h++; 104 } 105 106 if ($societe->fournisseur) 107 { 108 $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$societe->id; 109 $head[$h][1] = $langs->trans("Supplier"); 110 $h++; 111 } 112 113 if ($conf->compta->enabled) 114 { 115 $langs->load("compta"); 116 $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$societe->id; 117 $head[$h][1] = $langs->trans("Accountancy"); 118 $h++; 119 } 120 121 $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$societe->id; 122 $head[$h][1] = $langs->trans("Note"); 123 $h++; 124 if ($user->societe_id == 0) 125 { 126 $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$societe->id; 127 $head[$h][1] = $langs->trans("Documents"); 128 $h++; 129 } 130 131 $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$societe->id; 132 $head[$h][1] = $langs->trans("Notifications"); 133 134 135 dolibarr_fiche_head($head, $hselected, $societe->nom); 136 137 /* 138 * 139 */ 140 print "<table width=\"100%\">\n"; 141 print '<tr><td valign="top" width="50%">'; 142 143 print '<table class="border" width="100%">'; 144 print '<tr><td width="25%">'.$langs->trans("Name").'</td><td width="80%" colspan="3">'.$societe->nom.'</td></tr>'; 145 print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">'.nl2br($societe->adresse)."</td></tr>"; 146 147 print '<tr><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td colspan="3">'.$societe->cp." ".$societe->ville.'</td></tr>'; 148 print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">'.$societe->pays.'</td></tr>'; 149 150 print '<tr><td>'.$langs->trans("Phone").'</td><td>'.$societe->tel.' </td><td>Fax</td><td>'.$societe->fax.' </td></tr>'; 151 print '<tr><td>'.$langs->trans("Web")."</td><td colspan=\"3\"><a href=\"http://$societe->url\">$societe->url</a> </td></tr>"; 152 153 if ($societe->rubrique) 154 { 155 print "<tr><td>Rubrique</td><td colspan=\"3\">$societe->rubrique</td></tr>"; 156 } 157 158 print '<tr><td>'.$langs->trans('JuridicalStatus').'</td><td colspan="3">'.$societe->forme_juridique.'</td></tr>'; 159 print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">'.$societe->statut_commercial.'</td>'; 160 print '<td> '; 161 print '<a href="fiche.php?id='.$societe->id.'&stcomm=-1&action=cstc">'; 162 print img_action(0,-1); 163 print '</a> <a href="fiche.php?id='.$societe->id.'&stcomm=0&action=cstc">'; 164 print img_action(0,0); 165 print '</a> <a href="fiche.php?id='.$societe->id.'&stcomm=1&action=cstc">'; 166 print img_action(0,1); 167 print '</a> <a href="fiche.php?id='.$societe->id.'&stcomm=2&action=cstc">'; 168 print img_action(0,2); 169 print '</a> <a href="fiche.php?id='.$societe->id.'&stcomm=3&action=cstc">'; 170 print img_action(0,3); 171 print '</a>'; 172 print '</td></tr>'; 173 print '</table>'; 174 175 print '</div>'; 176 177 /* 178 * 179 */ 180 print "</td>\n"; 181 print '<td valign="top" width="50%">'; 182 183 /* 184 * 185 * Propales 186 * 187 */ 188 $var = true; 189 print '<table class="border" width="100%">'; 190 $sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price, p.ref, p.remise, ".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid"; 191 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c WHERE p.fk_soc = s.idp AND p.fk_statut = c.id"; 192 $sql .= " AND s.idp = $societe->id ORDER BY p.datep DESC"; 193 194 if ( $db->query($sql) ) 195 { 196 $num = $db->num_rows(); 197 if ($num >0 ) 198 { 199 print "<tr $bc[$var]><td colspan=\"4\">"; 200 print '<table width="100%" class="noborder"><tr><td>'.$langs->trans("LastProposals").'</td>'; 201 print '<td align="right"><a href="../propal.php?socidp='.$societe->id.'">'.$langs->trans("AllPropals").' ('.$num.')</a></td>'; 202 print '</tr></table>'; 203 print '</td></tr>'; 204 $var=!$var; 205 } 206 $i = 0; $now = time(); $lim = 3600 * 24 * 15 ; 207 while ($i < $num && $i < 2) 208 { 209 $objp = $db->fetch_object(); 210 print "<tr $bc[$var]>"; 211 print "<td><a href=\"../propal.php?propalid=$objp->propalid\">"; 212 print img_object($langs->trans("ShowPropal"),"propal"); 213 print " $objp->ref</a>\n"; 214 if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 ) 215 { 216 print " <b>> 15 jours</b>"; 217 } 218 print "</td><td align=\"right\">".strftime("%d %B %Y",$objp->dp)."</td>\n"; 219 print "<td align=\"right\">".price($objp->price)."</td>\n"; 220 print "<td align=\"center\">$objp->statut</td></tr>\n"; 221 $var=!$var; 222 $i++; 223 } 224 $db->free(); 225 } 226 227 print "</table>"; 228 229 print "</td></tr>"; 230 print "</table>\n</div>\n"; 231 232 233 /* 234 * Barre d'action 235 * 236 */ 237 238 print '<div class="tabsAction">'; 239 240 print '<a class="tabAction" href="../../contact/fiche.php?socid='.$societe->id.'&action=create">'.$langs->trans("AddContact").'</a>'; 241 242 print '<a class="tabAction" href="../action/fiche.php?action=create&socid='.$socid.'&afaire=1">'.$langs->trans("AddAction").'</a>'; 243 244 245 if ($conf->propal->enabled && defined("MAIN_MODULE_PROPALE") && MAIN_MODULE_PROPALE && $user->rights->propale->creer) 246 { 247 print '<a class="tabAction" href="'.DOL_URL_ROOT.'/comm/addpropal.php?socidp='.$societe->id.'&action=create">'.$langs->trans("AddProp").'</a>'; 248 } 249 250 if ($conf->projet->enabled && $user->rights->projet->creer) 251 { 252 print '<a class="tabAction" href="'.DOL_URL_ROOT.'/projet/fiche.php?socidp='.$socid.'&action=create">'.$langs->trans("AddProject").'</a>'; 253 } 254 print '</div>'; 255 256 print '<br>'; 257 258 /* 259 * 260 * Liste des contacts 261 * 262 */ 263 if (defined("MAIN_MODULE_CLICKTODIAL") && MAIN_MODULE_CLICKTODIAL==1) 264 { 265 $user->fetch_clicktodial(); // lecture des infos de clicktodial 266 } 267 268 print '<table width="100%" class="noborder">'; 269 270 print '<tr class="liste_titre"><td>'.$langs->trans("Firstname").' '.$langs->trans("Name").'</td>'; 271 print '<td>Poste</td><td colspan="2">'.$langs->trans("Tel").'</td>'; 272 print '<td>'.$langs->trans("Fax").'</td><td>'.$langs->trans("EMail").'</td>'; 273 print '<td> </td>'; 274 275 $sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note"; 276 $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as p"; 277 $sql.= " WHERE p.fk_soc = $societe->id ORDER by p.datec"; 278 $result = $db->query($sql); 279 $i = 0 ; $num = $db->num_rows(); $tag = True; 280 while ($i < $num) 281 { 282 $obj = $db->fetch_object($result); 283 $var = !$var; 284 print "<tr $bc[$var]>"; 285 286 print '<td>'; 287 288 print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$obj->idp.'">'; 289 print img_object($langs->trans("ShowContact"),"contact").' '.$obj->firstname.' '. $obj->name.'</a> '; 290 291 if ($obj->note) 292 { 293 print "<br>".nl2br($obj->note); 294 } 295 print "</td>"; 296 print "<td>$obj->poste </td>"; 297 298 print '<td>'; 299 300 /* 301 * Lien click to dial 302 */ 303 304 if (strlen($obj->phone) && $user->clicktodial_enabled == 1) 305 { 306 print '<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&actionid=1&contactid='.$obj->idp.'&socid='.$societe->id.'&call='.$obj->phone.'">'; 307 print img_phone_out("Appel émis") ; 308 } 309 print '</td>'; 310 311 print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&actionid=1&contactid='.$obj->idp.'&socid='.$societe->id.'">'; 312 313 print ' '.dolibarr_print_phone($obj->phone).'</a> </td>'; 314 print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&actionid=2&contactid='.$obj->idp.'&socid='.$societe->id.'">'.$obj->fax.'</a> </td>'; 315 print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&actionid=4&contactid='.$obj->idp.'&socid='.$societe->id.'">'.$obj->email.'</a> </td>'; 316 print "<td align=\"center\">"; 317 print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?action=edit&id='.$obj->idp.'">'; 318 print img_edit(); 319 print '</a></td>'; 320 print "</tr>\n"; 321 $i++; 322 $tag = !$tag; 323 } 324 print "</table>"; 325 326 /* 327 * Listes des actions a faire 328 */ 329 $var=true; 330 print '<br>'; 331 print '<table width="100%" class="noborder">'; 332 print '<tr class="liste_titre"><td colspan="8">'.$langs->trans("ActionsToDo").'</td></tr>'; 333 $sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.code as acode, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid, a.note "; 334 $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u "; 335 $sql .= " WHERE a.fk_soc = $societe->id "; 336 $sql .= " AND u.rowid = a.fk_user_author"; 337 $sql .= " AND c.id=a.fk_action AND a.percent < 100"; 338 $sql .= " ORDER BY a.datea DESC, a.id DESC"; 339 340 $resql=$db->query($sql); 341 if ($resql) 342 { 343 $i = 0 ; $num = $db->num_rows($resql); 344 while ($i < $num) 345 { 346 $var = !$var; 347 348 $obj = $db->fetch_object($resql); 349 350 print "<tr $bc[$var]>"; 351 352 if ($oldyear == strftime("%Y",$obj->da) ) 353 { 354 //print '<td align="center">|</td>'; 355 print '<td align="center">' .strftime("%Y",$obj->da)."</td>\n"; 356 } 357 else 358 { 359 print '<td align="center">' .strftime("%Y",$obj->da)."</td>\n"; 360 $oldyear = strftime("%Y",$obj->da); 361 } 362 363 if ($oldmonth == strftime("%Y%b",$obj->da) ) 364 { 365 print '<td align="center">' .strftime("%b",$obj->da)."</td>\n"; 366 } 367 else 368 { 369 print "<td align=\"center\">" .strftime("%b",$obj->da)."</td>\n"; 370 $oldmonth = strftime("%Y%b",$obj->da); 371 } 372 373 print "<td>" .strftime("%d",$obj->da)."</td>\n"; 374 print "<td>" .strftime("%H:%M",$obj->da)."</td>\n"; 375 376 print '<td width="10%"> </td>'; 377 378 379 print '<td width="40%">'; 380 if ($obj->propalrowid) 381 { 382 print '<a href="../propal.php?propalid='.$obj->propalrowid.'">'; 383 $transcode=$langs->trans("Action".$obj->acode); 384 $libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); 385 print $libelle; 386 print '</a>'; 387 } 388 else 389 { 390 print '<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$obj->id.'">'.img_object($langs->trans("ShowAction"),"task").' '; 391 $transcode=$langs->trans("Action".$obj->acode); 392 $libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); 393 print $libelle; 394 print '</a>'; 395 } 396 print '</td>'; 397 398 /* 399 * Contact pour cette action 400 * 401 */ 402 print '<td width="40%">'; 403 if ($obj->fk_contact) 404 { 405 $contact = new Contact($db); 406 $contact->fetch($obj->fk_contact); 407 print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$contact->id.'">'.$contact->fullname.'</a></td>'; 408 } 409 else 410 { 411 print ' </td>'; 412 } 413 /* 414 * 415 */ 416 print '<td>'; 417 print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->fk_user_author.'">'; 418 print $obj->code.'</a></td>'; 419 print "</tr>\n"; 420 421 if ($obj->note) 422 { 423 print "<tr $bc[$var]>"; 424 print '<td colspan="5"> </td><td colspan="3">'.stripslashes($obj->note).'</td></tr>'; 425 } 426 427 $i++; 428 } 429 print "</table>"; 430 431 $db->free($resql); 432 } 433 else 434 { 435 dolibarr_print_error($db); 436 } 437 438 /* 439 * Listes des actions effectuees 440 */ 441 $sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid, a.note "; 442 $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u "; 443 $sql .= " WHERE a.fk_soc = $societe->id "; 444 $sql .= " AND u.rowid = a.fk_user_author"; 445 $sql .= " AND c.id=a.fk_action AND a.percent = 100"; 446 $sql .= " ORDER BY a.datea DESC, a.id DESC"; 447 $resql=$db->query($sql); 448 if ($resql) 449 { 450 $i = 0 ; 451 $num = $db->num_rows($resql); 452 453 if ($num) 454 { 455 print '<br>'; 456 457 print '<table width="100%" class="noborder">'; 458 print '<tr class="liste_titre"><td><a href="action/index.php?socid='.$socid.'">'.$langs->trans("ActionsDone").'</a></td></tr>'; 459 print '<tr>'; 460 print '<td valign="top">'; 461 462 print '<table width="100%" class="noborder">'; 463 464 $oldyear=''; 465 $oldmonth=''; 466 while ($i < $num) 467 { 468 $var = !$var; 469 470 $obj = $db->fetch_object($resql); 471 print "<tr $bc[$var]>"; 472 473 if ($oldyear == strftime("%Y",$obj->da) ) 474 { 475 print '<td align="center">|</td>'; 476 } 477 else 478 { 479 print "<td align=\"center\">" .strftime("%Y",$obj->da)."</td>\n"; 480 $oldyear = strftime("%Y",$obj->da); 481 } 482 483 if ($oldmonth == strftime("%Y%b",$obj->da) ) 484 { 485 print '<td align="center">|</td>'; 486 } 487 else 488 { 489 print "<td align=\"center\">" .strftime("%b",$obj->da)."</td>\n"; 490 $oldmonth = strftime("%Y%b",$obj->da); 491 } 492 493 print "<td>" .strftime("%d",$obj->da)."</td>\n"; 494 print "<td>" .strftime("%H:%M",$obj->da)."</td>\n"; 495 496 print '<td width="10%"> </td>'; 497 498 print '<td width="40%">'; 499 if ($obj->propalrowid) 500 { 501 print '<a href="'.DOL_URL_ROOT.'/comm/propal.php?propalid='.$obj->propalrowid.'">'.img_file().' '.$obj->libelle.'</a>'; 502 } 503 else 504 { 505 print '<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$obj->id.'">'.img_object($langs->trans("ShowTask"),"task").' '.$obj->libelle.'</a>'; 506 } 507 print '</td>'; 508 /* 509 * Contact pour cette action 510 * 511 */ 512 if ($obj->fk_contact) 513 { 514 $contact = new Contact($db); 515 $contact->fetch($obj->fk_contact); 516 print '<td width="40%">'.$contact->fullname.'</td>'; 517 } 518 else 519 { 520 print '<td width="40%"> </td>'; 521 } 522 /* 523 */ 524 print '<td width="20%"><a href="../user/fiche.php?id='.$obj->fk_user_author.'">'.$obj->code.'</a></td>'; 525 print "</tr>\n"; 526 527 if ($i < 2 && strlen($obj->note)) 528 { 529 print "<tr $bc[$var]>"; 530 print '<td colspan="5"> </td><td colspan="3">'; 531 print stripslashes(nl2br($obj->note)); 532 print '</td></tr>'; 533 } 534 535 $i++; 536 } 537 print "</table>"; 538 print "</td></tr></table>"; 539 } 540 $db->free(); 541 } 542 else 543 { 544 dolibarr_print_error($db); 545 } 546 547 } 548 549 $db->close(); 550 551 llxFooter('$Date: 2005/09/24 22:28:19 $ - $Revision: 1.46 $'); 552 ?>
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 |
![]() |