2004-10-19 22:19:58 +02:00
< ? php
2004-01-30 11:32:21 +01:00
/* Copyright ( C ) 2001 - 2004 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2004-01-28 00:15:17 +01:00
* Copyright ( C ) 2004 Laurent Destailleur < eldy @ users . sourceforge . net >
2002-05-10 14:28:10 +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 .
*
2003-03-23 16:37:36 +01:00
* $Id $
* $Source $
*
2002-05-10 14:28:10 +02:00
*/
2004-10-30 04:01:06 +02:00
/*!
\file htdocs / comm / fiche . php
\ingroup commercial
2004-11-12 01:50:14 +01:00
\brief Onglet client de la fiche societe
2004-10-30 04:01:06 +02:00
\version $Revision $
*/
2003-09-11 18:30:47 +02:00
require ( " ./pre.inc.php " );
require ( " ../contact.class.php " );
require ( " ../actioncomm.class.php " );
2002-05-10 14:28:10 +02:00
2004-11-12 01:50:14 +01:00
$langs -> load ( " companies " );
$langs -> load ( " orders " );
$langs -> load ( " contracts " );
2004-11-26 15:44:04 +01:00
$user -> getrights ();
2004-08-07 01:39:54 +02:00
2004-02-21 02:46:26 +01:00
llxHeader ();
2004-08-07 01:39:54 +02:00
$sortorder = $_GET [ " sortorder " ];
$sortfield = $_GET [ " sortfield " ];
2002-05-10 14:28:10 +02:00
if ( $sortorder == " " ) {
$sortorder = " ASC " ;
}
if ( $sortfield == " " ) {
$sortfield = " nom " ;
}
2004-08-15 17:38:02 +02:00
if ( $_GET [ " action " ] == 'attribute_prefix' ) {
$societe = new Societe ( $db , $_GET [ " socid " ]);
$societe -> attribute_prefix ( $db , $_GET [ " socid " ]);
2002-05-10 14:28:10 +02:00
}
if ( $action == 'recontact' ) {
$dr = mktime ( 0 , 0 , 0 , $remonth , $reday , $reyear );
2004-03-28 20:57:11 +02:00
$sql = " INSERT INTO " . MAIN_DB_PREFIX . " soc_recontact (fk_soc, datere, author) VALUES ( $socid , $dr ,' " . $user -> login . " ') " ;
2002-05-10 14:28:10 +02:00
$result = $db -> query ( $sql );
}
if ( $action == 'stcomm' ) {
if ( $stcommid <> 'null' && $stcommid <> $oldstcomm ) {
$sql = " INSERT INTO socstatutlog (datel, fk_soc, fk_statut, author) " ;
2004-03-28 20:57:11 +02:00
$sql .= " VALUES (' $dateaction ', $socid , $stcommid ,' " . $user -> login . " ') " ;
2002-05-10 14:28:10 +02:00
$result = @ $db -> query ( $sql );
if ( $result ) {
2004-01-30 11:32:21 +01:00
$sql = " UPDATE " . MAIN_DB_PREFIX . " societe SET fk_stcomm= $stcommid WHERE idp= $socid " ;
2002-05-10 14:28:10 +02:00
$result = $db -> query ( $sql );
} else {
$errmesg = " ERREUR DE DATE ! " ;
}
}
if ( $actioncommid ) {
2004-01-30 11:32:21 +01:00
$sql = " INSERT INTO " . MAIN_DB_PREFIX . " actioncomm (datea, fk_action, fk_soc, fk_user_author) VALUES (' $dateaction ', $actioncommid , $socid ,' " . $user -> id . " ') " ;
2002-05-10 14:28:10 +02:00
$result = @ $db -> query ( $sql );
if ( ! $result ) {
$errmesg = " ERREUR DE DATE ! " ;
}
}
}
/*
* Recherche
*
*
*/
if ( $mode == 'search' ) {
if ( $mode - search == 'soc' ) {
2004-01-30 11:32:21 +01:00
$sql = " SELECT s.idp FROM " . MAIN_DB_PREFIX . " societe as s " ;
2002-05-10 14:28:10 +02:00
$sql .= " WHERE lower(s.nom) like '% " . strtolower ( $socname ) . " %' " ;
}
if ( $db -> query ( $sql ) ) {
if ( $db -> num_rows () == 1 ) {
2004-10-23 18:55:07 +02:00
$obj = $db -> fetch_object ();
2002-05-10 14:28:10 +02:00
$socid = $obj -> idp ;
}
$db -> free ();
}
}
2003-11-19 16:12:24 +01:00
/*
*
*/
2004-07-29 15:29:27 +02:00
$_socid = $_GET [ " socid " ];
2003-03-23 16:00:42 +01:00
/*
* S<EFBFBD> curit<EFBFBD> si un client essaye d ' acc<EFBFBD> der <EFBFBD> une autre fiche que la sienne
*/
if ( $user -> societe_id > 0 )
{
2004-07-29 15:29:27 +02:00
$_socid = $user -> societe_id ;
2003-03-23 16:00:42 +01:00
}
2003-11-19 16:12:24 +01:00
/*********************************************************************************
2002-05-10 14:28:10 +02:00
*
* Mode fiche
*
*
2003-11-19 16:12:24 +01:00
*********************************************************************************/
2004-07-29 15:29:27 +02:00
if ( $_socid > 0 )
2003-11-19 16:12:24 +01:00
{
2004-07-13 09:43:43 +02:00
// On recupere les donnees societes par l'objet
$objsoc = new Societe ( $db );
2004-07-29 15:29:27 +02:00
$objsoc -> id = $_socid ;
$objsoc -> fetch ( $_socid , $to );
2004-07-13 09:43:43 +02:00
$dac = strftime ( " %Y-%m-%d %H:%M " , time ());
if ( $errmesg )
2004-05-29 17:58:36 +02:00
{
2004-07-13 09:43:43 +02:00
print " <b> $errmesg </b><br> " ;
2004-05-29 17:58:36 +02:00
}
2004-07-13 09:43:43 +02:00
/*
* Affichage onglets
*/
$h = 0 ;
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/soc.php?socid=' . $objsoc -> id ;
2004-11-09 14:28:00 +01:00
$head [ $h ][ 1 ] = $langs -> trans ( " Company " );
2004-07-13 09:43:43 +02:00
$h ++ ;
if ( $objsoc -> client == 1 )
2004-05-29 17:58:36 +02:00
{
2004-07-13 09:43:43 +02:00
$hselected = $h ;
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/comm/fiche.php?socid=' . $objsoc -> id ;
2004-11-12 01:50:14 +01:00
$head [ $h ][ 1 ] = $langs -> trans ( " Customer " );;
2004-07-13 09:43:43 +02:00
$h ++ ;
2004-05-29 17:58:36 +02:00
}
2004-07-13 09:43:43 +02:00
if ( $objsoc -> client == 2 )
2004-05-29 17:58:36 +02:00
{
2004-07-13 09:43:43 +02:00
$hselected = $h ;
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/comm/prospect/fiche.php?id=' . $obj -> socid ;
2004-11-12 01:50:14 +01:00
$head [ $h ][ 1 ] = $langs -> trans ( " Prospect " );
2004-07-13 09:43:43 +02:00
$h ++ ;
2004-05-29 17:58:36 +02:00
}
2004-07-13 09:43:43 +02:00
if ( $objsoc -> fournisseur )
{
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/fourn/fiche.php?socid=' . $objsoc -> id ;
2004-11-12 01:50:14 +01:00
$head [ $h ][ 1 ] = $langs -> trans ( " Supplier " );
2004-07-13 09:43:43 +02:00
$h ++ ;
2004-05-29 17:58:36 +02:00
}
2004-07-13 09:43:43 +02:00
if ( $conf -> compta -> enabled ) {
2004-11-12 01:50:14 +01:00
$langs -> load ( " compta " );
2004-07-13 09:43:43 +02:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/compta/fiche.php?socid=' . $objsoc -> id ;
2004-11-12 01:50:14 +01:00
$head [ $h ][ 1 ] = $langs -> trans ( " Accountancy " );
2004-07-13 09:43:43 +02:00
$h ++ ;
}
2004-05-29 17:58:36 +02:00
2004-07-13 09:43:43 +02:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/socnote.php?socid=' . $objsoc -> id ;
2004-11-12 01:50:14 +01:00
$head [ $h ][ 1 ] = $langs -> trans ( " Note " );
2004-05-29 17:58:36 +02:00
$h ++ ;
if ( $user -> societe_id == 0 )
{
2004-07-13 09:43:43 +02:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/docsoc.php?socid=' . $objsoc -> id ;
2004-11-12 01:50:14 +01:00
$head [ $h ][ 1 ] = $langs -> trans ( " Documents " );
2004-05-29 17:58:36 +02:00
$h ++ ;
}
2004-07-13 09:43:43 +02:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/societe/notify/fiche.php?socid=' . $objsoc -> id ;
2004-11-12 01:50:14 +01:00
$head [ $h ][ 1 ] = $langs -> trans ( " Notifications " );
$h ++ ;
2004-05-06 11:04:01 +02:00
if ( file_exists ( DOL_DOCUMENT_ROOT . '/sl/' ))
{
2004-05-20 13:22:08 +02:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/sl/fiche.php?id=' . $objsoc -> id ;
2004-05-06 11:04:01 +02:00
$head [ $h ][ 1 ] = 'Fiche catalogue' ;
$h ++ ;
}
2004-07-12 16:13:27 +02:00
if ( $user -> societe_id == 0 )
{
$head [ $h ][ 0 ] = DOL_URL_ROOT . " /comm/index.php?socidp= $objsoc->id &action=add_bookmark " ;
2004-07-28 15:58:37 +02:00
$head [ $h ][ 1 ] = '<img border="0" src="' . DOL_URL_ROOT . '/theme/' . $conf -> theme . '/img/bookmark.png" alt="Bookmark" title="Bookmark">' ;
2004-07-12 16:13:27 +02:00
$head [ $h ][ 2 ] = 'image' ;
2004-11-12 01:50:14 +01:00
$h ++ ;
2004-07-12 16:13:27 +02:00
}
2004-07-13 09:43:43 +02:00
dolibarr_fiche_head ( $head , $hselected , $objsoc -> nom );
2004-05-06 11:04:01 +02:00
2002-05-10 14:28:10 +02:00
/*
*
*
*/
2003-10-12 16:29:07 +02:00
print '<table width="100%" border="0">' ;
print '<tr><td valign="top">' ;
2004-08-07 01:39:54 +02:00
print '<table class="border" cellpadding="3" cellspacing="0" width="100%">' ;
2002-05-10 14:28:10 +02:00
2004-08-18 11:36:31 +02:00
print '<tr><td width="20%">' . $langs -> trans ( " Name " ) . '</td><td width="80%" colspan="3">' ;
2004-05-20 13:22:08 +02:00
print $objsoc -> nom ;
print '</td></tr>' ;
2004-08-07 01:39:54 +02:00
print " <tr><td valign= \" top \" > " . $langs -> trans ( " Address " ) . " </td><td colspan= \" 3 \" > " . nl2br ( $objsoc -> adresse ) . " <br> " . $objsoc -> cp . " " . $objsoc -> ville . " " . $objsoc -> pays . " </td></tr> " ;
print '<tr><td>' . $langs -> trans ( " Phone " ) . '</td><td>' . dolibarr_print_phone ( $objsoc -> tel ) . ' </td><td>Fax</td><td>' . dolibarr_print_phone ( $objsoc -> fax ) . ' </td></tr>' ;
print '<tr><td>' . $langs -> trans ( " Web " ) . " </td><td colspan= \" 3 \" ><a href= \" http:// $objsoc->url\ " > $objsoc -> url </ a >& nbsp ; </ td ></ tr > " ;
2002-05-10 14:28:10 +02:00
2004-05-20 13:22:08 +02:00
print " <tr><td>Siren</td><td><a href= \" http://www.societe.com/cgi-bin/recherche?rncs= $objsoc->siren\ " > $objsoc -> siren </ a >& nbsp ; </ td > " ;
2002-05-10 14:28:10 +02:00
print " <td>prefix</td><td> " ;
2003-05-15 21:31:47 +02:00
if ( $objsoc -> prefix_comm )
{
print $objsoc -> prefix_comm ;
}
else
{
2004-07-13 19:40:42 +02:00
print " [<a href= \" fiche.php?socid= $objsoc->id &action=attribute_prefix \" >Attribuer</a>] " ;
2003-05-15 21:31:47 +02:00
}
2002-05-10 14:28:10 +02:00
print " </td></tr> " ;
2004-08-07 01:39:54 +02:00
print " <tr><td> " . $langs -> trans ( " Type " ) . " </td><td> $objsoc->typent </td><td>Effectif</td><td> $objsoc->effectif </td></tr> " ;
2004-11-09 16:17:35 +01:00
print '<tr><td>' ;
print $langs -> trans ( " CustomerDiscount " ) . '</td><td>' . $objsoc -> remise_client . " %</td> " ;
print '<td colspan="2"><a href="remise.php?id=' . $objsoc -> id . '">' ;
2004-08-18 12:02:09 +02:00
print img_edit ( " Modifier la remise " );
print " </a> " ;
2004-11-09 16:17:35 +01:00
print '</td>' ;
print '<tr><td colspan="2">Remise exceptionnelles' ;
print '</td>' ;
print '<td colspan="2"><a href="remx.php?id=' . $objsoc -> id . '">' ;
print img_edit ( " Modifier la remise " );
print " </a> " ;
print '</td></tr>' ;
2002-05-10 14:28:10 +02:00
print " </table> " ;
2004-05-20 13:22:08 +02:00
print " <br> " ;
2002-05-10 14:28:10 +02:00
/*
*
*/
print " </td> \n " ;
2004-05-20 13:22:08 +02:00
//if ($conf->propal->enabled) {
2002-05-10 14:28:10 +02:00
print '<td valign="top" width="50%">' ;
/*
*
* Propales
*
*/
2003-11-19 16:12:24 +01:00
$var = true ;
2004-11-28 17:03:12 +01:00
print '<table class="border" width="100%">' ;
2002-05-10 14:28:10 +02:00
$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 " ;
2004-01-30 11:32:21 +01:00
$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 " ;
2004-05-20 13:22:08 +02:00
$sql .= " AND s.idp = " . $objsoc -> id . " ORDER BY p.datep DESC " ;
2002-05-10 14:28:10 +02:00
2003-11-19 16:12:24 +01:00
if ( $db -> query ( $sql ) )
{
$num = $db -> num_rows ();
if ( $num > 0 )
{
2004-05-20 13:22:08 +02:00
print " <tr $bc[$var] ><td colspan= \" 4 \" ><a href= \" propal.php?socidp= $objsoc->id\ " > Liste des propales ( $num ) </ td ></ tr > " ;
2003-11-19 16:12:24 +01:00
$var =! $var ;
}
$i = 0 ; $now = time (); $lim = 3600 * 24 * 15 ;
while ( $i < $num && $i < 2 )
{
2004-10-23 18:55:07 +02:00
$objp = $db -> fetch_object ();
2003-11-19 16:12:24 +01:00
print " <tr $bc[$var] > " ;
print " <td><a href= \" propal.php?propalid= $objp->propalid\ " > $objp -> ref </ a > \n " ;
if ( ( $now - $objp -> dp ) > $lim && $objp -> statutid == 1 )
{
print " <b>> 15 jours</b> " ;
}
2004-11-28 17:03:12 +01:00
print " </td><td align= \" right \" > " . strftime ( " %d %B %Y " , $objp -> dp ) . " </td> \n " ;
2004-07-27 10:25:00 +02:00
print '<td align="right" width="120">' . price ( $objp -> price ) . '</td>' ;
print '<td width="100" align="center">' . $objp -> statut . '</td></tr>' ;
2003-11-19 16:12:24 +01:00
$var =! $var ;
$i ++ ;
}
$db -> free ();
2002-05-10 14:28:10 +02:00
}
2004-05-20 13:22:08 +02:00
else {
2004-11-28 17:03:12 +01:00
dolibarr_print_error ( $db );
2004-05-20 13:22:08 +02:00
}
2004-11-28 17:03:12 +01:00
2003-11-19 16:12:24 +01:00
/*
* Commandes
*
*/
2004-11-28 17:03:12 +01:00
print '<table class="border" width="100%">' ;
2004-07-27 10:25:00 +02:00
$sql = " SELECT s.nom, s.idp, p.rowid as propalid, p.total_ht, p.ref, " . $db -> pdate ( " p.date_commande " ) . " as dp " ;
2004-01-30 11:32:21 +01:00
$sql .= " FROM " . MAIN_DB_PREFIX . " societe as s, " . MAIN_DB_PREFIX . " commande as p WHERE p.fk_soc = s.idp " ;
2004-05-20 13:22:08 +02:00
$sql .= " AND s.idp = $objsoc->id ORDER BY p.date_commande DESC " ;
2003-11-19 16:12:24 +01:00
if ( $db -> query ( $sql ) )
{
$num = $db -> num_rows ();
if ( $num > 0 )
{
print " <tr $bc[$var] > " ;
2004-05-20 13:22:08 +02:00
print '<td colspan="4"><a href="' . DOL_URL_ROOT . '/commande/liste.php?socidp=' . $objsoc -> id . '">Liste des commandes (' . $num . ')</td></tr>' ;
2003-11-19 16:12:24 +01:00
}
$i = 0 ; $now = time (); $lim = 3600 * 24 * 15 ;
while ( $i < $num && $i < 2 )
{
2004-10-23 18:55:07 +02:00
$objp = $db -> fetch_object ();
2003-11-19 16:12:24 +01:00
$var =! $var ;
print " <tr $bc[$var] > " ;
print '<td><a href="' . DOL_URL_ROOT . '/commande/fiche.php?id=' . $objp -> propalid . '">' . $objp -> ref . " </a> \n " ;
if ( ( $now - $objp -> dp ) > $lim && $objp -> statutid == 1 )
{
print " <b>> 15 jours</b> " ;
}
print " </td><td align= \" right \" > " . strftime ( " %d %B %Y " , $objp -> dp ) . " </TD> \n " ;
2004-07-27 10:25:00 +02:00
print '<td align="right" width="120">' . price ( $objp -> total_ht ) . '</td>' ;
print '<td align="center" width="100">' . $objp -> statut . '</td></tr>' ;
2003-11-19 16:12:24 +01:00
$i ++ ;
}
$db -> free ();
}
2002-05-10 14:28:10 +02:00
/*
*
* Liste des projets associ<EFBFBD> s
*
*/
$sql = " SELECT p.rowid,p.title,p.ref, " . $db -> pdate ( " p.dateo " ) . " as do " ;
2004-05-20 13:22:08 +02:00
$sql .= " FROM " . MAIN_DB_PREFIX . " projet as p WHERE p.fk_soc = $objsoc->id " ;
2002-05-10 14:28:10 +02:00
if ( $db -> query ( $sql ) ) {
2004-08-07 01:39:54 +02:00
print " <table class= \" border \" cellspacing=0 width=100% cellpadding= \" 1 \" > " ;
2002-05-10 14:28:10 +02:00
$i = 0 ;
$num = $db -> num_rows ();
if ( $num > 0 ) {
$tag = ! $tag ; print " <tr $bc[$tag] > " ;
2004-05-20 13:22:08 +02:00
print " <td colspan= \" 2 \" ><a href= \" ../projet/index.php?socidp= $objsoc->id\ " > liste des projets ( $num ) </ td ></ tr > " ;
2002-05-10 14:28:10 +02:00
}
while ( $i < $num && $i < 5 ) {
2004-10-23 18:55:07 +02:00
$obj = $db -> fetch_object ();
2002-05-10 14:28:10 +02:00
$tag = ! $tag ;
print " <tr $bc[$tag] > " ;
2003-09-04 13:15:13 +02:00
print '<td><a href="../projet/fiche.php?id=' . $obj -> rowid . '">' . $obj -> title . '</a></td>' ;
2002-05-10 14:28:10 +02:00
print " <td align= \" right \" > " . $obj -> ref . " </td></tr> " ;
$i ++ ;
}
$db -> free ();
print " </table> " ;
} else {
2004-11-28 17:03:12 +01:00
dolibarr_print_error ( $db );
2002-05-10 14:28:10 +02:00
}
/*
*
*
*/
print " </td></tr> " ;
2004-05-06 11:04:01 +02:00
print " </table></div> \n " ;
2004-05-20 13:22:08 +02:00
2003-08-29 20:29:56 +02:00
/*
2003-10-12 16:29:07 +02:00
* Barre d ' action
2003-08-29 20:29:56 +02:00
*
*/
2004-05-06 11:04:01 +02:00
print '<div class="tabsAction">' ;
2003-11-05 19:08:53 +01:00
2004-03-06 19:49:27 +01:00
if ( $conf -> propal -> enabled && $user -> rights -> propale -> creer )
2003-08-29 20:29:56 +02:00
{
2004-07-12 16:13:27 +02:00
print '<a class="tabAction" href="addpropal.php?socidp=' . $objsoc -> id . '&action=create">Proposition</a>' ;
2003-08-29 20:29:56 +02:00
}
2004-03-04 18:39:49 +01:00
2004-11-26 15:44:04 +01:00
if ( $user -> rights -> contrat -> creer )
{
print '<a class="tabAction" href="' . DOL_URL_ROOT . '/contrat/fiche.php?socid=' . $objsoc -> id . '&action=create">Contrat</a>' ;
}
2004-03-06 19:49:27 +01:00
if ( $conf -> commande -> enabled && $user -> rights -> commande -> creer )
2003-11-05 19:08:53 +01:00
{
2004-08-06 02:46:07 +02:00
print '<a class="tabAction" href="' . DOL_URL_ROOT . '/commande/fiche.php?socidp=' . $objsoc -> id . '&action=create">' . $langs -> trans ( " Order " ) . '</a>' ;
2003-11-05 19:08:53 +01:00
}
2004-03-04 18:39:49 +01:00
2004-01-24 21:23:14 +01:00
if ( $conf -> projet -> enabled && $user -> rights -> projet -> creer )
2003-11-10 20:21:56 +01:00
{
2004-08-06 02:46:07 +02:00
print '<a class="tabAction" href="../projet/fiche.php?socidp=' . $objsoc -> id . '&action=create">' . $langs -> trans ( " Project " ) . '</a>' ;
2003-11-10 20:21:56 +01:00
}
2004-01-31 18:00:32 +01:00
2004-03-06 19:49:27 +01:00
if ( $conf -> fichinter -> enabled )
2004-01-31 18:00:32 +01:00
{
2004-05-20 13:22:08 +02:00
print '<a class="tabAction" href="../fichinter/fiche.php?socidp=' . $objsoc -> id . '&action=create">Intervention</a>' ;
2004-01-31 18:00:32 +01:00
}
2004-07-31 13:36:01 +02:00
2004-03-04 18:39:49 +01:00
print '</div>' ;
2004-05-20 13:22:08 +02:00
print '<br>' ;
2002-05-10 14:28:10 +02:00
/*
*
*
*
*/
if ( $action == 'changevalue' ) {
2004-03-06 19:49:27 +01:00
print " <hr noshade> " ;
2004-05-20 13:22:08 +02:00
print " <form action= \" index.php?socid= $objsoc->id\ " method = \ " post \" > " ;
2002-05-10 14:28:10 +02:00
print " <input type= \" hidden \" name= \" action \" value= \" cabrecrut \" > " ;
print " Cette soci<63> t<EFBFBD> est un cabinet de recrutement : " ;
print " <select name= \" selectvalue \" > " ;
print " <option value= \" \" > " ;
print " <option value= \" t \" >Oui " ;
print " <option value= \" f \" >Non " ;
print " </select> " ;
2004-07-31 13:36:01 +02:00
print " <input type= \" submit \" value= \" " . $langs -> trans ( " Valid " ) . " \" > " ;
2002-05-10 14:28:10 +02:00
print " </form> \n " ;
} else {
/*
*
* Liste des contacts
*
*/
2004-10-30 04:01:06 +02:00
print '<table class="noborder" width="100%">' ;
2002-05-10 14:28:10 +02:00
2004-08-18 11:36:31 +02:00
print '<tr class="liste_titre"><td>' . $langs -> trans ( " Firstname " ) . ' ' . $langs -> trans ( " LastName " ) . '</td>' ;
2004-08-07 01:39:54 +02:00
print '<td>' . $langs -> trans ( " Poste " ) . '</td><td>' . $langs -> trans ( " Tel " ) . '</td>' ;
2004-08-06 02:46:07 +02:00
print '<td>' . $langs -> trans ( " Fax " ) . '</td><td>' . $langs -> trans ( " EMail " ) . '</td>' ;
2004-09-23 20:51:34 +02:00
print " <td align= \" center \" ><a href= \" " . DOL_URL_ROOT . '/contact/fiche.php?socid=' . $objsoc -> id . " &action=create \" > " . $langs -> trans ( " AddContact " ) . " </a></td> " ;
2004-08-07 01:39:54 +02:00
print '<td> </td>' ;
print " </tr> " ;
2002-05-10 14:28:10 +02:00
2004-05-20 13:22:08 +02:00
$sql = " SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note FROM " . MAIN_DB_PREFIX . " socpeople as p WHERE p.fk_soc = $objsoc->id ORDER by p.datec " ;
2002-05-10 14:28:10 +02:00
$result = $db -> query ( $sql );
$i = 0 ; $num = $db -> num_rows (); $tag = True ;
2003-05-16 15:15:36 +02:00
while ( $i < $num )
{
2004-11-26 16:24:09 +01:00
$obj = $db -> fetch_object ();
$var = ! $var ;
print " <tr $bc[$var] > " ;
print '<td>' ;
print '<a href="' . DOL_URL_ROOT . '/contact/fiche.php?id=' . $obj -> idp . '">' ;
print img_file ();
print ' ' . $obj -> firstname . ' ' . $obj -> name . '</a> ' ;
if ( $obj -> note )
{
print " <br> " . nl2br ( $obj -> note );
}
print " </td> " ;
print " <td> $obj->poste </td> " ;
print '<td><a href="action/fiche.php?action=create&actionid=1&contactid=' . $obj -> idp . '&socid=' . $objsoc -> id . '">' . dolibarr_print_phone ( $obj -> phone ) . '</a> </td>' ;
print '<td><a href="action/fiche.php?action=create&actionid=2&contactid=' . $obj -> idp . '&socid=' . $objsoc -> id . '">' . dolibarr_print_phone ( $obj -> fax ) . '</a> </td>' ;
print '<td><a href="action/fiche.php?action=create&actionid=4&contactid=' . $obj -> idp . '&socid=' . $objsoc -> id . '">' . $obj -> email . '</a> </td>' ;
print '<td align="center">' ;
print " <a href= \" ../contact/fiche.php?action=edit&id= $obj->idp\ " > " ;
print img_edit ();
print '</a></td>' ;
print '<td align="center"><a href="action/fiche.php?action=create&actionid=5&contactid=' . $obj -> idp . '&socid=' . $objsoc -> id . '">' ;
print img_actions ();
print '</a></td>' ;
print " </tr> \n " ;
$i ++ ;
$tag = ! $tag ;
}
2002-05-10 14:28:10 +02:00
print " </table> " ;
2004-11-26 16:24:09 +01:00
2003-05-16 15:15:36 +02:00
print " <p /> " ;
2004-11-26 16:24:09 +01:00
2002-05-10 14:28:10 +02:00
/*
* Listes des actions a faire
*
*/
2004-10-30 04:01:06 +02:00
print '<table width="100%" class="noborder">' ;
2004-08-06 02:46:07 +02:00
print '<tr class="liste_titre"><td><a href="action/index.php?socid=' . $objsoc -> id . '">' . $langs -> trans ( " ActionsToDo " ) . '</a></td><td align="right"> <a href="action/fiche.php?action=create&socid=' . $objsoc -> id . '&afaire=1">' . $langs -> trans ( " AddActionToDo " ) . '</a></td></tr>' ;
2002-05-10 14:28:10 +02:00
print '<tr>' ;
2003-08-03 15:18:35 +02:00
print '<td colspan="2" valign="top">' ;
2002-05-10 14:28:10 +02:00
$sql = " SELECT a.id, " . $db -> pdate ( " a.datea " ) . " as da, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid " ;
2004-01-30 11:32:21 +01:00
$sql .= " FROM " . MAIN_DB_PREFIX . " actioncomm as a, " . MAIN_DB_PREFIX . " c_actioncomm as c, " . MAIN_DB_PREFIX . " user as u " ;
2004-05-20 13:22:08 +02:00
$sql .= " WHERE a.fk_soc = $objsoc->id " ;
2002-05-10 14:28:10 +02:00
$sql .= " AND u.rowid = a.fk_user_author " ;
$sql .= " AND c.id=a.fk_action AND a.percent < 100 " ;
$sql .= " ORDER BY a.datea DESC, a.id DESC " ;
if ( $db -> query ( $sql ) ) {
2004-10-30 04:01:06 +02:00
print " <table width= \" 100% \" class= \" noborder \" > \n " ;
2002-05-10 14:28:10 +02:00
$i = 0 ; $num = $db -> num_rows ();
while ( $i < $num ) {
$var = ! $var ;
2004-10-23 18:55:07 +02:00
$obj = $db -> fetch_object ();
2002-05-10 14:28:10 +02:00
print " <tr $bc[$var] > " ;
2004-09-08 16:40:48 +02:00
if ( $oldyear == strftime ( " %Y " , $obj -> da ) )
{
//print '<td align="center">|</td>';
print " <td align= \" center \" > " . strftime ( " %Y " , $obj -> da ) . " </TD> \n " ;
}
else
{
2004-08-07 01:39:54 +02:00
print " <td align= \" center \" > " . strftime ( " %Y " , $obj -> da ) . " </TD> \n " ;
2002-05-10 14:28:10 +02:00
$oldyear = strftime ( " %Y " , $obj -> da );
}
2004-09-08 16:40:48 +02:00
if ( $oldmonth == strftime ( " %Y%b " , $obj -> da ) )
{
//print '<td align="center">|</td>';
2004-10-30 04:01:06 +02:00
print " <td align= \" center \" > " . strftime ( " %b " , $obj -> da ) . " </TD> \n " ;
2004-09-08 16:40:48 +02:00
}
else
{
2004-08-07 01:39:54 +02:00
print " <td align= \" center \" > " . strftime ( " %b " , $obj -> da ) . " </TD> \n " ;
2002-05-10 14:28:10 +02:00
$oldmonth = strftime ( " %Y%b " , $obj -> da );
}
2004-08-07 01:39:54 +02:00
print " <td> " . strftime ( " %d " , $obj -> da ) . " </td> \n " ;
print " <td> " . strftime ( " %H:%M " , $obj -> da ) . " </td> \n " ;
2002-05-10 14:28:10 +02:00
print '<td width="10%"> </td>' ;
2003-08-03 15:18:35 +02:00
if ( $obj -> propalrowid )
{
2003-09-11 18:30:47 +02:00
print '<td width="40%"><a href="propal.php?propalid=' . $obj -> propalrowid . '">' . $obj -> libelle . '</a></td>' ;
2003-08-03 15:18:35 +02:00
}
else
{
2003-09-11 18:30:47 +02:00
print '<td width="40%"><a href="action/fiche.php?id=' . $obj -> id . '">' . $obj -> libelle . '</a></td>' ;
2003-08-03 15:18:35 +02:00
}
2002-05-10 14:28:10 +02:00
/*
* Contact pour cette action
*
*/
if ( $obj -> fk_contact ) {
$contact = new Contact ( $db );
$contact -> fetch ( $obj -> fk_contact );
2004-05-20 13:22:08 +02:00
print '<td width="40%"><a href="people.php?socid=' . $objsoc -> id . '&contactid=' . $contact -> id . '">' . $contact -> fullname . '</a></td>' ;
2002-05-10 14:28:10 +02:00
} else {
print '<td width="40%"> </td>' ;
}
/*
*/
2003-09-11 18:30:47 +02:00
print '<td width="20%"><a href="../user/fiche.php?id=' . $obj -> fk_user_author . '">' . $obj -> code . '</a></td>' ;
2002-05-10 14:28:10 +02:00
print " </tr> \n " ;
$i ++ ;
}
print " </table> " ;
$db -> free ();
} else {
2004-11-28 17:03:12 +01:00
dolibarr_print_error ( $db );
2002-05-10 14:28:10 +02:00
}
print " </td></tr></table> " ;
/*
*
* Listes des actions effectuees
*
*/
2004-06-10 19:34:33 +02:00
print '<table class="noborder" width="100%" cellspacing=0 cellpadding=2>' ;
2004-08-06 02:46:07 +02:00
print '<tr class="liste_titre"><td><a href="action/index.php?socid=' . $objsoc -> id . '">' . $langs -> trans ( " ActionsDone " ) . '</a></td></tr>' ;
2002-05-10 14:28:10 +02:00
print '<tr>' ;
print '<td valign="top">' ;
$sql = " SELECT a.id, " . $db -> pdate ( " a.datea " ) . " as da, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid " ;
2004-01-30 11:32:21 +01:00
$sql .= " FROM " . MAIN_DB_PREFIX . " actioncomm as a, " . MAIN_DB_PREFIX . " c_actioncomm as c, " . MAIN_DB_PREFIX . " user as u " ;
2004-05-20 13:22:08 +02:00
$sql .= " WHERE a.fk_soc = $objsoc->id " ;
2002-05-10 14:28:10 +02:00
$sql .= " AND u.rowid = a.fk_user_author " ;
$sql .= " AND c.id=a.fk_action AND a.percent = 100 " ;
$sql .= " ORDER BY a.datea DESC, a.id DESC " ;
2003-05-15 21:31:47 +02:00
if ( $db -> query ( $sql ) )
{
2004-02-10 19:44:59 +01:00
print '<table width="100%" cellspacing="0" border="0" cellpadding="2">' ;
2002-05-10 14:28:10 +02:00
2003-05-15 21:31:47 +02:00
$i = 0 ;
$num = $db -> num_rows ();
$oldyear = '' ;
$oldmonth = '' ;
while ( $i < $num )
{
$var = ! $var ;
2004-10-23 18:55:07 +02:00
$obj = $db -> fetch_object ();
2003-05-15 21:31:47 +02:00
print " <tr $bc[$var] > " ;
if ( $oldyear == strftime ( " %Y " , $obj -> da ) )
{
print '<td align="center">|</td>' ;
}
else
{
print " <TD align= \" center \" > " . strftime ( " %Y " , $obj -> da ) . " </TD> \n " ;
$oldyear = strftime ( " %Y " , $obj -> da );
}
if ( $oldmonth == strftime ( " %Y%b " , $obj -> da ) )
{
print '<td align="center">|</td>' ;
}
else
{
print " <TD align= \" center \" > " . strftime ( " %b " , $obj -> da ) . " </TD> \n " ;
$oldmonth = strftime ( " %Y%b " , $obj -> da );
}
print " <TD> " . strftime ( " %d " , $obj -> da ) . " </TD> \n " ;
print " <TD> " . strftime ( " %H:%M " , $obj -> da ) . " </TD> \n " ;
print '<td width="10%"> </td>' ;
if ( $obj -> propalrowid )
{
2004-06-10 19:34:33 +02:00
print '<td width="40%"><a href="' . DOL_URL_ROOT . '/comm/propal.php?propalid=' . $obj -> propalrowid . '">' . $obj -> libelle . '</a></td>' ;
2003-05-15 21:31:47 +02:00
}
else
{
2004-06-10 19:34:33 +02:00
print '<td width="40%"><a href="' . DOL_URL_ROOT . '/comm/action/fiche.php?id=' . $obj -> id . '">' . $obj -> libelle . '</a></td>' ;
2003-05-15 21:31:47 +02:00
}
/*
* Contact pour cette action
*
*/
if ( $obj -> fk_contact )
{
$contact = new Contact ( $db );
$contact -> fetch ( $obj -> fk_contact );
2004-05-20 13:22:08 +02:00
print '<td width="40%"><a href="people.php?socid=' . $objsoc -> id . '&contactid=' . $contact -> id . '">' . $contact -> fullname . '</a></td>' ;
2003-05-15 21:31:47 +02:00
}
else
{
print '<td width="40%"> </td>' ;
}
/*
*/
2003-09-11 18:30:47 +02:00
print '<td width="20%"><a href="../user/fiche.php?id=' . $obj -> fk_user_author . '">' . $obj -> code . '</a></td>' ;
2003-05-15 21:31:47 +02:00
print " </tr> \n " ;
$i ++ ;
}
print " </table> " ;
$db -> free ();
}
else
{
2004-11-28 17:03:12 +01:00
dolibarr_print_error ( $db );
2002-05-10 14:28:10 +02:00
}
print " </td></tr></table> " ;
/*
*
* Notes sur la societe
*
*/
2004-02-10 19:44:59 +01:00
if ( $objsoc -> note )
{
2004-10-30 14:15:59 +02:00
print '<table class="border" width="100%" bgcolor="#e0e0e0">' ;
2004-02-10 19:44:59 +01:00
print " <tr><td> " . nl2br ( $objsoc -> note ) . " </td></tr> " ;
print " </table> " ;
}
2002-05-10 14:28:10 +02:00
/*
*
*
*
*/
}
} else {
2004-10-30 14:15:59 +02:00
dolibarr_print_error ( $db );
2002-05-10 14:28:10 +02:00
}
2004-05-29 17:58:36 +02:00
2002-05-10 14:28:10 +02:00
$db -> close ();
llxFooter ( " <em>Dernière modification $Date $ révision $Revision $ </em> " );
?>