Remove duplicate code
This commit is contained in:
parent
95068050b0
commit
d0cbd05e0d
@ -31,6 +31,7 @@ require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/contact.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("users");
|
||||
@ -475,6 +476,8 @@ if ($user->rights->societe->contact->creer)
|
||||
|
||||
if ($_GET["id"] && $_GET["action"] != 'edit')
|
||||
{
|
||||
$objsoc = new Societe($db);
|
||||
|
||||
/*
|
||||
* Fiche en mode visualisation
|
||||
*
|
||||
@ -495,7 +498,6 @@ if ($_GET["id"] && $_GET["action"] != 'edit')
|
||||
// Company
|
||||
if ($contact->socid > 0)
|
||||
{
|
||||
$objsoc = new Societe($db);
|
||||
$objsoc->fetch($contact->socid);
|
||||
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="3">'.$objsoc->getNomUrl(1).'</td></tr>';
|
||||
@ -633,143 +635,12 @@ if ($_GET["id"] && $_GET["action"] != 'edit')
|
||||
}
|
||||
|
||||
|
||||
// Historique des actions sur ce contact
|
||||
print_titre($langs->trans("TasksHistoryForThisContact"));
|
||||
$histo=array();
|
||||
$numaction = 0 ;
|
||||
print show_actions_todo($conf,$langs,$db,$objsoc,$contact);
|
||||
|
||||
// Recherche histo sur actioncomm
|
||||
$sql = "SELECT a.id, ".$db->pdate("a.datep")." as da, a.note, a.percent as percentage,";
|
||||
$sql.= " c.code as acode, c.libelle,";
|
||||
$sql.= " u.rowid as user_id, u.login";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u ";
|
||||
$sql.= " WHERE fk_contact = ".$contact->id;
|
||||
$sql.= " AND u.rowid = a.fk_user_author";
|
||||
$sql.= " AND c.id=a.fk_action";
|
||||
$sql.= " ORDER BY a.datea DESC, a.id DESC";
|
||||
|
||||
dolibarr_syslog("contact/fiche.php sql=".$sql, LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i = 0 ;
|
||||
$num = $db->num_rows($resql);
|
||||
$var=true;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$histo[$numaction]=array('type'=>'action','id'=>$obj->id,'date'=>$obj->da,'note'=>$obj->note,'percent'=>$obj->percentage,
|
||||
'acode'=>$obj->acode,'libelle'=>$obj->libelle,
|
||||
'userid'=>$obj->user_id,'login'=>$obj->login);
|
||||
$numaction++;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
// Recherche histo sur mailing
|
||||
$sql = "SELECT m.rowid as id, ".$db->pdate("mc.date_envoi")." as da, m.titre as note, '100' as percentage,";
|
||||
$sql.= " 'AC_EMAILING' as acode,";
|
||||
$sql.= " u.rowid as user_id, u.login"; // User that valid action
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE mc.email = '".addslashes($contact->email)."'"; // Search is done on email.
|
||||
$sql.= " AND mc.statut = 1";
|
||||
$sql.= " AND u.rowid = m.fk_user_valid";
|
||||
$sql.= " AND mc.fk_mailing=m.rowid";
|
||||
$sql.= " ORDER BY mc.date_envoi DESC, m.rowid DESC";
|
||||
|
||||
dolibarr_syslog("contact/fiche.php sql=".$sql, LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i = 0 ;
|
||||
$num = $db->num_rows($resql);
|
||||
$var=true;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$histo[$numaction]=array('type'=>'mailing','id'=>$obj->id,'date'=>$obj->da,'note'=>$obj->note,'percent'=>$obj->percentage,
|
||||
'acode'=>$obj->acode,'libelle'=>$obj->libelle,
|
||||
'userid'=>$obj->user_id,'login'=>$obj->login,
|
||||
'contact_id'=>$obj->contact_id);
|
||||
$numaction++;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
// Affichage actions sur contact
|
||||
print '<table width="100%" class="noborder">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Date").'</td>';
|
||||
print '<td>'.$langs->trans("Actions").'</td>';
|
||||
print '<td>'.$langs->trans("Comments").'</td>';
|
||||
print '<td>'.$langs->trans("Author").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Status").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
foreach ($histo as $key=>$value)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
// Date
|
||||
print "<td>". dolibarr_print_date($histo[$key]['date'],"dayhour") ."</td>";
|
||||
|
||||
// Action
|
||||
print '<td>';
|
||||
if ($histo[$key]['type']=='action')
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$histo[$key]['id'].'">'.img_object($langs->trans("ShowTask"),"task").' ';
|
||||
$transcode=$langs->trans("Action".$histo[$key]['acode']);
|
||||
$libelle=($transcode!="Action".$histo[$key]['acode']?$transcode:$histo[$key]['libelle']);
|
||||
print dolibarr_trunc($libelle,30);
|
||||
print '</a>';
|
||||
}
|
||||
if ($histo[$key]['type']=='mailing')
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/mailing/fiche.php?id='.$histo[$key]['id'].'">'.img_object($langs->trans("ShowEMailing"),"email").' ';
|
||||
$transcode=$langs->trans("Action".$histo[$key]['acode']);
|
||||
$libelle=($transcode!="Action".$histo[$key]['acode']?$transcode:'Send mass mailing');
|
||||
print dolibarr_trunc($libelle,30);
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Note
|
||||
print '<td>'.dolibarr_trunc($histo[$key]['note'], 30).'</td>';
|
||||
|
||||
// Author
|
||||
print '<td>';
|
||||
if ($histo[$key]['login'])
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$histo[$key]['userid'].'">'.img_object($langs->trans("ShowUser"),'user').' '.$histo[$key]['login'].'</a>';
|
||||
}
|
||||
else print " ";
|
||||
print "</td>";
|
||||
|
||||
// Status/Percent
|
||||
print '<td align="right">';
|
||||
$actionstatic=new ActionComm($db);
|
||||
print $actionstatic->LibStatut($histo[$key]['percent'],5);
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
print '<br>';
|
||||
print show_actions_done($conf,$langs,$db,$objsoc,$contact);
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
|
||||
?>
|
||||
|
||||
@ -20,12 +20,18 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/lib/company.lib.php
|
||||
\brief Ensemble de fonctions de base pour le module societe
|
||||
\ingroup societe
|
||||
\version $Id$
|
||||
* \file htdocs/lib/company.lib.php
|
||||
* \brief Ensemble de fonctions de base pour le module societe
|
||||
* \ingroup societe
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param unknown_type $objsoc
|
||||
* @return unknown
|
||||
*/
|
||||
function societe_prepare_head($objsoc)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
@ -126,7 +132,12 @@ function societe_prepare_head($objsoc)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param unknown_type $objsoc
|
||||
* @return unknown
|
||||
*/
|
||||
function societe_prepare_head2($objsoc)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
@ -226,7 +237,7 @@ function getFormeJuridiqueLabel($code)
|
||||
|
||||
|
||||
/**
|
||||
* \brief Show html area for list of contacts
|
||||
* \brief Show html area for list of contacts
|
||||
*/
|
||||
function show_contacts($conf,$langs,$db,$objsoc)
|
||||
{
|
||||
@ -336,9 +347,14 @@ function show_contacts($conf,$langs,$db,$objsoc)
|
||||
|
||||
|
||||
/**
|
||||
* \brief Show html area with actions to do
|
||||
* \brief Show html area with actions to do
|
||||
* \param conf Object conf
|
||||
* \param langs Object langs
|
||||
* \param db Object db
|
||||
* \param objsoc Object third party
|
||||
* \param objcon Object contact
|
||||
*/
|
||||
function show_actions_todo($conf,$langs,$db,$objsoc)
|
||||
function show_actions_todo($conf,$langs,$db,$objsoc,$objcon='')
|
||||
{
|
||||
global $bc;
|
||||
|
||||
@ -349,11 +365,12 @@ function show_actions_todo($conf,$langs,$db,$objsoc)
|
||||
$userstatic=new User($db);
|
||||
$contactstatic = new Contact($db);
|
||||
|
||||
print_titre($langs->trans("ActionsOnCompany"));
|
||||
if (is_object($objcon) && $objcon->id) print_titre($langs->trans("TasksHistoryForThisContact"));
|
||||
else print_titre($langs->trans("ActionsOnCompany"));
|
||||
|
||||
print '<table width="100%" class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="11"><a href="'.DOL_URL_ROOT.'/comm/action/listactions.php?socid='.$objsoc->id.'&status=todo">'.$langs->trans("ActionsToDoShort").'</a></td><td align="right"> </td>';
|
||||
print '<td colspan="7"><a href="'.DOL_URL_ROOT.'/comm/action/listactions.php?socid='.$objsoc->id.'&status=todo">'.$langs->trans("ActionsToDoShort").'</a></td><td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
$sql = "SELECT a.id, a.label,";
|
||||
@ -385,16 +402,9 @@ function show_actions_todo($conf,$langs,$db,$objsoc)
|
||||
$var = !$var;
|
||||
|
||||
$obj = $db->fetch_object($result);
|
||||
print "<tr $bc[$var]>";
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
print '<td width="30" align="center">'.strftime("%Y",$obj->dp)."</td>\n";
|
||||
$oldyear = strftime("%Y",$obj->dp);
|
||||
|
||||
print '<td width="30" align="center">' .strftime("%b",$obj->dp)."</td>\n";
|
||||
$oldmonth = strftime("%Y%b",$obj->dp);
|
||||
|
||||
print '<td width="20">'.strftime("%d",$obj->dp)."</td>\n";
|
||||
print '<td width="30" nowrap="nowrap">'.strftime("%H:%M",$obj->dp).'</td>';
|
||||
print '<td width="100" align="left">'.dolibarr_print_date($obj->dp,'dayhour')."</td>\n";
|
||||
|
||||
// Picto warning
|
||||
print '<td width="16">';
|
||||
@ -402,12 +412,9 @@ function show_actions_todo($conf,$langs,$db,$objsoc)
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
// Status/Percent
|
||||
print '<td width="30"> </td>';
|
||||
|
||||
if ($obj->propalrowid)
|
||||
{
|
||||
print '<td><a href="propal.php?propalid='.$obj->propalrowid.'">'.img_object($langs->trans("ShowAction"),"task");
|
||||
print '<td width="140" ><a href="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;
|
||||
@ -418,23 +425,24 @@ function show_actions_todo($conf,$langs,$db,$objsoc)
|
||||
$actionstatic->code=$obj->acode;
|
||||
$actionstatic->libelle=$obj->libelle;
|
||||
$actionstatic->id=$obj->id;
|
||||
print '<td>'.$actionstatic->getNomUrl(1,16).'</td>';
|
||||
print '<td width="140">'.$actionstatic->getNomUrl(1,16).'</td>';
|
||||
}
|
||||
|
||||
print '<td colspan="2">'.$obj->label.'</td>';
|
||||
|
||||
// Contact pour cette action
|
||||
if ($obj->fk_contact > 0)
|
||||
if (! $objcon->id && $obj->fk_contact > 0)
|
||||
{
|
||||
$contactstatic->name=$obj->name;
|
||||
$contactstatic->firstname=$obj->firstname;
|
||||
$contactstatic->id=$obj->fk_contact;
|
||||
print '<td>'.$contactstatic->getNomUrl(1).'</td>';
|
||||
print '<td width="120">'.$contactstatic->getNomUrl(1,'',10).'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
|
||||
|
||||
print '<td width="80" nowrap="nowrap">';
|
||||
$userstatic->id=$obj->fk_user_author;
|
||||
$userstatic->login=$obj->login;
|
||||
@ -466,141 +474,220 @@ function show_actions_todo($conf,$langs,$db,$objsoc)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Show html area with actions done
|
||||
* \brief Show html area with actions done
|
||||
* \param conf Object conf
|
||||
* \param langs Object langs
|
||||
* \param db Object db
|
||||
* \param objsoc Object third party
|
||||
* \param objcon Object contact
|
||||
*/
|
||||
function show_actions_done($conf,$langs,$db,$objsoc)
|
||||
function show_actions_done($conf,$langs,$db,$objsoc,$objcon='')
|
||||
{
|
||||
global $bc;
|
||||
|
||||
$histo=array();
|
||||
$numaction = 0 ;
|
||||
|
||||
if ($conf->agenda->enabled)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
||||
$actionstatic=new ActionComm($db);
|
||||
$userstatic=new User($db);
|
||||
$contactstatic = new Contact($db);
|
||||
$facturestatic=new Facture($db);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="12"><a href="'.DOL_URL_ROOT.'/comm/action/listactions.php?socid='.$objsoc->id.'&status=done">'.$langs->trans("ActionsDoneShort").'</a></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Recherche histo sur actioncomm
|
||||
$sql = "SELECT a.id, a.label,";
|
||||
$sql.= " ".$db->pdate("a.datep")." as dp,";
|
||||
$sql.= " ".$db->pdate("a.datep2")." as dp2,";
|
||||
$sql.= " a.percent,";
|
||||
$sql.= " a.propalrowid, a.fk_facture, a.fk_user_author, a.fk_contact,";
|
||||
$sql.= " a.note, a.percent,";
|
||||
$sql.= " a.propalrowid as pid, a.fk_commande as oid, a.fk_facture as fid,";
|
||||
$sql.= " a.fk_user_author, a.fk_contact,";
|
||||
$sql.= " c.code as acode, c.libelle,";
|
||||
$sql.= " u.login, u.rowid,";
|
||||
$sql.= " sp.name, sp.firstname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
||||
$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.datep2 DESC, a.id DESC";
|
||||
|
||||
dolibarr_syslog("comm/fiche.php sql=".$sql);
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
$sql.= " WHERE u.rowid = a.fk_user_author";
|
||||
if ($objsoc->id) $sql.= " AND a.fk_soc = ".$objsoc->id;
|
||||
if ($objcon->id) $sql.= " AND a.fk_contact = ".$objcon->id;
|
||||
$sql.= " AND c.id=a.fk_action";
|
||||
$sql.= " AND a.percent = 100";
|
||||
$sql.= " ORDER BY a.datea DESC, a.id DESC";
|
||||
|
||||
dolibarr_syslog("company.lib::show_actions_done sql=".$sql, LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i = 0 ;
|
||||
$num = $db->num_rows($result);
|
||||
$oldyear='';
|
||||
$oldmonth='';
|
||||
$num = $db->num_rows($resql);
|
||||
$var=true;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$var = !$var;
|
||||
|
||||
$obj = $db->fetch_object($result);
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
// Champ date
|
||||
print '<td width="30" align="center">'.strftime("%Y",$obj->dp2)."</td>\n";
|
||||
$oldyear = strftime("%Y",$obj->dp2);
|
||||
print '<td width="30" align="center">'.strftime("%b",$obj->dp2)."</td>\n";
|
||||
$oldmonth = strftime("%Y%b",$obj->dp2);
|
||||
print '<td width="20">'.strftime("%d",$obj->dp2)."</td>\n";
|
||||
print '<td width="30">'.strftime("%H:%M",$obj->dp2)."</td>\n";
|
||||
|
||||
// Picto
|
||||
print '<td width="16"> </td>';
|
||||
|
||||
// Espace
|
||||
print '<td width="30"> </td>';
|
||||
|
||||
// Action
|
||||
print '<td>';
|
||||
$actionstatic->code=$obj->acode;
|
||||
$actionstatic->libelle=$obj->libelle;
|
||||
$actionstatic->id=$obj->id;
|
||||
print $actionstatic->getNomUrl(1,16);
|
||||
print '</td>';
|
||||
|
||||
// Objet lie
|
||||
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)
|
||||
{
|
||||
$facturestatic->ref=$langs->trans("Invoice");
|
||||
$facturestatic->id=$obj->fk_facture;
|
||||
$facturestatic->type=$obj->type;
|
||||
print $facturestatic->getNomUrl(1,'compta');
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
// Libelle
|
||||
print '<td>'.$obj->label.'</td>';
|
||||
|
||||
// Contact pour cette action
|
||||
if ($obj->fk_contact > 0)
|
||||
{
|
||||
$contactstatic->name=$obj->name;
|
||||
$contactstatic->firstname=$obj->firstname;
|
||||
$contactstatic->id=$obj->fk_contact;
|
||||
print '<td>'.$contactstatic->getNomUrl(1).'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
|
||||
// Auteur
|
||||
print '<td nowrap="nowrap" width="80">';
|
||||
$userstatic->id=$obj->rowid;
|
||||
$userstatic->login=$obj->login;
|
||||
print $userstatic->getLoginUrl(1);
|
||||
print '</td>';
|
||||
|
||||
// Statut
|
||||
print '<td nowrap="nowrap" width="20">'.$actionstatic->LibStatut($obj->percent,3).'</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$obj = $db->fetch_object($resql);
|
||||
$histo[$numaction]=array('type'=>'action','id'=>$obj->id,'date'=>$obj->dp2,'note'=>$obj->label,'percent'=>$obj->percent,
|
||||
'acode'=>$obj->acode,'libelle'=>$obj->libelle,
|
||||
'userid'=>$obj->user_id,'login'=>$obj->login,
|
||||
'contact_id'=>$obj->fk_contact,'name'=>$obj->name,'firstname'=>$obj->firstname,
|
||||
'pid'=>$obj->pid,'oid'=>$obj->oid,'fid'=>$obj->fid);
|
||||
$numaction++;
|
||||
$i++;
|
||||
}
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
print "<br>\n";
|
||||
}
|
||||
|
||||
if ($conf->mailing->enabled && $objcon->email)
|
||||
{
|
||||
$langs->load("mails");
|
||||
|
||||
// Recherche histo sur mailing
|
||||
$sql = "SELECT m.rowid as id, ".$db->pdate("mc.date_envoi")." as da, m.titre as note, '100' as percentage,";
|
||||
$sql.= " 'AC_EMAILING' as acode,";
|
||||
$sql.= " u.rowid as user_id, u.login"; // User that valid action
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE mc.email = '".addslashes($objcon->email)."'"; // Search is done on email.
|
||||
$sql.= " AND mc.statut = 1";
|
||||
$sql.= " AND u.rowid = m.fk_user_valid";
|
||||
$sql.= " AND mc.fk_mailing=m.rowid";
|
||||
$sql.= " ORDER BY mc.date_envoi DESC, m.rowid DESC";
|
||||
|
||||
dolibarr_syslog("compan.lib::show_actions_done sql=".$sql, LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i = 0 ;
|
||||
$num = $db->num_rows($resql);
|
||||
$var=true;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$histo[$numaction]=array('type'=>'mailing','id'=>$obj->id,'date'=>$obj->da,'note'=>$obj->note,'percent'=>$obj->percentage,
|
||||
'acode'=>$obj->acode,'libelle'=>$obj->libelle,
|
||||
'userid'=>$obj->user_id,'login'=>$obj->login,
|
||||
'contact_id'=>$obj->contact_id);
|
||||
$numaction++;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($conf->agenda->enabled || ($conf->mailing->enabled && $objcon->email))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
||||
$actionstatic=new ActionComm($db);
|
||||
$userstatic=new User($db);
|
||||
$contactstatic = new Contact($db);
|
||||
$propalstatic=new Propal($db);
|
||||
$orderstatic=new Commande($db);
|
||||
$facturestatic=new Facture($db);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="8"><a href="'.DOL_URL_ROOT.'/comm/action/listactions.php?socid='.$objsoc->id.'&status=done">'.$langs->trans("ActionsDoneShort").'</a></td>';
|
||||
print '</tr>';
|
||||
|
||||
foreach ($histo as $key=>$value)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
// Champ date
|
||||
print '<td width="100" align="left">'.dolibarr_print_date($histo[$key]['date'],'dayhour')."</td>\n";
|
||||
|
||||
// Picto
|
||||
print '<td width="16"> </td>';
|
||||
|
||||
// Action
|
||||
print '<td width="140">';
|
||||
if ($histo[$key]['type']=='action')
|
||||
{
|
||||
$actionstatic->code=$histo[$key]['acode'];
|
||||
$actionstatic->libelle=$histo[$key]['libelle'];
|
||||
$actionstatic->id=$histo[$key]['id'];
|
||||
print $actionstatic->getNomUrl(1,16);
|
||||
}
|
||||
if ($histo[$key]['type']=='mailing')
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/mailing/fiche.php?id='.$histo[$key]['id'].'">'.img_object($langs->trans("ShowEMailing"),"email").' ';
|
||||
$transcode=$langs->trans("Action".$histo[$key]['acode']);
|
||||
$libelle=($transcode!="Action".$histo[$key]['acode']?$transcode:'Send mass mailing');
|
||||
print dolibarr_trunc($libelle,30);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Note
|
||||
print '<td>'.dolibarr_trunc($histo[$key]['note'], 30).'</td>';
|
||||
|
||||
// Objet lie
|
||||
print '<td>';
|
||||
if ($histo[$key]['pid'] && $conf->propal->enabled)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/propal.php?propalid='.$histo[$key]['pid'].'">'.img_object($langs->trans("ShowPropal"),"propal");
|
||||
print $langs->trans("Propal");
|
||||
print '</a>';
|
||||
}
|
||||
elseif ($histo[$key]['oid'] && $conf->commande->enabled)
|
||||
{
|
||||
$orderstatic->ref=$langs->trans("Order");
|
||||
$orderstatic->id=$histo[$key]['oid'];
|
||||
print $orderstatic->getNomUrl(1);
|
||||
}
|
||||
elseif ($histo[$key]['fid'] && $conf->facture->enabled)
|
||||
{
|
||||
$facturestatic->ref=$langs->trans("Invoice");
|
||||
$facturestatic->id=$histo[$key]['fid'];
|
||||
$facturestatic->type=$histo[$key]['ftype'];
|
||||
print $facturestatic->getNomUrl(1,'compta');
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
// Contact pour cette action
|
||||
if (! $objcon->id && $histo[$key]['contact_id'] > 0)
|
||||
{
|
||||
$contactstatic->name=$histo[$key]['name'];
|
||||
$contactstatic->firstname=$histo[$key]['firstname'];
|
||||
$contactstatic->id=$histo[$key]['contact_id'];
|
||||
print '<td width="120">'.$contactstatic->getNomUrl(1,'',10).'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
|
||||
// Auteur
|
||||
print '<td nowrap="nowrap" width="80">';
|
||||
$userstatic->id=$histo[$key]['userid'];
|
||||
$userstatic->login=$histo[$key]['login'];
|
||||
print $userstatic->getLoginUrl(1);
|
||||
print '</td>';
|
||||
|
||||
// Statut
|
||||
print '<td nowrap="nowrap" width="20">'.$actionstatic->LibStatut($histo[$key]['percent'],3).'</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
print "<br>\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Show footer of page for PDF generation
|
||||
* \param pdf Object PDF
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
@ -15,19 +15,22 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* or see http://www.gnu.org/
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/lib/contact.lib.php
|
||||
\brief Ensemble de fonctions de base pour les contacts
|
||||
\version $Revision$
|
||||
|
||||
Ensemble de fonctions de base de dolibarr sous forme d'include
|
||||
*/
|
||||
* \file htdocs/lib/contact.lib.php
|
||||
* \brief Ensemble de fonctions de base pour les contacts
|
||||
* \version $Id$
|
||||
*
|
||||
* Ensemble de fonctions de base de dolibarr sous forme d'include
|
||||
*/
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param unknown_type $contrat
|
||||
* @return unknown
|
||||
*/
|
||||
function contact_prepare_head($contrat)
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user