35 global $db, $langs, $conf, $user;
40 $head[$tab][0] = DOL_URL_ROOT.
'/contact/card.php?id='.$object->id;
41 $head[$tab][1] = $langs->trans(
"Contact");
42 $head[$tab][2] =
'card';
45 if ((!empty($conf->ldap->enabled) && !empty($conf->global->LDAP_CONTACT_ACTIVE))
46 && (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || !empty($user->admin))) {
49 $head[$tab][0] = DOL_URL_ROOT.
'/contact/ldap.php?id='.$object->id;
50 $head[$tab][1] = $langs->trans(
"LDAPCard");
51 $head[$tab][2] =
'ldap';
55 $head[$tab][0] = DOL_URL_ROOT.
'/contact/perso.php?id='.$object->id;
56 $head[$tab][1] = $langs->trans(
"PersonalInformations");
57 $head[$tab][2] =
'perso';
60 if (!empty($conf->project->enabled) && $user->hasRight(
'project',
'lire')) {
63 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
64 $cachekey =
'count_projects_contact_'.$object->id;
67 if (!is_null($dataretrieved)) {
68 $nbProject = $dataretrieved;
70 $sql =
'SELECT COUNT(n.rowid) as nb';
71 $sql .=
' FROM '.MAIN_DB_PREFIX.
'projet as n';
72 $sql .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact as cc ON (n.rowid = cc.element_id)';
73 $sql .=
' WHERE cc.fk_socpeople = '.((int) $object->id);
74 $sql .=
' AND cc.fk_c_type_contact IN (SELECT rowid FROM '.MAIN_DB_PREFIX.
'c_type_contact WHERE element="project" AND source="external")';
75 $sql .=
' AND n.entity IN ('.getEntity(
'project').
')';
78 $obj = $db->fetch_object(
$resql);
79 $nbProject = $obj->nb;
85 $head[$tab][0] = DOL_URL_ROOT.
'/contact/project.php?id='.$object->id;
86 $head[$tab][1] = $langs->trans(
"Projects");
88 $head[$tab][1] .=
'<span class="badge marginleftonlyshort">'.$nbProject.
'</span>';
90 $head[$tab][2] =
'project';
95 if (!empty($conf->commande->enabled) || !empty($conf->propal->enabled) ||
isModEnabled(
'facture') || !empty($conf->ficheinter->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
96 $head[$tab][0] = DOL_URL_ROOT.
'/contact/consumption.php?id='.$object->id;
97 $head[$tab][1] = $langs->trans(
"Referers");
98 $head[$tab][2] =
'consumption';
109 if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
110 $nbNote = (empty($object->note_private) ? 0 : 1) + (empty($object->note_public) ? 0 : 1);
111 $head[$tab][0] = DOL_URL_ROOT.
'/contact/note.php?id='.$object->id;
112 $head[$tab][1] = $langs->trans(
"Note");
114 $head[$tab][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
116 $head[$tab][2] =
'note';
120 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
121 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
123 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
124 $nbLinks =
Link::count($db, $object->element, $object->id);
125 $head[$tab][0] = DOL_URL_ROOT.
'/contact/document.php?id='.$object->id;
126 $head[$tab][1] = $langs->trans(
"Documents");
127 if (($nbFiles + $nbLinks) > 0) {
128 $head[$tab][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
130 $head[$tab][2] =
'documents';
134 $head[$tab][0] = DOL_URL_ROOT.
'/contact/agenda.php?id='.$object->id;
135 $head[$tab][1] = $langs->trans(
"Events");
136 if (
isModEnabled(
'agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
137 $head[$tab][1] .=
'/';
138 $head[$tab][1] .= $langs->trans(
"Agenda");
140 $head[$tab][2] =
'agenda';
173 if (!empty($conf->project->enabled) && $user->rights->projet->lire) {
174 $langs->load(
"projects");
177 if (!empty($conf->project->enabled) && $user->rights->projet->creer && empty($nocreatelink)) {
178 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'AddProject'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/projet/card.php?socid='.$object->id.
'&action=create&backtopage='.urlencode($backtopage));
182 print
load_fiche_titre($langs->trans(
"ProjectsHavingThisContact"), $newcardbutton.$morehtmlright,
'');
183 print
'<div class="div-table-responsive">';
184 print
"\n".
'<table class="noborder" width=100%>';
186 $sql =
'SELECT p.rowid as id, p.entity, p.title, p.ref, p.public, p.dateo as do, p.datee as de, p.fk_statut as status, p.fk_opp_status, p.opp_amount, p.opp_percent, p.tms as date_update, p.budget_amount';
187 $sql .=
', cls.code as opp_status_code, ctc.libelle';
188 $sql .=
' FROM '.MAIN_DB_PREFIX.
'projet as p';
189 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_lead_status as cls on p.fk_opp_status = cls.rowid';
190 $sql .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact as cc ON (p.rowid = cc.element_id)';
191 $sql .=
' INNER JOIN '.MAIN_DB_PREFIX.
'c_type_contact as ctc ON (ctc.rowid = cc.fk_c_type_contact)';
192 $sql .=
' WHERE cc.fk_socpeople = '.((int) $object->id);
193 $sql .=
' AND ctc.element="project" AND ctc.source="external"';
194 $sql .=
' AND p.entity IN ('.getEntity(
'project').
')';
195 $sql .=
' ORDER BY p.dateo DESC';
197 $result = $db->query($sql);
199 $num = $db->num_rows($result);
201 print
'<tr class="liste_titre">';
202 print
'<td>'.$langs->trans(
"Ref").
'</td>';
203 print
'<td>'.$langs->trans(
"Name").
'</td>';
204 print
'<td>'.$langs->trans(
"ContactType").
'</td>';
205 print
'<td class="center">'.$langs->trans(
"DateStart").
'</td>';
206 print
'<td class="center">'.$langs->trans(
"DateEnd").
'</td>';
207 print
'<td class="right">'.$langs->trans(
"OpportunityAmountShort").
'</td>';
208 print
'<td class="center">'.$langs->trans(
"OpportunityStatusShort").
'</td>';
209 print
'<td class="right">'.$langs->trans(
"OpportunityProbabilityShort").
'</td>';
210 print
'<td class="right">'.$langs->trans(
"Status").
'</td>';
214 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
216 $projecttmp =
new Project($db);
221 $obj = $db->fetch_object($result);
222 $projecttmp->fetch($obj->id);
225 $userAccess = $projecttmp->restrictedProjectArea($user);
227 if ($user->rights->projet->lire && $userAccess > 0) {
228 print
'<tr class="oddeven">';
232 print $projecttmp->getNomUrl(1);
236 print
'<td>'.$obj->title.
'</td>';
237 print
'<td>'.$obj->libelle.
'</td>';
239 print
'<td class="center">'.dol_print_date($db->jdate($obj->do),
"day").
'</td>';
241 print
'<td class="center">'.dol_print_date($db->jdate($obj->de),
"day").
'</td>';
243 print
'<td class="right">';
244 if ($obj->opp_status_code) {
245 print
price($obj->opp_amount, 1,
'', 1, -1, -1,
'');
249 print
'<td class="center">';
250 if ($obj->opp_status_code) {
251 print $langs->trans(
"OppStatus".$obj->opp_status_code);
255 print
'<td class="right">';
256 if ($obj->opp_percent) {
257 print
price($obj->opp_percent, 1,
'', 1, 0).
'%';
261 print
'<td class="right">'.$projecttmp->getLibStatut(5).
'</td>';
268 print
'<tr class="oddeven"><td colspan="8"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
dol_getcache($memoryid)
Read a memory area shared by all users, all sessions on server.
dol_setcache($memoryid, $data, $expire=0)
Save data into a memory area shared by all users, all sessions on server.
dolGetButtonTitle($label, $helpText= '', $iconClass= 'fa fa-file', $url= '', $id= '', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
price($amount, $form=0, $outlangs= '', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code= '')
Function to format a value into an amount for visual output Function used into PDF and HTML pages...
Class to manage projects.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
static count($dbs, $objecttype, $objectid)
Return nb of links.
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0)
Scan a directory and return a list of files/directories.
if(isModEnabled('facture')&&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur')&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)&&$user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice')&&$user->rights->supplier_invoice->lire)) if(isModEnabled('don')&&!empty($user->rights->don->lire)) if(isModEnabled('tax')&&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture')&&isModEnabled('commande')&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
isModEnabled($module)
Is Dolibarr module enabled.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode= 'add')
Complete or removed entries into a head array (used to build tabs).