Modif pour register_globals=off

This commit is contained in:
Rodolphe Quiedeville 2004-07-13 13:02:40 +00:00
parent 8d7976d24d
commit 7c27a410a0
2 changed files with 143 additions and 161 deletions

View File

@ -39,31 +39,31 @@ if ($user->societe_id > 0)
* *
* *
*/ */
if ($HTTP_POST_VARS["action"] == 'add_action') if ($_POST["action"] == 'add_action')
{ {
if ($contactid) if ($_POST["contactid"])
{ {
$contact = new Contact($db); $contact = new Contact($db);
$contact->fetch($contactid); $contact->fetch($_POST["contactid"]);
} }
$societe = new Societe($db); $societe = new Societe($db);
$societe->fetch($socid); $societe->fetch($_POST["socid"]);
if ($HTTP_POST_VARS["afaire"] <> 1) if ($_POST["afaire"] <> 1)
{ {
$actioncomm = new ActionComm($db); $actioncomm = new ActionComm($db);
$actioncomm->priority = 2; $actioncomm->priority = 2;
$actioncomm->type = $HTTP_POST_VARS["actionid"]; $actioncomm->type = $_POST["actionid"];
$actioncomm->date = $db->idate(mktime($HTTP_POST_VARS["heurehour"], $actioncomm->date = $db->idate(mktime($_POST["heurehour"],
$HTTP_POST_VARS["heuremin"], $_POST["heuremin"],
0, 0,
$HTTP_POST_VARS["acmonth"], $_POST["acmonth"],
$HTTP_POST_VARS["acday"], $_POST["acday"],
$HTTP_POST_VARS["acyear"]) $_POST["acyear"])
); );
if ($HTTP_POST_VARS["actionid"] == 5) if ($_POST["actionid"] == 5)
{ {
$actioncomm->percent = 0; $actioncomm->percent = 0;
} }
@ -72,12 +72,12 @@ if ($HTTP_POST_VARS["action"] == 'add_action')
$actioncomm->percent = 100; $actioncomm->percent = 100;
} }
$actioncomm->contact = $contactid; $actioncomm->contact = $_POST["contactid"];
$actioncomm->user = $user; $actioncomm->user = $user;
$actioncomm->societe = $socid; $actioncomm->societe = $_POST["socid"];
$actioncomm->note = $note; $actioncomm->note = $_POST["note"];
$actioncomm->add($user); $actioncomm->add($user);
} }
@ -86,7 +86,7 @@ if ($HTTP_POST_VARS["action"] == 'add_action')
{ {
$todo = new ActionComm($db); $todo = new ActionComm($db);
$todo->type = $HTTP_POST_VARS["nextactionid"]; $todo->type = $_POST["nextactionid"];
$todo->date = $db->idate(mktime(12,0,0,$remonth, $reday, $reyear)); $todo->date = $db->idate(mktime(12,0,0,$remonth, $reday, $reyear));
$todo->libelle = $todo_label; $todo->libelle = $todo_label;
$todo->priority = 2; $todo->priority = 2;
@ -119,10 +119,10 @@ if ($HTTP_POST_VARS["action"] == 'add_action')
} }
} }
// Header("Location: ".DOL_URL_ROOT."/comm/fiche.php?socid=$socid"); // Header("Location: ".DOL_URL_ROOT."/comm/fiche.php?socid=$socid");
Header("Location: ".$HTTP_POST_VARS["from"]); Header("Location: ".$_POST["from"]);
} }
if ($HTTP_POST_VARS["action"] == 'confirm_delete' && $HTTP_POST_VARS["confirm"] == yes) if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == yes)
{ {
$actioncomm = new ActionComm($db); $actioncomm = new ActionComm($db);
$actioncomm->delete($id); $actioncomm->delete($id);
@ -133,8 +133,8 @@ if ($action=='update')
{ {
$action = new Actioncomm($db); $action = new Actioncomm($db);
$action->fetch($id); $action->fetch($id);
$action->percent = $HTTP_POST_VARS["percent"]; $action->percent = $_POST["percent"];
$action->contact->id = $HTTP_POST_VARS["scontactid"]; $action->contact->id = $_POST["scontactid"];
$action->update(); $action->update();
} }
@ -159,18 +159,20 @@ if ($_GET["action"] == 'create')
if ($afaire <> 1) if ($afaire <> 1)
{ {
$caction->fetch($db, $actionid); $caction->fetch($db, $_GET["actionid"]);
$contact = new Contact($db); $contact = new Contact($db);
$contact->fetch($_GET["contactid"]); $contact->fetch($_GET["contactid"]);
} }
$societe = new Societe($db); $societe = new Societe($db);
$societe->get_nom($socid); $societe->get_nom($_GET["socid"]);
print '<form action="'.$PHP_SELF.'?socid='.$socid.'" method="post">'; print '<form action="fiche.php?socid='.$_GET["socid"].'" method="post">';
print '<input type="hidden" name="from" value="'.$_SERVER["HTTP_REFERER"].'">'; print '<input type="hidden" name="from" value="'.$_SERVER["HTTP_REFERER"].'">';
print '<input type="hidden" name="action" value="add_action">'; print '<input type="hidden" name="action" value="add_action">';
print '<input type="hidden" name="actionid" value="'.$actionid.'">'."\n"; print '<input type="hidden" name="actionid" value="'.$_GET["actionid"].'">'."\n";
print '<input type="hidden" name="contactid" value="'.$_GET["contactid"].'">';
print '<input type="hidden" name="socid" value="'.$_GET["socid"].'">';
/* /*
* Rendez-vous * Rendez-vous
@ -181,9 +183,6 @@ if ($_GET["action"] == 'create')
print '<input type="hidden" name="date" value="'.$db->idate(time()).'">'."\n"; print '<input type="hidden" name="date" value="'.$db->idate(time()).'">'."\n";
print '<input type="hidden" name="contactid" value="'.$contactid.'">';
print '<input type="hidden" name="socid" value="'.$socid.'">';
print '<table class="border" width="100%" border="1" cellspacing="0" cellpadding="3">'; print '<table class="border" width="100%" border="1" cellspacing="0" cellpadding="3">';
print '<tr><td colspan="2"><div class="titre">Rendez-vous</div></td></tr>'; print '<tr><td colspan="2"><div class="titre">Rendez-vous</div></td></tr>';
@ -214,20 +213,14 @@ if ($_GET["action"] == 'create')
*/ */
else else
{ {
print '<input type="hidden" name="contactid" value="'.$contactid.'">';
print '<input type="hidden" name="socid" value="'.$socid.'">';
if($afaire <> 1) if($afaire <> 1)
{ {
print_titre ("Action effectuée"); print_titre ("Action effectuée");
print '<table class="border" width="100%" border="1" cellspacing="0" cellpadding="3">'; print '<table class="border" width="100%" border="1" cellspacing="0" cellpadding="3">';
print '<tr><td width="10%">Action</td><td>'.$caction->libelle.'</td></tr>'; print '<tr><td width="10%">Action</td><td>'.$caction->libelle.'</td></tr>';
print '<tr><td width="10%">Société</td><td width="40%">'; print '<tr><td width="10%">Société</td><td width="40%">';
print '<a href="../fiche.php?socid='.$socid.'">'.$societe->nom.'</a></td></tr>'; print '<a href="../fiche.php?socid='.$_GET["socid"].'">'.$societe->nom.'</a></td></tr>';
print '<tr><td width="10%">Contact</td><td width="40%">'.$contact->fullname.'</td></tr>'; print '<tr><td width="10%">Contact</td><td width="40%">'.$contact->fullname.'</td></tr>';
print '<td>Date</td><td>'; print '<td>Date</td><td>';
print $html->select_date('','ac',1,1); print $html->select_date('','ac',1,1);
@ -249,7 +242,7 @@ if ($_GET["action"] == 'create')
print '<input type="hidden" name="todo" value="on">'; print '<input type="hidden" name="todo" value="on">';
print '<input type="hidden" name="afaire" value="1">'; print '<input type="hidden" name="afaire" value="1">';
print '<tr><td width="10%">Société</td><td width="40%">'; print '<tr><td width="10%">Société</td><td width="40%">';
print '<a href="../fiche.php?socid='.$socid.'">'.$societe->nom.'</a></td></tr>'; print '<a href="../fiche.php?socid='.$_GET["socid"].'">'.$societe->nom.'</a></td></tr>';
} }
print '<tr><td width="10%">Date</td><td width="40%">'; print '<tr><td width="10%">Date</td><td width="40%">';
@ -277,11 +270,11 @@ if ($_GET["action"] == 'create')
* *
* *
*/ */
if ($id) if ($_GET["id"])
{ {
if ($action == 'delete') if ($action == 'delete')
{ {
print '<form method="post" action="'.$PHP_SELF.'?id='.$id.'">'; print '<form method="post" action="fiche.php?id='.$_GET["id"].'">';
print '<input type="hidden" name="action" value="confirm_delete">'; print '<input type="hidden" name="action" value="confirm_delete">';
print '<table id="actions" cellspacing="0" border="1" width="100%" cellpadding="3">'; print '<table id="actions" cellspacing="0" border="1" width="100%" cellpadding="3">';
@ -309,7 +302,7 @@ if ($id)
if ($_GET["action"] == 'edit') if ($_GET["action"] == 'edit')
{ {
print_titre ("Edition de la fiche action"); print_titre ("Edition de la fiche action");
print '<form action="fiche.php?id='.$id.'" method="post">'; print '<form action="fiche.php?id='.$_GET["id"].'" method="post">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<table class="border" width="100%" border="1" cellspacing="0" cellpadding="3">'; print '<table class="border" width="100%" border="1" cellspacing="0" cellpadding="3">';
print '<tr><td width="20%">Type</td><td colspan="3">'.$act->type.'</td></tr>'; print '<tr><td width="20%">Type</td><td colspan="3">'.$act->type.'</td></tr>';

View File

@ -1,5 +1,5 @@
<?PHP <?PHP
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -40,73 +40,66 @@ $user->getrights('facture');
llxHeader(); llxHeader();
if ($action=='add_action')
if ($action=='add_action') {
/*
* Vient de actioncomm.php
*
*/
$actioncomm = new ActionComm($db);
$actioncomm->date = $date;
$actioncomm->type = $actionid;
$actioncomm->contact = $contactid;
$actioncomm->societe = $socid;
$actioncomm->note = $note;
$actioncomm->add($user);
$societe = new Societe($db);
$societe->fetch($socid);
}
if ($action == 'attribute_prefix')
{ {
$societe = new Societe($db, $socid); /*
$societe->attribute_prefix($db, $socid); * Vient de actioncomm.php
*
*/
$actioncomm = new ActionComm($db);
$actioncomm->date = $date;
$actioncomm->type = $actionid;
$actioncomm->contact = $contactid;
$actioncomm->societe = $socid;
$actioncomm->note = $note;
$actioncomm->add($user);
$societe = new Societe($db);
$societe->fetch($socid);
} }
if ($action == 'recontact') if ($action == 'recontact')
{ {
$dr = mktime(0, 0, 0, $remonth, $reday, $reyear); $dr = mktime(0, 0, 0, $remonth, $reday, $reyear);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."soc_recontact (fk_soc, datere, author) VALUES ($socid, $dr,'". $user->login ."')"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."soc_recontact (fk_soc, datere, author) VALUES ($socid, $dr,'". $user->login ."')";
$result = $db->query($sql); $result = $db->query($sql);
} }
/* TODO RODO
if ($action == 'stcomm') if ($action == 'stcomm')
{ {
if ($stcommid <> 'null' && $stcommid <> $oldstcomm) if ($stcommid <> 'null' && $stcommid <> $oldstcomm)
{ {
$sql = "INSERT INTO socstatutlog (datel, fk_soc, fk_statut, author) "; $sql = "INSERT INTO socstatutlog (datel, fk_soc, fk_statut, author) ";
$sql .= " VALUES ('$dateaction',$socid,$stcommid,'" . $user->login . "')"; $sql .= " VALUES ('$dateaction',$socid,$stcommid,'" . $user->login . "')";
$result = @$db->query($sql); $result = @$db->query($sql);
if ($result) if ($result)
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=$stcommid WHERE idp=$socid"; $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=$stcommid WHERE idp=$socid";
$result = $db->query($sql); $result = $db->query($sql);
} }
else else
{ {
$errmesg = "ERREUR DE DATE !"; $errmesg = "ERREUR DE DATE !";
} }
} }
if ($actioncommid) if ($actioncommid)
{ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm (datea, fk_action, fk_soc, fk_user_author) VALUES ('$dateaction',$actioncommid,$socid,'" . $user->id . "')"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm (datea, fk_action, fk_soc, fk_user_author) VALUES ('$dateaction',$actioncommid,$socid,'" . $user->id . "')";
$result = @$db->query($sql); $result = @$db->query($sql);
if (!$result) if (!$result)
{ {
$errmesg = "ERREUR DE DATE !"; $errmesg = "ERREUR DE DATE !";
} }
} }
} }
*/
/* /*
* Recherche * Recherche
@ -144,71 +137,68 @@ if ($mode == 'search')
* Mode fiche * Mode fiche
* *
*/ */
if ($socid > 0) if ($_GET["socid"] > 0)
{ {
$objsoc = new Societe($db); $societe = new Societe($db);
$objsoc->id = $socid; $societe->fetch($_GET["socid"], $to); // si $to='next' ajouter " AND s.idp > $socid ORDER BY idp ASC LIMIT 1";
$objsoc->idp = $socid;
$objsoc->fetch($socid, $to); // si $to='next' ajouter " AND s.idp > $socid ORDER BY idp ASC LIMIT 1";
/* /*
* Affichage onglets * Affichage onglets
*/ */
$h = 0; $h = 0;
$head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$socid; $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$societe->id;
$head[$h][1] = "Fiche société"; $head[$h][1] = "Fiche société";
$h++; $h++;
if ($objsoc->client==1) if ($societe->client==1)
{ {
$head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$socid; $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$societe->id;
$head[$h][1] = 'Fiche client'; $head[$h][1] = 'Fiche client';
$h++; $h++;
} }
if ($objsoc->client==2) if ($societe->client==2)
{ {
$head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$socid; $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$societe->id;
$head[$h][1] = 'Fiche prospect'; $head[$h][1] = 'Fiche prospect';
$h++; $h++;
} }
if ($objsoc->fournisseur) if ($societe->fournisseur)
{ {
$head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$socid; $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$societe->id;
$head[$h][1] = 'Fiche fournisseur'; $head[$h][1] = 'Fiche fournisseur';
$h++; $h++;
} }
if ($conf->compta->enabled) { if ($conf->compta->enabled) {
$hselected=$h; $hselected=$h;
$head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$socid; $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$societe->id;
$head[$h][1] = 'Fiche compta'; $head[$h][1] = 'Fiche compta';
$h++; $h++;
} }
$head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$socid; $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$societe->id;
$head[$h][1] = 'Note'; $head[$h][1] = 'Note';
$h++; $h++;
if ($user->societe_id == 0) if ($user->societe_id == 0)
{ {
$head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$socid; $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$societe->id;
$head[$h][1] = 'Documents'; $head[$h][1] = 'Documents';
$h++; $h++;
} }
$head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$socid; $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$societe->id;
$head[$h][1] = 'Notifications'; $head[$h][1] = 'Notifications';
$h++; $h++;
if ($user->societe_id == 0) if ($user->societe_id == 0)
{ {
$head[$h][0] = DOL_URL_ROOT."/index.php?socidp=$objsoc->id&action=add_bookmark"; $head[$h][0] = DOL_URL_ROOT."/index.php?socidp=$societe->id&action=add_bookmark";
$head[$h][1] = '<img border="0" src="/theme/'.$conf->theme.'/img/bookmark.png" alt="Bookmark" title="Bookmark">'; $head[$h][1] = '<img border="0" src="/theme/'.$conf->theme.'/img/bookmark.png" alt="Bookmark" title="Bookmark">';
$head[$h][2] = 'image'; $head[$h][2] = 'image';
} }
dolibarr_fiche_head($head, $hselected, $objsoc->nom); dolibarr_fiche_head($head, $hselected, $societe->nom);
/* /*
* *
@ -221,26 +211,20 @@ if ($socid > 0)
*/ */
print '<table class="border" cellpadding="2" cellspacing="0" width="100%">'; print '<table class="border" cellpadding="2" cellspacing="0" width="100%">';
print '<tr><td width="20%">Nom</td><td width="80%" colspan="3">'.$objsoc->nom.'</td></tr>'; print '<tr><td width="20%">Nom</td><td width="80%" colspan="3">'.$societe->nom.'</td></tr>';
print '<tr><td valign="top">Adresse</td><td colspan="3">'.nl2br($objsoc->adresse)."<br>$objsoc->cp $objsoc->ville</td></tr>"; print '<tr><td valign="top">Adresse</td><td colspan="3">'.nl2br($societe->adresse)."<br>$societe->cp $societe->ville</td></tr>";
print '<tr><td>Tél</td><td>'.$objsoc->tel.'&nbsp;</td><td>Fax</td><td>'.$objsoc->fax.'&nbsp;</td></tr>'; print '<tr><td>Tél</td><td>'.$societe->tel.'&nbsp;</td><td>Fax</td><td>'.$societe->fax.'&nbsp;</td></tr>';
print "<tr><td>Web</td><td colspan=\"3\"><a href=\"http://$objsoc->url\">$objsoc->url</a>&nbsp;</td></tr>"; print "<tr><td>Web</td><td colspan=\"3\"><a href=\"http://$societe->url\">$societe->url</a>&nbsp;</td></tr>";
print '<tr><td>Siren</td><td><a href="http://www.societe.com/cgi-bin/recherche?rncs='.$objsoc->siren.'">'.$objsoc->siren.'</a>&nbsp;</td>'; print '<tr><td>Siren</td><td><a href="http://www.societe.com/cgi-bin/recherche?rncs='.$societe->siren.'">'.$societe->siren.'</a>&nbsp;</td>';
print "<td>prefix</td><td>"; print "<td>prefix</td><td>";
if ($objsoc->prefix_comm) if ($societe->prefix_comm)
{ {
print $objsoc->prefix_comm; print $societe->prefix_comm;
} }
else
{
print "[<a href=\"$PHP_SELF?socid=$objsoc->idp&action=attribute_prefix\">Attribuer</a>]";
}
print "</td></tr>"; print "</td></tr>";
print "</table>"; print "</table>";
print "<br>"; print "<br>";
/* /*
@ -257,7 +241,7 @@ if ($socid > 0)
print '<table class="border" width="100%" cellspacing="0" cellpadding="1">'; print '<table class="border" width="100%" cellspacing="0" cellpadding="1">';
$var=!$var; $var=!$var;
$sql = "SELECT s.nom, s.idp, f.facnumber, f.amount, ".$db->pdate("f.datef")." as df, f.paye as paye, f.fk_statut as statut, f.rowid as facid "; $sql = "SELECT s.nom, s.idp, f.facnumber, f.amount, ".$db->pdate("f.datef")." as df, f.paye as paye, f.fk_statut as statut, f.rowid as facid ";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.idp AND s.idp = ".$objsoc->idp." ORDER BY f.datef DESC"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.idp AND s.idp = ".$societe->id." ORDER BY f.datef DESC";
if ( $db->query($sql) ) if ( $db->query($sql) )
{ {
@ -265,7 +249,7 @@ if ($socid > 0)
if ($num > 0) if ($num > 0)
{ {
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print "<td colspan=\"4\"><a href=\"facture.php?socidp=$objsoc->idp\">Liste des factures ($num)</td></tr>"; print "<td colspan=\"4\"><a href=\"facture.php?socidp=$societe->id\">Liste des factures ($num)</td></tr>";
} }
while ($i < $num && $i < 5) while ($i < $num && $i < 5)
@ -297,37 +281,40 @@ if ($socid > 0)
} }
print "</table>"; print "</table>";
} }
/* /*
* *
* Liste des projets associés * Liste des projets associés
* *
*/ */
$sql = "SELECT p.rowid,p.title,p.ref,".$db->pdate("p.dateo")." as do"; $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 = $societe->id";
if ( $db->query($sql) ) { if ( $db->query($sql) )
print "<table border=1 cellspacing=0 width=100% cellpadding=\"1\">"; {
print '<table border="1" cellspacing="0" width="100%" cellpadding="1">';
$i = 0 ; $i = 0 ;
$num = $db->num_rows(); $num = $db->num_rows();
if ($num > 0) { if ($num > 0)
{
$tag = !$tag; print "<tr $bc[$tag]>"; $tag = !$tag; print "<tr $bc[$tag]>";
print "<td colspan=\"2\"><a href=\"../projet/index.php?socidp=$objsoc->idp\">liste des projets ($num)</td></tr>"; print "<td colspan=\"2\"><a href=\"../projet/index.php?socidp=$societe->id\">liste des projets ($num)</td></tr>";
} }
while ($i < $num && $i < 5) { while ($i < $num && $i < 5)
$obj = $db->fetch_object( $i); {
$tag = !$tag; $obj = $db->fetch_object( $i);
$tag = !$tag;
print "<tr $bc[$tag]>"; print "<tr $bc[$tag]>";
print '<td><a href="../projet/fiche.php?id='.$obj->rowid.'">'.$obj->title.'</a></td>'; print '<td><a href="../projet/fiche.php?id='.$obj->rowid.'">'.$obj->title.'</a></td>';
print "<td align=\"right\">".strftime("%d %b %Y", $obj->do) ."</td></tr>"; print "<td align=\"right\">".strftime("%d %b %Y", $obj->do) ."</td></tr>";
$i++; $i++;
} }
$db->free(); $db->free();
print "</table>"; print "</table>";
} else { }
else
{
print $db->error(); print $db->error();
} }
/* /*
* *
@ -343,12 +330,12 @@ if ($socid > 0)
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($user->societe_id == 0) if ($user->societe_id == 0)
{ {
if ($user->rights->facture->creer) { if ($user->rights->facture->creer) {
print "<a class=\"tabAction\" href=\"facture.php?action=create&socidp=$objsoc->idp\">".translate("Créer Facture")."</a>"; print "<a class=\"tabAction\" href=\"facture.php?action=create&socidp=$societe->id\">".translate("Créer Facture")."</a>";
} }
print "<a class=\"tabAction\" href=\"deplacement/fiche.php?socid=$objsoc->idp&action=create\">Créer Déplacement</a>"; print "<a class=\"tabAction\" href=\"deplacement/fiche.php?socid=$societe->id&amp;action=create\">Créer Déplacement</a>";
} }
print '</div>'; print '</div>';
print "<br>\n"; print "<br>\n";
@ -360,7 +347,7 @@ if ($socid > 0)
if ($action == 'changevalue') { if ($action == 'changevalue') {
print "<hr noshade>"; print "<hr noshade>";
print "<form action=\"index.php?socid=$objsoc->idp\" method=\"post\">"; print "<form action=\"index.php?socid=$societe->id\" method=\"post\">";
print "<input type=\"hidden\" name=\"action\" value=\"cabrecrut\">"; print "<input type=\"hidden\" name=\"action\" value=\"cabrecrut\">";
print "Cette société est un cabinet de recrutement : "; print "Cette société est un cabinet de recrutement : ";
print "<select name=\"selectvalue\">"; print "<select name=\"selectvalue\">";
@ -371,7 +358,9 @@ if ($socid > 0)
print "<input type=\"submit\" value=\"Mettre &agrave; jour\">"; print "<input type=\"submit\" value=\"Mettre &agrave; jour\">";
print "</form>\n"; print "</form>\n";
} else { }
else
{
/* /*
* *
* Liste des contacts * Liste des contacts
@ -382,9 +371,9 @@ if ($socid > 0)
print '<tr class="liste_titre"><td><b>Pr&eacute;nom Nom</b></td>'; print '<tr class="liste_titre"><td><b>Pr&eacute;nom Nom</b></td>';
print '<td><b>Poste</b></td><td><b>T&eacute;l</b></td>'; print '<td><b>Poste</b></td><td><b>T&eacute;l</b></td>';
print "<td><b>Fax</b></td><td><b>Email</b></td>"; print "<td><b>Fax</b></td><td><b>Email</b></td>";
print "<td align=\"center\"><a href=\"".DOL_URL_ROOT.'/contact/fiche.php?socid='.$socid."&amp;action=create\">Ajouter</a></td></tr>"; print "<td align=\"center\"><a href=\"".DOL_URL_ROOT.'/contact/fiche.php?socid='.$societe->id."&amp;action=create\">Ajouter</a></td></tr>";
$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 = $societe->id ORDER by p.datec";
$result = $db->query($sql); $result = $db->query($sql);
$i = 0 ; $num = $db->num_rows(); $i = 0 ; $num = $db->num_rows();
$var=1; $var=1;
@ -396,18 +385,18 @@ if ($socid > 0)
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print '<td>'; print '<td>';
//print '<a href="action/fiche.php?action=create&actionid=5&contactid='.$obj->idp.'&socid='.$objsoc->idp.'">'; //print '<a href="action/fiche.php?action=create&actionid=5&contactid='.$obj->idp.'&socid='.$societe->id.'">';
//print '<img border="0" src="/theme/'.$conf->theme.'/img/filenew.png"></a>&nbsp;'; //print '<img border="0" src="/theme/'.$conf->theme.'/img/filenew.png"></a>&nbsp;';
print '<a href="../comm/action/fiche.php?action=create&actionid=5&contactid='.$obj->idp.'&socid='.$objsoc->idp.'">'.$obj->firstname.' '. $obj->name.'</a>'; print '<a href="../comm/action/fiche.php?action=create&actionid=5&contactid='.$obj->idp.'&socid='.$societe->id.'">'.$obj->firstname.' '. $obj->name.'</a>';
if ($obj->note) if ($obj->note)
{ {
print "<br>".nl2br($obj->note); print "<br>".nl2br($obj->note);
} }
print "</td>"; print "</td>";
print "<td>$obj->poste&nbsp;</td>"; print "<td>$obj->poste&nbsp;</td>";
print '<td><a href="../comm/action/fiche.php?action=create&actionid=1&contactid='.$obj->idp.'&socid='.$objsoc->idp.'">'.$obj->phone.'</a>&nbsp;</td>'; print '<td><a href="../comm/action/fiche.php?action=create&actionid=1&contactid='.$obj->idp.'&socid='.$societe->id.'">'.$obj->phone.'</a>&nbsp;</td>';
print '<td><a href="../comm/action/fiche.php?action=create&actionid=2&contactid='.$obj->idp.'&socid='.$objsoc->idp.'">'.$obj->fax.'</a>&nbsp;</td>'; print '<td><a href="../comm/action/fiche.php?action=create&actionid=2&contactid='.$obj->idp.'&socid='.$societe->id.'">'.$obj->fax.'</a>&nbsp;</td>';
print '<td><a href="../comm/action/fiche.php?action=create&actionid=4&contactid='.$obj->idp.'&socid='.$objsoc->idp.'">'.$obj->email.'</a>&nbsp;</td>'; print '<td><a href="../comm/action/fiche.php?action=create&actionid=4&contactid='.$obj->idp.'&socid='.$societe->id.'">'.$obj->email.'</a>&nbsp;</td>';
print "<td align=\"center\"><a href=\"../contact/fiche.php?action=edit&amp;id=$obj->idp\">".img_edit()."</a></td>"; print "<td align=\"center\"><a href=\"../contact/fiche.php?action=edit&amp;id=$obj->idp\">".img_edit()."</a></td>";
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
@ -421,13 +410,13 @@ if ($socid > 0)
* *
*/ */
print '<table width="100%" cellspacing=0 border=0 cellpadding=2>'; print '<table width="100%" cellspacing=0 border=0 cellpadding=2>';
print '<tr class="liste_titre"><td><a href="action/index.php?socid='.$socid.'">Actions effectuées</a></td></tr>'; print '<tr class="liste_titre"><td><a href="action/index.php?socid='.$societe->id.'">Actions effectuées</a></td></tr>';
print '<tr>'; print '<tr>';
print '<td valign="top">'; 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 "; $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 .= " 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 = $societe->id ";
$sql .= " AND u.rowid = a.fk_user_author"; $sql .= " AND u.rowid = a.fk_user_author";
$sql .= " AND c.id=a.fk_action "; $sql .= " AND c.id=a.fk_action ";
$sql .= " ORDER BY a.datea DESC, a.id DESC"; $sql .= " ORDER BY a.datea DESC, a.id DESC";
@ -481,7 +470,7 @@ if ($socid > 0)
if ($obj->fk_contact) { if ($obj->fk_contact) {
$contact = new Contact($db); $contact = new Contact($db);
$contact->fetch($obj->fk_contact); $contact->fetch($obj->fk_contact);
print '<td width="40%"><a href="people.php?socid='.$objsoc->idp.'&contactid='.$contact->id.'">'.$contact->fullname.'</a></td>'; print '<td width="40%"><a href="people.php?socid='.$societe->id.'&contactid='.$contact->id.'">'.$contact->fullname.'</a></td>';
} else { } else {
print '<td width="40%">&nbsp;</td>'; print '<td width="40%">&nbsp;</td>';
} }
@ -504,9 +493,9 @@ if ($socid > 0)
* Notes sur la societe * Notes sur la societe
* *
*/ */
if ($objsoc->note) { if ($societe->note) {
print '<table border="1" width="100%" cellspacing="0" bgcolor="#e0e0e0">'; print '<table border="1" width="100%" cellspacing="0" bgcolor="#e0e0e0">';
print "<tr><td>".nl2br($objsoc->note)."</td></tr>"; print "<tr><td>".nl2br($societe->note)."</td></tr>";
print "</table>"; print "</table>";
} }
/* /*