Fix: bug #16281 : cration action impossible dans une fiche fournisseur
This commit is contained in:
parent
c2fed80874
commit
6957c80433
@ -64,39 +64,6 @@ if (!$user->rights->commercial->client->voir && $socid && !$user->societe_id > 0
|
||||
}
|
||||
|
||||
|
||||
/* TODO RODO
|
||||
if ($action == 'stcomm')
|
||||
{
|
||||
if ($stcommid <> 'null' && $stcommid <> $oldstcomm)
|
||||
{
|
||||
$sql = "INSERT INTO socstatutlog (datel, fk_soc, fk_statut, author) ";
|
||||
$sql .= " VALUES ('$dateaction',$socid,$stcommid,'" . $user->login . "')";
|
||||
$result = @$db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=$stcommid WHERE idp=$socid";
|
||||
$result = $db->query($sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$errmesg = "ERREUR DE DATE !";
|
||||
}
|
||||
}
|
||||
|
||||
if ($actioncommid)
|
||||
{
|
||||
$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);
|
||||
|
||||
if (!$result)
|
||||
{
|
||||
$errmesg = "ERREUR DE DATE !";
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
* Recherche
|
||||
*
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
*/
|
||||
|
||||
require('./pre.inc.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
||||
|
||||
$langs->load('suppliers');
|
||||
$langs->load('products');
|
||||
@ -36,19 +37,21 @@ $langs->load('bills');
|
||||
$langs->load('orders');
|
||||
$langs->load('companies');
|
||||
|
||||
// Sécurité accés client
|
||||
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
||||
|
||||
if ($socid == '') accessforbidden();
|
||||
|
||||
/*
|
||||
* Sécurité accés client
|
||||
*/
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
if ($socid == '') accessforbidden();
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Protection restriction commercial
|
||||
if (!$user->rights->commercial->client->voir && $socid && !$user->societe_id > 0)
|
||||
{
|
||||
@ -70,89 +73,89 @@ $societe = new Fournisseur($db);
|
||||
|
||||
if ( $societe->fetch($socid) )
|
||||
{
|
||||
$addons[0][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$socid;
|
||||
$addons[0][1] = $societe->nom;
|
||||
|
||||
llxHeader('',$langs->trans('SupplierCard').' : '.$societe->nom, $addons);
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$socid;
|
||||
$head[$h][1] = $langs->trans('Company');
|
||||
$h++;
|
||||
|
||||
if ($societe->client==1)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$socid;
|
||||
$head[$h][1] = $langs->trans('Customer');
|
||||
$h++;
|
||||
}
|
||||
if ($societe->client==2)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$socid;
|
||||
$head[$h][1] = $langs->trans('Prospect');
|
||||
$h++;
|
||||
}
|
||||
if ($societe->fournisseur)
|
||||
{
|
||||
$hselected=$h;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$socid;
|
||||
$head[$h][1] = $langs->trans('Supplier');
|
||||
$h++;
|
||||
}
|
||||
|
||||
if ($conf->compta->enabled || $conf->comptaexpert->enabled)
|
||||
{
|
||||
$langs->load('compta');
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$socid;
|
||||
$head[$h][1] = $langs->trans('Accountancy');
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$societe->id;
|
||||
$head[$h][1] = $langs->trans('Note');
|
||||
$h++;
|
||||
|
||||
if ($user->societe_id == 0)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$societe->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$societe->id;
|
||||
$head[$h][1] = $langs->trans('Notifications');
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$societe->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$h++;
|
||||
|
||||
dolibarr_fiche_head($head, $hselected, $societe->nom);
|
||||
$addons[0][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$socid;
|
||||
$addons[0][1] = $societe->nom;
|
||||
|
||||
llxHeader('',$langs->trans('SupplierCard').' : '.$societe->nom, $addons);
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$socid;
|
||||
$head[$h][1] = $langs->trans('Company');
|
||||
$h++;
|
||||
|
||||
if ($societe->client==1)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$socid;
|
||||
$head[$h][1] = $langs->trans('Customer');
|
||||
$h++;
|
||||
}
|
||||
if ($societe->client==2)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$socid;
|
||||
$head[$h][1] = $langs->trans('Prospect');
|
||||
$h++;
|
||||
}
|
||||
if ($societe->fournisseur)
|
||||
{
|
||||
$hselected=$h;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$socid;
|
||||
$head[$h][1] = $langs->trans('Supplier');
|
||||
$h++;
|
||||
}
|
||||
|
||||
if ($conf->compta->enabled || $conf->comptaexpert->enabled)
|
||||
{
|
||||
$langs->load('compta');
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$socid;
|
||||
$head[$h][1] = $langs->trans('Accountancy');
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$societe->id;
|
||||
$head[$h][1] = $langs->trans('Note');
|
||||
$h++;
|
||||
|
||||
if ($user->societe_id == 0)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$societe->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$societe->id;
|
||||
$head[$h][1] = $langs->trans('Notifications');
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$societe->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$h++;
|
||||
|
||||
dolibarr_fiche_head($head, $hselected, $societe->nom);
|
||||
|
||||
|
||||
|
||||
print '<table width="100%">';
|
||||
print '<tr><td valign="top" width="50%">';
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td width="20%">'.$langs->trans("Name").'</td><td width="80%" colspan="3">'.$societe->nom.'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$societe->prefix_comm.'</td></tr>';
|
||||
|
||||
if ($societe->fournisseur)
|
||||
{
|
||||
print '<tr><td nowrap="nowrap">';
|
||||
print $langs->trans('SupplierCode').'</td><td colspan="3">';
|
||||
print $societe->code_fournisseur;
|
||||
if ($societe->check_codefournisseur() <> 0) print ' '.$langs->trans("WrongSupplierCode");
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$societe->prefix_comm.'</td></tr>';
|
||||
|
||||
if ($societe->fournisseur)
|
||||
{
|
||||
print '<tr><td nowrap="nowrap">';
|
||||
print $langs->trans('SupplierCode').'</td><td colspan="3">';
|
||||
print $societe->code_fournisseur;
|
||||
if ($societe->check_codefournisseur() <> 0) print ' '.$langs->trans("WrongSupplierCode");
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">'.nl2br($societe->adresse).'</td></tr>';
|
||||
|
||||
|
||||
print '<tr><td>'.$langs->trans("Zip").'</td><td>'.$societe->cp.'</td>';
|
||||
print '<td>'.$langs->trans("Town").'</td><td>'.$societe->ville.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">'.$societe->pays.'</td></tr>';
|
||||
@ -170,79 +173,79 @@ if ( $societe->fetch($socid) )
|
||||
|
||||
|
||||
print '</td><td valign="top" width="50%">';
|
||||
$var=true;
|
||||
$var=true;
|
||||
|
||||
$MAXLIST=4;
|
||||
|
||||
// Lien recap
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="noborder"><tr><td>'.$langs->trans("Summary").'</td>';
|
||||
print '<td align="right"><a href="'.DOL_URL_ROOT.'/fourn/recap-fourn.php?socid='.$societe->id.'">'.$langs->trans("ShowSupplierPreview").'</a></td></tr></table></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
$MAXLIST=4;
|
||||
|
||||
/*
|
||||
* Liste des commandes associées
|
||||
*/
|
||||
// Lien recap
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="noborder"><tr><td>'.$langs->trans("Summary").'</td>';
|
||||
print '<td align="right"><a href="'.DOL_URL_ROOT.'/fourn/recap-fourn.php?socid='.$societe->id.'">'.$langs->trans("ShowSupplierPreview").'</a></td></tr></table></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
/*
|
||||
* Liste des commandes associées
|
||||
*/
|
||||
$orderstatic = new CommandeFournisseur($db);
|
||||
|
||||
$sql = "SELECT p.rowid,p.ref,".$db->pdate("p.date_commande")." as dc, p.fk_statut";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p ";
|
||||
$sql.= " WHERE p.fk_soc =".$societe->id;
|
||||
$sql.= " ORDER BY p.rowid";
|
||||
$sql.= " ".$db->plimit($MAXLIST);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i = 0 ;
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">';
|
||||
print '<table class="noborder" width="100%"><tr><td>'.$langs->trans("LastOrders",($num<=$MAXLIST?"":$MAXLIST)).'</td>';
|
||||
print '<td align="right"><a href="commande/liste.php?socid='.$societe->id.'">'.$langs->trans("AllOrders").' ('.$num.')</td></tr></table>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
while ($i < $num && $i <= $MAXLIST)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td><a href="commande/fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowOrder"),"order")." ".$obj->ref.'</a></td>';
|
||||
print '<td align="center" width="80">';
|
||||
if ($obj->dc)
|
||||
{
|
||||
print dolibarr_print_date($obj->dc);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "-";
|
||||
}
|
||||
print '</td>';
|
||||
$sql = "SELECT p.rowid,p.ref,".$db->pdate("p.date_commande")." as dc, p.fk_statut";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p ";
|
||||
$sql.= " WHERE p.fk_soc =".$societe->id;
|
||||
$sql.= " ORDER BY p.rowid";
|
||||
$sql.= " ".$db->plimit($MAXLIST);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i = 0 ;
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">';
|
||||
print '<table class="noborder" width="100%"><tr><td>'.$langs->trans("LastOrders",($num<=$MAXLIST?"":$MAXLIST)).'</td>';
|
||||
print '<td align="right"><a href="commande/liste.php?socid='.$societe->id.'">'.$langs->trans("AllOrders").' ('.$num.')</td></tr></table>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
while ($i < $num && $i <= $MAXLIST)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td><a href="commande/fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowOrder"),"order")." ".$obj->ref.'</a></td>';
|
||||
print '<td align="center" width="80">';
|
||||
if ($obj->dc)
|
||||
{
|
||||
print dolibarr_print_date($obj->dc);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "-";
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="right" nowrap="nowrap">'.$orderstatic->LibStatut($obj->fk_statut,5).'</td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
if ($num > 0)
|
||||
{
|
||||
print "</table><br>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
if ($num > 0)
|
||||
{
|
||||
print "</table><br>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Liste des factures associées
|
||||
*/
|
||||
/*
|
||||
* Liste des factures associées
|
||||
*/
|
||||
$MAXLIST=5;
|
||||
|
||||
$langs->load('bills');
|
||||
@ -293,15 +296,15 @@ if ( $societe->fetch($socid) )
|
||||
/*
|
||||
* Liste des produits
|
||||
*/
|
||||
if ($conf->produit->enabled || $conf->service->enabled)
|
||||
{
|
||||
$langs->load("products");
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("ProductsAndServices").'</td><td align="right">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/fourn/product/liste.php?fourn_id='.$societe->id.'">'.$langs->trans("All").' ('.$societe->NbProduct().')';
|
||||
print '</a></td></tr></table><br>';
|
||||
}
|
||||
if ($conf->produit->enabled || $conf->service->enabled)
|
||||
{
|
||||
$langs->load("products");
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("ProductsAndServices").'</td><td align="right">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/fourn/product/liste.php?fourn_id='.$societe->id.'">'.$langs->trans("All").' ('.$societe->NbProduct().')';
|
||||
print '</a></td></tr></table><br>';
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
print '</table>' . "\n";
|
||||
@ -313,98 +316,311 @@ if ( $societe->fetch($socid) )
|
||||
* Barre d'actions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
|
||||
if ($user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
$langs->load("orders");
|
||||
print '<a class="tabAction" href="'.DOL_URL_ROOT.'/fourn/commande/fiche.php?action=create&socid='.$societe->id.'">'.$langs->trans("AddOrder").'</a>';
|
||||
}
|
||||
|
||||
|
||||
if ($user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
$langs->load("bills");
|
||||
print '<a class="tabAction" href="'.DOL_URL_ROOT.'/fourn/facture/fiche.php?action=create&socid='.$societe->id.'">'.$langs->trans("AddBill").'</a>';
|
||||
}
|
||||
|
||||
print '<a class="butAction" href="action/fiche.php?action=create&socid='.$objsoc->id.'">'.$langs->trans("AddAction").'</a>';
|
||||
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&socid='.$societe->id.'">'.$langs->trans("AddAction").'</a>';
|
||||
|
||||
if ($user->rights->societe->contact->creer)
|
||||
{
|
||||
print "<a class=\"tabAction\" href=\"".DOL_URL_ROOT.'/contact/fiche.php?socid='.$socid."&action=create\">".$langs->trans("AddContact")."</a>";
|
||||
}
|
||||
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Liste des contacts
|
||||
*
|
||||
*/
|
||||
/*
|
||||
*
|
||||
* Liste des contacts
|
||||
*
|
||||
*/
|
||||
$langs->load("companies");
|
||||
|
||||
|
||||
print '<br><table class="noborder" width="100%">';
|
||||
|
||||
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Firstname").' '.$langs->trans("Lastname").'</td>';
|
||||
print '<td>'.$langs->trans("Poste").'</td><td>'.$langs->trans("Tel").'</td>';
|
||||
print "<td>".$langs->trans("Fax")."</td><td>".$langs->trans("EMail")."</td>";
|
||||
print "<td align=\"center\"> </td>";
|
||||
print '<td> </td>';
|
||||
print "</tr>";
|
||||
|
||||
$sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as p";
|
||||
$sql.= " WHERE p.fk_soc = ".$societe->id;
|
||||
$sql.= " ORDER by p.datec";
|
||||
|
||||
$result = $db->query($sql);
|
||||
$sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as p";
|
||||
$sql.= " WHERE p.fk_soc = ".$societe->id;
|
||||
$sql.= " ORDER by p.datec";
|
||||
|
||||
$i = 0 ;
|
||||
$num = $db->num_rows($result);
|
||||
$var=true;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var = !$var;
|
||||
$result = $db->query($sql);
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
$i = 0 ;
|
||||
$num = $db->num_rows($result);
|
||||
$var=true;
|
||||
|
||||
print '<td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$obj->idp.'">';
|
||||
print img_object($langs->trans("ShowContact"),"contact");
|
||||
print ' '.$obj->firstname.' '. $obj->name.'</a> ';
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var = !$var;
|
||||
|
||||
if ($obj->note)
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$obj->idp.'">';
|
||||
print img_object($langs->trans("ShowContact"),"contact");
|
||||
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="../comm/action/fiche.php?action=create&actionid=1&contactid='.$obj->idp.'&socid='.$societe->id.'">'.$obj->phone.'</a> </td>';
|
||||
print '<td><a href="../comm/action/fiche.php?action=create&actionid=2&contactid='.$obj->idp.'&socid='.$societe->id.'">'.$obj->fax.'</a> </td>';
|
||||
print '<td><a href="../comm/action/fiche.php?action=create&actionid=4&contactid='.$obj->idp.'&socid='.$societe->id.'">'.$obj->email.'</a> </td>';
|
||||
|
||||
if ($user->rights->societe->contact->creer)
|
||||
{
|
||||
print "<td align=\"center\"><a href=\"../contact/fiche.php?action=edit&id=$obj->idp\">".img_edit()."</a></td>";
|
||||
}
|
||||
|
||||
print '<td align="center"><a href="../comm/action/fiche.php?action=create&actionid=5&contactid='.$obj->idp.'&socid='.$societe->id.'">';
|
||||
print img_object($langs->trans("Rendez-Vous"),"action");
|
||||
print '</a></td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
/*
|
||||
* Listes des actions a faire
|
||||
*
|
||||
*/
|
||||
print '<table width="100%" class="noborder">';
|
||||
print '<tr class="liste_titre"><td colspan="10"><a href="action/index.php?socid='.$societe->id.'">'.$langs->trans("ActionsToDo").'</a></td><td align="right"> </td></tr>';
|
||||
|
||||
$sql = "SELECT a.id, a.label, ".$db->pdate("a.datea")." as da, c.code as acode, 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 = ".$societe->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";
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$i = 0 ;
|
||||
$num = $db->num_rows($result);
|
||||
$var=true;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$var = !$var;
|
||||
|
||||
$obj = $db->fetch_object($result);
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
if ($oldyear == strftime("%Y",$obj->da) )
|
||||
{
|
||||
print "<br>".nl2br($obj->note);
|
||||
print '<td width="30" align="center">|</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td width="30" align="center">'.strftime("%Y",$obj->da)."</td>\n";
|
||||
$oldyear = strftime("%Y",$obj->da);
|
||||
}
|
||||
print "</td>";
|
||||
print "<td>$obj->poste </td>";
|
||||
print '<td><a href="../comm/action/fiche.php?action=create&actionid=1&contactid='.$obj->idp.'&socid='.$societe->id.'">'.$obj->phone.'</a> </td>';
|
||||
print '<td><a href="../comm/action/fiche.php?action=create&actionid=2&contactid='.$obj->idp.'&socid='.$societe->id.'">'.$obj->fax.'</a> </td>';
|
||||
print '<td><a href="../comm/action/fiche.php?action=create&actionid=4&contactid='.$obj->idp.'&socid='.$societe->id.'">'.$obj->email.'</a> </td>';
|
||||
|
||||
if ($user->rights->societe->contact->creer)
|
||||
{
|
||||
print "<td align=\"center\"><a href=\"../contact/fiche.php?action=edit&id=$obj->idp\">".img_edit()."</a></td>";
|
||||
}
|
||||
|
||||
print '<td align="center"><a href="../comm/action/fiche.php?action=create&actionid=5&contactid='.$obj->idp.'&socid='.$societe->id.'">';
|
||||
print img_object($langs->trans("Rendez-Vous"),"action");
|
||||
print '</a></td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
if ($oldmonth == strftime("%Y%b",$obj->da) )
|
||||
{
|
||||
print '<td width="30" align="center">|</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td width="30" align="center">' .strftime("%b",$obj->da)."</td>\n";
|
||||
$oldmonth = strftime("%Y%b",$obj->da);
|
||||
}
|
||||
|
||||
print '<td width="20">'.strftime("%d",$obj->da)."</td>\n";
|
||||
print '<td width="30" nowrap="nowrap">'.strftime("%H:%M",$obj->da).'</td>';
|
||||
|
||||
// Picto warning
|
||||
print '<td width="16">';
|
||||
if (date("U",$obj->da) < time()) print ' '.img_warning("Late");
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
// Status/Percent
|
||||
print '<td width="30"> </td>';
|
||||
|
||||
if ($obj->propalrowid)
|
||||
{
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/comm/propal.php?propalid='.$obj->propalrowid.'">'.img_object($langs->trans("ShowAction"),"task");
|
||||
$transcode=$langs->trans("Action".$obj->acode);
|
||||
$libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle);
|
||||
print $libelle;
|
||||
print '</a></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$obj->id.'">'.img_object($langs->trans("ShowAction"),"task");
|
||||
$transcode=$langs->trans("Action".$obj->acode);
|
||||
$libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle);
|
||||
print $libelle;
|
||||
print '</a></td>';
|
||||
}
|
||||
|
||||
print '<td colspan="2">'.$obj->label.'</td>';
|
||||
|
||||
// Contact pour cette action
|
||||
if ($obj->fk_contact)
|
||||
{
|
||||
$contact = new Contact($db);
|
||||
$contact->fetch($obj->fk_contact);
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$obj->fk_contact.'">'.img_object($langs->trans("ShowContact"),"contact").' '.$contact->fullname.'</a></td>';
|
||||
} else {
|
||||
print '<td> </td>';
|
||||
}
|
||||
|
||||
// Auteur
|
||||
print '<td width="50" nowrap="nowrap"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->fk_user_author.'">'.img_object($langs->trans("ShowUser"),"user").' '.$obj->code.'</a></td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
$db->free($result);
|
||||
} else {
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
print "</table><br>";
|
||||
|
||||
/*
|
||||
* Listes des actions effectuées
|
||||
*/
|
||||
print '<table width="100%" class="noborder">';
|
||||
print '<tr class="liste_titre"><td colspan="11"><a href="action/index.php?socid='.$societe->id.'">'.$langs->trans("ActionsDone").'</a></td></tr>';
|
||||
|
||||
$sql = "SELECT a.id, a.label, ".$db->pdate("a.datea")." as da,";
|
||||
$sql.= " a.propalrowid, a.fk_facture, a.fk_user_author, a.fk_contact,";
|
||||
$sql.= " c.code as acode, c.libelle,";
|
||||
$sql.= " u.code, 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 = ".$societe->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";
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$i = 0 ;
|
||||
$num = $db->num_rows($result);
|
||||
$var=true;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$var = !$var;
|
||||
|
||||
$obj = $db->fetch_object($result);
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
if ($oldyear == strftime("%Y",$obj->da) )
|
||||
{
|
||||
print '<td width="30" align="center">|</td>';
|
||||
} else {
|
||||
print '<td width="30" align="center">'.strftime("%Y",$obj->da)."</td>\n";
|
||||
$oldyear = strftime("%Y",$obj->da);
|
||||
}
|
||||
|
||||
if ($oldmonth == strftime("%Y%b",$obj->da) )
|
||||
{
|
||||
print '<td width="30" align="center">|</td>';
|
||||
} else {
|
||||
print '<td width="30" align="center">'.strftime("%b",$obj->da)."</td>\n";
|
||||
$oldmonth = strftime("%Y%b",$obj->da);
|
||||
}
|
||||
|
||||
print '<td width="20">'.strftime("%d",$obj->da)."</td>\n";
|
||||
print '<td width="30">'.strftime("%H:%M",$obj->da)."</td>\n";
|
||||
|
||||
// Picto
|
||||
print '<td width="16"> </td>';
|
||||
|
||||
// Espace
|
||||
print '<td width="30"> </td>';
|
||||
|
||||
// Action
|
||||
print '<td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$obj->id.'">'.img_object($langs->trans("ShowTask"),"task");
|
||||
$transcode=$langs->trans("Action".$obj->acode);
|
||||
$libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle);
|
||||
print $libelle;
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
|
||||
// Objet li
|
||||
print '<td>';
|
||||
if ($obj->propalrowid)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/propal.php?propalid='.$obj->propalrowid.'">'.img_object($langs->trans("ShowPropal"),"propal");
|
||||
print $langs->trans("Propal");
|
||||
print '</a>';
|
||||
}
|
||||
if ($obj->fk_facture)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->fk_facture.'">'.img_object($langs->trans("ShowBill"),"bill");
|
||||
print $langs->trans("Invoice");
|
||||
print '</a>';
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
// Libell
|
||||
print "<td>$obj->label</td>";
|
||||
|
||||
// Contact pour cette action
|
||||
if ($obj->fk_contact)
|
||||
{
|
||||
$contact = new Contact($db);
|
||||
$contact->fetch($obj->fk_contact);
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$contact->id.'">'.img_object($langs->trans("ShowContact"),"contact").' '.$contact->fullname.'</a></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
|
||||
// Auteur
|
||||
print '<td nowrap="nowrap" width="50"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->code.'</a></td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
print "</table>";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
$db->close();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user