diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 10b3f1cb405..a18aa9a8e7e 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -115,12 +115,9 @@ if ($user->societe_id > 0) *********************************************************************************/ if ($socid > 0) { - - $societe = new Societe($db, $socid); - + // On récupère id societe (courant ou suivant ou précédent) $sql = "SELECT s.idp, s.nom, ".$db->pdate("s.datec")." as dc, s.tel, s.fax, st.libelle as stcomm, s.fk_stcomm, s.url,s.address,s.cp,s.ville, s.note, t.libelle as typent, e.libelle as effectif, s.siren, s.prefix_comm, s.services,s.parent, s.description FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st, ".MAIN_DB_PREFIX."c_typent as t, ".MAIN_DB_PREFIX."c_effectif as e "; $sql .= " WHERE s.fk_stcomm=st.id AND s.fk_typent = t.id AND s.fk_effectif = e.id"; - if ($to == 'next') { $sql .= " AND s.idp > $socid ORDER BY idp ASC LIMIT 1"; } elseif ($to == 'prev') { @@ -133,7 +130,12 @@ if ($socid > 0) if ($result) { - $objsoc = $db->fetch_object(0); + $resp = $db->fetch_object(0); + + // On recupere les donnees societes par l'objet + $objsoc = new Societe($db); + $objsoc->id=$resp->idp; + $objsoc->fetch($resp->idp); $dac = strftime("%Y-%m-%d %H:%M", time()); if ($errmesg) @@ -144,68 +146,65 @@ if ($socid > 0) /* * */ - $head[0][0] = DOL_URL_ROOT.'/soc.php?socid='.$societe->id; + $head[0][0] = DOL_URL_ROOT.'/soc.php?socid='.$objsoc->id; $head[0][1] = "Fiche société"; $h = 1; - $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?id='.$societe->id; + $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?id='.$objsoc->id; $head[$h][1] = 'Fiche client'; $h++; + if ($conf->compta->enabled) { + $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$objsoc->id; + $head[$h][1] = 'Fiche compta'; + $h++; + } + if (file_exists(DOL_DOCUMENT_ROOT.'/sl/')) { - $head[$h][0] = DOL_URL_ROOT.'/sl/fiche.php?id='.$societe->id; + $head[$h][0] = DOL_URL_ROOT.'/sl/fiche.php?id='.$objsoc->id; $head[$h][1] = 'Fiche catalogue'; $h++; } if ($soc->fournisseur) { - $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$societe->id; + $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$objsoc->id; $head[$h][1] = 'Fiche fournisseur'; $h++; } - $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$societe->id; + $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$objsoc->id; $head[$h][1] = 'Note'; $h++; + if ($user->societe_id == 0) { - $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$societe->id; + $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$objsoc->id; $head[$h][1] = 'Documents'; $h++; } - $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$societe->id; + $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$objsoc->id; $head[$h][1] = 'Notifications'; dolibarr_fiche_head($head, 1); - print_titre("Fiche client : $objsoc->nom"); - - print ''; - - if ($user->societe_id == 0) - { - print ""; - print ""; - - } - print "
idp\">Compta[idp&action=add_bookmark\">Bookmark]
"; /* * * */ - - print ''; print '\n"; + + //if ($conf->propal->enabled) { + print ''; print ''; print ""; - print ""; + print ""; - $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->idp ORDER by p.datec"; + $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"; $result = $db->query($sql); $i = 0 ; $num = $db->num_rows(); $tag = True; while ($i < $num) @@ -407,7 +423,7 @@ if ($socid > 0) print '"; print ""; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print "'; + print ''; } else { print ''; } @@ -521,7 +537,7 @@ if ($socid > 0) $sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid "; $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u "; - $sql .= " WHERE a.fk_soc = $objsoc->idp "; + $sql .= " WHERE a.fk_soc = $objsoc->id "; $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"; @@ -582,7 +598,7 @@ if ($socid > 0) { $contact = new Contact($db); $contact->fetch($obj->fk_contact); - print ''; + print ''; } else {
'; - print ''; + print '
'; - print ""; - print ""; - print ""; + print ''; + print ""; + print ""; + print ""; - print ""; + print ""; print ""; - print ""; + print ""; print "
Type $objsoc->typentEffectif$objsoc->effectif
Tel $objsoc->tel fax$objsoc->fax 
Ville".nl2br($objsoc->address)."
$objsoc->cp $objsoc->ville
Nom'; + print $objsoc->nom; + print '
Adresse".nl2br($objsoc->address)."
".$objsoc->cp." ".$objsoc->ville." ".$objsoc->pays."
Téléphone $objsoc->tel Fax$objsoc->fax 
Weburl\">$objsoc->url 
sirensiren\">$objsoc->siren 
Sirensiren\">$objsoc->siren prefix"; if ($objsoc->prefix_comm) { @@ -213,19 +212,28 @@ if ($socid > 0) } else { - print "[idp&action=attribute_prefix\">Attribuer]"; + print "[id&action=attribute_prefix\">Attribuer]"; } print "
Siteurl\">$objsoc->url 
Type $objsoc->typentEffectif$objsoc->effectif
"; + if ($user->societe_id == 0) + { + print "[id&action=add_bookmark\">Bookmark fiche]
"; + } + print "
"; + /* * */ print "
'; /* @@ -237,14 +245,14 @@ if ($socid > 0) print ''; $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"; $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"; - $sql .= " AND s.idp = $objsoc->idp ORDER BY p.datep DESC"; + $sql .= " AND s.idp = ".$objsoc->id." ORDER BY p.datep DESC"; if ( $db->query($sql) ) { $num = $db->num_rows(); if ($num >0 ) { - print ""; + print ""; $var=!$var; } $i = 0; $now = time(); $lim = 3600 * 24 * 15 ; @@ -265,6 +273,9 @@ if ($socid > 0) } $db->free(); } + else { + print "Erreur ".$db->error()."
".$sql; + } /* * Commandes * @@ -272,7 +283,7 @@ if ($socid > 0) print '
idp\">Liste des propales ($num)
id\">Liste des propales ($num)
'; $sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.ref, ".$db->pdate("p.date_commande")." as dp"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as p WHERE p.fk_soc = s.idp "; - $sql .= " AND s.idp = $objsoc->idp ORDER BY p.date_commande DESC"; + $sql .= " AND s.idp = $objsoc->id ORDER BY p.date_commande DESC"; if ( $db->query($sql) ) { @@ -280,7 +291,7 @@ if ($socid > 0) if ($num >0 ) { print ""; - print ''; + print ''; } $i = 0; $now = time(); $lim = 3600 * 24 * 15 ; while ($i < $num && $i < 2) @@ -307,14 +318,14 @@ if ($socid > 0) * */ $sql = "SELECT p.rowid,p.title,p.ref,".$db->pdate("p.dateo")." as do"; - $sql .= " FROM ".MAIN_DB_PREFIX."projet as p WHERE p.fk_soc = $objsoc->idp"; + $sql .= " FROM ".MAIN_DB_PREFIX."projet as p WHERE p.fk_soc = $objsoc->id"; if ( $db->query($sql) ) { print "
Liste des commandes ('.$num.')
Liste des commandes ('.$num.')
"; $i = 0 ; $num = $db->num_rows(); if ($num > 0) { $tag = !$tag; print ""; - print ""; + print ""; } while ($i < $num && $i < 5) { $obj = $db->fetch_object( $i); @@ -337,21 +348,21 @@ if ($socid > 0) */ print ""; print "
idp\">liste des projets ($num)
id\">liste des projets ($num)
\n"; + /* * Barre d'action * */ - print '
'; if ($conf->propal->enabled && $user->rights->propale->creer) { - print 'Créer une proposition'; + print 'Créer une proposition'; } if ($conf->commande->enabled && $user->rights->commande->creer) { - print 'Créer une commande'; + print 'Créer une commande'; } if ($conf->projet->enabled && $user->rights->projet->creer) @@ -361,11 +372,16 @@ if ($socid > 0) if ($conf->fichinter->enabled) { - print 'Intervention'; + print 'Intervention'; } + + print 'Ajouter un contact'; + + print 'Notifications'; print '
'; - + print '
'; + /* * * @@ -373,7 +389,7 @@ if ($socid > 0) */ if ($action == 'changevalue') { print "
"; - print "
idp\" method=\"post\">"; + print "id\" method=\"post\">"; print ""; print "Cette société est un cabinet de recrutement : "; print "
Prénom NomPosteTélFaxEmailidp&action=create\">Ajouter
id&action=create\">Ajouter
'; - print ''.$obj->firstname.' '. $obj->name.' '; + print ''.$obj->firstname.' '. $obj->name.' '; if ($obj->note) { @@ -415,9 +431,9 @@ if ($socid > 0) } print "$obj->poste '.$obj->phone.' '.$obj->fax.' '.$obj->email.' '.$obj->phone.' '.$obj->fax.' '.$obj->email.' "; print "idp\">"; print img_edit(); @@ -442,7 +458,7 @@ if ($socid > 0) $sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid "; $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u "; - $sql .= " WHERE a.fk_soc = $objsoc->idp "; + $sql .= " WHERE a.fk_soc = $objsoc->id "; $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"; @@ -491,7 +507,7 @@ if ($socid > 0) if ($obj->fk_contact) { $contact = new Contact($db); $contact->fetch($obj->fk_contact); - print ''.$contact->fullname.''.$contact->fullname.' '.$contact->fullname.''.$contact->fullname.'