dolibarr 25.0.0-alpha
index.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2014-2021 Charlene Benke <charlene.r@benke.fr>
6 * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
7 * Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
8 * Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
9 * Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <https://www.gnu.org/licenses/>.
23 */
24
31// Load Dolibarr environment
32require '../main.inc.php';
40require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
41require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
42require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
43
44// Load translation files required by the page
45$langs->load("companies");
46
47
48// Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array
49$hookmanager->initHooks(array('thirdpartiesindex'));
50
51
52$socid = GETPOSTINT('socid');
53if ($user->socid) {
54 $socid = $user->socid;
55}
56
57// Security check
58$result = restrictedArea($user, 'societe|contact', 0, '', '', '', '');
59
60$thirdparty_static = new Societe($db);
61$contact_static = new Contact($db);
62
63if (!isset($form) || !is_object($form)) {
64 $form = new Form($db);
65}
66
67// Load $resultboxes
68$resultboxes = FormOther::getBoxesArea($user, "3");
69
70// Add box (when submit is done from a form when ajax disabled)
71include DOL_DOCUMENT_ROOT.'/core/actions_addbox.inc.php';
72
73$max = getDolUserInt('MAIN_SIZE_SHORTLIST_LIMIT', getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5));
74
75
76/*
77 * View
78 */
79
80$transAreaType = $langs->trans("ThirdPartiesArea");
81$helpurl = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Terceros';
82
83llxHeader("", $langs->trans("ThirdParties"), $helpurl);
84
85print load_fiche_titre($transAreaType, $resultboxes['selectboxlist'], 'companies');
86
87
88// Statistics area
89
90$third = array(
91 'customer' => 0,
92 'prospect' => 0,
93 'supplier' => 0,
94 'other' =>0
95);
96$total = 0;
97
98$sql = "SELECT s.rowid, s.client, s.fournisseur";
99$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
100if (!$user->hasRight('societe', 'client', 'voir')) {
101 $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
102}
103$sql .= ' WHERE s.entity IN ('.getEntity('societe').')';
104if (!$user->hasRight('societe', 'client', 'voir')) {
105 $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
106}
107if (!$user->hasRight('fournisseur', 'lire')) {
108 $sql .= " AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible
109}
110// Add where from hooks
111$parameters = array('socid' => $socid);
112$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $thirdparty_static); // Note that $action and $object may have been modified by hook
113if (empty($reshook)) {
114 if ($socid > 0) {
115 $sql .= " AND s.rowid = ".((int) $socid);
116 }
117}
118$sql .= $hookmanager->resPrint;
119//print $sql;
120$result = $db->query($sql);
121if ($result) {
122 while ($objp = $db->fetch_object($result)) {
123 $found = 0;
124 if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS_STATS') && ($objp->client == 2 || $objp->client == 3)) {
125 $found = 1;
126 $third['prospect']++;
127 }
128 if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS_STATS') && ($objp->client == 1 || $objp->client == 3)) {
129 $found = 1;
130 $third['customer']++;
131 }
132 if (((isModEnabled('fournisseur') && $user->hasRight('fournisseur', 'lire') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled('supplier_order') && $user->hasRight('supplier_order', 'lire')) || (isModEnabled('supplier_invoice') && $user->hasRight('supplier_invoice', 'lire'))) && !getDolGlobalString('SOCIETE_DISABLE_SUPPLIERS_STATS') && $objp->fournisseur) {
133 $found = 1;
134 $third['supplier']++;
135 }
136 if (isModEnabled('societe') && $objp->client == 0 && $objp->fournisseur == 0) {
137 $found = 1;
138 $third['other']++;
139 }
140 if ($found) {
141 $total++;
142 }
143 }
144} else {
145 dol_print_error($db);
146}
147
148$thirdpartygraph = '<div class="div-table-responsive-no-min">';
149$thirdpartygraph .= '<table class="noborder nohover centpercent">'."\n";
150$thirdpartygraph .= '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("NatureOfThirdParty").'</th></tr>';
151if (!empty($conf->use_javascript_ajax) && ((round($third['prospect']) ? 1 : 0) + (round($third['customer']) ? 1 : 0) + (round($third['supplier']) ? 1 : 0) + (round($third['other']) ? 1 : 0) >= 2)) {
152 $thirdpartygraph .= '<tr><td class="center" colspan="2">';
153 $dataseries = array();
154 if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS_STATS')) {
155 $dataseries[] = array($langs->transnoentitiesnoconv("Prospects"), round($third['prospect']));
156 }
157 if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS_STATS')) {
158 $dataseries[] = array($langs->transnoentitiesnoconv("Customers"), round($third['customer']));
159 }
160 if (((isModEnabled('fournisseur') && $user->hasRight('fournisseur', 'lire') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled('supplier_order') && $user->hasRight('supplier_order', 'lire')) || (isModEnabled('supplier_invoice') && $user->hasRight('supplier_invoice', 'lire'))) && !getDolGlobalString('SOCIETE_DISABLE_SUPPLIERS_STATS')) {
161 $dataseries[] = array($langs->transnoentitiesnoconv("Suppliers"), round($third['supplier']));
162 }
163 if (isModEnabled('societe')) {
164 $dataseries[] = array($langs->transnoentitiesnoconv("Others"), round($third['other']));
165 }
166 include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
167 $dolgraph = new DolGraph();
168 $dolgraph->SetData($dataseries);
169 $dolgraph->setShowLegend(2);
170 $dolgraph->setShowPercent(1);
171 $dolgraph->SetType(array('pie'));
172 $dolgraph->setHeight('200');
173 $dolgraph->draw('idgraphthirdparties');
174 $thirdpartygraph .= $dolgraph->show();
175 $thirdpartygraph .= '</td></tr>'."\n";
176} else {
177 $statstring = '';
178 if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS_STATS')) {
179 $statstring .= "<tr>";
180 $statstring .= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=p">'.$langs->trans("Prospects").'</a></td><td class="right">'.round($third['prospect']).'</td>';
181 $statstring .= "</tr>";
182 }
183 if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS_STATS')) {
184 $statstring .= "<tr>";
185 $statstring .= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=c">'.$langs->trans("Customers").'</a></td><td class="right">'.round($third['customer']).'</td>';
186 $statstring .= "</tr>";
187 }
188 $statstring2 = '';
189 if (((isModEnabled('fournisseur') && $user->hasRight('fournisseur', 'lire') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled('supplier_order') && $user->hasRight('supplier_order', 'lire')) || (isModEnabled('supplier_invoice') && $user->hasRight('supplier_invoice', 'lire'))) && !getDolGlobalString('SOCIETE_DISABLE_SUPPLIERS_STATS')) {
190 $statstring2 .= "<tr>";
191 $statstring2 .= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=f">'.$langs->trans("Suppliers").'</a></td><td class="right">'.round($third['supplier']).'</td>';
192 $statstring2 .= "</tr>";
193 }
194 $thirdpartygraph .= $statstring;
195 $thirdpartygraph .= $statstring2;
196}
197$thirdpartygraph .= '<tr class="liste_total"><td>'.$langs->trans("UniqueThirdParties").'</td><td class="right">';
198$thirdpartygraph .= $total;
199$thirdpartygraph .= '</td></tr>';
200$thirdpartygraph .= '</table>';
201$thirdpartygraph .= '</div>';
202
203$thirdpartycateggraph = '';
204if (isModEnabled('category') && getDolGlobalString('CATEGORY_GRAPHSTATS_ON_THIRDPARTIES')) {
205 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
206
207 $thirdpartycateggraph = '<div class="div-table-responsive-no-min">';
208 $thirdpartycateggraph .= '<table class="noborder nohover centpercent">';
209 $thirdpartycateggraph .= '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Categories").'</th></tr>';
210 $thirdpartycateggraph .= '<tr><td class="center" colspan="2">';
211 $sql = "SELECT c.label, count(*) as nb";
212 $sql .= " FROM ".MAIN_DB_PREFIX."categorie_societe as cs";
213 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cs.fk_categorie = c.rowid";
214 $sql .= " WHERE c.type = 2";
215 if (!is_numeric(getDolGlobalString('CATEGORY_GRAPHSTATS_ON_THIRDPARTIES'))) {
216 $sql .= " AND c.label like '".$db->escape(getDolGlobalString('CATEGORY_GRAPHSTATS_ON_THIRDPARTIES'))."'";
217 }
218 $sql .= " AND c.entity IN (".getEntity('category').")";
219 $sql .= " GROUP BY c.label";
220 $total = 0;
221 $result = $db->query($sql);
222 if ($result) {
223 $num = $db->num_rows($result);
224 $i = 0;
225 if (!empty($conf->use_javascript_ajax)) {
226 $dataseries = array();
227 $rest = 0;
228 $nbmax = 10;
229
230 while ($i < $num) {
231 $obj = $db->fetch_object($result);
232 if ($i < $nbmax) {
233 $dataseries[] = array($obj->label, round($obj->nb));
234 } else {
235 $rest += $obj->nb;
236 }
237 $total += $obj->nb;
238 $i++;
239 }
240 if ($i > $nbmax) {
241 $dataseries[] = array($langs->trans("Other"), round($rest));
242 }
243 include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
244 $dolgraph = new DolGraph();
245 $dolgraph->SetData($dataseries);
246 $dolgraph->setShowLegend(2);
247 $dolgraph->setShowPercent(1);
248 $dolgraph->SetType(array('pie'));
249 $dolgraph->setHeight('200');
250 $dolgraph->draw('idgraphcateg');
251 $thirdpartycateggraph .= $dolgraph->show();
252 } else {
253 while ($i < $num) {
254 $obj = $db->fetch_object($result);
255
256 $thirdpartycateggraph .= '<tr class="oddeven"><td>'.dolPrintHTML($obj->label).'</td><td>'.$obj->nb.'</td></tr>';
257 $total += $obj->nb;
258 $i++;
259 }
260 }
261 }
262 $thirdpartycateggraph .= '</td></tr>';
263 $thirdpartycateggraph .= '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td class="right">';
264 $thirdpartycateggraph .= $total;
265 $thirdpartycateggraph .= '</td></tr>';
266 $thirdpartycateggraph .= '</table>';
267 $thirdpartycateggraph .= '</div>';
268} else {
269 $thirdpartycateggraph = '';
270}
271
272
273/*
274 * Latest modified third parties
275 */
276
277$sql = "SELECT s.rowid, s.nom as name, s.email, s.client, s.fournisseur";
278$sql .= ", s.code_client";
279$sql .= ", s.code_fournisseur";
280if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
281 $sql .= ", spe.accountancy_code_supplier as code_compta_fournisseur";
282 $sql .= ", spe.accountancy_code_customer as code_compta";
283} else {
284 $sql .= ", s.code_compta_fournisseur";
285 $sql .= ", s.code_compta";
286}
287$sql .= ", s.logo";
288$sql .= ", s.entity";
289$sql .= ", s.canvas, GREATEST(s.tms, sef.tms) as date_modification, s.status as status";
290$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
291$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields as sef ON sef.fk_object=s.rowid";
292if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
293 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
294}
295// TODO Replace this
296if (!$user->hasRight('societe', 'client', 'voir')) {
297 $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
298}
299$sql .= ' WHERE s.entity IN ('.getEntity('societe').')';
300if (!$user->hasRight('societe', 'client', 'voir')) {
301 $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
302}
303if (!$user->hasRight('fournisseur', 'lire')) {
304 $sql .= " AND (s.fournisseur != 1 OR s.client != 0)";
305}
306// Add where from hooks
307$parameters = array('socid' => $socid);
308$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $thirdparty_static); // Note that $action and $object may have been modified by hook
309if (empty($reshook)) {
310 if ($socid > 0) {
311 $sql .= " AND s.rowid = ".((int) $socid);
312 }
313}
314$sql .= $hookmanager->resPrint;
315$sql .= $db->order("date_modification", "DESC");
316$sql .= $db->plimit($max, 0);
317
318//print $sql;
319$lastmodified="";
320$result = $db->query($sql);
321if ($result) {
322 $num = $db->num_rows($result);
323
324 $i = 0;
325
326 if ($num > 0) {
327 $transRecordedType = $langs->trans("LastModifiedThirdParties", $max);
328
329 $lastmodified = "\n<!-- last thirdparties modified -->\n";
330 $lastmodified .= '<div class="div-table-responsive-no-min">';
331 $lastmodified .= '<table class="noborder centpercent">';
332
333 $lastmodified .= '<tr class="liste_titre"><th colspan="2">';
334 //$lastmodified .= img_picto('', 'company', 'class="pictofixedwidth"');
335 $lastmodified .= '<span class="valignmiddle">'.$transRecordedType.'</span>';
336 $lastmodified .= '<a class="marginleftonlyshort" href="'.DOL_URL_ROOT.'/societe/list.php?sortfield=s.tms&sortorder=DESC" title="'.$langs->trans("FullList").'">';
337 $lastmodified .= '<span class="badge marginleftonlyshort">...</span>';
338 $lastmodified .= '</a>';
339 $lastmodified .= '</th>';
340 $lastmodified .= '<th>&nbsp;</th>';
341 $lastmodified .= '<th class="right">';
342 $lastmodified .= '</th>';
343 $lastmodified .= '</tr>'."\n";
344
345 while ($i < $num) {
346 $objp = $db->fetch_object($result);
347
348 $thirdparty_static->id = $objp->rowid;
349 $thirdparty_static->name = $objp->name;
350 $thirdparty_static->client = $objp->client;
351 $thirdparty_static->fournisseur = $objp->fournisseur;
352 $thirdparty_static->logo = $objp->logo;
353 $thirdparty_static->date_modification = $db->jdate($objp->date_modification);
354 $thirdparty_static->status = $objp->status;
355 $thirdparty_static->code_client = $objp->code_client;
356 $thirdparty_static->code_fournisseur = $objp->code_fournisseur;
357 $thirdparty_static->canvas = $objp->canvas;
358 $thirdparty_static->email = $objp->email;
359 $thirdparty_static->entity = $objp->entity;
360 $thirdparty_static->code_compta_fournisseur = $objp->code_compta_fournisseur;
361 $thirdparty_static->code_compta_client = $objp->code_compta;
362
363 $lastmodified .= '<tr class="oddeven">';
364 // Name
365 $lastmodified .= '<td class="nowrap tdoverflowmax200">';
366 $lastmodified .= $thirdparty_static->getNomUrl(1);
367 $lastmodified .= "</td>\n";
368 // Type
369 $lastmodified .= '<td class="center">';
370 $lastmodified .= $thirdparty_static->getTypeUrl();
371 $lastmodified .= '</td>';
372 // Last modified date
373 $lastmodified .= '<td class="right tddate" title="'.dol_escape_htmltag($langs->trans("DateModification").' '.dol_print_date($thirdparty_static->date_modification, 'dayhour', 'tzuserrel')).'">';
374 $lastmodified .= dol_print_date($thirdparty_static->date_modification, 'day', 'tzuserrel');
375 $lastmodified .= "</td>";
376 $lastmodified .= '<td class="right nowrap">';
377 $lastmodified .= $thirdparty_static->getLibStatut(3);
378 $lastmodified .= "</td>";
379 $lastmodified .= "</tr>\n";
380 $i++;
381 }
382
383 $db->free($result);
384
385 $lastmodified .= "</table>\n";
386 $lastmodified .= '</div>';
387 $lastmodified .= "<!-- End last thirdparties modified -->\n";
388 }
389} else {
390 dol_print_error($db);
391}
392
393
394
395/*
396 * Latest modified contacts
397 */
398$sql = "SELECT s.rowid, s.nom as name, s.email, s.client, s.fournisseur";
399$sql .= ", s.code_client";
400$sql .= ", s.code_fournisseur";
401if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
402 $sql .= ", spe.accountancy_code_supplier as code_compta_fournisseur";
403 $sql .= ", spe.accountancy_code_customer as code_compta";
404} else {
405 $sql .= ", s.code_compta_fournisseur";
406 $sql .= ", s.code_compta";
407}
408$sql .= ", s.logo";
409$sql .= ", s.entity";
410$sql .= ", s.canvas";
411$sql .= ", s.status as status";
412$sql .= ", GREATEST(sp.tms, spef.tms) as date_modification, sp.statut as cstatus";
413$sql .= ", sp.rowid as cid, sp.canvas as ccanvas, sp.email as cemail, sp.firstname, sp.lastname";
414$sql .= ", sp.address as caddress, sp.phone as cphone";
415$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
416$sql .= " INNER JOIN ".MAIN_DB_PREFIX."socpeople as sp ON sp.fk_soc = s.rowid AND ((sp.fk_user_creat = ".((int) $user->id)." AND sp.priv = 1) OR sp.priv = 0)";
417$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "socpeople_extrafields as spef ON spef.fk_object = sp.rowid";
418if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
419 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
420}
421// TODO Replace this
422if (!$user->hasRight('societe', 'client', 'voir')) {
423 $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
424}
425$sql .= " WHERE s.entity IN (".getEntity('societe').") ";
426if (!$user->hasRight('societe', 'client', 'voir')) {
427 $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
428}
429if (!$user->hasRight('fournisseur', 'lire')) {
430 $sql .= " AND (s.fournisseur != 1 OR s.client != 0)";
431}
432// Add where from hooks
433$parameters = array('socid' => $socid);
434$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $thirdparty_static); // Note that $action and $object may have been modified by hook
435if (empty($reshook)) {
436 if ($socid > 0) {
437 $sql .= " AND s.rowid = ".((int) $socid);
438 }
439}
440$sql .= $hookmanager->resPrint;
441$sql .= $db->order("date_modification", "DESC");
442$sql .= $db->plimit($max, 0);
443
444//print $sql;
445$lastmodifiedcontact = '';
446$result = $db->query($sql);
447if ($result) {
448 $num = $db->num_rows($result);
449
450 $i = 0;
451
452 if ($num > 0) {
453 $transRecordedType = $langs->trans("LastModifiedContacts", $max);
454
455 $lastmodifiedcontact = "\n<!-- last contacts modified -->\n";
456 $lastmodifiedcontact .= '<div class="div-table-responsive-no-min">';
457 $lastmodifiedcontact .= '<table class="noborder centpercent">';
458
459 $lastmodifiedcontact .= '<tr class="liste_titre"><th colspan="2">';
460 //$lastmodifiedcontact .= img_picto('', 'contact', 'class="pictofixedwidth"');
461 $lastmodifiedcontact .= '<span class="valignmiddle">'.$transRecordedType.'</div>';
462 $lastmodifiedcontact .= '<a class="marginleftonlyshort" href="'.DOL_URL_ROOT.'/contact/list.php?sortfield=p.tms&sortorder=DESC" title="'.$langs->trans("FullList").'">';
463 //$lastmodifiedcontact .= img_picto($langs->trans("FullList"), 'contact');
464 $lastmodifiedcontact .= '<span class="badge marginleftonlyshort">...</span>';
465 $lastmodifiedcontact .= '</th>';
466 $lastmodifiedcontact .= '<th>&nbsp;</th>';
467 $lastmodifiedcontact .= '<th class="right">';
468 //$lastmodifiedcontact .= '<a href="'.DOL_URL_ROOT.'/contact/list.php?sortfield=s.tms&sortorder=DESC">'.img_picto($langs->trans("FullList"), 'contact');
469 $lastmodifiedcontact .= '</th>';
470 $lastmodifiedcontact .= '</tr>'."\n";
471
472 while ($i < $num) {
473 $objp = $db->fetch_object($result);
474
475 $thirdparty_static->id = $objp->rowid;
476 $thirdparty_static->name = $objp->name;
477 $thirdparty_static->client = $objp->client;
478 $thirdparty_static->fournisseur = $objp->fournisseur;
479 $thirdparty_static->logo = $objp->logo;
480 $thirdparty_static->date_modification = $db->jdate($objp->date_modification);
481 $thirdparty_static->status = $objp->status;
482 $thirdparty_static->code_client = $objp->code_client;
483 $thirdparty_static->code_fournisseur = $objp->code_fournisseur;
484 $thirdparty_static->canvas = $objp->canvas;
485 $thirdparty_static->email = $objp->email;
486 $thirdparty_static->entity = $objp->entity;
487 $thirdparty_static->code_compta_fournisseur = $objp->code_compta_fournisseur;
488 $thirdparty_static->code_compta_client = $objp->code_compta;
489
490 $contact_static->id = $objp->cid;
491 $contact_static->status = $objp->cstatus;
492 $contact_static->firstname = $objp->firstname;
493 $contact_static->lastname = $objp->lastname;
494 $contact_static->email = $objp->cemail;
495 $contact_static->socid = $objp->rowid;
496 $contact_static->canvas = $objp->ccanvas;
497 $contact_static->phone_pro = $objp->cphone;
498 $contact_static->address = $objp->caddress;
499
500 $lastmodifiedcontact .= '<tr class="oddeven">';
501 // Contact
502 $lastmodifiedcontact .= '<td class="tdoverflowmax150">';
503 $lastmodifiedcontact .= $contact_static->getNomUrl(1);
504 $lastmodifiedcontact .= '</td>';
505 // Third party
506 $lastmodifiedcontact .= '<td class="nowrap tdoverflowmax125">';
507 $lastmodifiedcontact .= $thirdparty_static->getNomUrl(1);
508 $lastmodifiedcontact .= "</td>\n";
509 // Last modified date
510 $lastmodifiedcontact .= '<td class="right tddate" title="'.dol_escape_htmltag($langs->trans("DateModification").' '.dol_print_date($thirdparty_static->date_modification, 'dayhour', 'tzuserrel')).'">';
511 $lastmodifiedcontact .= dol_print_date($thirdparty_static->date_modification, 'day', 'tzuserrel');
512 $lastmodifiedcontact .= "</td>";
513 $lastmodifiedcontact .= '<td class="right nowrap">';
514 $lastmodifiedcontact .= $thirdparty_static->getLibStatut(3);
515 $lastmodifiedcontact .= "</td>";
516 $lastmodifiedcontact .= "</tr>\n";
517 $i++;
518 }
519
520 $db->free($result);
521
522 $lastmodifiedcontact .= "</table>\n";
523 $lastmodifiedcontact .= '</div>';
524 $lastmodifiedcontact .= "<!-- End last contacts modified -->\n";
525 }
526} else {
527 dol_print_error($db);
528}
529
530
531// boxes
532print '<div class="clearboth"></div>';
533print '<div class="fichecenter fichecenterbis">';
534
535$boxlist = '<div class="twocolumns">';
536
537$boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
538$boxlist .= $thirdpartygraph;
539$boxlist .= '<br>';
540$boxlist .= $thirdpartycateggraph;
541$boxlist .= '<br>';
542$boxlist .= $resultboxes['boxlista'];
543$boxlist .= '</div>'."\n";
544
545$boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
546$boxlist .= $lastmodified;
547$boxlist .= '<br>';
548$boxlist .= $lastmodifiedcontact;
549$boxlist .= '<br>';
550$boxlist .= $resultboxes['boxlistb'];
551$boxlist .= '</div>'."\n";
552
553$boxlist .= '</div>';
554
555print $boxlist;
556
557print '</div>';
558
559$parameters = array('user' => $user);
560$reshook = $hookmanager->executeHooks('dashboardThirdparties', $parameters, $thirdparty_static); // Note that $action and $object may have been modified by hook
561
562// End of page
563llxFooter();
564$db->close();
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Class to manage contact/addresses.
Class to build graphs.
Class to manage generation of HTML components Only common components must be here.
static getBoxesArea($user, $areacode)
Get array with HTML tabs with widgets/boxes of a particular area including personalized choices of us...
Class to manage third parties objects (customers, suppliers, prospects...)
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
getDolUserInt($key, $default=0, $tmpuser=null)
Return Dolibarr user constant int value.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.