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// Counted by the database: the page must not fetch one row per third party
99$sql = "SELECT s.client, s.fournisseur, COUNT(s.rowid) as nb";
100$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
101if (!$user->hasRight('societe', 'client', 'voir')) {
102 $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
103}
104$sql .= ' WHERE s.entity IN ('.getEntity('societe').')';
105if (!$user->hasRight('societe', 'client', 'voir')) {
106 $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
107}
108if (!$user->hasRight('fournisseur', 'lire')) {
109 $sql .= " AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible
110}
111// Add where from hooks
112$parameters = array('socid' => $socid);
113$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $thirdparty_static); // Note that $action and $object may have been modified by hook
114if (empty($reshook)) {
115 if ($socid > 0) {
116 $sql .= " AND s.rowid = ".((int) $socid);
117 }
118}
119$sql .= $hookmanager->resPrint;
120$sql .= " GROUP BY s.client, s.fournisseur";
121//print $sql;
122$result = $db->query($sql);
123if ($result) {
124 while ($objp = $db->fetch_object($result)) {
125 $found = 0;
126 if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS_STATS') && ($objp->client == 2 || $objp->client == 3)) {
127 $found = 1;
128 $third['prospect'] += $objp->nb;
129 }
130 if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS_STATS') && ($objp->client == 1 || $objp->client == 3)) {
131 $found = 1;
132 $third['customer'] += $objp->nb;
133 }
134 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) {
135 $found = 1;
136 $third['supplier'] += $objp->nb;
137 }
138 if (isModEnabled('societe') && $objp->client == 0 && $objp->fournisseur == 0) {
139 $found = 1;
140 $third['other'] += $objp->nb;
141 }
142 if ($found) {
143 $total += $objp->nb;
144 }
145 }
146} else {
147 dol_print_error($db);
148}
149
150$thirdpartygraph = '<div class="div-table-responsive-no-min">';
151$thirdpartygraph .= '<table class="noborder nohover centpercent">'."\n";
152$thirdpartygraph .= '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("NatureOfThirdParty").'</th></tr>';
153if (!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)) {
154 $thirdpartygraph .= '<tr><td class="center" colspan="2">';
155 $dataseries = array();
156 if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS_STATS')) {
157 $dataseries[] = array($langs->transnoentitiesnoconv("Prospects"), round($third['prospect']));
158 }
159 if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS_STATS')) {
160 $dataseries[] = array($langs->transnoentitiesnoconv("Customers"), round($third['customer']));
161 }
162 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')) {
163 $dataseries[] = array($langs->transnoentitiesnoconv("Suppliers"), round($third['supplier']));
164 }
165 if (isModEnabled('societe')) {
166 $dataseries[] = array($langs->transnoentitiesnoconv("Others"), round($third['other']));
167 }
168 include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
169 $dolgraph = new DolGraph();
170 $dolgraph->SetData($dataseries);
171 $dolgraph->setShowLegend(2);
172 $dolgraph->setShowPercent(1);
173 $dolgraph->SetType(array('pie'));
174 $dolgraph->setHeight('200');
175 $dolgraph->draw('idgraphthirdparties');
176 $thirdpartygraph .= $dolgraph->show();
177 $thirdpartygraph .= '</td></tr>'."\n";
178} else {
179 $statstring = '';
180 if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS_STATS')) {
181 $statstring .= "<tr>";
182 $statstring .= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=p">'.$langs->trans("Prospects").'</a></td><td class="right">'.round($third['prospect']).'</td>';
183 $statstring .= "</tr>";
184 }
185 if (isModEnabled('societe') && $user->hasRight('societe', 'lire') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS_STATS')) {
186 $statstring .= "<tr>";
187 $statstring .= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=c">'.$langs->trans("Customers").'</a></td><td class="right">'.round($third['customer']).'</td>';
188 $statstring .= "</tr>";
189 }
190 $statstring2 = '';
191 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')) {
192 $statstring2 .= "<tr>";
193 $statstring2 .= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=f">'.$langs->trans("Suppliers").'</a></td><td class="right">'.round($third['supplier']).'</td>';
194 $statstring2 .= "</tr>";
195 }
196 $thirdpartygraph .= $statstring;
197 $thirdpartygraph .= $statstring2;
198}
199$thirdpartygraph .= '<tr class="liste_total"><td>'.$langs->trans("UniqueThirdParties").'</td><td class="right">';
200$thirdpartygraph .= $total;
201$thirdpartygraph .= '</td></tr>';
202$thirdpartygraph .= '</table>';
203$thirdpartygraph .= '</div>';
204
205$thirdpartycateggraph = '';
206if (isModEnabled('category') && getDolGlobalString('CATEGORY_GRAPHSTATS_ON_THIRDPARTIES')) {
207 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
208
209 $thirdpartycateggraph = '<div class="div-table-responsive-no-min">';
210 $thirdpartycateggraph .= '<table class="noborder nohover centpercent">';
211 $thirdpartycateggraph .= '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Categories").'</th></tr>';
212 $thirdpartycateggraph .= '<tr><td class="center" colspan="2">';
213 $sql = "SELECT c.label, count(*) as nb";
214 $sql .= " FROM ".MAIN_DB_PREFIX."categorie_societe as cs";
215 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cs.fk_categorie = c.rowid";
216 $sql .= " WHERE c.type = 2";
217 if (!is_numeric(getDolGlobalString('CATEGORY_GRAPHSTATS_ON_THIRDPARTIES'))) {
218 $sql .= " AND c.label like '".$db->escape(getDolGlobalString('CATEGORY_GRAPHSTATS_ON_THIRDPARTIES'))."'";
219 }
220 $sql .= " AND c.entity IN (".getEntity('category').")";
221 $sql .= " GROUP BY c.label";
222 $total = 0;
223 $result = $db->query($sql);
224 if ($result) {
225 $num = $db->num_rows($result);
226 $i = 0;
227 if (!empty($conf->use_javascript_ajax)) {
228 $dataseries = array();
229 $rest = 0;
230 $nbmax = 10;
231
232 while ($i < $num) {
233 $obj = $db->fetch_object($result);
234 if ($i < $nbmax) {
235 $dataseries[] = array($obj->label, round($obj->nb));
236 } else {
237 $rest += $obj->nb;
238 }
239 $total += $obj->nb;
240 $i++;
241 }
242 if ($i > $nbmax) {
243 $dataseries[] = array($langs->trans("Other"), round($rest));
244 }
245 include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
246 $dolgraph = new DolGraph();
247 $dolgraph->SetData($dataseries);
248 $dolgraph->setShowLegend(2);
249 $dolgraph->setShowPercent(1);
250 $dolgraph->SetType(array('pie'));
251 $dolgraph->setHeight('200');
252 $dolgraph->draw('idgraphcateg');
253 $thirdpartycateggraph .= $dolgraph->show();
254 } else {
255 while ($i < $num) {
256 $obj = $db->fetch_object($result);
257
258 $thirdpartycateggraph .= '<tr class="oddeven"><td>'.dolPrintHTML($obj->label).'</td><td>'.$obj->nb.'</td></tr>';
259 $total += $obj->nb;
260 $i++;
261 }
262 }
263 }
264 $thirdpartycateggraph .= '</td></tr>';
265 $thirdpartycateggraph .= '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td class="right">';
266 $thirdpartycateggraph .= $total;
267 $thirdpartycateggraph .= '</td></tr>';
268 $thirdpartycateggraph .= '</table>';
269 $thirdpartycateggraph .= '</div>';
270} else {
271 $thirdpartycateggraph = '';
272}
273
274
275/*
276 * Latest modified third parties
277 */
278
279$sql = "SELECT s.rowid, s.nom as name, s.email, s.client, s.fournisseur";
280$sql .= ", s.code_client";
281$sql .= ", s.code_fournisseur";
282if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
283 $sql .= ", spe.accountancy_code_supplier as code_compta_fournisseur";
284 $sql .= ", spe.accountancy_code_customer as code_compta";
285} else {
286 $sql .= ", s.code_compta_fournisseur";
287 $sql .= ", s.code_compta";
288}
289$sql .= ", s.logo";
290$sql .= ", s.entity";
291$sql .= ", s.canvas, GREATEST(s.tms, COALESCE(sef.tms, s.tms)) as date_modification, s.status as status";
292$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
293$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields as sef ON sef.fk_object=s.rowid";
294if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
295 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
296}
297// TODO Replace this
298if (!$user->hasRight('societe', 'client', 'voir')) {
299 $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
300}
301$sql .= ' WHERE s.entity IN ('.getEntity('societe').')';
302if (!$user->hasRight('societe', 'client', 'voir')) {
303 $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
304}
305if (!$user->hasRight('fournisseur', 'lire')) {
306 $sql .= " AND (s.fournisseur != 1 OR s.client != 0)";
307}
308// Add where from hooks
309$parameters = array('socid' => $socid);
310$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $thirdparty_static); // Note that $action and $object may have been modified by hook
311if (empty($reshook)) {
312 if ($socid > 0) {
313 $sql .= " AND s.rowid = ".((int) $socid);
314 }
315}
316$sql .= $hookmanager->resPrint;
317$sql .= $db->order("date_modification", "DESC");
318$sql .= $db->plimit($max, 0);
319
320//print $sql;
321$lastmodified="";
322$result = $db->query($sql);
323if ($result) {
324 $num = $db->num_rows($result);
325
326 $i = 0;
327
328 if ($num > 0) {
329 $transRecordedType = $langs->trans("LastModifiedThirdParties", $max);
330
331 $lastmodified = "\n<!-- last thirdparties modified -->\n";
332 $lastmodified .= '<div class="div-table-responsive-no-min">';
333 $lastmodified .= '<table class="noborder centpercent">';
334
335 $lastmodified .= '<tr class="liste_titre"><th colspan="2">';
336 //$lastmodified .= img_picto('', 'company', 'class="pictofixedwidth"');
337 $lastmodified .= '<span class="valignmiddle">'.$transRecordedType.'</span>';
338 $lastmodified .= '<a class="marginleftonlyshort" href="'.DOL_URL_ROOT.'/societe/list.php?sortfield=s.tms&sortorder=DESC" title="'.$langs->trans("FullList").'">';
339 $lastmodified .= '<span class="badge marginleftonlyshort">...</span>';
340 $lastmodified .= '</a>';
341 $lastmodified .= '</th>';
342 $lastmodified .= '<th>&nbsp;</th>';
343 $lastmodified .= '<th class="right">';
344 $lastmodified .= '</th>';
345 $lastmodified .= '</tr>'."\n";
346
347 while ($i < $num) {
348 $objp = $db->fetch_object($result);
349
350 $thirdparty_static->id = $objp->rowid;
351 $thirdparty_static->name = $objp->name;
352 $thirdparty_static->client = $objp->client;
353 $thirdparty_static->fournisseur = $objp->fournisseur;
354 $thirdparty_static->logo = $objp->logo;
355 $thirdparty_static->date_modification = $db->jdate($objp->date_modification);
356 $thirdparty_static->status = $objp->status;
357 $thirdparty_static->code_client = $objp->code_client;
358 $thirdparty_static->code_fournisseur = $objp->code_fournisseur;
359 $thirdparty_static->canvas = $objp->canvas;
360 $thirdparty_static->email = $objp->email;
361 $thirdparty_static->entity = $objp->entity;
362 $thirdparty_static->code_compta_fournisseur = $objp->code_compta_fournisseur;
363 $thirdparty_static->code_compta_client = $objp->code_compta;
364
365 $lastmodified .= '<tr class="oddeven">';
366 // Name
367 $lastmodified .= '<td class="nowrap tdoverflowmax200">';
368 $lastmodified .= $thirdparty_static->getNomUrl(1);
369 $lastmodified .= "</td>\n";
370 // Type
371 $lastmodified .= '<td class="center">';
372 $lastmodified .= $thirdparty_static->getTypeUrl();
373 $lastmodified .= '</td>';
374 // Last modified date
375 $lastmodified .= '<td class="right tddate" title="'.dol_escape_htmltag($langs->trans("DateModification").' '.dol_print_date($thirdparty_static->date_modification, 'dayhour', 'tzuserrel')).'">';
376 $lastmodified .= dol_print_date($thirdparty_static->date_modification, 'day', 'tzuserrel');
377 $lastmodified .= "</td>";
378 $lastmodified .= '<td class="right nowrap">';
379 $lastmodified .= $thirdparty_static->getLibStatut(3);
380 $lastmodified .= "</td>";
381 $lastmodified .= "</tr>\n";
382 $i++;
383 }
384
385 $db->free($result);
386
387 $lastmodified .= "</table>\n";
388 $lastmodified .= '</div>';
389 $lastmodified .= "<!-- End last thirdparties modified -->\n";
390 }
391} else {
392 dol_print_error($db);
393}
394
395
396
397/*
398 * Latest modified contacts
399 */
400$sql = "SELECT s.rowid, s.nom as name, s.email, s.client, s.fournisseur";
401$sql .= ", s.code_client";
402$sql .= ", s.code_fournisseur";
403if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
404 $sql .= ", spe.accountancy_code_supplier as code_compta_fournisseur";
405 $sql .= ", spe.accountancy_code_customer as code_compta";
406} else {
407 $sql .= ", s.code_compta_fournisseur";
408 $sql .= ", s.code_compta";
409}
410$sql .= ", s.logo";
411$sql .= ", s.entity";
412$sql .= ", s.canvas";
413$sql .= ", s.status as status";
414$sql .= ", GREATEST(sp.tms, COALESCE(spef.tms, sp.tms)) as date_modification, sp.statut as cstatus";
415$sql .= ", sp.rowid as cid, sp.canvas as ccanvas, sp.email as cemail, sp.firstname, sp.lastname";
416$sql .= ", sp.address as caddress, sp.phone as cphone";
417$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
418$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)";
419$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "socpeople_extrafields as spef ON spef.fk_object = sp.rowid";
420if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
421 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
422}
423// TODO Replace this
424if (!$user->hasRight('societe', 'client', 'voir')) {
425 $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
426}
427$sql .= " WHERE s.entity IN (".getEntity('societe').") ";
428if (!$user->hasRight('societe', 'client', 'voir')) {
429 $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
430}
431if (!$user->hasRight('fournisseur', 'lire')) {
432 $sql .= " AND (s.fournisseur != 1 OR s.client != 0)";
433}
434// Add where from hooks
435$parameters = array('socid' => $socid);
436$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $thirdparty_static); // Note that $action and $object may have been modified by hook
437if (empty($reshook)) {
438 if ($socid > 0) {
439 $sql .= " AND s.rowid = ".((int) $socid);
440 }
441}
442$sql .= $hookmanager->resPrint;
443$sql .= $db->order("date_modification", "DESC");
444$sql .= $db->plimit($max, 0);
445
446//print $sql;
447$lastmodifiedcontact = '';
448$result = $db->query($sql);
449if ($result) {
450 $num = $db->num_rows($result);
451
452 $i = 0;
453
454 if ($num > 0) {
455 $transRecordedType = $langs->trans("LastModifiedContacts", $max);
456
457 $lastmodifiedcontact = "\n<!-- last contacts modified -->\n";
458 $lastmodifiedcontact .= '<div class="div-table-responsive-no-min">';
459 $lastmodifiedcontact .= '<table class="noborder centpercent">';
460
461 $lastmodifiedcontact .= '<tr class="liste_titre"><th colspan="2">';
462 //$lastmodifiedcontact .= img_picto('', 'contact', 'class="pictofixedwidth"');
463 $lastmodifiedcontact .= '<span class="valignmiddle">'.$transRecordedType.'</div>';
464 $lastmodifiedcontact .= '<a class="marginleftonlyshort" href="'.DOL_URL_ROOT.'/contact/list.php?sortfield=p.tms&sortorder=DESC" title="'.$langs->trans("FullList").'">';
465 //$lastmodifiedcontact .= img_picto($langs->trans("FullList"), 'contact');
466 $lastmodifiedcontact .= '<span class="badge marginleftonlyshort">...</span>';
467 $lastmodifiedcontact .= '</th>';
468 $lastmodifiedcontact .= '<th>&nbsp;</th>';
469 $lastmodifiedcontact .= '<th class="right">';
470 //$lastmodifiedcontact .= '<a href="'.DOL_URL_ROOT.'/contact/list.php?sortfield=s.tms&sortorder=DESC">'.img_picto($langs->trans("FullList"), 'contact');
471 $lastmodifiedcontact .= '</th>';
472 $lastmodifiedcontact .= '</tr>'."\n";
473
474 while ($i < $num) {
475 $objp = $db->fetch_object($result);
476
477 $thirdparty_static->id = $objp->rowid;
478 $thirdparty_static->name = $objp->name;
479 $thirdparty_static->client = $objp->client;
480 $thirdparty_static->fournisseur = $objp->fournisseur;
481 $thirdparty_static->logo = $objp->logo;
482 $thirdparty_static->date_modification = $db->jdate($objp->date_modification);
483 $thirdparty_static->status = $objp->status;
484 $thirdparty_static->code_client = $objp->code_client;
485 $thirdparty_static->code_fournisseur = $objp->code_fournisseur;
486 $thirdparty_static->canvas = $objp->canvas;
487 $thirdparty_static->email = $objp->email;
488 $thirdparty_static->entity = $objp->entity;
489 $thirdparty_static->code_compta_fournisseur = $objp->code_compta_fournisseur;
490 $thirdparty_static->code_compta_client = $objp->code_compta;
491
492 $contact_static->id = $objp->cid;
493 $contact_static->status = $objp->cstatus;
494 $contact_static->firstname = $objp->firstname;
495 $contact_static->lastname = $objp->lastname;
496 $contact_static->email = $objp->cemail;
497 $contact_static->socid = $objp->rowid;
498 $contact_static->canvas = $objp->ccanvas;
499 $contact_static->phone_pro = $objp->cphone;
500 $contact_static->address = $objp->caddress;
501
502 $lastmodifiedcontact .= '<tr class="oddeven">';
503 // Contact
504 $lastmodifiedcontact .= '<td class="tdoverflowmax150">';
505 $lastmodifiedcontact .= $contact_static->getNomUrl(1);
506 $lastmodifiedcontact .= '</td>';
507 // Third party
508 $lastmodifiedcontact .= '<td class="nowrap tdoverflowmax125">';
509 $lastmodifiedcontact .= $thirdparty_static->getNomUrl(1);
510 $lastmodifiedcontact .= "</td>\n";
511 // Last modified date
512 $lastmodifiedcontact .= '<td class="right tddate" title="'.dol_escape_htmltag($langs->trans("DateModification").' '.dol_print_date($thirdparty_static->date_modification, 'dayhour', 'tzuserrel')).'">';
513 $lastmodifiedcontact .= dol_print_date($thirdparty_static->date_modification, 'day', 'tzuserrel');
514 $lastmodifiedcontact .= "</td>";
515 $lastmodifiedcontact .= '<td class="right nowrap">';
516 $lastmodifiedcontact .= $thirdparty_static->getLibStatut(3);
517 $lastmodifiedcontact .= "</td>";
518 $lastmodifiedcontact .= "</tr>\n";
519 $i++;
520 }
521
522 $db->free($result);
523
524 $lastmodifiedcontact .= "</table>\n";
525 $lastmodifiedcontact .= '</div>';
526 $lastmodifiedcontact .= "<!-- End last contacts modified -->\n";
527 }
528} else {
529 dol_print_error($db);
530}
531
532
533// boxes
534print '<div class="clearboth"></div>';
535print '<div class="fichecenter fichecenterbis">';
536
537$boxlist = '<div class="twocolumns">';
538
539$boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
540$boxlist .= $thirdpartygraph;
541$boxlist .= '<br>';
542$boxlist .= $thirdpartycateggraph;
543$boxlist .= '<br>';
544$boxlist .= $resultboxes['boxlista'];
545$boxlist .= '</div>'."\n";
546
547$boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
548$boxlist .= $lastmodified;
549$boxlist .= '<br>';
550$boxlist .= $lastmodifiedcontact;
551$boxlist .= '<br>';
552$boxlist .= $resultboxes['boxlistb'];
553$boxlist .= '</div>'."\n";
554
555$boxlist .= '</div>';
556
557print $boxlist;
558
559print '</div>';
560
561$parameters = array('user' => $user);
562$reshook = $hookmanager->executeHooks('dashboardThirdparties', $parameters, $thirdparty_static); // Note that $action and $object may have been modified by hook
563
564// End of page
565llxFooter();
566$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
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
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...)
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.